Friday, 15 January 2010

disk io - Python Writing a 512-byte block of zeros to /dev/sda works, but doesn't behave like it is working -


Here I am trying to create a function (after all) support wiping of drives using several attributes. When I try to write zeroblock in the disc, it is written, but whatever the problem is, you have failed. The reason for this is that I have done this work that has approved the drive from the drive in my test system

  def wipedisk (drive, wipepepe, pass): diskisize = int (system) . HDD [Drive]. Size) DiscSact = Int (System. HDD [Drive]. Signer ()) Characterization = Int (System. HDD [Drive]. Circuit) System. HDD [drive] .start = time.time () if (wipespec == "zero"): Open ("/ dev / zero", "rb") as zero as: zeroblock = zero Rod (Sanctification) zero Close (= pass) = 0 open (with system .hdd [drive]. Device, as "wb") disk: while (pass  

For file.write says:

There is no return value to file a string type.

You mistakenly believe that write assumes that it has succeeded in writing or not. It is not.


swift - Sharing NSUserDefaults plist file? -


I want to use the facilities of NSUserDefaults to save the state. I am currently working. But I want to copy this plist file and want to apply it to the same app on another device.

Is there a way to pass a file name for NSUserDefaults or do I need to use another category? Or is it ok to share the same app with the other device?

The app on Device 1 and Device 2 is the only app I'm not trying to share data between different applications.

?

NSDictionary * dict = [[NSUserDefaults standard user default] dictionary report];

Then on another device:

  NSUserDefaults * defaults = [NSUserDefaults StandardUserDefaults]; (Copy dictionary in NSString * key) {ID of OB = Dictionary [key]; [Default set object: for ob: key]; }  

Or, you can write a .olist to a .plist file, from that to Transport, .plist Decode to dict and like I did the above.

Write in a .plist file:

  [dict tofile: @ "path / to / your / file.plast" atomically : Yes]; Reading from a  .plist  file: 

  NSDictionary * dict = [[NSDictionary alloc] initWithContentsOfFile: @ "Path / / To your / file.plist "];  

html - How do you add multile vendor prefixes to one css property? -


I have an image inside the .img-container. I would like the image inside the container at the center.

  & lt; Div class = 'col-xs-12 col-sm-4 col-lg-4 img-container' & gt; & Lt; Img class = "img- about responsive img-" src = 'img / about5001000.jpg' & gt; & Lt; / Div & gt;  

The only way I know how to handle different browsers with CSS code is how to code them individually (-moz-center, webkit-center):

  .img-container {padding-right: 0 pixels; Padding-left: 0 pixels; Text-line: -moz-center; }  

or

  .img-container {padding-right: 0px; Padding-left: 0 pixels; Text align: -webkit-center; }  

This is not for Firefox nor for Safari and Chrome:

  .img-container {padding-right: 0px; Padding-left: 0 pixels; Text align: center; }  

I'm sure there is a solution that works universally. Thanks!

The browser prefix is ​​used for experimental features that are not yet ready for normal use Or based on the parts of the CSS space which have not yet been finalized.

Text-Align: Center exists since the beginning of time and therefore anytime the prefix Is not required just write ...

  .img- container {padding-right: 0 pixels; Padding-left: 0 pixels; Text align: center; }  

The reason for this does not work for your image is img-responsive class. In Bootsrap, this creates a block element on your image, block elements can not be aligned to text-align .

Bootstrap 3 has an built-in center-block class that should be added to the IMG tag ...

  & lt; Div class = 'Col-xs-12 col-sm-4 col-lg-4 img-container' & gt; & Lt; Img class = "img- centric block about img-" src = 'img / about5001000.jpg' & gt; & Lt; / Div & gt;  


jquery - Fancybox 2 vertical scroll issue -


I use Alt to add additional text to the fancybox v2.1.4 popup, but the problem is that there is no visible Giving a vertical scrollbar to the description text, some text can not be read.

HTML:

  & lt ;! - Item Project Name - & gt; & Lt; Li class = "item-thumb span3 design" & gt; & Lt ;! - Fancybox - Gallery enabled - Title - Full image - & gt; & Lt; A class = "hover-rap fancybox" data -fancybox-group = "gallery" title = "the city" href = "_ included / img / work / full / image-01-full.jpg" gt; & Lt; Span class = "overlay-img" & gt; & Lt; / Span & gt; & Lt; Span class = "overlay-img-thumb font-icon-plus" & gt; & Lt; / Span & gt; & Lt; / A & gt; & Lt ;! - Image and description of thumb - & gt; & Lt; Img src = "_ include / img / work / thumbs / image-01.jpg" alt = "If I put too much text here, there is no scrollbar inside a popup & gt; & lt; / li & gt; & Lt;! - Last Item Project ->  

On the odd, fancybox CSS, all looks correct:

. Fancybox-lock Fancybox overlays {Overflow: Auto; overflow-y: scroll;}

What am I missing?

Do not use CSS to install scroll issues, you can" Helpers ".

Follow the code to fix the scroll issue.

  $ (" .fancybox "). Fancybox ({fitToView : False, height: 'auto', auto-size: false, helper: {overlay: {lock: false}}});  

sockets - Google App Engine Python: [Errno 10054] XML parse -


I am developing an app engine application that relies on the webpage 2 framework. In my case, I need a lib to parse the XML file and I found that ElementTree lib which is under my Python directory Python27 \ Lib \ xml \ etree \ ElementTree.py, Python is version 2.7 and I parsed it Use the method. After parsing operation, I'm repeating it. My relative code snippet here:

  import xml.etree.ElementTree as ET tree = ET. Pars ('myLargeSample.xml') root = tree.getroot () for item in root.iter ('item'): # Function of simple counting  

When I use my wrapper class I request this, which is webapp2 RequestHandler, in most cases this was done, but now I have around 11 MB and when I run the code, I get this error: [Errone 10054] Exception Stack At the end of an existing connection forcibly turned off by the remote host .

Not only this, but my python.xa has consumed up to 2 GB of membrane which is unusual when I requested the wrapper class! When I was found I could not find any close affair because the socket error is the original error, I think do you have any suggestions on what the problem would be? I'm really messing up with this error, thanks for your reply.


javascript - creating custom indicators - each for every 4 item in slider -


Then I have a content slider

Each item has a square in which theat items offset in the slider Such as

like

  & lt; Div id = "slider" & gt; & Lt; Div class = "item item-number -1" & gt; & Lt; / Div & gt; & Lt; Div class = "item item-number-2" & gt; & Lt; / Div & gt; & Lt; Div class = "item item-number -3" & gt; & Lt; / Div & gt; & Lt; / Div & gt;  

And this is a round slider, after the last item it shows the first object again

So I added custom indicators to the slider on top, but most Contrast slider for every 4 items in each indicator slider

  For example, when I have 1-4 items 1 is ancillary, when there are 1-8 items, I have 2 indicators When I have 3 indicators in 1-12 items  

That is why I am an active class. Ihn user sliding starts to add correct indicator

  $ (document) .on ('click', '.prev, .next', function () {var p = $ (This) .parents ('# slider'); var it = p.find ('. Item: first'); var offset = number (this is 'et.' ('Class'). Partition ('') .pop ('Item-num-', '')); var indicator / number; if (offset = 4) indicator = 1 = number; other indicator_number = ?; $ ('.inidicator'). Eq (Indicator_number) .addClass ("active");})  

I want this part indicator_number =? ; I want a formula to find the correct indicator when the current index is larger than the offset 4

Simple arithmetic you should do what you want:

  indicator_number = mathematics.flur ((offset - 1) / 4) + 1);  

Offset - 1 : Obtain the zero based index of the current slide.
/ 4 : Split + 1 : Convert the result to a non-zero based index Math.floor : in a whole number Convert


java - What is the MEMORY complexity of this fibonacci sequence algorithm? -


I recently had a technical interview and I was asked to report the memory complexity of the following algorithms written on the whiteboard.

To be more specific, if I remember correctly, it was referring to "heap space":

  public int [] fib = new int [1000]; Public Intimate Fibonacci (Int Eye) {if (i == 0) returned to 0; If (i == 1) returns 1; If (fib [i]! = 0) returns fib [i]; Fib [I] = Fibonacci (I-1) + Fibonacci (I-2); Returns fib [i]; }  

Because he said "heap space", it seems like he was giving me a clue that he wanted to give me the complexity of the following line code:

  public int [] fiber = new int [1000];  

I think I remember learning in school that in Java there is new in the form of malloc , where malloc < / Code> Allocates storage to a heap, thinking that my memory works correctly, now go back to my question: What is the complexity of this memory? Did I want to say o (1000)? On)? anything else?

Thank you!

"post-text" itemprop = "text">

I think your interviewer wanted to know how well you understood the results of the written code. The usual potential memory problem with the non-tail call recursive code is that every recurring call has a stack frame, which is not complete until the call (including all its recurring subclasses). Heap frames are allocated with a pile, so the recycling can end the pile.

Without a memoimization shortcut that saves and retrieves the already calculated Fibonacci number, memory complexity will be o (n 2 ): nth Fibonacci number calculation According to the ratio of the square of the constellation, a recursive tree will be formed, it re-calculates the same number for different branches of the tree.

But the post code should not count a Fibonacci number more than once, and the total number of the stackframe will not explode in the same way, it will be placed in O (n) worst position, where the array starts After the array is populated, it will be o (1), because from that point it is equal to seeing an array.


java - Could not find org.datanucleus.store_mapping extension in datanucleus-core-4.0 -


I tried to follow, but the extension described in step 4 could not locate org.datanucleus.store_mapping. Can anyone help please?

Thanks in advance

(I can not find a related guide for version 4.)

As far as I'm watching, all the data Nucleus extension points are adequately defined in individual guides like


javascript - bootstrap nav tab is not highlighting the active tab -


I am working on an asp.net mvc web application, I am using the following: -

1.bootstrap v2.0.4

2.jQuery 1.11.2

