Posts

jQuery global variable with getScript -

This object is decalred in foo.js, and has been modified in bar.js. And when I getScript, I tried to get results. foo.js P> / * // It works fine, but I want to decalre it inside jQuery var myObject = {str: "hello world", num: "123"}; * / $ (Function () {// This makes my object global variable y myObject = {str: "Hello World", num: "123"}; Warning (myObject.str + "+ myObject.num); $ ; .getScript ("bar.js", function () {warning (myObject.str + "+ myObject.num);});}); bar.js $ (function () {myObject = {str: "new string", number: " 999 "};}); Since you have declared a variable within a function, it is local for functions . What you can do is declare the variable out, but assign values ​​inside jQuery's ready handler foo.js / * // This works fine, but I want to decalre it within jQuery var myObject = {str: "hello world", num: "123"}; * / Var myObject; ...

ios7 - How to add UIImageView (UIActivityIndicatorForSDWebImage) in SDWebImage downloader? -

I am using SDWebImage to download the image. I want to show an indicator while downloading the image. For this I got a square UIImageView ( UIActivityIndicatorForSDWebImage ); I have found it: Anybody please help me how do I add it to my project? I'm not using cocoapod to help Kripa Marie. You can copy .h and .m in your project as stated in the document In the first error, the UIImageView + WebCap category was not found. Are you sure you imported SDWebImage? Apart from the other screenshots, it seems that SDWebImageCompletionBlock is not found. I think it was introduced in version 3.7 of SDWebImage, so you may have an older version

avr - floating point operations anomaly -

I'm using temperature at temp sensor tmp36 using atmega2560. After reading the temperature sensor digital values ​​and converting two etemeda into readable form in 2560 microcontrollers, I get different answers. Why do I get answers like this? ? The code snippet is present below: Float temp; // global variable {unsigned long temp_volt; Unsigned four temp_h, temp_l; Unsigned integer temp_buf; Temp_l = ADCL; Temp_h = ADCH; Temp_buf = ((int) temp_h & lt; & lt; 8) | Temp_l; Temp_volt = (((unsigned long) temp_buf * 256 * 10) / 1023) - 993; // Decrease the offset giant tempo = ((float) temp_devault * 1000/1014 * 100/1996) / 10; // gain prints ("temp_buf:% d, temp_volt:% d, temp:% 0.2f \ r \ n", temp_buf, temp_volt, temp); } I have an ATMEGA2560 answer: temp_buf: 55, temp_volt: 447, temp: 22.4 What's on another ATMEGA2560 Found: temp_buf: 53, temp_volt: -861, temp: 0.00 For this reason I made this adjustment temp_volt = (( (Unsigned long) temp_bu...

multithreading - Can I accelerate python file method `read()` by parallelism? -

I have many files to read (300 ~ 500), and I want to speed up this task. is the illustration: import import import from import import _io filelist = map (open, OSListDipper) if __name__ == '__main__': with pool (): Pool: A = pool.map (_io.TextIowrapper.read, filelist) Of course, I got an error: type ERROR: Can not serialize '_IO.TextIowrapper' object The question is: Can I speed up the I / O process with equality? if so, how? Update findings: Now I have found a path of equality and my code has been tested: I used 22 items, total 63.2 Import from the multiprocessex import Import import import _Of my_read (file_name): with open (file_name) f: return f.read () def mul (): in the form of pool (form of pool In): A = pool.map (my_read, os.listdir ()) def single (): a = [] for i in os.listdir (): open (i) as f: r = f.read () A. Unfortunately, single () costs 0.4s while the is Mul () cost 0.8. Update 1: Some people said that this is an IO-...

facebook javascript v2.0 -

Facebook Javascript v2.0 app notifies specific user IDs But what if any old user has a Uninstalled the application and then changed that application after the version of the application? Will they have the new userid ? He will get the same ID, so that you can still identify the returning users. I tested it with an app to make sure: Authorize user, call / me, delete the app, authorize user again, call me / me & gt; Same id EDIT: We have only discussed this in another thread: It seems that Scoped ID can change if the user has unauthorized your app and long Authorized, but you have to delete the user data anyway, if the user does not use the app for a long time - data privacy and accessories

objective c - Sort the Main NSArray using the SubArray key value pair -

I want to sort my main array based on first_name in swap self.contacts The code that is used to sort the array - (zero) Sort {NSSortDescriptor * sdName = [[NSSortDescriptor alloc] InitWithKey: @ "first_name" ascending: yes]; Self.contacts = [NSMutableArray arrayWithArray: [Contacted with your own word descriptor: [NSArray arrayWithObjects: sdName, zero]]]; } MyData self.contacts = ({contact = {"first_name" = "test r";}; "Last_met" = ({"last_met_date" = "2014-10-09";});}, {contact = {"first_name" = "test of";}; "last_met" = ({"last_met_date" = "2014 -10-09 ";}};}) Try with this sort descriptor Do: Descriptor = [[NSSSort Descriptor Alok] initWithKey: @ "contact.first_name" ascending: Yes]; parameter key is actually a key path , and nsDictionary is compliant as you like stuff You can write: [Contact [0] valueForKeyPath: @ "conta...

.htaccess - multiple parameters friendly URL rewriteRule -

I need help on rewriteRule for several parameters: sitename.com/ Project .php? To become T = value1 and a = value2 sitename.com/project/value2/value1 But in any case I was unable to solve the problem and 500 internal server error The page shown to my HTAC file: DirectoryIndex index .php option -index & lt; Files * htaccess & gt; From all & lt; / Files & gt; & Lt; Files page & gt; Forteotype application / X-HPD-PHP & lt; / Files & gt; & Lt; IfModule mod_rewrite.c & gt; Option + SymLinksIfOwnerMatch RewriteEngine% {REQUEST_FILENAME} on rewriting! -d Rewrite Convert% {REQUEST_FILENAME}! -f #resolve .php Extension Extension Rewrite for php URL% {REQUEST_FILENAME}. Php -f rewrite rule ^ (. *) $ $ 1.php [L] RRRRRRRR ^ CP / edit-agent /([^/\.]+)/?$ cp / edit-agent.php? Name = $ 1 [L] Rev. Raul ^ ([^ /.] +) /? $ Agent.php? Name = $ 1 [L] Example # / 123 / sys RewriteRule Project / ([0- 9] +) / ([^ / \. +] /? #Crew to handle $ Proje...