Inside the view I have the following nav tab proivde: - ..

  & lt; Ul class = "nav nav-tabs" id = "myTab" & gt; & Lt; Li & gt; @ Ajax.ActionLink ("Show related server", "CustomerServer", "Customer", New {Customer ID = Model.AccountDefinition.ORG_ID}, New AjaxOptions {InsertionMode = InsertionMode.Replace, UpdateTargetId = "Extension", LoadingElementId = "Progress ", Onsput =" description ",}) & lt; / Li & gt; & Lt; Li & gt; @ Ajax.ActionLink ("Affiliates Show VMs", "CustomerVM", "Customer", New {Customer ID = Model.AccountDefinition.ORG_ID}, New AjaxOptions {InsertionMode = InsertionMode.Replace, UpdateTargetId = "Extension", Loading ElementID = "Progress ", Onsput =" description "}) & lt; / Li & gt;  

Where every Ajax The External Link will provide partial views when the user clicks on it. Currently, when I move a mouse over a tab, the tab background color will change, but if I click on a tab and partial view is provided, the active tab will not be highlighted.

The following CSS files I am referring to are: -

  & lt; Link id = "bs css" href = "~ / content / css / bootstrap-cerulean.css" rel = "stylesheet" & gt; & Lt; Link href = '~ / content / css / opa-icons.css' rel = 'stylesheet' & gt; & Lt; Link href = "~ / content / css / bootstrap-responsive.css" rel = "stylesheet" & gt; & Lt; Link href = "~ / content / start / jquery-ui-1.10.3.custom.min.css" rel = "stylesheet" />  

and the following script (in a ddtion to cours jQuery js): -

  & lt; Script src = "~ / script / js / bootstrap-tab.js" & gt; & Lt; / Script & gt;  

active tab

  class = "active " 

class


html - Google Adsense responsive add not displayed correctly -


I have Google Adsense sensitive ads on my web site, they are going to appear in their parents' containers, but often They overflow it.

A simple example page, a DIV with an ADI in it:

Normally when the browser (body element)> 500 pixels wide, the ad performance is correct, but when it & lt ; 400px performance will often be wrong (vertical overflow) I could certainly hide the overflow, but the joint will be cut partially, so this is not an option.

I have tried many code changes, but any ideas without success?

Sample page code:

  & lt ;! DOCTYPE HTML & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Title & gt; Title & lt; / Title & gt; & Lt; Meta name = "viewport" content = "width = device-width, initial-scale = 1.0" & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; Div style = "width: 320px; height: 70px; range: 3px solid red" & gt; & Lt; Script async src = "// pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script> & Lt; Ins class = "adsbygoogle" style = "display: block" data-ad-client = "ca-pub-5645119364072707" data-ad-slot = "9521328853" data-ad-format = "auto" & gt; & Lt; / Ins & gt; & Lt; Script & gt; (Adsbygoogle = window.adsbygoogle || []). Push ({}); & Lt; / Script & gt; & Lt; / Div & gt; & Lt; / Body & gt; & Lt; / Html & gt;  

Screenshots: Enter image details here

ios - Print `po` object description with println()? -


अगर मैं ऐसा कर रहा हूं:

  class MyObject {var name = "something "} Var myObject = MyObject ()  

और फिर रनटाइम पर कंसोल में, po myObject , मुझे यह मिलता है:

  0x00007fe1596ef890 (नाम = "कुछ")  

दूसरे शब्दों में, यह ऑब्जेक्ट में प्रत्येक प्रॉपर्टी की प्रॉपर्टी वैल्यू प्रिंट करता है।

मैं इस व्यवहार को दोहराना चाहता हूं

MyApp.MyObject

मैं इसे कैसे प्राप्त कर सकता / सकती हूं? संपत्ति के मूल्यों को मुद्रित करें, वैसे ही अगर मैं po कमांड का उपयोग करना चाहता हूं।

यदि आप अपना वर्ग प्रिंट करने योग्य प्रोटोकॉल के अनुरूप करते हैं, तो एक विवरण टाइप किए गए संपत्ति के बजाय मुद्रित किया जाएगा:

  वर्ग MyObject: मुद्रण योग्य {var नाम = "कुछ" Var वर्णन: स्ट्रिंग {वापसी "MyObject (name = \ (self.name))"}} myObject = MyObject () println (myObject) / MyObject (name = something)  

वैकल्पिक रूप से, आप स्विफ्ट के रिफ्लेक्शन टूल के उपयोग से ऑब्जेक्ट के गुणों को डंप करने के लिए println () के बजाय डंप () का उपयोग कर सकते हैं:

  डंप (myObject ) // ▿ __lldb_expr_920.MyObject # 0 // - नाम: कुछ  

Apple watch event detection -


Do anyone know of any app API for Apple Watch? I am trying to detect incidents such as turning on / off the wrist incidents, to determine whether to look or not.

There are no other events other than simple people declared in different interface controls, such as activate Gone, button tap, etc.

There are rumors that in this fall, more capacities will be included in the next version of Watchkit, such as being able to run some code on the clock, it may be possible once more information comes out, but who knows.


javascript - Timbre.JS alternative that works on mobile devices via phonegap? -


Timbre Looks like a great library to create sound effects for the JS mobile app, however, it seems that there is a very significant delay when the speakers try to play sound in the browser, the samples working in the documents also show delays. . It is also in the Chrome mobile emulator on Windows (on Mac, there is no delay). Docs says that "Android support is only the Firefox app." I'm not sure what that means. In the PhoneGap application, the sound is not played at all

This is the code that I am using with Timber:

  Function Place () {var sine1 = T ("Sin", {freq: 440.00, mul: 0.5}); T ("purse", {r: 500}, sign1) .on ("finished", function () {this.pause ();}). Bang (). Play (); }  

If TimberJS is not working on mobile, is there any other means of generating simple voice through a phonegap app?


r - Subsetting a spacetime::SDFDF by time -


मैं एक spacetime :: SDFDF को कैसे कम कर सकता हूँ (spatio-temporal सोफर, मैंने कोशिश की:

  लाइब्रेरी ("नक्शे") लाइब्रेरी (" ("राज्य", प्लॉट = FALSE, fill = TRUE) आईडी & lt; - sapply (strsplit (states.m $ नाम, "मैप्सटोल्स") लाइब्रेरी ("स्पेसटाइम") लाइब्रेरी ("पीएलएम") राज्यों। एम & lt; : "), फ़ंक्शन (एक्स) एक्स [1]) राज्यों & lt; - map2SpatialPolygons (राज्यों, आईडी = आईडी) yrs & lt; - 1970: 1986 समय & lt; - as.POSIXct (पेस्ट (yrs," -01- ("उत्पादन") उत्पादक (उत्पाद) "- एसटीएफडीएफ (राज्य [-8], समय, उत्पादन [ऑर्डर (उत्पादक [2], प्रॉड्यूक [1] ),]) Produc.st@time [c (1,5,17)] उत्पादक। [उत्पादक। समय [सी (1,5, 17)]]  

"पोस्ट-टेक्स्ट" आइटमप्रॉप = "टेक्स्ट">

कृपया कोशिश करें

  उत्पादक। [[अनुक्रमणिका], [सूचकांक (produc.st@time [c (1,5, 17)]]]  

यानी, समय चयन I , के बाद किया गया है, और xts ऑब्जेक्ट के रूप में Produc.st@time [c (1,5,17)] के साथ नहीं चुनें < / कोड> है, लेकिन एक समय ( POSIXct ) वेक्टर के साथ।


unity3d - How to set second material to a second submesh in a combined mesh? -


I have this code (basically not my invention) which is working fine, but I have a problem with it Is suppressed. I do not seem to present the second submarine with the other material.

I can not understand the problem contained in the [renderer] part or the second "novel" which is probably never a combination.

  @script RequireComponent (MeshFilter) @ script requiredCompany (Meshrenderer) Private Variant Material: Content [] = New Content [2]; Var mat: material; Var Matt 2: Material; Start function () {mater [0] = mat; Mater [1] = matte 2; For (different children in change) child.position == transform.position; Transform.position = Vector3.zero; Change. Rotation = quatorian Var MeshFilters = GetComponentsInChildren (MeshFilter); Vardhan Alliance: Judaistance [] = New Combination Device [MeshFilters. Length-1]; Var Index = 0; For (var i = 0; i & lt; meshFilters.Length; i ++) {if (meshFilters [i] .sharedMesh == tap) released; Coalition [index] .mesh = meshfilters [i] .sharedMesh; [Index ++] Coalition Transform = meshfilters [i] .transform.localToWorldMatrix; Renderer Shared content = butterfly; MeshFilters [i] .active = false; } GetComponent (MeshFilter). Mess = new mesh (); GetComponent (MeshFilter) .mesh.CombineMeshes (Alliance); Renderer.active = True; // Here seems trouble is the renderer. Shared content = butterfly; }  

Alternatively I have tried,

  renderer.sharedMaterials [1] = mortar [1];  

In short, I am in trouble I have to save some draw calls, which is not good until it gets cured.


ios - Refactoring 3 different UI components into one UIView into a CocoaPod -


In my iOS project I am reusing the same 3 different UI elements:

  • Label
  • Input
  • Check Mark (or X).

And the logic is the same:

  • Validate when user is entering text
  • While verification fails, Red check mark, etc.

So, the next clear step is to do it again in a UIView so that I can simply drag and drop.

And I want it in a cocoa blossom.

Restructuring of elements in a UIview, etc. is not difficult, but I am stuck by putting this argument into coco fu. XIB does not load, so the subview is empty

I added IB_DESIGNABLE to header file but there is no rendering and exceptions at runtime

suggestion? What do I post for help?

Edit:

My resource section of podspec

 s.source_files = 'pod / classes / ** / *' s.resources = 'pod / property / ** / * 'S.resource_bundles = {' jawbreaker '=> [' PD / asset / *. PNG ']} 

UIView XIB file does not automatically load when you create a UIView class So you need something like this :.

  MyView * view = [Myview loadFromNib];  

Remember if you want to use IB_DESIGNABLE:


haskell - Check wreq request headers -


I'm very new in Haskell and I'm not sure how I can get it. I am using as an HTTP client and I want to know which HTTP header is being sent to the server. For example, I have defined the following method, which can be used to authenticate the use of Facebook credentials. Attempts:

  Authentication ⦂ String → String → IO (Response biotechring) certify facebookId facebookToken = postWith opts "https: // Api.somedomain.com/auth" (object $ [" Facebook_token ". = FacebookToken, "Facebook_id". = FacebookId]) where opts = defaults & amp; Header "Content-Type" ~ ["Application / JS"] & amp; Header "Accept" ~ ["App / JS"] & amp; Proxy? ~ HttpProxy "localhost" 9396  

I get a proper response with POSTMAN, but I get unauthorized access to wreq (403) I think that something Additional requests can be added by the header library and this is what I want to see.

Any hint?

EDIT: An HTTP proxy now does not know HTTP traffic ( wreq though request).

In Wreq, type options type show There is an example, so that you can pass it or just observe it on ghci:

  ghci & gt; Import the network. Default :: option option {manager = left _, proxy = none, opus = nothing, header = [("user-agent", "haskell verac -0.3.0.1")], parameters = [], redirects = 10 , Cookies = []}  

You can also use the lens to focus directly on the header:

  ghci & gt; Omission ^. Header [post]  followed by  code> (if it is adding some headers to Wreq) [["user-agent", "Haskell Verac -0.3.0.1"]]  

With , you will need to use a web debugging proxy as if it is coming to know what's happening.


unit testing - What to test and when? -


I am creating true applications that synchronize data between different systems, services and APIs.

My reconfiguration application is as follows:

  1. Selecting an HTTP endpoint to get some user information
  2. User service to User ID Enrich the message
  3. For example, I am testing the data changes which I consider to test the unit. I am testing that if the user (stubbed) response has been returned from the user service then the value is properly rich by using my expression. I think it will be a functional test?

    But should I test the polling? Is each ending point called? Will this be the integration test?

What works for me is to ensure that I define "units" My software is in a way that allows me to talk about just about my application, and allow facets to change which I need a reunion. Virtually in ESB applications, it sometimes leaves me with a lot of unit tests that look like those I'll write in a Java program. Most of my unit tests come out from functional tests, and the number of in-process testing for the actual system required to integrate me includes a few numbers.

I have tried to use Munit to complete it, but some design decisions that make this style of testing difficult, so my unit test usually comes from the functional testcases.

For your application, I can test as the following:

  1. Make sure that the HTTP endpoint is correctly voted up
  2. A unique ID has been returned from the user service, to ensure that the targeted service is called the correct message
  3. If the change logic is complex, then I can add many tests which can be used in different edges Be sure to find out My conversion is working properly
  4. Sometimes the web services require some headers or authorization tokens, so I often prepare several tests to ensure that they are < Note that I do not explicitly tell that my message gets "rich" or "change" mid flow, because these steps are only a means to end Change the steps The road should be set for the road or using XSLT instead of Java, these tests will not need to be replaced.

    To make an in-process test pair for your HTTP services, take a look.


python - Django App (treeio) error on PDF Generation -


This is the error that I am getting when I generate a PDF for any page ... any suggestions What is it?

Every time I press the button of PDF, it returns a file and then returns 500 error if I do DEBUG = FALSE if DEBUG = TRUE error occurs ...

> Environment: Request method: Get Request URL: http://example.com/sales/product/view/76.pdf Django Version: 1.5.1 Python Version: 2.7.8 Installed Application: ('django.contrib .auth', 'django.contrib.contenttypes',' django.contrib.sessions', 'django.contrib.sites',' django.contrib.admin ',' django.contrib.markup ',' Django_websocket ',' Django.contrib.messages ',' treeio.account ',' treeio.core ',' trio.core.app Iai 'Tryiokkorksserch' Tryoo documents' Tryoavents' Tryaofinens' 'Tryio Islands' Tryoioifrastrccr' Tryio. Knowledge ',' Tryio. Messaging 'Tryio. News 'Tryio Pirojekts' Tryoaarports' Tryoosles' Tr Eeiokservices' Dajaxice' Dajax 'coffin', 'Captcha', the 'South') Middleware: ( 'django.contrib .sessions.middleware.SessionMiddleware ',' treeio.core.middleware.user. AuthMiddleware ',' django.contrib.auth.middleware.AuthenticationMiddleware ',' treeio.core.middleware.user.LanguageMiddleware ',' django.middleware.locale.LocaleMiddleware ',' django.middleware.common.CommonMiddleware ',' Johnny. Midilveyrkloklstrclearmeeddlevre 'Jonikmidilveyrkkwerikachemidlware' Djngokmidilveyrkgzipkgzipmiddlevre 'Triiokkorkmidilveyrkugrksslmiddlevre' Djngokmidilveyrkksrfkksrfviawmiddlevre 'Triiokkor. Midilveyrkchatkctjshmiddlevre 'Djngokcontribkmessgeskmidilveyrkmessgemiddlevre' Triiokkorkmidilveyrkmodlskmodledetekt 'Minidetectorkmidilveyr' Triiokkorkmidilveyrkugrkcommonmiddlevre ' treeio.core.middleware.user.PopupMiddleware ') Traceback: file "/treeio/treeio/venv/lib/python2.7/site-packages/django/core/handlers/base.py" 121. in response get_response = Midlveyr_maleshn ( Request, e) file "/treeio/treeio/venv/lib/python2.7/site-packages/django/core/handlers/base.py" get_response 115. response = callback (request, * callback_args, ** callback_kwargs) file "/treeio/treeio/core/decorators.py" 48. In the wrap, return (request, * args, ** kwargs) file "/treeio/treeio/core/decorators.py" wrap 124. response = F (Request, * Args, ** kwargs) in the file "/treeio/treeio/sales/views.py" product_view 674 Render_to_response 154. f = codecs.open (source, encoding = 'utf-8', mode = 'w') in the file "/ treeio / treeio / core / rendering" Context_instance = RequestContext (request), response_format = response_format file " /usr/lib/python2.7/codecs.py "Open file = __biltin___ in open 878. (file name, mode, buffering) exception type: IOError at /sales/product/view/76.pdf Exception value: [Error 13] Permission denied: '/ tr Eeio / treeiobbaffc6da2ff9d79dbdbe7012437c4c0.html'


node.js - Node js supertest is async? -


I want to write some tests for some routes and I want to do something like this:

 < Code> var = requires ('should'); Var app = requires ('../../app'); Var Requests = Required ('Superstest'); Describe ('Create and verify that creation is successful', function () {var user_id = ''; ('Add a new case and return a Jason array', function (done) {var newUser = {nume : '(' / Api / new_user ') .end (newUser) .expect (201) .expect (' content-type ', / json / test),' test ', varsta: 23} request (app).). Und (function (fault, leakage) {if (mistake) was returned (mistake); res.body.should.be.instanceOf (array); res.body.should.have.property ('_ id'); user_id = Res.body._id; done ();});}); ('New user should be back', function (done) {request (app) .get ('/ api / new_user /' + user_id) hope (200). Hope ('content-type', / json /) .end (function (error, ridge) {if (err) return done (err); res.body.should.be.instanceOf (object); Res.body._id.should.be.exactly (user_id); done ( );});});});  

I am not sure that two statements are executed after each other or each is assinked and when I go to the other, it is not executed first So it will fail because the insert was not done in the server. Should I use async.series?

Supertest in your example is responsible for the series from the request (app) Below, it is actually the provider of description () and this () call, which determines the order, or lacks it, in which your tests are executed In which I'm fine?

If yes, then Mocha will run your testcosms in sequence (as the second, which is already completed, will be called second).


mysql - incorrect sql query created using setMaxResults with native query -


I have this code, where I am creating a native query and while executing native queries, I use the setMaxResults method Has been doing.

  list & lt ;? & Gt; ResultList = getEntityManager (speedwingCustId, loggedInUserId list) .createNativeQuery (statement) .setMaxResults (Integer.MAX_VALUE) .getResultList ();  

This is your statement before the above code:

  (Selection IQV.VERSION_ID VERSION_ID as ITEM_QUERY_VIEW IQV Where AVAILABLE_VALUE_ID (15,611) and EQUIPMENT_AVAILABILITY_ID = 1 And in region_id (5, 8, 10, 14, 21, 20, 23, 24, 26, 35, 33, 39, 45, 55, 54, 53, 52, 63, 62, 61, 68, 71, 64, COUNT (DISTINCT (AVAILABLE_VALUE_ID)) = 1)  

of the group by VERSION_ID (65, 76, 72) and VEHICLE_TYPE_ID (1, 2, 3, 4, 5, 6, 7) My query is during this execution:

  Hibernate: (SE Top (?) LECT IQV.VERSION_ID as ITEM_QUERY_VIEW IQV from VERSION_ID where AVAILABLE_VALUE_ID IN (15611) and EQUIPMENT_AVAILABILITY_ID = 1 more REGION_ID IN (5, 8, 10, 14, 2 1, 20, 23, 24, 26, 35, 33, 39, 45, 55, 54, 53, 52, 63, 62, 61, 68, 71, 64, 65, 76, 72) and VEHICLE_TYPE_ID IN (1, 2, 3, 4, 5, 6, 7) VERSION_ID HOWING C OUNT (DISTINCT (AVAILABLE_VALUE_ID)) by group = 1)  

I am using MSSQL server and JPA.

Why do you set Integer.MAX_VALUE to MaxResults ()? It does not mean try to extract it or pass a meaningful number, for example, setMaxResults (30).


Lotus notes 8.5 enable clickable hyperlink in edit mode -


I would like to get a clickable link in the editing mode of Lotus Notes 8.5. Now I am able to see the link only if I go to the option or if I send an email myself.

itemprop = "text">

You can click on the CTRL + link, not sure it has been added to 8.5 or 9.0

< / Div>

java - Protogen Vs. Protoc Compiler Options -


I have some .proto files that are used to compile classes from Java, C ++ and C # Are there. I use Protok Compiler for Java and C ++ and use Protogen for C #. Java / C ++ class script to create

  @ECHO set SRC_DIR =% ~ dp0 REM Java and C Set ++ JAVA_OUT_DIR =% SRC_DIR% \ .. Make \ bull-Sndeshon- Java \ src \ main \ java if exist% JAVA_OUT_DIR% (mkdir% JAVA_OUT_DIR%) set CPP_OUT_DIR =% SRC_DIR% \ .. \ bull-messages-CPP does not exist,% CPP_OUT_DIR% (mkdir% CPP_OUT_DIR%) protoc I =% SRC_DIR% --java_out =% JAVA_OUT_DIR% --cpp_out =% CPP_OUT_DIR %% SRC_DIR% Vrisb- mux.proto protoc I =% SRC_DIR% --java_out =% JAVA_OUT_DIR% --cpp_out =% CPP_OUT_DIR %% SRC_DIR% Vrisb- backtest .proto  

and C # class generation I

  @ECHO set WORK_DIR =% ~ dp0 set OUT_ DIR =% WORK_DIR% \ Message =% WORK_DIR% to SRC_DIR set \ .. \ .. \ .. \ Cancer \ Trunk \ bull-messages-proto \ not exist% OUT_DIR% (mkdir% OUT_DIR%) CD% SRC_DIR % protogen -p: detectMissing I: taurus- backtest.proto -o:% OUT_DIR% \ TaurusBacktest.cs protogen -p: I detectMissing: Vrisb- mux.proto -o:% OUT_DIR% \ TaurusMux.cs CDs% WORK_DIR% < / Code> 

Both script references CE. Proto file (definitually;]) I have added the above C # script to generate the -p: detectMissing properties, I have permission to check whether a field is specified or not; The option creates * specified for all areas where isRequired = false .

My question is simple, I want to make sure that C #, C ++ and Java classes have to be aligned, but for C # me, -p: detecting Is the option to use with Proton to have equal option to use Protoc?

If I have correctly considered the question , Then there really is not an "equivalent" option - they are different tools used for different purposes. If your main driver is a similar use, then you want to see protobuf-csharp-port, which maintains very similar use while going to C #. On the contrary, ProtoBuff-Net does not try to present the same API as Google - it works as a idiomatic NAT serializer that talks in Protobf format.


javascript - Expose jQuery to real Window object with Webpack -


I do not want to expose the jQuery object to the global window object which is available in the browser within the Developer Console. Now in my webpack config I have the following lines:

  plugins: [new webpack.ProvidePlugin ({$: 'jQuery', jQuery: 'jQuery'})]  

These lines add jQuery definitions to each file in my webpack module. But when I create a project and try to use jQuery in the Developer Console like this:

  window. $; Window.jQuery;  

It says that these properties are undefined ...

Is there any way to fix this?

You need to use it.

  NPM Exposure Loader --save-dev  

You can do this when you need it:

 < Code> Required ("Explain? $! Jquery");  

Or you can do this in your config:

  Loader: [{test: require.resolve ('jquery'), loader: 'expos ? According to WebPack 2, you must use  instead of using  Exposure Loader  :   
  Module: {Rule: [{test: require.resolve ('jquery'), use: [[loader: 'expose-loader', option: '$'}]}]}  

math - How does 4x4 matrix work in 3d graphic? -


I'm learning about 3D graphics and stumbling across the matrix, which I can not fully understand . I have 3D object, with topology, points in coordination system and ECS (object 4x4 matrix) ECS is:

  -1.1247455413666 E-32, 1.83690953073357 E-16, 1, -95, 1, 6.12303176911189 E-17, 0, 604, -6.12303176911189 E-17, 1, -1.83690953073357 E-16, 200.5, 0, 0, 0, 1,  

How is each row different with a comma? Are these translations vectors?

Rotation of the coordinate system from the upper left 3x3 block, the coordinates of the top 3 final columns give translation vector.

The general idea of ​​this Anne parametrication is to convert a polygon to

  [x, y, z, 1] ^ t  

Right from


node.js - How to reference another schema in my Mongoose schema? -


I am creating a MonoSize schema for a dating application

Let me know every The person document contains the context of all the events where event is another schema with its own model. How can I describe this in schema?

  var personchem = mongoose.Schema ({firstname: string, last name: string, email: string, gender: {type: string, enum: ["male", "woman"]} Dob: date, city: string, interests: [keys by interest], events attached: ???});  

You describe it using

Population is the process of automatically transcribing the routes specified in the document with the document (s) from another collection (s)

Assume that your The event schema is defined as:

ex> var mongoose = requires ('mongos'), schema = Mongoose . Chemera Event Event Schema = Schema ({title: string, location: string, start date: date, expiry date: date}); Var person schema = schema ({first name: string, last name: string, email: string, gender: {type: string, enum: ["male", "woman"]} dob: date, city: string, interests: [Interests], Events include: [{Type: schema type: object, ref: 'event'}]}); Var event = mongos Model ('event', event sachima); Var person = Mongoz Model ('person', person schema);

To show how populated is used, first person object, Aaron = new person ({first name: 'Aaron'}) and code > Event 1 = New Event ({title: 'Hackathon', location: 'foo'}) :

  aaron.eventsAttended.push (event1); Aaron.save (callback);  

Then, when you create your query, you can populate such references:

  person .findOne ({first name: 'Aaron'}). Populate ('Event Attached') // only works when we rifle a person. Events Eteted XAC (function (fault, person) {if return) returns handler; console.log (person);});  

visual studio 2010 - How to provide an option in a Setup project dialog box where the user can choose the instance names from the local machine or a server? -


Suppose I have a dialogue box to give an example name and I want to see that the other available in the local machine What are the examples or servers and if the user has both SQL Server 2005 and SQL Server 2008 installed in their system and I want to choose the name of the database to be deployed in the database. How can I use a setup project that was created using Visual Studio 2010?

Please guide me because I'm new to the setup project thanks

That VS Start Setup does not let you create your own customized dialogue, and you do not allow them to populate or run the code to validate the content. This means that you are not actually using the setup project because you will end up writing your own code to do all of this. Although you can take the test to run this code as a custom action, the system will run with the account (in each installation) and the dialog will not work properly because you will not run in the winding STA context, Use the device (such as YX) and create your own dialogue to show during the standard install dialog, then you can integrate it in all the setups. Can. The general design pattern is that you can gather information and move it into properties that are used in conjunction with the cusom functions in order to perform the changes. Msiexec enables silent installs by specifying property values ​​on command line or group policy delivery.

With the VS installed in the first part of the app, the user will be better able to run his code to configure it all.


javascript - trNgGrid - show/hide column -


Hi,

I have a question I have trNgGrid v3.0.5 rc I want to use and there is too much data in my Jason.

I should show and hide the column after clicking a check box.

"Autodetected (field = empty or not set)" check box I can hide on the show's column, through which I can see 3 check boxes. I

Please let me know Tell me how I can apply it, because my angular knowledge is weak.

Many check boxes should be checked after the document is ready and the rest should be unchecked.

I do not know how I can get it

thanks

You can use the attribute of the field trNgGrid.

  & lt; Table tr-ng-grid = '' fields = 'show_fields' item = 'myItems' & gt; & Lt; / Table & gt; In the admin  

  $ scope.show_fields = ['column1', 'column2'];  


php - Laravel. Keep variable in view during all routes -


I have a very easy problem in Laval 4.2 but I can not solve it. I've got a right-side bar in which there should be some content from my database table during all the routes. I have found the mysql query on the home page page and I pass the variable to see:

  $ query .... Return see: create ('home') - & gt; With ('query', $ query);  

I would like to send this to see 'right-side-bar' for everyone to see, but it has to be identified during all the routes. I have tried to hunt nest, after sharing the variable, but from the time of changing the path, my 'right-side-bar' visible variable can not recognize the query $. I would like to hear some suggestions about how I can solve it. thank you in advanced!

Edit:

Using visual creators

Keep in mind that when you are using visual composers, you should automatically load your files / classes via composer.

Fast dirty route:

  see :: composer ('your-view-name', function ($ view) {$ query = // your query code $ view -> ('query', $ query);});  

or with multiple views:

  View :: Composer (array ('A-View', 'A-Second-View'), Function ($ View) {$ query = // Your query code $ view-> ('query', $ query);});  

Class-based approach ( recommended )

  see: composer ('mine-view', 'MyViewComposerClass');  

then create a class

  class MyViewComposerClass {public function compose ($ view) {$ query = // your query code $ view-> ('query ', Query); }}  

Use of the Base Controller

An easy fix for what you want, something that you have to do in your BaseController constructor .

BaseController.php

  Public function __construct () {$ query = // See your query code: Share ('query' , $ Query); }  

and then make their parent controllers in their constructs such that their second controllers (who clearly expand the bas controller) in this way

< Strong> Other controllers that extend BaseController .php

  public function __ composition () {origin: __ creation (); }  

Then you use the usual variable.

Hope this helps ..

More about Visual Composers:

Laser 5.1:


Ruby on Rails, Prawn - Repairing a corrupt PDF in Rails -


I am using the Prune Mani (V 0.12.0, we do not use 2.0.0 due to compatibility issues A user in Ruby on Rail Project has uploaded a PDF, which he has received directly from an official government website, so it is a PDF that we have to handle for other users, but it is corrupt and crashed Gone, when Zico St Wants to present in the form of credit. You can find PDFs on the "Payment of paid payment" link.

I get the error with this PDF:

  NoMethodError - the undefined method 'size' for zero: NilClass:  

And this is coming in our prone gem by this method:

  def finalada if dictionary.data [Contents] .is_a? (Array) Dictionary. Data [: Content] .each do | Stream | Stream.compress_stream if document.compression_enabled? Stream.data [: length] = stream.stream.size # this line !!! Content.compress_stream at end.com if document.compression_enabled? Content.data [: length] = content.stream.size # It does not get this ending end  

I'm stuck. To "correct" PDF, I can find only one tool Adobe Acrobat and PDF through my searches. PDFTK can be used in a server, but it is only for Windows and our server is running on a Linux server. I can not find any gems or any other way around it. I was able to "fix" PDFs on Mac by "saving as PDF" from Google Chrome (v41) (neither Windows nor Ubuntu Google Chrome worked). I want to be able to "fix" the PDF inside my Rail project. Any ideas / suggestions?

[edit] command line worked for me to use Ghostscript this line: GS-o Ripared PDF -sdiaiviii = Peedifaiarti-Deepeedifistitiijis = / Preepres CRP_14PDF , PDF "Fixed" view now in RGHost Mani to see if I can do the same thing from within an administrator or model.

After leaving support for shrimp templates, I wrote a Ruby country gem.

I can not test it with your file, but you may be able to load the PDF using the gem, can render it in a string (or within the temporary file) and shrimp Reload. Or, maybe this can help you move on shrimp 2.0 (you can make new PDF data with shrimp and ticket it with an existing file).

It's just a thought, do not kill me if it does not work; -)

Good luck!


pdf - Insert values from a file in a latex document -


If there is a latex document, how can I read some key-values ​​from a file, insert them in the document?

Something like this:

Latex code:

  Customer ID: $ {customerID}  

text file :

  CustomerID = 123456  

and the resulting .pdf should have a Customer ID in the file.

We can always write a Perl script to extend ...

Defs.txt:

  customerID = 123456 Customer Tel = 22530000000  

doc.tex:

  \ documentclass { Article} \ start {document} latex customer ID: $ {customerID} and $ {address} costume tailfusion ID: $ {customerTel} \ end {document}  

perl script Tech- def:

  #! / Usr / bin / perl -n BEGIN {$ tex = 0;} If (not $ tex and /^(\w+)=(.*)/) {$ v {$ 1} = $ 2} If (/ \ Documentclass \ {/) {$ tex = 1} if ($ tex) {S / \ $ \ {(\ w +) \} / $ v {$ 1} || / GE "$ 1 ???"; Print}  

test (after chmod ...):

  $ tex-def defs.txt doc.tex \ documentclass {article} \ start {Document} Latex customer ID: 123456 and ??? Address cost telephone ID: 22530000000 \ end {document}  

Is it possible to count the number of items in a Haskell list? -


I am trying to calculate the number of items in a list in Haskell, but I have to find online that you do It's just if you're using a value to satisfy the condition.

I was wondering if you had a normal count :: list -> gt;

length:: [A] ->

For example, evaluates for length [1, 1, 2, 42, 7] 5. / P>


python - Combining two parts of Dataframes: "ValueError: array length 1 does not match index length 586" -


I am trying to create a new data frame from some previous dataframe which I have met with CSV and calculates something on something Like

  addtest = pd.DataFrame ({'coordinate': 123456, 'level1': rain delay, 'coordinate 1': 789, 'level2': rainD2.level})  

In the above example, level1 and level2 are the levels imported from a single CSV, without any that have been applied to them, and I Get a new data frame without any help Of course, although the beginning and end dates in the level of 2 separate CSV files are different (which is deliberate).

However, if I try "identical" in my entire script, errors

  traceback (the most recent call final) Along with: File "Standardization_Loop_Package", Line 365, & lt; Module & gt; 'SGW_month': Yearlist_sorted.level}) file "/usr/lib64/python2.7/site-packages/pandas/core/frame.py", in line 383, in __init__ mgr = self._init_dict (data, index, column, Dtype = dtype) file "/usr/lib64/python2.7/site-packages/pandas/core/frame.py", line 515, in _init_dict dtype = dtype) file "/usr/lib64/python2.7/site- Package / panda / core / frame.py ", line 5263, _arrays_to_mgr index = extract_index (arrays) file in" /usr/lib64/python2.7/site-packages/pandas/core/frame.py ", in line 5325, Extract_index ValueError Enhanced (msg) ValueError: Array length 1 does not match index length 586  

What do I get this error Wants to hana?

What did I do to get there:

  Combined_df = pd.DataFrame ({'coordinates': coordinates, 'SGW_યુयार': RainDGW Level, 'SGW_manthe': earlists_sorted.love})  

edit (see also comments): Coordinates are only numbers, although if I remove that part Yes, I still get an error, although now it has been changed to the condition error: Block size incompatible with mortgage or I first ignored that type? However, according to the tests given below, the level of two dataframes should be fit:

And to ensure that they are not actually matching or duplicate, I RainD_SGW.level and before the yearlist_sorted.level :

  Yearlist_sorted.info () & lt; Class 'pandas.core.frame.DataFrame' & gt; DatetimeIndex: 586 Entries, 1965-12-01 00:00:00 to 2014-09-01 00:00:00 Data Column: Level 586 Value of Non-Values ​​dtypes: float64 (1) None Yearlist_sorted.index. Get_duplicates () & lt; Class' Pendas. Trials Index.datetime index '& gt; Length: 0, Frakk: None, Timezone: None RainD_SGW.info () & lt; Class 'pandas.core.frame.DataFrame' & gt; DatetimeIndex: 586 entries, 1 965-12-01 00:00:00 to 2014-09-01 00:00:00 Data column: Level 586 Value of non-values ​​dtypes: float64 (1) None RainD_SGW.index. Get_duplicates () & lt; Class' Pendas. Trials Index.datetime index '& gt; Length: 0, Freak: None, Timezone: Anyone  

I like it? They are in the same date range in the same size, and they are not suffering from duplicate, so what else is it?

Not sure that I can count it as an answer, but I have a

Anyway, it goes here:

  RainD ['SGW_month'] = erial_sorted rain [[SGW_UYER]] = Rainfall DSGW rain ['coordinate'] = Str (coordinate)  

So instead of trying to create a new dataframe, and I want parts of the data that I have calculated, Award would like to add original Detafrem ( RainD ), and it seems that it is only wise to use the levels of those Diattifarmon.

But it does not look right for me. I'm scared that it will fail, if my data frame is more than just one thing in addition to their index.

In addition to this, I asked the value to be the coordinate string. I thought they were already one, but it seems that I was wrong.


asp.net mvc - What is the difference between UserManager created using HttpContext vs DBContext -


What is the difference between the two methods for creating a user-manager?

  var userManager1 = HttpContext .GetOwinContext () GetUserManager & LT; ApplicationUserManager & gt; (); Var userManager2 = New User Manager & lt; ApplicationUser & gt; (New userstore & lt; ApplicationUser & gt; (DBCtext);  

Uses HttpContext.GetOwinContext for both the application UserManager and RoleManager . In addition, AccountController uses the HttpContext.GetOwinContext in the default MVC 5 application template, but when I create a new controller that uses UserManager It uses db ( ApplicationDbContext )

Default AccountController

  Public Application User Manager UserManager {get_userManager {get}. HttpContext.GetOwinContext () GetUserManager & LT; ApplicationUserManager & gt; (); } Private Set {_userManager = value; }} // can be used as a Public Action Rule Index () (see return (UserManager.Users.ToList ()); }  

A new administrator

  private applicationDbContext db = new ApplicationDbContext (); // can be used as the Public Action Rashtult Index () {return View (db.Users.ToList ()); }  

In what method should two methods be used?


winforms - How to get a dataGridview columns style in c#? -



winforms - How to get a dataGridview columns style in c#? -

how know style column in datagridview has ? need know, style of datagridview column is, like:

bool bold = column1.bold; bool italic = column2.italic;

in order specific columns style, can utilize style property. can utilize :

var cellstyle = yourdatagridview.selectedrows[0].cells[0].style;

if need font property associated column need utilize font property of selected column style. nail nail on head want utilize thing :

bool bold = datagridview1.selectedrows[0].cells[0].style.font.bold; bool italic = datagridview1.selectedrows[0].cells[0].style.font.italic;

c# winforms

java - Android hashmap converting to JSON in the wrong format -



java - Android hashmap converting to JSON in the wrong format -

i've got random issue cannot seem work out. given next code:

hashmap<string, object> params = new hashmap<string, object>(); params.put("method","getproducts"); hashmap<string, string> methodparams = new hashmap<string, string>(); methodparams.put("currency", currency); params.put("params", methodparams); restclient.setbodyvalueforkey("json", new jsonobject(params).tostring());

the next hashmaps converted json , sent php server.

the server should receive info in next format via post

array ( [json] => {"method":"getproducts","params":{"currency":"gbp"}} )

on android devices (not sure determining factor is) right on others beingness sent as

array ( [json] => {"method":"getproducts","params":"{currency=gbp}"} )

as can see sec hash map beingness converted string , not beingness added hashmap

does know causing inconsistency in parsing hashmaps?

thanks

try doing following

hashmap<string, object> params = new hashmap<string, object>(); params.put("method","getproducts"); hashmap<string, string> methodparams = new hashmap<string, string>(); methodparams.put("currency", currency); params.put("params", new jsonobject(methodparams)); restclient.setbodyvalueforkey("json", new jsonobject(params).tostring());

update

// replace params.put("params", new jsonobject(methodparams).tostring()); //with params.put("params", new jsonobject(methodparams));

java android json hashmap

python - Inserting value in orderedict by index? -



python - Inserting value in orderedict by index? -

let have ordered dictionary:

import collections d = collections.ordereddict([('a', none), ('b', none), ('c', none)])

and have these values in list:

lst = [10, 5, 50]

now when iterate on list, insert it's value in dictionary d list index. order need correct, don't know how insert (if possible) in dictionary index, not specifying key.

so illustration (with pseudo code here):

for in range(len(lst)): d.index(i) = lst[i] #this pseudo code, there might not such methods etc.

use zip() iterate on both dictionary keys , values list , assign values:

>>> d = collections.ordereddict([('a', none), ('b', none), ('c', none)]) >>> lst = [10, 5, 50] >>> k, val in zip(d, lst): d[k] = val ... >>> d ordereddict([('a', 10), ('b', 5), ('c', 50)])

and if know keys instead of initializing of dict first , assigning values can replaced with:

>>> keys = ['a', 'b', 'c'] >>> lst = [10, 5, 50] >>> collections.ordereddict(zip(keys, lst)) ordereddict([('a', 10), ('b', 5), ('c', 50)])

python list python-2.7 dictionary ordereddictionary

EXCEL 2013 VBA Querying two files on separate databases on different servers at same time -



EXCEL 2013 VBA Querying two files on separate databases on different servers at same time -

i have moderate experience when comes excel vba , ado. have 2 files task file , calendar file each of on different database , different server. need determine number of actual work days associated task. need take timestamp date task file, check against calendar file determine how many days in task actual working days. figured out how open 2 separate database connections in vba script, cannot figure out how combine 2 files can working days count.

something this

select taskid, count(*) taskfile, calendar taskdate >= calendardate , taskdate <= calendardate , calendarworkday = 1 grouping taskid

i thought preloading worksheet calendar info don't see how query work.

any suggestions or code snippets appreciated.

this quick , dirty subroutine suggested in sec comment above. won't work need right out of box, overall thought sound. realize every record returned in first query generate new query sec file/database, pretty hairy if there lot of records.

sub tworecordsets() dim objconn adodb.connection, objconn2 adodb.connection dim rs adodb.recordset dim strsql string dim strconn string, strconn2 string 'open first connection set objconn = new adodb.connection strconn = "<your 1st connection string>" objconn.open strconn 'open sec connection set objconn2 = new adodb.connection strconn2 = "<your 2nd connection string>" objconn2.open strconn2 'first query: strsql = "select taskid, taskdate taskfile grouping taskid" 'open first recordset using first query set rs = new adodb.recordset rs.open strsql, objconn 'die if there no records returned if rs.eof , rs.bof exit sub end if 'loop through recordset rs.movefirst until rs.eof 'build sql statement sec bit. might have monkey quote marks , date formats depending on db strsql = "select count(*) recordcount calendar '" & rs.fields("taskdate").value & "' >= calendardate , '" & rs.fields("taskdate").value & "' <= calendardate , calendarworkday = 1" 'open recordset set rs2 = new adodb.recordset rs2.open strsql, objconn2 'get reply homecoming heresyouranswer = rs2.fields("recordcount").value 'iterate next record in rs rs.movenext loop end sub

excel vba ado

php - CodeIgniter: queries not being executed -



php - CodeIgniter: queries not being executed -

i'm having unusual issue codeigniter + postgresql. table:

slearning=> select * lezione; id | titolo | descrizione | info | corsoid ----+------------------+-------------+------------+--------- 1 | prova | | 2014-10-09 | 1234 2 | lezione di oggi! | | 2014-10-09 | 1234 (2 rows)

i' have manually inserted these 2 records test queries. btw, within model lezione_m:(i removed checks , other controls anyway, version not working:)

public function get_lezione() { echo $this->db->_error_message(); $query = $this->db->get('lezione'); homecoming $query->result(); }

this controller:

class test_c extends ci_controller { function __construct() { parent::__construct(); $this->load->model('lezione_m'); } public function index() { $this->load->view('test', $data); $this->output->enable_profiler(true); echo '<pre>'; print_r($this->lezione_m->get_lezione(null, 1234)); echo '</pre>'; }

the print_r:

array ( )

what profiler says query:

0.0001 select * "lezione"

not sure going on here. i'm pretty sure codeigniter it's connected database ( kind of error in case).

done. it's unusual thing, site working port number within database config file wrong.

php sql codeigniter postgresql

regex - What does ?: in a regular expression mean? -



regex - What does ?: in a regular expression mean? -

this question has reply here:

reference - regex mean? 1 reply

please explain meaning of regular look , groups look generate?

$string =~ m/^(\d*)(?: \d.*?)(\d*)$/

ps: i'm re-factoring perl code java.

it means not capturing group. after successful match first (\d*) captured in $1, , sec in $2, , (?: \d.*?) not captured @ all.

$string =~ m/^(\d*)(?: \d.*?)(\d*)$/

from perldoc perlretut

non-capturing groupings

a grouping required bundle set of alternatives may or may not useful capturing group. if isn't, creates superfluous add-on set of available capture grouping values, within outside regexp. non-capturing groupings, denoted (?:regexp), still allow regexp treated single unit, don't found capturing grouping @ same time.

regex perl regex-group

java - SQL Procedure call from mybatis -



java - SQL Procedure call from mybatis -

all, trying phone call sql procedure java user mybatis, getting "java.sql.sqlexception: missing in or out parameter @ index:: 1". googling doesnt give me right answers. below code wrote. using mybatis first time, can please guide me.

mepper.xml :---

<select id="addhardwarelist" statementtype="callable" parametertype="java.util.hashmap"> { phone call p_hw_sw_crud.save_hardware_inventory( #{pdatain,javatype=object,jdbctype=array,jdbctypename=tab_idesk_hw_info,mode=in,typehandler=com.tristar.idesk.mybatis.mapper.hardwareinventoryhandler} #{pmsgcodeout,javatype=long,jdbctype=decimal,mode=out} ) } </select>

here setup map --

public void addupdateinventory(jsonnode jsonnode) { map<string, ?> inventorymap = getmapfromjsonaddupdate(jsonnode); hashmap<string,object> returnmap = new hashmap<string,object>(); long perrodcodeout = null; string perrormsg = null; returnmap.put("pdatain", (list<hardwareinventorybean>) inventorymap.get("beanhardwarelist")); returnmap.put("perrorcodeout", perrodcodeout); //returnmap.put("perrodmsgout", perrormsg); hardwareinventorymapper.addhardwarelist(returnmap); }

i implemented custom type handler map java bean attributes oracletype object.

public class hardwareinventoryhandler implements typehandler{ public void setparameter(preparedstatement ps, int i, object parameter, jdbctype jdbctype) throws sqlexception { try{ //new recloaderservice().getjsonobj("rec_icast_claimant_info", "tab_icast_claimant_info", jsonobject, i, ps); system.out.println(parameter); list<hardwareinventorybean> hwinventorylist = (list<hardwareinventorybean>) parameter; system.out.println("parameter here --"+parameter); structdescriptor structdescriptor = structdescriptor.createdescriptor(inventoryconstants.hw_db_rec_type_name, ps.getconnection()); struct[] structs = null; structs = new struct[hwinventorylist.size()]; (int index = 0; index < hwinventorylist.size(); index++) { hardwareinventorybean hwinventorybean = hwinventorylist.get(index); object[] params = new object[12]; params[0] = hwinventorybean.gethwid(); params[1] = hwinventorybean.gethwtypeid(); params[2] = hwinventorybean.gethwmodelid(); params[3] = hwinventorybean.getassetid(); params[4] = hwinventorybean.getdatereceived(); params[5] = hwinventorybean.gethwprice(); params[6] = hwinventorybean.gethwstatus(); params[7] = hwinventorybean.gethwwarranty(); params[8] = hwinventorybean.getcreatedby(); params[9] = hwinventorybean.getcreateddate(); params[10] = hwinventorybean.getmodifiedby(); params[11] = hwinventorybean.getmodifieddate(); system.out.println("---------> " +hwinventorybean.gethwid()); struct struct = new struct(structdescriptor, ps.getconnection(), params); structs[index] = struct; } arraydescriptor desc = arraydescriptor.createdescriptor(inventoryconstants.hw_db_teb_type_name, ps.getconnection()); array oraclearray = new array(desc, ps.getconnection(), structs); ps.setarray(i, oraclearray); } catch(exception e){ e.printstacktrace(); } } public jsonobject getresult(resultset rs, string columnname) throws sqlexception { // todo auto-generated method stub homecoming null; } public jsonobject getresult(resultset rs, int columnindex) throws sqlexception { // todo auto-generated method stub homecoming null; } public jsonobject getresult(callablestatement cs, int columnindex) throws sqlexception { // todo auto-generated method stub homecoming null; } }

mapper interface ----

public void addhardwarelist(hashmap<string, object> returnmap);

my sql procedure code :-

create or replace bundle body p_hw_sw_crud -- body procedure save_hardware_inventory (hw in tab_idesk_hw_info, nu out number) error_code number(10); error_desc varchar2(200); begin nu := 10; in 1 .. hw.count loop if(hw(i).hw_id <> 0) insert idesk_hw_inventory values (idesk_hw_inventory_seq.nextval, hw(i).hwtypeid , hw(i).hwmodelid,hw(i).assetid , hw(i).datereceived , hw(i).hwprice ,hw(i).hwstatus , hw(i).hwwarrenty , hw(i).createdby , sysdate,hw(i).modifiedby, sysdate); else update idesk_hw_inventory set hw_type_id=hw(i).hwtypeid,hw_model_id=hw(i).hwmodelid,asset_id=hw(i).assetid,date_received=hw(i).datereceived,hw_price=hw(i).hwprice,hw_status=hw(i).hwstatus,hw_warrenty=hw(i).hwwarrenty,modified_by=hw(i).modifiedby,modified_date=sysdate hw_id=hw(i).hw_id; end if; end loop; exception when others rollback; error_code := sqlcode; error_desc := sqlerrm; end save_hardware_inventory ; procedure save_software_inventory (sw in tab_idesk_sw_info ) error_code number(10); error_desc varchar2(200); begin in 1 .. sw.count loop if(sw(i).sw_id <> 0) insert idesk_sw_inventory values (idesk_sw_inventory_seq.nextval, sw(i).sw_vendor_id , sw(i).sw_version_title,sw(i).quantity , sw(i).price , sw(i).contract_acount_num ,sw(i).sw_status , sw(i).created_by ,sysdate, sw(i).modified_by , sysdate); else update idesk_sw_inventory set sw_vendor_id=sw(i).sw_vendor_id,sw_version_title=sw(i).sw_version_title,quantity=sw(i).quantity,price=sw(i).price,contract_acount_num=sw(i).contract_acount_num,sw_status=sw(i).sw_status,modified_by=sw(i).modified_by,modified_date=sysdate sw_id=sw(i).sw_id; end if; end loop; exception when others rollback; error_code := sqlcode; error_desc := sqlerrm; end save_software_inventory ; end p_hw_sw_crud ;

believe need callablestatement (which way subclass of preparedstatement) , need utilize 'registeroutparameter'.

see if this example helps.

java oracle hibernate mybatis ibatis

excel - Dynamically select a cell inside For statement -



excel - Dynamically select a cell inside For statement -

i want dynamically select cell, in column b, within statement.

however get: "application-defined or object-defined error"

how can properly?

for = 1 30 sheets("back").range(cells(i + 3, 2)).select select case activecell.value case "3" sheets("back").cells(i + 3, 2).value = "good" case "8" sheets("back").cells(i + 3, 2).value = "bad" case else sheets("back").cells(i + 3, 2).value = "" end select next

try this:

for = 1 30

sheets("back").cells(i + 3, 2).select select case activecell.value case "3" sheets("back").cells(i + 3, 2).value = "good" case "8" sheets("back").cells(i + 3, 2).value = "bad" case else sheets("back").cells(i + 3, 2).value = "" end select

next i

excel vba

SQL join ruby on rails -



SQL join ruby on rails -

so have 2 different models 1 called numbers structured

t.string :number t.date :texted t.integer :times t.timestamps

and 1 called users (i included relevant portion)

t.string :phone_number t.timestamps

what need grab numbers texted date more 2 weeks ago , times less 4 , t.string :number not equal t.string :phone_number in users table. need sort of sql bring together accomplish this?

this have far:

numbers = onumber.where("texted <= ? , times<=4",2.week.ago.utc)

yes left join more suitable here:

onumber.joins( 'left bring together users on onumbers.number = users.phone_number' ).where( 'users.phone_number null , onumber.times <= 4 , onumber.texted < ?', 2.weeks.ago.utc )

this give numbers not in users.phone_number, texted times value less or equal 4.

sql ruby-on-rails ruby ruby-on-rails-4

angularjs - Construct an absolute URL without circumventing $location's abstraction -



angularjs - Construct an absolute URL without circumventing $location's abstraction -

in angularjs application utilize $location's html5-mode, handily includes fallback browsers not supporting html5 history api.

i need generate url pointing application , avoid hardwiring it. instead, leverage $location or underlying mechanisms.

example: need url have $location.path() /my/subpath. in browser html5-support url http://example.com/my/subpath, in browser without http://example.com/#!/my/subpath.

i tried find mechanism used anchor rewriting in angular sources not find it.

is planning possible or on wrong track?

you use

var path = window.location.hash.substr(1);

of course of study should check html 5 back upwards in browser before using either of apis

angularjs

android - How to authorize user in Cordova app with web token? -



android - How to authorize user in Cordova app with web token? -

i developing cordova app communicating server api. want authorize users web tokens instead of cookies understood more secure. understood need encrypt users' info in token , pass server somehow (& decrypt?)... right & secure way pass web tokens server cordova app? essential me build high level security.

then implement oauth2 flow on ssl connection.

android cordova

PHP - mpdf and output buffering couldn't work inside a function -



PHP - mpdf and output buffering couldn't work inside a function -

i using mpdf generate pdf file using output buffering. there no problem of generating pdfs outside function. problem is, couldn't generate pdf within function. no pdf file generated. info included in pdf image files in foreach loop below.

include("search/mpdf/mpdf.php"); function generatecont ($firstdate, $seconddate, $allfiles) { echo '<div class="displayoutput" style="display:none;">'; echo "<a href='data/pdf/".$_get["parameter"].'-'.$firstdate .'-'. $seconddate. '.pdf' ."'>download pdf </a>"; //include("search/mpdf/mpdf.php"); global $html; global $mpdf; $mpdf=new mpdf(); ob_start(); foreach ($allfiles $filesfound) { echo '<h1 class="displaytitle">'.strtoupper(substr(basename($filesfound), 0,-4)). '</h1>'; echo '<div class="visualize">'.'<img src="'. $filesfound. '"></div>'; } $html = ob_get_contents(); ob_get_flush(); $mpdf->writehtml($html); $mpdf->output('data/pdf/'.$_get["parameter"].'-'.$firstdate .'-'. $firstdate. '.pdf','f'); echo '</div>'; }

i check permissions start, , output/log messages. also, link generated in first part uses $seconddate file beingness saved near end uses $firstdate twice. file beingness generated not same file beingness linked.

php function pdf include mpdf

Django: how to build relations and queries the best way? -



Django: how to build relations and queries the best way? -

i'm new django, , i'm having difficulties related objects. easy in terms of sql seems quite tricky here.

i have simple db looks this:

from django.contrib.contenttypes.fields import genericforeignkey, genericrelation django.contrib.contenttypes.models import contenttype django.db import models class language(models.model): code = models.charfield(max_length = 2) name = models.charfield(max_length = 20) class translation(models.model): content_type = models.foreignkey(contenttype) object_id = models.positiveintegerfield() content_object = genericforeignkey('content_type', 'object_id') language = models.foreignkey(language) title = models.textfield() text = models.textfield() class article(models.model): pub_date = models.datetimefield(verbose_name = "publication date") visible = models.booleanfield(default = false) translations = genericrelation(translation)

this follow-up my previous question. andrea corbellini, above model looks clear , simple.

now want show articles on web page. there current language, , need select articles 1) visible , 2) have translation current language. in sql mean joining several tables , filtering them in single query.

how in django? question includes 2 questions: how create fast query , how pass result template.

what first filtering visible , ordering pub_date, iterating through query set, picking articles have proper translation, , copying fields context because template engine doesn't seem understand how access related objects. here code; looks awkward:

articles = article.objects.filter(visible = true).order_by('-pub_date') recent_news = [] article in articles: content = article.content(translation.get_language()) if not content.exists(): go on content = content[0] recent_news.append({ 'pub_date': article.pub_date, 'title': content.title, 'abstract': content.text, 'text': content.text }) context = { 'recent_news_list': recent_news }

what help here 'meta model' or middleware of job , cache result requesting articles language require single query. way?

since info need send template in translation model, query on model, , send template. thing need in article model visible field, can filter on that:

article = contenttype.objects.get_for_model(article) article_ids = article.objects.filter(visible=true).values_list('id') translations = translation.objects.filter(content_type=article, object_id__in=article_ids) context = {'recent_news_list: translations}

this 3 queries: 1 contenttype (although cached automatically), 1 translations, , 1 articles (and django may indeed 3rd subquery of second).

it's going complicated though; that's cost pay using generic relations. know other question have multiple types related translation, if can away without doing things indeed much simpler.

django django-models

Groovy equivalent for Java 8 Lambda Expression -



Groovy equivalent for Java 8 Lambda Expression -

i have got java interface 1 method.

// java interface public interface auditoraware { auditor getcurrentauditor(); }

i using java 8 lambda look create insance of auditoraware following.

// java 8 lambda create instance of auditoraware public auditoraware currentauditor() { homecoming () -> auditorcontextholder.getauditor(); }

i trying write above java implementation in groovy.

i see there many ways implement interfaces in groovy shown in groovy ways implement interfaces documentation.

i have implemented above java code groovy equivalent using implement interfaces map shown in above mentioned documentation.

// groovy equivalent "implement interfaces map" method auditoraware currentauditor() { [getcurrentauditor: auditorcontextholder.auditor] auditoraware }

but implement interfaces closure method seems more concise shown in documentation example. however, when seek implement follows, intellij shows errors saying ambiguous code block.

// groovy equivalent "implement interfaces closure" method ??? auditoraware currentauditor() { {auditorcontextholder.auditor} auditoraware }

how can alter java 8 lambda implementation groovy equivalent using "implement interfaces closure" method?

as commented dylan bijnagte, next code worked.

// groovy equivalent "implement interfaces closure" method auditoraware currentauditor() { { -> auditorcontextholder.auditor} auditoraware }

section paramter notes of documentation on groovy closure explain this.

java groovy lambda closures java-8

text - Terminal command 'find' read from txt files -



text - Terminal command 'find' read from txt files -

i find .html files directory ignore files.

$ find /volumes/workspace/myproject/ -name '*.html' ! -name 'myfile.html'

above command ignore myfile.html only. have lists of files ignore , wanna maintain ignore file in single txt file.

myfile1.html myfile1.html myfile2.html myfile2.html

above txt file content.

i have list of files ignored maintain in single txt files , utilize txt file in find command.

please advice. in advance.

you have build array file , utilize in find syntax. i.e.

#!/bin/bash while ifs= read -r file; arr+=(-name "$file" -o) done < list_of_filenames_to_omit.txt #remove trailing -o unset arr[$((${#arr[@]}-1))] if ((${#arr[@]}!=0)); find /volumes/workspace/myproject/ -name '*.html' ! \( "${arr[@]}" \) else #list_of_filenames_to_omit.txt empty find /volumes/workspace/myproject/ -name '*.html' fi

text terminal find command

java - How to correct download multiple images(thumbnails for videos) -



java - How to correct download multiple images(thumbnails for videos) -

i write client kaltura media platform. have activity "video". in activity must display list of video thumbnails first of all, download list of videos using kaltura api, , works fine. every video entry have field thumbnailurl, point out thumbnail video. when download thumbnails videos, it's(thumbnails) downloads in wrong order, thumbnails not downloaded, thumbnails repeated other video, , not downloaded. code of callback if downloadind videos:

private void handlefetchvideolisttask(list<videoobject> videoobjects){ linearlayout videolistprogressbarcontainer = (linearlayout)mactivity.findviewbyid(r.id.videolistprogressbarcontainer); linearlayout videolistviewcontainer = (linearlayout)mactivity.findviewbyid(r.id.videolistviewcontainer); videolistprogressbarcontainer.setvisibility(view.gone); videolistviewcontainer.setvisibility(view.visible); listview listview = (listview)videolistviewcontainer.findviewbyid(r.id.videolistview); videolistadapter adapter = new videolistadapter((layoutinflater) mactivity.getsystemservice(context.layout_inflater_service)); adapter.setlist(videoobjects); listview.setadapter(adapter); downloadthumbnailstask task = new downloadthumbnailstask(videoobjects, adapter); task.execute(); }

this code of downloadthumbnailstask:

public class downloadthumbnailstask extends asynctask<list<videoobject>, videoobject, void>{ private list<videoobject> videoobjectlist = null; private list<videoobject> toprocess = null; private videolistadapter adapter = null; public downloadthumbnailstask(list<videoobject> videoobjectlist, videolistadapter adapter){ this.videoobjectlist = videoobjectlist; this.toprocess = new arraylist<videoobject>(videoobjectlist); this.adapter = adapter; } @override protected void doinbackground(list<videoobject>... lists) { for(int i=0; i<toprocess.size(); i++){ videoobject item = videoobjectlist.get(i); string urldisplay = item.getthumbnailurl(); bitmap micon11 = null; seek { inputstream in = new java.net.url(urldisplay).openstream(); micon11 = bitmapfactory.decodestream(in); } grab (exception e) { log.e("error", e.getmessage()); e.printstacktrace(); } item.setthumbnail(micon11); micon11 = null; publishprogress(item); } homecoming null; } @override protected void onprogressupdate(videoobject... values) { if(values != null && values.length > 0){ videoobject item = values[0]; videoobjectlist.remove(item); videoobjectlist.add(item); adapter.setlist(videoobjectlist); adapter.notifydatasetchanged(); } } @override protected void onpostexecute(void avoid) { this.toprocess.clear(); this.toprocess = null; } }

this code of adapter:

public class videolistadapter extends baseadapter { private list<videoobject> list; private layoutinflater layoutinflater; public videolistadapter(layoutinflater layoutinflater){ this.layoutinflater = layoutinflater; } @override public int getcount() { homecoming list.size(); } @override public object getitem(int i) { homecoming list.get(i); } @override public long getitemid(int i) { homecoming list.get(i).getid(); } @override public view getview(int i, view view, viewgroup viewgroup) { if(view == null){ view = layoutinflater.inflate(r.layout.list_item_video, viewgroup, false); } viewholder viewholder = new viewholder(view); view.settag(viewholder); videoobject item = getvideoobjectitem(i); viewholder.duration.settext(item.getformattedduration()); viewholder.title.settext(item.getname()); if(item.getthumbnail() != null){ viewholder.thumbnail.setimagebitmap(item.getthumbnail()); } homecoming view; } private videoobject getvideoobjectitem(int position){ homecoming (videoobject) getitem(position); } public list<videoobject> getlist() { homecoming list; } public void setlist(list<videoobject> list) { this.list = list; } public static class viewholder { public final imageview thumbnail; public final textview title; public final textview duration; public viewholder(view view) { this.thumbnail = (imageview)view.findviewbyid(r.id.imgvideothumbnail); this.title = (textview)view.findviewbyid(r.id.txtvideoname); this.duration = (textview)view.findviewbyid(r.id.txtvideoduration); } } }

and result of code:

i noticed 2 things:

inside doinbackground waiting

inputstream in = new java.net.url(urldisplay).openstream(); micon11 = bitmapfactory.decodestream(in);

to finish before downloading next image.

try this:

protected void doinbackground(list<videoobject>... lists) { for(final int i=0; i<toprocess.size(); i++){ seek { new thread(){ @override public void run() { videoobject item = videoobjectlist.get(i); string urldisplay = item.getthumbnailurl(); bitmap micon11 = null; seek { inputstream in = new java.net.url(urldisplay).openstream(); micon11 = bitmapfactory.decodestream(in); } grab (exception e) { log.e("error", e.getmessage()); e.printstacktrace(); } item.setthumbnail(micon11); publishprogress(item); } }.start(); } grab (exception e) { log.e("error", e.getmessage()); } } homecoming null; } @override protected void onprogressupdate(videoobject... values) { adapter.notifydatasetchanged(); }

i think 2 lines problem:

videoobjectlist.remove(item); videoobjectlist.add(item);

you're removing item , adding 1 time again @ bottom. phone call notifydatasetchanged after setting bitmap.

inside getview you're creating new viewholder every time.

@override public view getview(int i, view view, viewgroup viewgroup) { viewholder viewholder; if(view == null){ view = layoutinflater.inflate(r.layout.list_item_video, viewgroup, false); viewholder = new viewholder(view); view.settag(viewholder); }else{ viewholder = view.gettag(); } videoobject item = getvideoobjectitem(i); viewholder.duration.settext(item.getformattedduration()); viewholder.title.settext(item.getname()); if(item.getthumbnail() != null){ viewholder.thumbnail.setimagebitmap(item.getthumbnail()); } homecoming view; }

java android download

promise - Bluebird .then method -



promise - Bluebird .then method -

the bluebird docs .call method have code sample labeled, "chaining lo-dash or underscore methods".

what purpose of chained .then(_) in code snippet below?

var promise = require("bluebird"); ... var _ = require("lodash"); var fs = promise.promisifyall(require("fs")); fs.readdirasync(".").then(_) <-- ??? .call("groupby", function(filename) { homecoming filename.charat(0); }) ...

thanks!

in underscore _ identifier function namespace.

doing .then returns result of passed function.

calling _ function starts underscore chain, consecutive actions happen on object passed. starts chain result of readdirasync.

promise bluebird

ActionController::UnknownFormat when creating rss feed in Rails 4 -



ActionController::UnknownFormat when creating rss feed in Rails 4 -

so, i'm trying add together rss feed rails 4 app, next tuto, i'm struggling actioncontroller::unknownformat understand it's happening in controller.

hacks_controller.rb

def index @hacks = hack.order('id desc').paginate(:page => params[:page], per_page: 5) end def feed @hacks = hack.where(:active => true) respond_to |format| format.atom { render :template => 'feed.atom.builder', :layout => false } end end

feed.atom.builder

atom_feed {language: 'en-us', url: root_url} |feed| feed.title "my own blog title" feed.updated @hacks.maximum(:created_at) @hacks.each |hack| feed.entry hack, {published: hack.created_at, updated: hack.updated_at} |entry| entry.title hack.title entry.content post.text, type: 'html' end end end

i have tried changing

format.atom { render :template => 'feed.atom.builder', :layout => false }

to

format.atom { render :layout => false }

but still not working. trace is

actioncontroller::unknownformat - actioncontroller::unknownformat: actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:440:in `retrieve_collector_from_mimes' actionpack (4.1.1) lib/action_controller/metal/mime_responds.rb:256:in `respond_to' () users/javier/desktop/definitive/app/controllers/hacks_controller.rb:14:in `feed' actionpack (4.1.1) lib/action_controller/metal/implicit_render.rb:4:in `send_action' actionpack (4.1.1) lib/abstract_controller/base.rb:189:in `process_action' actionpack (4.1.1) lib/action_controller/metal/rendering.rb:10:in `process_action' actionpack (4.1.1) lib/abstract_controller/callbacks.rb:20:in `block in process_action' activesupport (4.1.1) lib/active_support/callbacks.rb:113:in `call'

i had same problem rss format, had route

defaults => { :format => 'rss' }

try alter format atom.

ruby-on-rails

javascript - When loggin an event object, currentTarget is null, but when logging event.currentTarget it logs a value. Why is that? -



javascript - When loggin an event object, currentTarget is null, but when logging event.currentTarget it logs a value. Why is that? -

with below code noticed in browser console when log event, value currenttarget logs null. when log e.currenttarget logs value. idea's on how works?

var button = document.getelementbyid("btn"); var eventbuttonhandler = function(e) { var button = e.target; console.log(e); // logs mouseevent object currenttarget:null console.log(e.currenttarget); // logs value if(!button.classlist.contains("active")) button.classlist.add("active"); else button.classlist.remove("active"); }; button.addeventlistener("click", eventbuttonhandler);

a jsbin can found here: http://jsbin.com/xatixa/2/watch?html,js,output

this artifact of way javascript console works when log object. log doesn't contain re-create of object properties, contains reference object. when click on disclosure triangle, looks properties , displays them.

in case, @ time phone call console.log(e), there's dom element in currenttarget property. sometime later, property reset null reason. when expand event object, that's see.

a simple illustration demonstrates is:

class="snippet-code-js lang-js prettyprint-override">var foo = { }; (var = 0; < 100; i++) { foo['longprefix' + i] = i; } console.log(foo); foo.longprefix90 = 'abc';

when view object in console, you'll see foo.longprefix90 contains "abc", though contained 90 @ time console.log(foo) called.

the demonstration needs utilize object lots of properties. when it's logging, shows first few properties fit in console, in snapshot. properties after display anomalous behavior.

javascript javascript-events

tomcat - Grails war fails to deploy java.lang.NoClassDefFoundError and SLF4J: Class path contains multiple SLF4J bindings -



tomcat - Grails war fails to deploy java.lang.NoClassDefFoundError and SLF4J: Class path contains multiple SLF4J bindings -

my application works fine when utilize grails run-app when seek run using war file run-war next errors:

i tried solutions proposed here on stack none of them solved problem.

and package/class beingness showed on trace 1 of domain classes :

nested exception java.lang.noclassdeffounderror: gneellaan/ecf

gneellaan = package , ecf = domain class

|running grails application error | slf4j: class path contains multiple slf4j bindings. error | slf4j: found binding in [jar:file:/c:/grails-2.4.2/dist/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/staticloggerbinder.class] error | slf4j: found binding in [jar:file:/c:/grails/gneellaan/target/work/tomcat/webapps/gneellaan/web-inf/lib/grails-plugin-log4j-2.4.2.jar!/org/slf4j/impl/staticloggerbinder.class] error | slf4j: see http://www.slf4j.org/codes.html#multiple_bindings explanation. error | slf4j: actual binding of type [org.slf4j.impl.grailsslf4jloggerfactory] 2014-10-23 14:28:08,255 [localhost-startstop-1] error context.contextloader - context initialization failed org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more 2014-10-23 14:28:08,257 [localhost-startstop-1] error context.grailscontextloaderlistener - error initializing application: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more 2014-10-23 14:28:08,258 [localhost-startstop-1] error context.grailscontextloaderlistener - error initializing grails: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more exception sending context initialized event listener instance of class org.codehaus.groovy.grails.web.context.grailscontextloaderlistener org.springframework.beans.factory.beancreationexception: error creating bean name 'grailsapplication' defined in servletcontext resource [/web-inf/applicationcontext.xml]: invocation of init method failed; nested exception java.lang.noclassdeffounderror: gneellaan/ecf @ java.util.concurrent.futuretask.run(futuretask.java:266) @ java.util.concurrent.threadpoolexecutor.runworker(threadpoolexecutor.java:1142) @ java.util.concurrent.threadpoolexecutor$worker.run(threadpoolexecutor.java:617) @ java.lang.thread.run(thread.java:745) caused by: java.lang.noclassdeffounderror: gneellaan/ecf @ java.lang.class.forname(class.java:340) ... 4 more caused by: java.lang.classnotfoundexception: gneellaan.ecf ... 5 more error listenerstart context [/gneellaan] startup failed due previous errors web application [/gneellaan] registered jdbc driver [org.h2.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. web application [/gneellaan] registered jdbc driver [com.mysql.jdbc.driver] failed unregister when web application stopped. prevent memory leak, jdbc driver has been forcibly unregistered. web application [/gneellaan] appears have started thread named [abandoned connection cleanup thread] has failed stop it. create memory leak. |server running. browse http://localhost:9091/gneellaan |server running. browse http://localhost:9091/gneellaan

right - its' classpath problem, , slf4j messages ignorable warnings. there's big difference between java.lang.classnotfoundexception , java.lang.noclassdeffounderror. classnotfoundexception easy - there's no jar file or directory in classpath containing class or resource. prepare classpath, or add together missing library it, , move on.

but noclassdeffounderror (which cause classnotfoundexception) lot harder fix. indicates named class found when loading it, dependency has wasn't met. should relatively rare when using grails, maven, gradle, etc. integrate dependency management, , determine dependencies of dependencies , include those. when configure lookup not recurse through dependency graph, or exclude 1 or more jars think safe exclude, can happen.

i'm guessing gneellaan.ecf class - there's 1 result in google, , it's question (it's technically 2 words, i'm still calling googlewhack). if 3rd-party library, utilize site http://mvnrepository.com/ determine dependencies (e.g. http://mvnrepository.com/artifact/io.hawt/hawtio-util/1.4.27). have source, shouldn't hard find cause. if there's lot going on in class, seek commenting out can , create sure everyting still compiles, remove can.

tomcat grails groovy war slf4j