question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
6,195,483
6,195,604
How to detect how many times a selector has been performed Cocos2d?
I have a game in the works in Cocos2d. I have enemies that spawn every 0.8 seconds. I would like to have a DIFFERENT type of enemy spawn after, say, 25 spawn. How do I tell how many times a selector has been called? Any help is appreciated. Thanks!
so this might be a really simple answer, but I feel I should ask it, can't you just use a counter that you increment on each creation? Is there any reason why you aren't doing this?
How to detect how many times a selector has been performed Cocos2d? I have a game in the works in Cocos2d. I have enemies that spawn every 0.8 seconds. I would like to have a DIFFERENT type of enemy spawn after, say, 25 spawn. How do I tell how many times a selector has been called? Any help is appreciated. Thanks!
TITLE: How to detect how many times a selector has been performed Cocos2d? QUESTION: I have a game in the works in Cocos2d. I have enemies that spawn every 0.8 seconds. I would like to have a DIFFERENT type of enemy spawn after, say, 25 spawn. How do I tell how many times a selector has been called? Any help is apprec...
[ "iphone", "cocos2d-iphone", "selector" ]
0
2
50
2
0
2011-06-01T02:00:39.437000
2011-06-01T02:28:29.060000
6,195,485
6,196,381
How do I add additional mod_rewrite rules on a wordpress site?
I have uploaded a file 'events.php' to my wordpress site (the wordpress is installed in my root directory). I would like to make a mod_rewrite to this file so that one may go to mydomain.com/events I tried simply doing something like this: # BEGIN WordPress RewriteEngine On RewriteBase / RewriteRule %events$ events.ph...
Correct me if I’m wrong, but if all you want is for someone who goes to example.com/events to be directed to example.com/events.php, than you can just do a redirect like so. Redirect 301 /events http://www.example.com/events.php
How do I add additional mod_rewrite rules on a wordpress site? I have uploaded a file 'events.php' to my wordpress site (the wordpress is installed in my root directory). I would like to make a mod_rewrite to this file so that one may go to mydomain.com/events I tried simply doing something like this: # BEGIN WordPress...
TITLE: How do I add additional mod_rewrite rules on a wordpress site? QUESTION: I have uploaded a file 'events.php' to my wordpress site (the wordpress is installed in my root directory). I would like to make a mod_rewrite to this file so that one may go to mydomain.com/events I tried simply doing something like this:...
[ "wordpress", "mod-rewrite" ]
0
0
288
2
0
2011-06-01T02:00:47.017000
2011-06-01T04:46:00.313000
6,195,486
6,195,528
Javascript Function Accepting PHP Variables
I'm drawing a complete blank why this isn't working. I can do it with one variable passing through, but not two. When I use actually numbers like getnt(1,2) it works. It's just not working with two PHP variables. VIEW ";?> I can make the code work with echo " VIEW ";, but that's no good if I want to add in alerts and j...
If the ID and pnID are strings, enclose them with brackets like this. VIEW ";?> If still not working, You can debug your code View the source code in browser, make sure it generates correctly. Put some alert messages in the javascript function. Install Firebug if you have Firefox or see Javaascript console if you get a...
Javascript Function Accepting PHP Variables I'm drawing a complete blank why this isn't working. I can do it with one variable passing through, but not two. When I use actually numbers like getnt(1,2) it works. It's just not working with two PHP variables. VIEW ";?> I can make the code work with echo " VIEW ";, but tha...
TITLE: Javascript Function Accepting PHP Variables QUESTION: I'm drawing a complete blank why this isn't working. I can do it with one variable passing through, but not two. When I use actually numbers like getnt(1,2) it works. It's just not working with two PHP variables. VIEW ";?> I can make the code work with echo ...
[ "php", "javascript", "function", "variables" ]
0
2
846
3
0
2011-06-01T02:00:52.293000
2011-06-01T02:09:05.810000
6,195,487
6,195,511
File in use C/C++
I'm learning C/C++ right now and I am reading about file operations. Suppose a program A is working with an external file (say, a text file) and another another program B is, say, trying to move the file (or worse, delete it). Is it possible to tell the OS to inform the program B that the file is in use, even though it...
What you're trying to do is called file locking. Search for "file locking in C".
File in use C/C++ I'm learning C/C++ right now and I am reading about file operations. Suppose a program A is working with an external file (say, a text file) and another another program B is, say, trying to move the file (or worse, delete it). Is it possible to tell the OS to inform the program B that the file is in u...
TITLE: File in use C/C++ QUESTION: I'm learning C/C++ right now and I am reading about file operations. Suppose a program A is working with an external file (say, a text file) and another another program B is, say, trying to move the file (or worse, delete it). Is it possible to tell the OS to inform the program B tha...
[ "c++", "c", "file" ]
1
5
532
2
0
2011-06-01T02:01:10.653000
2011-06-01T02:05:18.423000
6,195,488
6,196,121
Dispose and/or Finalize not called when using VB6 IDE END Debugging
Following on from my question a little while ago. I have resolved most of the parts related to that. Detect when a COM Object goes out of Scope I now face a new problem whilst developers are working on the VB6 code. If they run the project inside the IDE, and then press END, the Dispose nor Finalize are being called. I...
No, there is nothing you can do. Stopping debugging does not give your program a chance to run code.
Dispose and/or Finalize not called when using VB6 IDE END Debugging Following on from my question a little while ago. I have resolved most of the parts related to that. Detect when a COM Object goes out of Scope I now face a new problem whilst developers are working on the VB6 code. If they run the project inside the I...
TITLE: Dispose and/or Finalize not called when using VB6 IDE END Debugging QUESTION: Following on from my question a little while ago. I have resolved most of the parts related to that. Detect when a COM Object goes out of Scope I now face a new problem whilst developers are working on the VB6 code. If they run the pr...
[ ".net", "com", "vb6" ]
0
3
786
2
0
2011-06-01T02:01:52.087000
2011-06-01T04:01:34.340000
6,195,492
6,195,561
XNA Game Development for Windows Phone
I am trying to get involved in XNA game development (most likely for Windows Phone). I have a decent amount of experience programming and have made quite a few small XNA games for practice. At this point, before I take on a larger project, I would like to make sure I get the fundamental design and flow concepts down. W...
I found Learning XNA to be a great book. I've got 3.0, but 4.0 is now available which also has a section on Windows Phone 7. I can't imagine they're much different since it's the same author. As obvious as it sounds, I find that people often overlook or underestimate the usefulness of the Content Catalog on AppHub. Not...
XNA Game Development for Windows Phone I am trying to get involved in XNA game development (most likely for Windows Phone). I have a decent amount of experience programming and have made quite a few small XNA games for practice. At this point, before I take on a larger project, I would like to make sure I get the funda...
TITLE: XNA Game Development for Windows Phone QUESTION: I am trying to get involved in XNA game development (most likely for Windows Phone). I have a decent amount of experience programming and have made quite a few small XNA games for practice. At this point, before I take on a larger project, I would like to make su...
[ "windows", "windows-phone-7", "xna" ]
1
3
455
1
0
2011-06-01T02:02:15.877000
2011-06-01T02:18:03.667000
6,195,496
6,195,625
Complex Query with Has many and belongs to for RAILS 3
I am trying to do a QUERY in my controller to get a list of suppliers with a category ID. I have my models set up like this. class Supplier < ActiveRecord::Base has_and_belongs_to_many:sub_categories end class Category < ActiveRecord::Base has_many:sub_categories end class SubCategory < ActiveRecord::Base belongs_to:...
Well, that's certainly an sql error. The stuff inside the where() call gets translated directly to SQL, and that's not sq;l.:) You need to join tables together. I'm assuming there's a sub_category_suppliers table that completes the habtm association. (BTW, I much prefer to use has_many:through exclusively) I think it w...
Complex Query with Has many and belongs to for RAILS 3 I am trying to do a QUERY in my controller to get a list of suppliers with a category ID. I have my models set up like this. class Supplier < ActiveRecord::Base has_and_belongs_to_many:sub_categories end class Category < ActiveRecord::Base has_many:sub_categories ...
TITLE: Complex Query with Has many and belongs to for RAILS 3 QUESTION: I am trying to do a QUERY in my controller to get a list of suppliers with a category ID. I have my models set up like this. class Supplier < ActiveRecord::Base has_and_belongs_to_many:sub_categories end class Category < ActiveRecord::Base has_ma...
[ "sql", "ruby", "ruby-on-rails-3", "has-many" ]
1
2
752
1
0
2011-06-01T02:02:47.237000
2011-06-01T02:31:04.960000
6,195,506
6,196,698
Would like to do a mercurial clone with filter of patterns in hgignore
Over time a number of the developers have committed files that were then added to the.hgignore. From what I hear there is no way to remove items from the history of mercurial, which is ok. But I also heard that there is a way to do a clone, I think using the convert plugin, to clone/export a repo while specifying which...
You could create a filemap from.hgignore doing something like this: hg clone -U yourrepo temprepo # create a temp repo with no files in working dir cd tmprepo hg revert --all # put files in working dir hg forget ** # un-add the files hg status --ignored --no-status | sed 's/^/exclude /' >../filemap that will get you a ...
Would like to do a mercurial clone with filter of patterns in hgignore Over time a number of the developers have committed files that were then added to the.hgignore. From what I hear there is no way to remove items from the history of mercurial, which is ok. But I also heard that there is a way to do a clone, I think ...
TITLE: Would like to do a mercurial clone with filter of patterns in hgignore QUESTION: Over time a number of the developers have committed files that were then added to the.hgignore. From what I hear there is no way to remove items from the history of mercurial, which is ok. But I also heard that there is a way to do...
[ "mercurial", "clone", "partial" ]
2
2
400
2
0
2011-06-01T02:03:52.807000
2011-06-01T05:30:35.083000
6,195,508
6,195,610
Game Engine Remake - Trouble Choosing a Language /API(Java or Python)
The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly load the graphics from a disc, or.iso (I already know the sectors the gr...
I'd recommend going with PySFML, and, of course, Python. If you do your Python programming correctly, and if you really are willing to fiddle with C or ASM Python plugins for faster computations, you shouldn't really have too much performace hits.
Game Engine Remake - Trouble Choosing a Language /API(Java or Python) The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The plan is to mainly lo...
TITLE: Game Engine Remake - Trouble Choosing a Language /API(Java or Python) QUESTION: The engine I've been wanting to remake is from a PlayStation 1 game called Final Fantasy Tactics, and the game is basically a 2.5D game I guess you could say. Low-resolution sprites and textures, and 3D maps for battlefields. The pl...
[ "java", "python" ]
1
0
216
3
0
2011-06-01T02:04:43.067000
2011-06-01T02:28:59.203000
6,195,514
6,196,565
Loading high res background image
I have a colourful background image that is 2000px x 1500px and because of the details I am saving it as a jpeg that renders at 1.1 MB. I am using the CSS background property to render the image. So being relatively new to web dev and working with a client/designer that's not open to a change of design at this point in...
There's no way to make images magically load faster. Sometimes, though, splitting an image in smaller images allows for surprising size gains; so if it's not out of question for your CSS layout (it typically is, though), you could try this. Another possibility for you would be to use progressive JPEG images. They are e...
Loading high res background image I have a colourful background image that is 2000px x 1500px and because of the details I am saving it as a jpeg that renders at 1.1 MB. I am using the CSS background property to render the image. So being relatively new to web dev and working with a client/designer that's not open to a...
TITLE: Loading high res background image QUESTION: I have a colourful background image that is 2000px x 1500px and because of the details I am saving it as a jpeg that renders at 1.1 MB. I am using the CSS background property to render the image. So being relatively new to web dev and working with a client/designer th...
[ "css", "background", "loading" ]
3
8
19,395
5
0
2011-06-01T02:05:48.260000
2011-06-01T05:10:50.900000
6,195,518
6,197,273
NSPredicate versus NSString: Which is better/faster for finding superstrings?
I have a large number of strings that I'm searching to see if a given substring exists. It seems there are two reasonable ways to do this. Option 1: Use the NSString method rangeOfSubstring and test whether.location exists: NSRange range = [string rangeOfSubstring:substring]; return (range.location!= NSNotFound); Optio...
You should benchmark and time any solution that uses NSPredicate because in my experience NSPredicate can be very slow. For simplicity, I would go with a simple for(NSString *string in stringsArray) { } type of loop. The loop body would contain a simple rangeOfSubstring check. You might be able improve the performance ...
NSPredicate versus NSString: Which is better/faster for finding superstrings? I have a large number of strings that I'm searching to see if a given substring exists. It seems there are two reasonable ways to do this. Option 1: Use the NSString method rangeOfSubstring and test whether.location exists: NSRange range = [s...
TITLE: NSPredicate versus NSString: Which is better/faster for finding superstrings? QUESTION: I have a large number of strings that I'm searching to see if a given substring exists. It seems there are two reasonable ways to do this. Option 1: Use the NSString method rangeOfSubstring and test whether.location exists: ...
[ "iphone", "objective-c", "ios", "nsstring", "nspredicate" ]
4
18
3,290
2
0
2011-06-01T02:06:13.550000
2011-06-01T06:46:00.237000
6,195,523
6,197,246
Play framework job queue
How does play handle asynchronous jobs when they are called using the now() method? Are they executed immediately, or are they stored in a queue and processed by a fixed number of threads? What sort of control do we have over that?
When you call now(), your job is put into a ScheduledThreadPoolExecutor via submit(). Since the executor uses a fixed-size pool, your job may end up being queued. Also, the pool is shared with your scheduled jobs, so you may have contention with them in addition to any jobs you spawned on demand. You can adjust the siz...
Play framework job queue How does play handle asynchronous jobs when they are called using the now() method? Are they executed immediately, or are they stored in a queue and processed by a fixed number of threads? What sort of control do we have over that?
TITLE: Play framework job queue QUESTION: How does play handle asynchronous jobs when they are called using the now() method? Are they executed immediately, or are they stored in a queue and processed by a fixed number of threads? What sort of control do we have over that? ANSWER: When you call now(), your job is put...
[ "asynchronous", "queue", "playframework" ]
6
6
2,714
1
0
2011-06-01T02:07:19.013000
2011-06-01T06:42:45.430000
6,195,524
6,195,919
Memory Leak on device when using mutableCopy
I thought that I was really close to release this new App of mine when I ran into a dead end. My code works without memory leaks in the simulator (Xcode 4.0.2) but reports memory leaks on my devices. I think my issue is related to that I copy an object, because in my troubleshooting attempts I tried without a copy, and...
Thanks for fast replies and suggestions. You got me on the right track. The cityToAdd that I added to my array was added several times in a loop, but I kept the alloc and init outside of the loop. Once I moved it inside the loop it works in both simulator and device. Weird that the simulator don't report that memory le...
Memory Leak on device when using mutableCopy I thought that I was really close to release this new App of mine when I ran into a dead end. My code works without memory leaks in the simulator (Xcode 4.0.2) but reports memory leaks on my devices. I think my issue is related to that I copy an object, because in my trouble...
TITLE: Memory Leak on device when using mutableCopy QUESTION: I thought that I was really close to release this new App of mine when I ran into a dead end. My code works without memory leaks in the simulator (Xcode 4.0.2) but reports memory leaks on my devices. I think my issue is related to that I copy an object, bec...
[ "iphone", "xcode", "memory-leaks", "nsmutablearray", "nscopying" ]
0
0
514
3
0
2011-06-01T02:07:30.850000
2011-06-01T03:21:21.470000
6,195,530
6,195,623
What would a good approach be for file storage and retrieval?
I am working on rewriting a Java web application to Rails which relies heavily on collections (100's or 1000's) of large (50-100MB) TIFF files. In the Java version, the user specifies a local root path (such as a mounted SAN drive) for these files in the application configuration, and they are read by the application u...
I would look into storing the files with paperclip or carrierwave. They are two great file upload and management gems that allow you to store your files in many different ways. I have included links to two great sceencasts above and here are the github pages for paperclip and carrierwave.
What would a good approach be for file storage and retrieval? I am working on rewriting a Java web application to Rails which relies heavily on collections (100's or 1000's) of large (50-100MB) TIFF files. In the Java version, the user specifies a local root path (such as a mounted SAN drive) for these files in the app...
TITLE: What would a good approach be for file storage and retrieval? QUESTION: I am working on rewriting a Java web application to Rails which relies heavily on collections (100's or 1000's) of large (50-100MB) TIFF files. In the Java version, the user specifies a local root path (such as a mounted SAN drive) for thes...
[ "java", "ruby-on-rails", "file", "storage" ]
0
1
161
1
0
2011-06-01T02:09:40.990000
2011-06-01T02:30:52.193000
6,195,532
6,196,015
Drawing anywhere on screen in Mac OS X / Objective C
I'm trying to create a little utility that will draw an arbitrary shape on the screen below the mouse pointer (basically like drawing a line that follows the cursor). This could be anywhere on the screen not in a specific window. My problem is that I can't figure out how to draw on the "screen". Is there a layer or a v...
Create a transparent overlay window over the area where you want to draw (this could be the whole screen or screens). Set the window level so it appears below the cursor. Apple has some sample code which may help.
Drawing anywhere on screen in Mac OS X / Objective C I'm trying to create a little utility that will draw an arbitrary shape on the screen below the mouse pointer (basically like drawing a line that follows the cursor). This could be anywhere on the screen not in a specific window. My problem is that I can't figure out...
TITLE: Drawing anywhere on screen in Mac OS X / Objective C QUESTION: I'm trying to create a little utility that will draw an arbitrary shape on the screen below the mouse pointer (basically like drawing a line that follows the cursor). This could be anywhere on the screen not in a specific window. My problem is that ...
[ "objective-c", "macos", "view", "mouse", "screen" ]
7
9
3,901
1
0
2011-06-01T02:09:53.227000
2011-06-01T03:39:59.023000
6,195,534
6,198,448
Unable to use editRow with jqgrid
The line grid.editRow(id, true); - is giving error. uncaught TypeError: Object # has no method 'editRow' How can this be fixed?...
You haven't posted the whole HTML code which you use, so I'll have to guess. The most common reason for the problem which you describe could be one of these two: You included code like $.jgrid.no_legacy_api = true; before jquery.jqGrid.min.js. So only "new API" can be used. In other words you should replace the code gr...
Unable to use editRow with jqgrid The line grid.editRow(id, true); - is giving error. uncaught TypeError: Object # has no method 'editRow' How can this be fixed?...
TITLE: Unable to use editRow with jqgrid QUESTION: The line grid.editRow(id, true); - is giving error. uncaught TypeError: Object # has no method 'editRow' How can this be fixed?... ANSWER: You haven't posted the whole HTML code which you use, so I'll have to guess. The most common reason for the problem which you de...
[ "jquery", "jqgrid" ]
0
5
5,701
1
0
2011-06-01T02:10:03.083000
2011-06-01T08:42:37.280000
6,195,537
6,195,714
Why is there no flash video player that holds on to *all* cached data blocks (even if the user skips forwards and back)?
Is this fundamentally not possible on the flash platform?
I don't like to say "impossible" when it comes to programming as there are always solutions, it's just whether or not the solutions are worthwhile. The cached blocks are generated server-side, and are sent to Flash as independently generated FLV files. Each time the user seeks to a spot that is outside the loaded parts...
Why is there no flash video player that holds on to *all* cached data blocks (even if the user skips forwards and back)? Is this fundamentally not possible on the flash platform?
TITLE: Why is there no flash video player that holds on to *all* cached data blocks (even if the user skips forwards and back)? QUESTION: Is this fundamentally not possible on the flash platform? ANSWER: I don't like to say "impossible" when it comes to programming as there are always solutions, it's just whether or ...
[ "flash" ]
0
1
54
1
0
2011-06-01T02:10:40.177000
2011-06-01T02:46:20.363000
6,195,541
6,195,564
How to improve this TCP code?
There are times that the recByte will fail to receive response even though the server did reply because the server wasn't fast enough. Which if happened I use catch (System.IO.IOException ioe) to prevent the error, but are there possible alternatives that allow the client to wait a bit longer? I did try clientStream.Re...
You need to increase timeout for the tcpClient, not for the stream. Also, probably want to increase timeout for both send and receive, and probably to more than just 2 sec. var client = new TcpClient { SendTimeout = 10000, ReceiveTimeout = 10000 }; I believe if you look at inner exception in IOException, you will see S...
How to improve this TCP code? There are times that the recByte will fail to receive response even though the server did reply because the server wasn't fast enough. Which if happened I use catch (System.IO.IOException ioe) to prevent the error, but are there possible alternatives that allow the client to wait a bit lon...
TITLE: How to improve this TCP code? QUESTION: There are times that the recByte will fail to receive response even though the server did reply because the server wasn't fast enough. Which if happened I use catch (System.IO.IOException ioe) to prevent the error, but are there possible alternatives that allow the client...
[ "c#", ".net", "sockets", "tcpclient" ]
1
1
1,213
3
0
2011-06-01T02:12:20.543000
2011-06-01T02:18:49.217000
6,195,545
6,196,603
Showing a DevExpress AspxPopUpControl when user clicks a button
I have added a aspxpopupcontrol to my website. I want to show this pop when a user clicks a button. I don't know how to invoke the controller. How can this be done?
There are two ways to show the ASPxPopupControl - using the server side and client side code. To show the ASPxPopupControl from the server code, set the ASPxPopupControl.ShowOnPageLoad property to true. To invoke the ASPxPopupControl from a client side code, call the ASPxPopupControl's Show method. The How to show the ...
Showing a DevExpress AspxPopUpControl when user clicks a button I have added a aspxpopupcontrol to my website. I want to show this pop when a user clicks a button. I don't know how to invoke the controller. How can this be done?
TITLE: Showing a DevExpress AspxPopUpControl when user clicks a button QUESTION: I have added a aspxpopupcontrol to my website. I want to show this pop when a user clicks a button. I don't know how to invoke the controller. How can this be done? ANSWER: There are two ways to show the ASPxPopupControl - using the serv...
[ "asp.net", "devexpress" ]
2
5
18,055
1
0
2011-06-01T02:12:59.130000
2011-06-01T05:16:07.517000
6,195,549
6,195,558
References to methods C#
I'm just wondering if there is a C# equivilent for this python code. I want to store the names of methods in some sort of collection and call them later on. I have searched, but I really don't know what to look for. For example in python I could do: def add_one(x): return x + 1 def double_it(x): return x*2 maths_rules...
Yes, you can use delegates. For this one use Func. like: int addone(int x) { return x + 1; } and in main: Func myFunc = new Func (addone); myFunc(5); // to use it, you can pass it as you like example on your code: static int add_one(int x) { return x + 1; } static int double_it(int x) { return x * 2; } static int do_ma...
References to methods C# I'm just wondering if there is a C# equivilent for this python code. I want to store the names of methods in some sort of collection and call them later on. I have searched, but I really don't know what to look for. For example in python I could do: def add_one(x): return x + 1 def double_it(x)...
TITLE: References to methods C# QUESTION: I'm just wondering if there is a C# equivilent for this python code. I want to store the names of methods in some sort of collection and call them later on. I have searched, but I really don't know what to look for. For example in python I could do: def add_one(x): return x + ...
[ "c#", "python", "functional-programming" ]
3
4
133
2
0
2011-06-01T02:13:31.417000
2011-06-01T02:16:44.270000
6,195,550
6,195,636
How to force download of big files without using too much memory?
I'm trying to serve large zip files to users. When there are 2 concurrent connections, the server runs out of memory (RAM). I increased the amount of memory from 300MB to 4GB (Dreamhost VPS) and then it worked fine. I need to allow a lot more than 2 concurrent connections. The actual 4GB would allow something like 20 c...
There are some ideas over in this thread. I don't know if the readfile() method will save memory, but it sounds promising.
How to force download of big files without using too much memory? I'm trying to serve large zip files to users. When there are 2 concurrent connections, the server runs out of memory (RAM). I increased the amount of memory from 300MB to 4GB (Dreamhost VPS) and then it worked fine. I need to allow a lot more than 2 conc...
TITLE: How to force download of big files without using too much memory? QUESTION: I'm trying to serve large zip files to users. When there are 2 concurrent connections, the server runs out of memory (RAM). I increased the amount of memory from 300MB to 4GB (Dreamhost VPS) and then it worked fine. I need to allow a lo...
[ "php", "apache", "codeigniter", "memory-management", "force-download" ]
9
3
15,450
6
0
2011-06-01T02:13:37.650000
2011-06-01T02:33:06.233000
6,195,553
6,195,570
Android - Using Handlers?
Is there any problem with using multiple Handlers in the same Activity. I noticed that in all samples provided in android official website they use a single handler and detect different actions depending on the value of "what", is this because of memory management, and high amount of memory used by the Handler? Or shou...
No there isn't such a limit (a Handler is just a message receiver), but if you want to do such a thing the more common approach is to have one Handler that you post Runnable objects to.
Android - Using Handlers? Is there any problem with using multiple Handlers in the same Activity. I noticed that in all samples provided in android official website they use a single handler and detect different actions depending on the value of "what", is this because of memory management, and high amount of memory us...
TITLE: Android - Using Handlers? QUESTION: Is there any problem with using multiple Handlers in the same Activity. I noticed that in all samples provided in android official website they use a single handler and detect different actions depending on the value of "what", is this because of memory management, and high a...
[ "android", "memory", "memory-management", "android-activity", "handler" ]
7
9
2,758
2
0
2011-06-01T02:14:01.570000
2011-06-01T02:20:32.180000
6,195,575
6,195,771
Python ctypes calling reboot() from libc on Linux
I'm trying to call the reboot function from libc in Python via ctypes and I just can not get it to work. I've been referencing the man 2 reboot page ( http://linux.die.net/man/2/reboot ). My kernel version is 2.6.35. Below is the console log from the interactive Python prompt where I'm trying to get my machine to reboo...
Try: >>> libc = CDLL('libc.so.6', use_errno=True) That should allow get_errno() to work. [update] Also, the last argument is a void *. If this is a 64-bit system, then the integer 0 is not a valid repesentation for NULL. I would try None or maybe c_void_p(None). (Not sure how that could matter in this context, though.)...
Python ctypes calling reboot() from libc on Linux I'm trying to call the reboot function from libc in Python via ctypes and I just can not get it to work. I've been referencing the man 2 reboot page ( http://linux.die.net/man/2/reboot ). My kernel version is 2.6.35. Below is the console log from the interactive Python ...
TITLE: Python ctypes calling reboot() from libc on Linux QUESTION: I'm trying to call the reboot function from libc in Python via ctypes and I just can not get it to work. I've been referencing the man 2 reboot page ( http://linux.die.net/man/2/reboot ). My kernel version is 2.6.35. Below is the console log from the i...
[ "python", "c", "linux", "ctypes", "libc" ]
5
4
1,763
2
0
2011-06-01T02:21:32.310000
2011-06-01T02:53:26.903000
6,195,580
6,195,705
How can I make professional looking animations?
I'm looking to make professional animations easily for a service I have. I'm wondering if it can be something like this: http://www.youtube.com/watch?v=0QRO3gKj3qw. Can this be done easily?
For free, look at tools like LiveSwif or Pencil. For paid, Adobe Flash is the benchmark. If you're a student, you can get Flash for under $200 from the Adobe Education Store
How can I make professional looking animations? I'm looking to make professional animations easily for a service I have. I'm wondering if it can be something like this: http://www.youtube.com/watch?v=0QRO3gKj3qw. Can this be done easily?
TITLE: How can I make professional looking animations? QUESTION: I'm looking to make professional animations easily for a service I have. I'm wondering if it can be something like this: http://www.youtube.com/watch?v=0QRO3gKj3qw. Can this be done easily? ANSWER: For free, look at tools like LiveSwif or Pencil. For pa...
[ "video", "animation", "2d" ]
1
0
2,180
2
0
2011-06-01T02:22:50.917000
2011-06-01T02:44:45.250000
6,195,581
6,196,472
Latency between different sounds in iPhone application
I’m trying to make a small iPhone application with some buttons to play WAV sounds. My buttons works, but I have a small latency (~ 0,5 sec). This is my.m file: #import "buttonSoundViewController.h" @implementation buttonSoundViewController //@synthesize player; -(IBAction) playSoundA:(id)sender{ NSString *path = [[N...
Using AudioServices is indeed much quicker for small sounds (less than 30 seconds). The required code isn't very long either (but it requires some good old C). #import SystemSoundID soundID = 0; NSString* str = [[NSBundle mainBundle] pathForResource:fileName ofType:nil]; CFURLRef soundFileURL = (CFURLRef)[NSURL URLWith...
Latency between different sounds in iPhone application I’m trying to make a small iPhone application with some buttons to play WAV sounds. My buttons works, but I have a small latency (~ 0,5 sec). This is my.m file: #import "buttonSoundViewController.h" @implementation buttonSoundViewController //@synthesize player; ...
TITLE: Latency between different sounds in iPhone application QUESTION: I’m trying to make a small iPhone application with some buttons to play WAV sounds. My buttons works, but I have a small latency (~ 0,5 sec). This is my.m file: #import "buttonSoundViewController.h" @implementation buttonSoundViewController //@sy...
[ "iphone", "objective-c", "cocoa-touch", "audio", "latency" ]
3
6
2,716
5
0
2011-06-01T02:23:01.553000
2011-06-01T04:58:09.097000
6,195,589
6,195,630
Algorithm optimization
Say you wanted to find which input causes function x to output value y, and you know the (finite) range of possible inputs. The input and output are both numbers, and positively correlated. What would be the best way to optimize that? I'm currently just looping through all of the possible inputs. Thanks.
One solution would be a binary search over the possible inputs. Flow: find the median input x get the output from function(x) if the output is less than the desired y start over using the smaller half of the possible inputs else start over using the larger half of the possible inputs
Algorithm optimization Say you wanted to find which input causes function x to output value y, and you know the (finite) range of possible inputs. The input and output are both numbers, and positively correlated. What would be the best way to optimize that? I'm currently just looping through all of the possible inputs....
TITLE: Algorithm optimization QUESTION: Say you wanted to find which input causes function x to output value y, and you know the (finite) range of possible inputs. The input and output are both numbers, and positively correlated. What would be the best way to optimize that? I'm currently just looping through all of th...
[ "algorithm", "optimization" ]
1
1
184
4
0
2011-06-01T02:25:21.290000
2011-06-01T02:31:28.873000
6,195,590
6,195,697
Combining jQuery Validate and ajax form submission
I have a simple form like Hello! Send My JS is as follows to submit the form via Ajax: $('#send_btn').live('click', function(event){ event.preventDefault(); var form = $('#invite_form'); $.ajax({ url: '/invite', type: "POST", data: form.serialize(), dataType: "html", success: function(html) { $('#send_div').html('Suc...
Try this: $('#send_btn').live('click', function(event){ event.preventDefault(); var form = $('#invite_form'); if(form.valid()) { $.ajax({ url: '/invite', type: "POST", data: form.serialize(), dataType: "html", success: function(html) { $('#send_div').html('Success!'); } }); else {; //do whatever if the form is not val...
Combining jQuery Validate and ajax form submission I have a simple form like Hello! Send My JS is as follows to submit the form via Ajax: $('#send_btn').live('click', function(event){ event.preventDefault(); var form = $('#invite_form'); $.ajax({ url: '/invite', type: "POST", data: form.serialize(), dataType: "html",...
TITLE: Combining jQuery Validate and ajax form submission QUESTION: I have a simple form like Hello! Send My JS is as follows to submit the form via Ajax: $('#send_btn').live('click', function(event){ event.preventDefault(); var form = $('#invite_form'); $.ajax({ url: '/invite', type: "POST", data: form.serialize(),...
[ "javascript", "validation", "jquery" ]
0
3
606
1
0
2011-06-01T02:26:11.023000
2011-06-01T02:43:11.227000
6,195,609
6,195,764
Converting ARBG to RGB with alpha blending with a White Background
I have a color hex string stored in the database like 0x78dce6b0; I can convert this to an ARGB color using: string colorString=0x78dce6b0; int hexColor = Convert.ToInt32(colorString?? "0", 16); Color colorTL = Color.FromArgb(hexColor); Now I want to convert this to use in an HTML page, so I need to convert into an HTM...
HTML Colors do not have an Alpha component. Unfortunately it is impossible to convert ARGB to HTML RGB without losing the Alpha component. If you want to blend your color with white, based upon your alpha value... Convert each Hex component (A, R, G, B) into a value from 0 to 255, where a value of FF equates to 255, 00...
Converting ARBG to RGB with alpha blending with a White Background I have a color hex string stored in the database like 0x78dce6b0; I can convert this to an ARGB color using: string colorString=0x78dce6b0; int hexColor = Convert.ToInt32(colorString?? "0", 16); Color colorTL = Color.FromArgb(hexColor); Now I want to co...
TITLE: Converting ARBG to RGB with alpha blending with a White Background QUESTION: I have a color hex string stored in the database like 0x78dce6b0; I can convert this to an ARGB color using: string colorString=0x78dce6b0; int hexColor = Convert.ToInt32(colorString?? "0", 16); Color colorTL = Color.FromArgb(hexColor)...
[ "c#", "rgb", "alphablending", "argb" ]
3
6
6,877
3
0
2011-06-01T02:28:51.693000
2011-06-01T02:52:19.270000
6,195,613
6,200,190
delete link is going to show link in rails 3 app
<% for available_times in @available_times %> <%= link_to "Show", available_times %> <%= link_to "Edit", edit_available_times_path(available_times) %> <%= link_to "Destroy", available_times,:confirm => 'Are you sure?',:method =>:delete %> <% end %> routes.rb resources:available_times javascripts included
You are missing the include of rails.js. That file either implements the Prototype or Jquery behaviour you need. Since you are using jquery-ui (not jquery?), the best way to install all the jquery file, is using the jquery-rails gem, and running the generator: rails g jquery:install and then include the rails.js file. ...
delete link is going to show link in rails 3 app <% for available_times in @available_times %> <%= link_to "Show", available_times %> <%= link_to "Edit", edit_available_times_path(available_times) %> <%= link_to "Destroy", available_times,:confirm => 'Are you sure?',:method =>:delete %> <% end %> routes.rb resources:av...
TITLE: delete link is going to show link in rails 3 app QUESTION: <% for available_times in @available_times %> <%= link_to "Show", available_times %> <%= link_to "Edit", edit_available_times_path(available_times) %> <%= link_to "Destroy", available_times,:confirm => 'Are you sure?',:method =>:delete %> <% end %> rout...
[ "ruby-on-rails", "ruby-on-rails-3", "routes" ]
0
0
259
2
0
2011-06-01T02:29:12.823000
2011-06-01T11:09:31.860000
6,195,615
6,195,639
Get contents of <body> </body> within a string
I want to do the following. $("a").click(function (event) { event.preventDefault(); $.get($(this).attr("href"), function(data) { $("html").html(data); }); }); I want the behavior of all hyperlinks to make a ajax calls and retrieve the html. Unfortunately you cannot simply replace the current html with the html you...
If I understand you correctly, grab the content between the body tags with a regex. $.get($(this).attr("href"), function(data) { var body=data.replace(/^.*? (.*?)<\/body>.*?$/s,"$1"); $("body").html(body); }); EDIT Based on your comments below, here's an update to match any body tag, irrespective of its attributes: $....
Get contents of <body> </body> within a string I want to do the following. $("a").click(function (event) { event.preventDefault(); $.get($(this).attr("href"), function(data) { $("html").html(data); }); }); I want the behavior of all hyperlinks to make a ajax calls and retrieve the html. Unfortunately you cannot si...
TITLE: Get contents of <body> </body> within a string QUESTION: I want to do the following. $("a").click(function (event) { event.preventDefault(); $.get($(this).attr("href"), function(data) { $("html").html(data); }); }); I want the behavior of all hyperlinks to make a ajax calls and retrieve the html. Unfortuna...
[ "jquery", "html", "ajax" ]
5
12
22,913
3
0
2011-06-01T02:29:44.007000
2011-06-01T02:33:55.937000
6,195,626
6,195,673
Joining on deletion
I'm working with mysql: btableA has tableB_id column tableB has some_interestring_column_on_TableB I want (pseudo sql below): delete from tableA where the associated row in tableB (via tableB_id) has some_interestring_column_on_TableB = 'interestingValue' Please help me to translate the pseudo sql into real sql.
MySQL supports JOINs in the DELETE statement, as well as deleting from multiple tables in a single statement. The following will only delete from TABLEA: DELETE ta FROM TABLEA ta JOIN TABLEB tb ON b.id = a.tableb_id AND b.col = 'some value' If you wanted to delete from both tables, use: DELETE ta, tb FROM TABLEA ta JOI...
Joining on deletion I'm working with mysql: btableA has tableB_id column tableB has some_interestring_column_on_TableB I want (pseudo sql below): delete from tableA where the associated row in tableB (via tableB_id) has some_interestring_column_on_TableB = 'interestingValue' Please help me to translate the pseudo sql i...
TITLE: Joining on deletion QUESTION: I'm working with mysql: btableA has tableB_id column tableB has some_interestring_column_on_TableB I want (pseudo sql below): delete from tableA where the associated row in tableB (via tableB_id) has some_interestring_column_on_TableB = 'interestingValue' Please help me to translat...
[ "mysql", "sql", "sql-delete" ]
0
2
42
3
0
2011-06-01T02:31:07.827000
2011-06-01T02:39:28.917000
6,195,633
6,195,735
Matching arbitrary url to controller
Hi everyone I am trying to do configure routes.rb to allow me to do the following mapping: /links/quick/"arbitrary comment"/"http://www.arbitrary-site.com/test?a=1" to links#quick (LinksController.quick)? I came from django and is used to using regex to do this kind of mapping. Does rails have something equivalent? htt...
if you want to have a route and pass in additional parameters then usually you would use a syntax like: match '/links/quick/:comment/:url/test' => controller The parameters denoted with a colon are called segment keys and they will accept whatever value you put in them. You then can access these segment keys in your co...
Matching arbitrary url to controller Hi everyone I am trying to do configure routes.rb to allow me to do the following mapping: /links/quick/"arbitrary comment"/"http://www.arbitrary-site.com/test?a=1" to links#quick (LinksController.quick)? I came from django and is used to using regex to do this kind of mapping. Does...
TITLE: Matching arbitrary url to controller QUESTION: Hi everyone I am trying to do configure routes.rb to allow me to do the following mapping: /links/quick/"arbitrary comment"/"http://www.arbitrary-site.com/test?a=1" to links#quick (LinksController.quick)? I came from django and is used to using regex to do this kin...
[ "ruby-on-rails" ]
0
0
160
1
0
2011-06-01T02:32:37.700000
2011-06-01T02:48:07.823000
6,195,635
6,195,675
&& is breaking the page in WordPress
I added this to my WordPress page if (script.readyState && script.onload!==null){ script.onreadystatechange= function () { if (this.readyState == 'complete') mce_preload_check(); } } and the && is being turned to if (script.readyState && script.onload!==null){ I pasted this in WordPress HTML view and I made sure this w...
You need to disable WP's autoformatting. WP will auto format even in the html editor, and the spaces and line breaks will break your javascript. Use this plugin http://wordpress.org/extend/plugins/wp-no-format/ Update 4/08/2015: plugin is dated but still works for me. This also works: add the plugin directly to functio...
&& is breaking the page in WordPress I added this to my WordPress page if (script.readyState && script.onload!==null){ script.onreadystatechange= function () { if (this.readyState == 'complete') mce_preload_check(); } } and the && is being turned to if (script.readyState && script.onload!==null){ I pasted this in WordP...
TITLE: && is breaking the page in WordPress QUESTION: I added this to my WordPress page if (script.readyState && script.onload!==null){ script.onreadystatechange= function () { if (this.readyState == 'complete') mce_preload_check(); } } and the && is being turned to if (script.readyState && script.onload!==null){ I pa...
[ "javascript", "html", "wordpress" ]
3
9
2,589
4
0
2011-06-01T02:32:58.483000
2011-06-01T02:39:37.607000
6,195,640
6,196,204
xpath not return values
I am able to pull the necessary information using xpath, when I use var_dump using the following code. When I try to add a foreach loop to return all ["href"] values i get a blank page any ideas where I am messing up? $dom = new DOMDocument(); @$dom->loadHTML($source); $xml = simplexml_import_dom($dom); $rss = $xml->xp...
Instead of: $rss = $xml->xpath("/html/body//a[@class='highzoom1']"); use: $hrefs = $xml->xpath("/html/body//a[@class='highzoom1']/@href"); The original XPath expression (the first above) you are using selects any a element in the XML document the value of whose class atribute is 'highzoom1' and that (the a element) is ...
xpath not return values I am able to pull the necessary information using xpath, when I use var_dump using the following code. When I try to add a foreach loop to return all ["href"] values i get a blank page any ideas where I am messing up? $dom = new DOMDocument(); @$dom->loadHTML($source); $xml = simplexml_import_do...
TITLE: xpath not return values QUESTION: I am able to pull the necessary information using xpath, when I use var_dump using the following code. When I try to add a foreach loop to return all ["href"] values i get a blank page any ideas where I am messing up? $dom = new DOMDocument(); @$dom->loadHTML($source); $xml = s...
[ "php", "xpath", "foreach", "simplexml" ]
1
0
824
2
0
2011-06-01T02:33:58.403000
2011-06-01T04:15:40.203000
6,195,647
6,197,897
PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade?
Assuming that we have millions of requests per day. Is the HTML processing in Node.js with Jade slower or faster than PHP's render engine? Or doesn't matter because the difference is really small? I'm using Node.js with the Jade template engine, I really like it. But I was always the guy who worried about performance. ...
Jade isn't designed for speed, it's designed for elegance. If you're really concerned with speed there are other javascript rendering engines that are faster. Check out http://jsperf.com/dom-vs-innerhtml-based-templating/63 (note that the chrome results match closely to node.js performance) But that's all assuming the ...
PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade? Assuming that we have millions of requests per day. Is the HTML processing in Node.js with Jade slower or faster than PHP's render engine? Or doesn't matter because the difference is really small? I'm using Node.js with the Jade template engine, I really l...
TITLE: PHP vs Node.js - Is HTML Rendering slower in Node.js with Jade? QUESTION: Assuming that we have millions of requests per day. Is the HTML processing in Node.js with Jade slower or faster than PHP's render engine? Or doesn't matter because the difference is really small? I'm using Node.js with the Jade template ...
[ "php", "html", "node.js", "rendering", "pug" ]
10
5
6,988
4
0
2011-06-01T02:35:07.903000
2011-06-01T07:50:57.970000
6,195,648
6,195,664
How to get the value of an xml sub element using DOMDocument methods?
I am new to PHP and XML. Can somebody tell me how can I get the values of a sub element or child node of a an xml element? index.php $domdoc = new DOMDocument(); $domdoc->load('actionstars.xml'); foreach ($domdoc->getElementsByTagName("actionstar") as $star) { echo $star->item(0)->nodeValue; // displays the element ec...
If you can guarantee their order, you can use childNodes and the offset, otherwise... $domdoc = new DOMDocument(); $domdoc->load('actionstars.xml'); foreach ($domdoc->getElementsByTagName("actionstar") as $star) { echo $shit->getElementsByTagName('id')->item(0)->nodeValue; // displays the element echo $shit->getElemen...
How to get the value of an xml sub element using DOMDocument methods? I am new to PHP and XML. Can somebody tell me how can I get the values of a sub element or child node of a an xml element? index.php $domdoc = new DOMDocument(); $domdoc->load('actionstars.xml'); foreach ($domdoc->getElementsByTagName("actionstar") ...
TITLE: How to get the value of an xml sub element using DOMDocument methods? QUESTION: I am new to PHP and XML. Can somebody tell me how can I get the values of a sub element or child node of a an xml element? index.php $domdoc = new DOMDocument(); $domdoc->load('actionstars.xml'); foreach ($domdoc->getElementsByTagN...
[ "php", "xml" ]
0
3
460
1
0
2011-06-01T02:35:09.577000
2011-06-01T02:38:22.740000
6,195,649
6,195,905
How do runtime loadable kernel modules know the addresses of core kernel functions?
I would be interested in answers for both Linux and NT (or any other for that matter) Edit: Thanks Laurion for the answer. More information here: http://www.symantec.com/connect/articles/dynamic-linking-linux-and-windows-part-one http://www.symantec.com/connect/articles/dynamic-linking-linux-and-windows-part-two
The runtime loader normally fixes up references to imported functions when the module is loaded. It looks at the table of imported functions and puts in the proper address. The module uses the imported functions through an indirection table.
How do runtime loadable kernel modules know the addresses of core kernel functions? I would be interested in answers for both Linux and NT (or any other for that matter) Edit: Thanks Laurion for the answer. More information here: http://www.symantec.com/connect/articles/dynamic-linking-linux-and-windows-part-one http:/...
TITLE: How do runtime loadable kernel modules know the addresses of core kernel functions? QUESTION: I would be interested in answers for both Linux and NT (or any other for that matter) Edit: Thanks Laurion for the answer. More information here: http://www.symantec.com/connect/articles/dynamic-linking-linux-and-windo...
[ "c", "linux-kernel", "kernel" ]
1
3
250
2
0
2011-06-01T02:35:27.793000
2011-06-01T03:18:56.480000
6,195,654
6,195,679
Java: Text not wrapping in JFrame dialog
I'm using a JFrame to present a message box with some text and 2 buttons. How do I get the text to wrap automatically based on the size of the box? Here's my current code: dialogFrame = new JFrame(); JButton newButton = new JButton("New"); newButton.addActionListener(new newUploadAction()); JButton resumeButton = new...
You could place the text in a JTextArea and call setLineWrap(true) and setWrapStyleWord(true) on the JTextArea. If you want it to look more JLabel-ish, then just change the color settings of the JTextArea to your liking. EDIT 1 Also another thing that could work: consider having the holding JPanel use a BorderLayout: J...
Java: Text not wrapping in JFrame dialog I'm using a JFrame to present a message box with some text and 2 buttons. How do I get the text to wrap automatically based on the size of the box? Here's my current code: dialogFrame = new JFrame(); JButton newButton = new JButton("New"); newButton.addActionListener(new newUpl...
TITLE: Java: Text not wrapping in JFrame dialog QUESTION: I'm using a JFrame to present a message box with some text and 2 buttons. How do I get the text to wrap automatically based on the size of the box? Here's my current code: dialogFrame = new JFrame(); JButton newButton = new JButton("New"); newButton.addActionL...
[ "java", "swing", "jframe" ]
0
3
3,024
1
0
2011-06-01T02:36:21.290000
2011-06-01T02:40:33.253000
6,195,660
6,195,728
How do I know if my js/CSS files is too huge?
What is the optimal filesize of a JavaScript and CSS files of a websites?
Zero bytes. It sounds facetious, but there's no such thing as an "optimal" file size. The bigger it is, the longer it will take your page to render. How fast is the connection to your web site for your visitors? If it's a video-oriented site, for example, it's probably relatively fast since people with 64 kbps modems a...
How do I know if my js/CSS files is too huge? What is the optimal filesize of a JavaScript and CSS files of a websites?
TITLE: How do I know if my js/CSS files is too huge? QUESTION: What is the optimal filesize of a JavaScript and CSS files of a websites? ANSWER: Zero bytes. It sounds facetious, but there's no such thing as an "optimal" file size. The bigger it is, the longer it will take your page to render. How fast is the connecti...
[ "javascript", "css", "file", "browser" ]
14
28
23,967
5
0
2011-06-01T02:37:56.863000
2011-06-01T02:47:25.267000
6,195,661
6,195,762
When to use nested classes and classes nested in modules?
I'm pretty familiar with when to use subclasses and modules, but more recently I've been seeing nested classes like this: class Foo class Bar # do some useful things end end As well as classes nested in modules like so: module Baz class Quux # more code end end Either documentation and articles are sparse or I'm not ed...
Other OOP languages have inner classes which cannot be instantiated without being bound to an upper level class. For instance, in Java, class Car { class Wheel { } } only methods in the Car class can create Wheel s. Ruby doesn’t have that behaviour. In Ruby, class Car class Wheel end end differs from class Car end cla...
When to use nested classes and classes nested in modules? I'm pretty familiar with when to use subclasses and modules, but more recently I've been seeing nested classes like this: class Foo class Bar # do some useful things end end As well as classes nested in modules like so: module Baz class Quux # more code end end ...
TITLE: When to use nested classes and classes nested in modules? QUESTION: I'm pretty familiar with when to use subclasses and modules, but more recently I've been seeing nested classes like this: class Foo class Bar # do some useful things end end As well as classes nested in modules like so: module Baz class Quux # ...
[ "ruby", "oop" ]
179
164
92,680
5
0
2011-06-01T02:37:57.637000
2011-06-01T02:51:59.380000
6,195,672
6,195,821
Does Thread.Sleep hinder other threads?
Here is a console program want 10 threads start in batch, wait 5 seconds, and stop in batch. static void Main(string[] args) { System.Threading.Tasks.Parallel.For(0, 10, (index) => { Action act = (i) => { Console.Write("start {0} ", i); Thread.Sleep(5000); }; act.BeginInvoke(index, OnTaskComplete, index); }); Console...
This is by design. You are seeing the threadpool manager trying to keep a limited number of threads in the executing state. Important to ensure that your program isn't running more threads than your machine has cpu cores. That's inefficient, less work gets done when Windows is forced to start swapping the cores between...
Does Thread.Sleep hinder other threads? Here is a console program want 10 threads start in batch, wait 5 seconds, and stop in batch. static void Main(string[] args) { System.Threading.Tasks.Parallel.For(0, 10, (index) => { Action act = (i) => { Console.Write("start {0} ", i); Thread.Sleep(5000); }; act.BeginInvoke(ind...
TITLE: Does Thread.Sleep hinder other threads? QUESTION: Here is a console program want 10 threads start in batch, wait 5 seconds, and stop in batch. static void Main(string[] args) { System.Threading.Tasks.Parallel.For(0, 10, (index) => { Action act = (i) => { Console.Write("start {0} ", i); Thread.Sleep(5000); }; a...
[ "c#", "multithreading", "thread-sleep", "parallel.for" ]
10
13
6,995
3
0
2011-06-01T02:39:25.937000
2011-06-01T03:04:28.357000
6,195,682
6,195,832
JDBC statement fails to delete row in specific MySql table
I have a table, say example1 and I'm using a jdbc statement to delete one of its rows. I have tried various methods, from delete from example1 where id = 1 to statement.addbatch(sql) but it does not delete the row. If I execute the same sql statement in Toad for Mysql it's able to delete the row just fine. Weird thing ...
Turning on general logging on the database or profiling in the JDBC driver would show you what's actually going to the database: http://dev.mysql.com/doc/refman/5.0/en/connector-j-reference-configuration-properties.html Enable profiling of queries for Connector/J by adding this to your connection string: profileSQL=tru...
JDBC statement fails to delete row in specific MySql table I have a table, say example1 and I'm using a jdbc statement to delete one of its rows. I have tried various methods, from delete from example1 where id = 1 to statement.addbatch(sql) but it does not delete the row. If I execute the same sql statement in Toad fo...
TITLE: JDBC statement fails to delete row in specific MySql table QUESTION: I have a table, say example1 and I'm using a jdbc statement to delete one of its rows. I have tried various methods, from delete from example1 where id = 1 to statement.addbatch(sql) but it does not delete the row. If I execute the same sql st...
[ "java", "mysql", "jdbc", "sql-delete", "failover" ]
1
0
2,156
2
0
2011-06-01T02:40:44.830000
2011-06-01T03:07:03.960000
6,195,698
6,195,723
Class decorator with class methods
I have written a class decorator that monkey-patches a class overwriting the init and adding a method persist (). So far everything OK. Now I need to add a class method (static method) to the decorated class. What do I have to change in my code to make staticMethod() a static method of the decorated class? This is my c...
@staticmethod def staticMethod (): print "I am static" or def staticMethod (): print "I am static" cls.staticMethod = staticmethod(staticMethod)
Class decorator with class methods I have written a class decorator that monkey-patches a class overwriting the init and adding a method persist (). So far everything OK. Now I need to add a class method (static method) to the decorated class. What do I have to change in my code to make staticMethod() a static method o...
TITLE: Class decorator with class methods QUESTION: I have written a class decorator that monkey-patches a class overwriting the init and adding a method persist (). So far everything OK. Now I need to add a class method (static method) to the decorated class. What do I have to change in my code to make staticMethod()...
[ "python", "decorator" ]
2
3
733
2
0
2011-06-01T02:43:21.397000
2011-06-01T02:47:18.963000
6,195,700
6,195,712
How can i run a website locally developed using .NET
I've developed a website in.NET using Visual Studio 2008. I gave this website to my friend using USB pendrive. Now he wants to run that website locally on his PC in which Visual Studio is not installed. Please suggest me how can i run locally that website in my friend pc. Where should i save that website on his PC?
You can install.NET runtime, and host it in his local IIS. The requirement is that IIS has the website set up pointing to the appropriate folder. (For example, save the website in 'c:/inetpub/website name' and point IIS's website directory to that same folder. You will also need to make sure that IIS_USR has read acces...
How can i run a website locally developed using .NET I've developed a website in.NET using Visual Studio 2008. I gave this website to my friend using USB pendrive. Now he wants to run that website locally on his PC in which Visual Studio is not installed. Please suggest me how can i run locally that website in my frien...
TITLE: How can i run a website locally developed using .NET QUESTION: I've developed a website in.NET using Visual Studio 2008. I gave this website to my friend using USB pendrive. Now he wants to run that website locally on his PC in which Visual Studio is not installed. Please suggest me how can i run locally that w...
[ ".net", "iis", "web" ]
4
4
1,178
3
0
2011-06-01T02:43:32.753000
2011-06-01T02:46:06.823000
6,195,702
6,205,482
Working on a way to return the text of a button after the button is clicked in tkinter
I'm trying to create a list of buttons that are clicked with this lambda function: button1.config(command=(lambda x: (clicked.append(x)))(button1.cget("text"))) It seems to sort of work but it prints the button text immediately i.e. it doesn't wait for user to click the button. Any ideas on how to make it responsive to...
Trying to do all this in a lambda is the wrong approach. It's simply too confusing, if not impossible to do what you want. Instead, create a method that does the work, and use lambda only as a way to call that function: from Tkinter import * class GraphicsInterface: def __init__(self): self.window = Tk() self.window.g...
Working on a way to return the text of a button after the button is clicked in tkinter I'm trying to create a list of buttons that are clicked with this lambda function: button1.config(command=(lambda x: (clicked.append(x)))(button1.cget("text"))) It seems to sort of work but it prints the button text immediately i.e. ...
TITLE: Working on a way to return the text of a button after the button is clicked in tkinter QUESTION: I'm trying to create a list of buttons that are clicked with this lambda function: button1.config(command=(lambda x: (clicked.append(x)))(button1.cget("text"))) It seems to sort of work but it prints the button text...
[ "python", "button", "tkinter" ]
5
3
3,630
2
0
2011-06-01T02:43:53.940000
2011-06-01T17:47:03.520000
6,195,704
6,195,754
Can I use a column I have selected later in a query?
Imagine this query... SELECT `id`, `hits` + `other_hits` AS `total_hits` FROM `something` WHERE `hits` + `other_hits` > 30 As you can see, I've repeated the addition of hits and other_hits. Can I refer to total_hits column I created in other parts of the query? I tried it, and I got 1054: Unknown column in where clause...
Use: SELECT `id`, `hits` + `other_hits` AS `total_hits` FROM `something` HAVING `total_hits` > 30 The earliest MySQL allows references to column aliases is the GROUP BY clause; clauses after that support references ( HAVING, ORDER BY ). Most other databases don't support referencing a table alias before the ORDER BY, w...
Can I use a column I have selected later in a query? Imagine this query... SELECT `id`, `hits` + `other_hits` AS `total_hits` FROM `something` WHERE `hits` + `other_hits` > 30 As you can see, I've repeated the addition of hits and other_hits. Can I refer to total_hits column I created in other parts of the query? I tri...
TITLE: Can I use a column I have selected later in a query? QUESTION: Imagine this query... SELECT `id`, `hits` + `other_hits` AS `total_hits` FROM `something` WHERE `hits` + `other_hits` > 30 As you can see, I've repeated the addition of hits and other_hits. Can I refer to total_hits column I created in other parts o...
[ "mysql", "sql", "mysql-error-1054" ]
3
6
586
5
0
2011-06-01T02:44:01.380000
2011-06-01T02:51:22.973000
6,195,721
6,196,475
How to create a sas dataset with one variable where each value is increased by a constant step?
This would be a junior sas question. I have a lower bound, say, 1 and an upper bound, say, 10 and I want to create a dataset with a single variable, with 10 observations from 1 to 10, step at 1. How can I do this convinently in sas? Thanks for any help.
Is this what you're after?: data count; do i = 1 to 10; output; end; run;
How to create a sas dataset with one variable where each value is increased by a constant step? This would be a junior sas question. I have a lower bound, say, 1 and an upper bound, say, 10 and I want to create a dataset with a single variable, with 10 observations from 1 to 10, step at 1. How can I do this convinently...
TITLE: How to create a sas dataset with one variable where each value is increased by a constant step? QUESTION: This would be a junior sas question. I have a lower bound, say, 1 and an upper bound, say, 10 and I want to create a dataset with a single variable, with 10 observations from 1 to 10, step at 1. How can I d...
[ "sas" ]
6
8
8,890
2
0
2011-06-01T02:47:09.540000
2011-06-01T04:58:24.567000
6,195,726
6,195,866
How to know if there is no more pics to disable (nxt/prv) button
I have this code css: div#container{ overflow: hidden; width: 331px; } div#content { position:relative; } jquery: $("#left").click(function(){ $("#content").animate({"right": "+=328px"}, "slow"); }); $("#right").click(function(){ $("#content").animate({"right": "-=328px"}, "slow"); }); HTML: << >> Description1 Descri...
I don't like using tables for that... Divs make your code much more fluid, and would allow an elegant solution: is(':last-child') on active div But since you're doing it with table, I can think of two ways of doing this One is using a counter, then checking it against number of columns of table. If displaying more than...
How to know if there is no more pics to disable (nxt/prv) button I have this code css: div#container{ overflow: hidden; width: 331px; } div#content { position:relative; } jquery: $("#left").click(function(){ $("#content").animate({"right": "+=328px"}, "slow"); }); $("#right").click(function(){ $("#content").animate({...
TITLE: How to know if there is no more pics to disable (nxt/prv) button QUESTION: I have this code css: div#container{ overflow: hidden; width: 331px; } div#content { position:relative; } jquery: $("#left").click(function(){ $("#content").animate({"right": "+=328px"}, "slow"); }); $("#right").click(function(){ $("#c...
[ "jquery", "html", "image", "jquery-animate" ]
1
1
99
2
0
2011-06-01T02:47:22.500000
2011-06-01T03:12:37.717000
6,195,729
6,195,753
Most efficient way to prepend a value to an array
Assuming I have an array that has a size of N (where N > 0 ), is there a more efficient way of prepending to the array that would not require O(N + 1) steps? In code, essentially, what I currently am doing is function prependArray(value, oldArray) { var newArray = new Array(value); for(var i = 0; i < oldArray.length; ...
I'm not sure about more efficient in terms of big-O but certainly using the unshift method is more concise: var a = [1, 2, 3, 4]; a.unshift(0); // => [0, 1, 2, 3, 4] console.log({a}); [Edit] This jsPerf benchmark shows that unshift is decently faster in at least a couple of browsers, regardless of possibly different bi...
Most efficient way to prepend a value to an array Assuming I have an array that has a size of N (where N > 0 ), is there a more efficient way of prepending to the array that would not require O(N + 1) steps? In code, essentially, what I currently am doing is function prependArray(value, oldArray) { var newArray = new A...
TITLE: Most efficient way to prepend a value to an array QUESTION: Assuming I have an array that has a size of N (where N > 0 ), is there a more efficient way of prepending to the array that would not require O(N + 1) steps? In code, essentially, what I currently am doing is function prependArray(value, oldArray) { va...
[ "javascript", "arrays", "prepend" ]
363
594
266,206
11
0
2011-06-01T02:47:28.963000
2011-06-01T02:51:14.753000
6,195,733
6,215,322
deploying a database and application with ClickOnce
I am new to ClickOnce. I created a WinForms application using C# and SQL Server Express. Currently my database is located in the mssql data folder. My connection string is located in an app.config file. How do I include my database file for it to deploy with the application? To which folder will the database be deploye...
You have a couple of options. First, if this is a simple database I recommend that you forego using SQL Express and use SQL Server Compact. A Compact SQL database is a file that can be bundled with your application installation. Below is a link guiding you through the creation process of a SQL Compact database. http://...
deploying a database and application with ClickOnce I am new to ClickOnce. I created a WinForms application using C# and SQL Server Express. Currently my database is located in the mssql data folder. My connection string is located in an app.config file. How do I include my database file for it to deploy with the appli...
TITLE: deploying a database and application with ClickOnce QUESTION: I am new to ClickOnce. I created a WinForms application using C# and SQL Server Express. Currently my database is located in the mssql data folder. My connection string is located in an app.config file. How do I include my database file for it to dep...
[ "visual-studio-2010", "clickonce" ]
5
7
13,123
1
0
2011-06-01T02:47:50.523000
2011-06-02T13:41:28.873000
6,195,739
6,197,780
How to Test Core Data Migration With an App Already in the App Store?
We have an app that is currently in the app store. It uses Core Data as its persistence mechanism. We have a new version ready to go, and it has some schema changes. Specifically, we have added 1 new entity and added a new attribute to an existing entity. From my understanding and reading, this is one of the most simpl...
I've been using Core Data for my app and upgraded about 7 times, migrating from old models to new models. Whenever, I am prepared to release the next version, I always test migration by using Model Mapping. As long as I made every entity and attribute of source model is matched against corresponding entity and attribut...
How to Test Core Data Migration With an App Already in the App Store? We have an app that is currently in the app store. It uses Core Data as its persistence mechanism. We have a new version ready to go, and it has some schema changes. Specifically, we have added 1 new entity and added a new attribute to an existing en...
TITLE: How to Test Core Data Migration With an App Already in the App Store? QUESTION: We have an app that is currently in the app store. It uses Core Data as its persistence mechanism. We have a new version ready to go, and it has some schema changes. Specifically, we have added 1 new entity and added a new attribute...
[ "ios", "core-data", "core-data-migration" ]
12
5
3,929
2
0
2011-06-01T02:48:19.320000
2011-06-01T07:39:21.407000
6,195,745
6,196,460
Why do I get this thread error?
I have this code: import urllib2 import thread a = 0 def workers(): while 1: a+=1 silva = urllib2.urlopen('http://en.dilandau.eu/download_music/said-the-whale-'+str(a)+'.html') si = silva.read() if 'var playlist' not in si: print a break thread.start_new_thread(workers,()) while 1: print '---' but I get an error: ...
I ran a simpler version of your code and see a stack trace besides the Unhandled Exception message. It should help you to locate the problem. There are a few improvement you should consider. First of all there is a high level library threading that is recommended over thread. Secondly you are doing a busy wait with the...
Why do I get this thread error? I have this code: import urllib2 import thread a = 0 def workers(): while 1: a+=1 silva = urllib2.urlopen('http://en.dilandau.eu/download_music/said-the-whale-'+str(a)+'.html') si = silva.read() if 'var playlist' not in si: print a break thread.start_new_thread(workers,()) while 1: ...
TITLE: Why do I get this thread error? QUESTION: I have this code: import urllib2 import thread a = 0 def workers(): while 1: a+=1 silva = urllib2.urlopen('http://en.dilandau.eu/download_music/said-the-whale-'+str(a)+'.html') si = silva.read() if 'var playlist' not in si: print a break thread.start_new_thread(work...
[ "python", "urllib2" ]
0
2
143
3
0
2011-06-01T02:49:58.063000
2011-06-01T04:57:22.467000
6,195,749
6,201,267
Lazy loading non-HTML pages in HTML5 offline cache
The HTML5 Offline Web application spec gives an example of how to lazily load HTML pages into the cache: CACHE MANIFEST FALLBACK: / /offline.html NETWORK: * This is explained in Dive Into HTML5 with the example of Wikipedia: You certainly don't want to cache the entire of Wikipedia when the website loads, but you want ...
That's what Dive Into HTML5 said, but I couldn't find the manifest in Wikipedia. Wikipedia doesn't really work in this way. In my Chrome console, I couldn't find any application cache of Wikipedia. I think you can try this: When the user has finished downloading a music track, send this info to the server via AJAX. The...
Lazy loading non-HTML pages in HTML5 offline cache The HTML5 Offline Web application spec gives an example of how to lazily load HTML pages into the cache: CACHE MANIFEST FALLBACK: / /offline.html NETWORK: * This is explained in Dive Into HTML5 with the example of Wikipedia: You certainly don't want to cache the entire...
TITLE: Lazy loading non-HTML pages in HTML5 offline cache QUESTION: The HTML5 Offline Web application spec gives an example of how to lazily load HTML pages into the cache: CACHE MANIFEST FALLBACK: / /offline.html NETWORK: * This is explained in Dive Into HTML5 with the example of Wikipedia: You certainly don't want t...
[ "html", "offline-caching", "cache-manifest" ]
2
2
1,338
2
0
2011-06-01T02:50:31.023000
2011-06-01T12:38:15.400000
6,195,759
6,196,877
Which real-time communication protocol between hardware and web components?
I wasn't entirely sure how to word my question in the title so apologies if it's confusing. I'd like to build a system that would function as a sort of information dashboard for my home. It would consist of a number of hardware and software components that would ultimately result in a simple, clean website with real-ti...
Like the other poster mentioned, your're not going to have issues with http post. Node's http implementation is built for high concurrency. Personally, I think I'd go with: Hardware device output -> Linux box fires an http post directly to your central server (node.js) -> Take your changes and immediately publish them ...
Which real-time communication protocol between hardware and web components? I wasn't entirely sure how to word my question in the title so apologies if it's confusing. I'd like to build a system that would function as a sort of information dashboard for my home. It would consist of a number of hardware and software com...
TITLE: Which real-time communication protocol between hardware and web components? QUESTION: I wasn't entirely sure how to word my question in the title so apologies if it's confusing. I'd like to build a system that would function as a sort of information dashboard for my home. It would consist of a number of hardwar...
[ "node.js", "real-time", "redis", "microcontroller", "data-collection" ]
2
0
4,176
3
0
2011-06-01T02:51:35.313000
2011-06-01T05:55:39.090000
6,195,768
6,195,879
XML Serialization without csc.exe
I am running into a problem with some.net controls that I created and which I want to use in Internet explorer while Protected Mode is enabled. I get all kind of security prompts which relate to csc.exe trying to dynamically generate the serialized types. Anyway my question is is there a.NET library out there that woul...
You can try using the sgen ( XML Serializer Generator ) tool. That will precompile the assemblies so that they don't need to be generated at runtime.
XML Serialization without csc.exe I am running into a problem with some.net controls that I created and which I want to use in Internet explorer while Protected Mode is enabled. I get all kind of security prompts which relate to csc.exe trying to dynamically generate the serialized types. Anyway my question is is there...
TITLE: XML Serialization without csc.exe QUESTION: I am running into a problem with some.net controls that I created and which I want to use in Internet explorer while Protected Mode is enabled. I get all kind of security prompts which relate to csc.exe trying to dynamically generate the serialized types. Anyway my qu...
[ "c#", ".net", "xml-serialization" ]
3
1
517
1
0
2011-06-01T02:52:49.410000
2011-06-01T03:14:07.510000
6,195,774
6,196,312
MKPinannotation detail disclosure button - present new view
FirstViewController.h #import #import @interface TransparentToolbar: UIToolbar{ } @end @interface AddressAnnotation: NSObject { CLLocationCoordinate2D coordinate; NSString *title; NSString *subTitle; NSString *directions; NSString *website; } @property (nonatomic,retain) NSString *title; @property (nonatomic,retain...
If I understand correctly, you want to add a disclosure button that would allow you to present a new view with information about the current pin annotation. To get a disclosure button, you just need to implement this code: - (MKAnnotationView *)mapView:(MKMapView *)mapView viewForAnnotation:(id )annotation { MKPinAnnot...
MKPinannotation detail disclosure button - present new view FirstViewController.h #import #import @interface TransparentToolbar: UIToolbar{ } @end @interface AddressAnnotation: NSObject { CLLocationCoordinate2D coordinate; NSString *title; NSString *subTitle; NSString *directions; NSString *website; } @property (no...
TITLE: MKPinannotation detail disclosure button - present new view QUESTION: FirstViewController.h #import #import @interface TransparentToolbar: UIToolbar{ } @end @interface AddressAnnotation: NSObject { CLLocationCoordinate2D coordinate; NSString *title; NSString *subTitle; NSString *directions; NSString *website...
[ "iphone", "mkmapview", "mkpinannotationview", "disclosure" ]
6
27
10,043
1
0
2011-06-01T02:54:23.567000
2011-06-01T04:33:18.173000
6,195,776
6,195,809
Zipping lists together in Common Lisp - Problem with "and"
What I am trying to do is create a function zip (note now that this is not homework) that iterates through multiple lists simultaneously, applying a function to each list of elements, like so: (zip f '(1 2 3) '(4 5 6) '(7 8 9)) = (list (f 1 4 7) (f 2 5 8) (f 3 6 9)) (zip f '(1 2 3 4) '(5 6) '(7 8 9)) = (list (f 1 5 7) ...
You are re-implementing mapcar? (mapcar #'list '(1 2 3) '(4 5 6) '(7 8 9)) ((1 4 7) (2 5 8) (3 6 9))? (mapcar #'list '(1 2 3 4) '(5 6) '(7 8 9)) ((1 5 7) (2 6 8))? (mapcar #'+ '(1 2 3) '(4 5 6) '(7 8 9)) (12 15 18)? (mapcar #'+ '(1 2 3 4) '(5 6) '(7 8 9)) (13 16) BTW, the function you want in your code in place of all ...
Zipping lists together in Common Lisp - Problem with "and" What I am trying to do is create a function zip (note now that this is not homework) that iterates through multiple lists simultaneously, applying a function to each list of elements, like so: (zip f '(1 2 3) '(4 5 6) '(7 8 9)) = (list (f 1 4 7) (f 2 5 8) (f 3 ...
TITLE: Zipping lists together in Common Lisp - Problem with "and" QUESTION: What I am trying to do is create a function zip (note now that this is not homework) that iterates through multiple lists simultaneously, applying a function to each list of elements, like so: (zip f '(1 2 3) '(4 5 6) '(7 8 9)) = (list (f 1 4 ...
[ "list", "function", "macros", "common-lisp" ]
6
24
6,154
1
0
2011-06-01T02:54:37.117000
2011-06-01T03:03:20.090000
6,195,781
6,205,193
IronPython: EXE compiled using pyc.py cannot import module "os"
I have a simple IronPython script: # Foo.py import os def main(): print( "Hello" ) if "__main__" == __name__: main() It runs fine and prints Hello if I run it with IronPython as: ipy Foo.py Following the instructions given in IronPython - how to compile exe, I compiled this IronPython script to a EXE using: ipy pyc.p...
Building an Ironpython EXE that you can distribute is a bit tricky - especially if you are using elements of the standard library. My typical solution is the following: I copy all of the stdlib modules I need into a folder (usually all of them just for completeness) and use this script to build my exe. In this example ...
IronPython: EXE compiled using pyc.py cannot import module "os" I have a simple IronPython script: # Foo.py import os def main(): print( "Hello" ) if "__main__" == __name__: main() It runs fine and prints Hello if I run it with IronPython as: ipy Foo.py Following the instructions given in IronPython - how to compile ...
TITLE: IronPython: EXE compiled using pyc.py cannot import module "os" QUESTION: I have a simple IronPython script: # Foo.py import os def main(): print( "Hello" ) if "__main__" == __name__: main() It runs fine and prints Hello if I run it with IronPython as: ipy Foo.py Following the instructions given in IronPython...
[ "python", "ironpython" ]
24
26
16,387
2
0
2011-06-01T02:57:08.793000
2011-06-01T17:21:39.240000
6,195,789
6,196,357
T-SQL Help - Pivot Like function to merge up some data
I have a T-SQL Question to ask, normally SQL is my forte, but for some reason I am stumped on the following. So here it goes. I have a table with the following format: CREATE TABLE [tmp_LoadDataWithAutoID]( [DataID] int PRIMARY KEY IDENTITY(1,1), [SiteType] [varchar](800) NULL, [RegionId] [varchar](800) NULL, [RegionNa...
Once you have Site information for each row. You can use the below query to get the Minimum and Maximum Data ID for each store. First part to incorporate the row numbers Select ROW_NUMBER() Over(Order by dataId) as RowNo, * into #temp1 from [tmp_LoadDataWithAutoID] Second part will get the minimum dataid Select Min(dat...
T-SQL Help - Pivot Like function to merge up some data I have a T-SQL Question to ask, normally SQL is my forte, but for some reason I am stumped on the following. So here it goes. I have a table with the following format: CREATE TABLE [tmp_LoadDataWithAutoID]( [DataID] int PRIMARY KEY IDENTITY(1,1), [SiteType] [varcha...
TITLE: T-SQL Help - Pivot Like function to merge up some data QUESTION: I have a T-SQL Question to ask, normally SQL is my forte, but for some reason I am stumped on the following. So here it goes. I have a table with the following format: CREATE TABLE [tmp_LoadDataWithAutoID]( [DataID] int PRIMARY KEY IDENTITY(1,1), ...
[ "sql-server-2008", "t-sql", "pivot" ]
0
1
279
2
0
2011-06-01T02:58:14.383000
2011-06-01T04:40:59.280000
6,195,790
6,196,055
Python: Implementing a series of functions with each one calling the next
programming isn't my field, but I'm trying to learn. I've been writing a program that works something like this: from Tkinter import * root=Tk() def Secondwindow(): firstframe.destroy() secondframe = Frame(root) secondframe.pack() secondcontent = Label(secondframe, text = 'second window content').pack() def Thirdwindo...
I un-nested the functions to see what the error was. The problem you have is that the functions try to access variables defined in the scope of another function. That won't work. You either have to nest functions so that their scopes overlap, as you did -- which is awkward -- or you have to use global variables -- whic...
Python: Implementing a series of functions with each one calling the next programming isn't my field, but I'm trying to learn. I've been writing a program that works something like this: from Tkinter import * root=Tk() def Secondwindow(): firstframe.destroy() secondframe = Frame(root) secondframe.pack() secondcontent ...
TITLE: Python: Implementing a series of functions with each one calling the next QUESTION: programming isn't my field, but I'm trying to learn. I've been writing a program that works something like this: from Tkinter import * root=Tk() def Secondwindow(): firstframe.destroy() secondframe = Frame(root) secondframe.pac...
[ "python", "function", "nameerror" ]
2
2
222
3
0
2011-06-01T02:58:30.400000
2011-06-01T03:48:04.107000
6,195,791
6,195,849
JavaScript incrementing a variable
I'm trying to increment a variable in JavaScript by clicking on a link, it works the first time but then every other time if I click on it once it will show up 3 times, then 4, 5 and so on. A screenshot of the console: The numbers in the blue (right) are as expected, there is nothing wrong with this but as you can see ...
Need to see more code, but typically I see JS beginners adding the event inside of the event. In other words, every time the link is clicked, another event handler is added. At any rate, here's an example of incrementing a counter in a click handler: http://jsfiddle.net/GSuSk/
JavaScript incrementing a variable I'm trying to increment a variable in JavaScript by clicking on a link, it works the first time but then every other time if I click on it once it will show up 3 times, then 4, 5 and so on. A screenshot of the console: The numbers in the blue (right) are as expected, there is nothing ...
TITLE: JavaScript incrementing a variable QUESTION: I'm trying to increment a variable in JavaScript by clicking on a link, it works the first time but then every other time if I click on it once it will show up 3 times, then 4, 5 and so on. A screenshot of the console: The numbers in the blue (right) are as expected,...
[ "javascript", "jquery" ]
2
1
1,153
4
0
2011-06-01T02:58:40.790000
2011-06-01T03:09:39.543000
6,195,793
6,196,001
How to change the foreign key using ASP.NET MVC 2 + Entity
[HttpPost] public ActionResult Edit(FormCollection form) { // Get movie to update var id = Int32.Parse(form["id_foto"]); var fotoToAdd = _db.foto.First(m => m.id_foto == id); // Deserialize (Include white list!) TryUpdateModel(fotoToAdd, new string[] { "descricao" }, form.ToValueProvider()); //Here I try to change my...
This will be a help for you Entity Framework: Setting a Foreign Key Property
How to change the foreign key using ASP.NET MVC 2 + Entity [HttpPost] public ActionResult Edit(FormCollection form) { // Get movie to update var id = Int32.Parse(form["id_foto"]); var fotoToAdd = _db.foto.First(m => m.id_foto == id); // Deserialize (Include white list!) TryUpdateModel(fotoToAdd, new string[] { "descri...
TITLE: How to change the foreign key using ASP.NET MVC 2 + Entity QUESTION: [HttpPost] public ActionResult Edit(FormCollection form) { // Get movie to update var id = Int32.Parse(form["id_foto"]); var fotoToAdd = _db.foto.First(m => m.id_foto == id); // Deserialize (Include white list!) TryUpdateModel(fotoToAdd, new ...
[ "asp.net-mvc", "entity-framework", "foreign-keys" ]
0
0
403
1
0
2011-06-01T02:59:09.617000
2011-06-01T03:37:33.263000
6,195,796
6,195,974
Reading file and writing into DB
Yesterday in an interview I was asked this question and the answers that I provided seem to have not impressed the interviewer.:( Here is the scenario... A file has comma delimited attribute values in new-line seperated records. There is a requirement that this file has to go into database table that has matching seque...
If you're using SQL Server, you can use the BULK INSERT command http://msdn.microsoft.com/en-us/library/ms188365.aspx Basically, you set up a SQLCommand object, set the CommandText to something like: sqlCommand.CommandText = "BULK INSERT " & tableName & " FROM '" & file & "' WITH(TABLOCK, FIELDTERMINATOR=',') sqlComman...
Reading file and writing into DB Yesterday in an interview I was asked this question and the answers that I provided seem to have not impressed the interviewer.:( Here is the scenario... A file has comma delimited attribute values in new-line seperated records. There is a requirement that this file has to go into datab...
TITLE: Reading file and writing into DB QUESTION: Yesterday in an interview I was asked this question and the answers that I provided seem to have not impressed the interviewer.:( Here is the scenario... A file has comma delimited attribute values in new-line seperated records. There is a requirement that this file ha...
[ ".net", "xml", "memory-management", "datatable" ]
1
2
180
3
0
2011-06-01T02:59:19.657000
2011-06-01T03:30:52.417000
6,195,798
6,195,807
$.fancybox.delay is not a function
i am using this plugin and now i tried add some delay time before close a div, but i get this error $.fancybox.delay is not a function for this code: $("#msgbox1").fadeTo(200, 0.1, function() { $(this).html('Foi enviado um email').removeClass('messageboxerror1').addClass('messageboxok1').fadeTo(900, 1); $.fancybox.dela...
That's because $.fancybox.delay is not a function. See the Fancybox API for a list of valid methods. Try using a setTimeout, e.g.: setTimeout(function() { $.fancybox.close(); }, 800);
$.fancybox.delay is not a function i am using this plugin and now i tried add some delay time before close a div, but i get this error $.fancybox.delay is not a function for this code: $("#msgbox1").fadeTo(200, 0.1, function() { $(this).html('Foi enviado um email').removeClass('messageboxerror1').addClass('messageboxok...
TITLE: $.fancybox.delay is not a function QUESTION: i am using this plugin and now i tried add some delay time before close a div, but i get this error $.fancybox.delay is not a function for this code: $("#msgbox1").fadeTo(200, 0.1, function() { $(this).html('Foi enviado um email').removeClass('messageboxerror1').addC...
[ "javascript", "jquery", "fancybox" ]
0
2
877
1
0
2011-06-01T02:59:47.753000
2011-06-01T03:02:27.403000
6,195,801
6,195,839
Java Full Screenshot
I wanted to display on the JFrame on the program the full screenshot of my screen. So far using the code below, I was able only to display part of the screen. The code below is the content of the paint(Graphics g). How can I make it full screen? // the screen resolution is 1280 x 1024 while the JPanel size is only 1024...
Maybe using something like this: //get the screen size Dimension dim = Toolkit.getDefaultToolkit().getScreenSize(); BufferedImage image = robot.createScreenCapture (dim); //other code //... I see you have some errors, I don't know if your code even compiles, 'cause references seems not to be declared, but a code simila...
Java Full Screenshot I wanted to display on the JFrame on the program the full screenshot of my screen. So far using the code below, I was able only to display part of the screen. The code below is the content of the paint(Graphics g). How can I make it full screen? // the screen resolution is 1280 x 1024 while the JPa...
TITLE: Java Full Screenshot QUESTION: I wanted to display on the JFrame on the program the full screenshot of my screen. So far using the code below, I was able only to display part of the screen. The code below is the content of the paint(Graphics g). How can I make it full screen? // the screen resolution is 1280 x ...
[ "java", "awtrobot" ]
3
2
3,599
3
0
2011-06-01T03:01:01.060000
2011-06-01T03:08:02.737000
6,195,805
6,196,098
Jinja2: Render template inheritance?
I'd like to render a fused Jinja2 and Markdown page using a template, which looks like so: {% block title %}{{ title }}{% endblock %} # {{ title[0] }} # {{ title[1] }} ## Introduction I can get that above code to generate HTML fine, but as I am using this script for a custom authoring application, I'd like to be able...
Jinja's renderer needs to know how to load template.html, so you need to give the Environment a template loader instance. For example, assuming the files page.html and template.html are in the current directory: from jinja import FileSystemLoader from jinja.environment import Environment env = Environment() env.loader...
Jinja2: Render template inheritance? I'd like to render a fused Jinja2 and Markdown page using a template, which looks like so: {% block title %}{{ title }}{% endblock %} # {{ title[0] }} # {{ title[1] }} ## Introduction I can get that above code to generate HTML fine, but as I am using this script for a custom autho...
TITLE: Jinja2: Render template inheritance? QUESTION: I'd like to render a fused Jinja2 and Markdown page using a template, which looks like so: {% block title %}{{ title }}{% endblock %} # {{ title[0] }} # {{ title[1] }} ## Introduction I can get that above code to generate HTML fine, but as I am using this script ...
[ "python", "extend", "jinja2" ]
11
21
12,621
1
0
2011-06-01T03:02:06.590000
2011-06-01T03:56:22.530000
6,195,812
6,202,683
ldap nested group membership
Is it possible to create an LDAP query which will return (or check for) users in a nested group? e.g. UserA is a member of GroupA, and GroupA is a member of GroupB. I want a query on GroupB to return that UserA is a member. LDAP only. The server is Active Directory.
Yes, using the LDAP_MATCHING_RULE_IN_CHAIN matching rule (OID 1.2.840.113556.1.4.1941). For example: (memberOf:1.2.840.113556.1.4.1941:=cn=group,cn=users,DC=x) see http://msdn.microsoft.com/en-us/library/aa746475%28VS.85%29.aspx
ldap nested group membership Is it possible to create an LDAP query which will return (or check for) users in a nested group? e.g. UserA is a member of GroupA, and GroupA is a member of GroupB. I want a query on GroupB to return that UserA is a member. LDAP only. The server is Active Directory.
TITLE: ldap nested group membership QUESTION: Is it possible to create an LDAP query which will return (or check for) users in a nested group? e.g. UserA is a member of GroupA, and GroupA is a member of GroupB. I want a query on GroupB to return that UserA is a member. LDAP only. The server is Active Directory. ANSWE...
[ "active-directory", "ldap", "nested" ]
63
110
113,703
3
0
2011-06-01T03:03:29.040000
2011-06-01T14:19:53.693000
6,195,814
6,195,829
Func<T, TResult> delegate real world uses
I've recently been playing around with the delegate Func and creating methods that return different instances Func containing lambda but what I have struggled to come up with is any good real world ideas of why one might want to return (or even create such an instance). There is an example on MSDN where they do the fol...
If what you're asking, really, is why we have delegates in general: If you've ever consumed an event, you've used a delegate If you've ever used LINQ, you've used a delegate (technically, with an IQueryable provider you've used an expression, but for LINQ-to-Objects you've used a delegate) Delegates provide a way of in...
Func<T, TResult> delegate real world uses I've recently been playing around with the delegate Func and creating methods that return different instances Func containing lambda but what I have struggled to come up with is any good real world ideas of why one might want to return (or even create such an instance). There i...
TITLE: Func<T, TResult> delegate real world uses QUESTION: I've recently been playing around with the delegate Func and creating methods that return different instances Func containing lambda but what I have struggled to come up with is any good real world ideas of why one might want to return (or even create such an ...
[ "c#", "lambda", "anonymous-function", "func" ]
7
12
4,764
8
0
2011-06-01T03:03:50.277000
2011-06-01T03:06:42.003000
6,195,818
6,196,465
Sort by Date in SQL
I have a resources table, one of the fields is a date field with the Data Type of date. I want to have to following output: Current month records (say May - year is not important) Then the following (again, assuming May is the current month) June Records July Records August Records September Records October Records Nov...
ORDER BY (MONTH(resource_date) - MONTH(GETDATE()) + 12) % 12, DATEADD(year, YEAR(GETDATE()) - YEAR(resource_date), resource_date), YEAR(resource_date) The first term sets the primary order by the month of resource_date (the current month will be first, the previous one, last). The second term orders the timestamps with...
Sort by Date in SQL I have a resources table, one of the fields is a date field with the Data Type of date. I want to have to following output: Current month records (say May - year is not important) Then the following (again, assuming May is the current month) June Records July Records August Records September Records...
TITLE: Sort by Date in SQL QUESTION: I have a resources table, one of the fields is a date field with the Data Type of date. I want to have to following output: Current month records (say May - year is not important) Then the following (again, assuming May is the current month) June Records July Records August Records...
[ "sql", "sql-server", "sql-server-2008", "sql-order-by" ]
4
4
16,395
6
0
2011-06-01T03:04:17.043000
2011-06-01T04:57:34.833000
6,195,820
6,196,632
Any java static/dynamic code analyze tool to find all recursive method in my java project
I need to find all recursive methods in my projects (100+ eclipse java/plugin projects with about ~1 millions lines of code) since we found some performance problems caused by recursive methods. We don't care about the used libraries. I would prefer open source/free and with eclipse plug-ins. Static code analyzer would...
You're barking up the wrong tree here. It is fallacious to conclude from 'some' performance problems that are due to a recursion that all recursions are causing all your performance problems. You must already have a way of looking for performance problems. So look for performance problems, not recursive methods. If the...
Any java static/dynamic code analyze tool to find all recursive method in my java project I need to find all recursive methods in my projects (100+ eclipse java/plugin projects with about ~1 millions lines of code) since we found some performance problems caused by recursive methods. We don't care about the used librar...
TITLE: Any java static/dynamic code analyze tool to find all recursive method in my java project QUESTION: I need to find all recursive methods in my projects (100+ eclipse java/plugin projects with about ~1 millions lines of code) since we found some performance problems caused by recursive methods. We don't care abo...
[ "java" ]
2
3
1,620
1
0
2011-06-01T03:04:27.747000
2011-06-01T05:19:57.813000
6,195,847
6,196,013
FTP error : 503 bad sequence of commands?
I am using FileZilla FTP Server windows edition. I wrote a java programe to connect to my FTP server, and send FTP raw commands to the server via socket. when I send "LIST", I got 503 error: (000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> Connected, sending welcome message... (000002)2011/6/1 10:46:56 - (not l...
I believe that in order to do a data transfer (and LIST is a data transfer command) you must issue a PORT command first to establish the data connection. The best way to figure this out is to either read the relevant spec, or (more fun) fire up Wireshark and see what actually happens using a working FTP client.
FTP error : 503 bad sequence of commands? I am using FileZilla FTP Server windows edition. I wrote a java programe to connect to my FTP server, and send FTP raw commands to the server via socket. when I send "LIST", I got 503 error: (000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> Connected, sending welcome mes...
TITLE: FTP error : 503 bad sequence of commands? QUESTION: I am using FileZilla FTP Server windows edition. I wrote a java programe to connect to my FTP server, and send FTP raw commands to the server via socket. when I send "LIST", I got 503 error: (000002)2011/6/1 10:46:56 - (not logged in) (127.0.0.1)> Connected, s...
[ "java", "ftp" ]
2
5
9,579
1
0
2011-06-01T03:09:25.483000
2011-06-01T03:39:39.160000
6,195,863
6,195,962
Retrieving a 2d varray in Java with JDBC
I have the following types: create or replace TYPE mytimestamp AS VARRAY(300) OF TIMESTAMP(6); create or replace TYPE trade_history_dts_array AS VARRAY(300) OF mytimestamp; The types are used in this way in the stored procedure: trade_history_dts tradehistorydtsarray; FOR i IN 1..20 loop trade_history_dts(i):= mytimes...
The approach that you've adopted will not work, because JDBC on it's own does not have any support for Oracle's collection types. You'll need to work on objects of type contained in the Oracle JDBC driver for accessing the contents of the resultset in the manner that you desire. This would involve casting the ResultSet...
Retrieving a 2d varray in Java with JDBC I have the following types: create or replace TYPE mytimestamp AS VARRAY(300) OF TIMESTAMP(6); create or replace TYPE trade_history_dts_array AS VARRAY(300) OF mytimestamp; The types are used in this way in the stored procedure: trade_history_dts tradehistorydtsarray; FOR i IN ...
TITLE: Retrieving a 2d varray in Java with JDBC QUESTION: I have the following types: create or replace TYPE mytimestamp AS VARRAY(300) OF TIMESTAMP(6); create or replace TYPE trade_history_dts_array AS VARRAY(300) OF mytimestamp; The types are used in this way in the stored procedure: trade_history_dts tradehistorydt...
[ "java", "oracle", "jdbc", "2d", "varray" ]
1
4
1,042
1
0
2011-06-01T03:12:02.457000
2011-06-01T03:28:47.793000
6,195,865
6,209,237
Turning an array of integers into an array of nonnegative integers
Start with an array of integers so that the sum of the values is some positive integer S. The following routine always terminates in the same number of steps with the same results. Why is this? Start with an array x = [x_0, x_1,..., x_N-1] such that all x_i 's are integers. While there is a negative entry, do the follo...
I think the easiest way to see why the output vector and the number of steps are the same no matter what index you choose at each step is to look at the problem as a bunch of matrix and vector multiplications. For the case where x has 3 components, think of x as a 3x1 vector: x = [x_0 x_1 x_2]' (where ' is the transpos...
Turning an array of integers into an array of nonnegative integers Start with an array of integers so that the sum of the values is some positive integer S. The following routine always terminates in the same number of steps with the same results. Why is this? Start with an array x = [x_0, x_1,..., x_N-1] such that all...
TITLE: Turning an array of integers into an array of nonnegative integers QUESTION: Start with an array of integers so that the sum of the values is some positive integer S. The following routine always terminates in the same number of steps with the same results. Why is this? Start with an array x = [x_0, x_1,..., x_...
[ "algorithm", "sorting" ]
13
4
556
3
0
2011-06-01T03:12:19.587000
2011-06-02T00:32:03.173000
6,195,872
6,206,742
Applying multiple filters at once with FFMPEG
I have the need to apply fadein and overlay filters to a video. Is it possible to apply 2 filters at once? I got: ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10 [out]" output.mpg I'm trying to add fade=in:0:20, but if I add a new -vf parameter, it will overwrite the preceding one,...
Okay, someone helped me somewhere. I had to separate filters with commas: ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10, fade=in:0:20 [out]" output.mpg This will apply fadein to both the watermark and the video.
Applying multiple filters at once with FFMPEG I have the need to apply fadein and overlay filters to a video. Is it possible to apply 2 filters at once? I got: ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10 [out]" output.mpg I'm trying to add fade=in:0:20, but if I add a new -vf p...
TITLE: Applying multiple filters at once with FFMPEG QUESTION: I have the need to apply fadein and overlay filters to a video. Is it possible to apply 2 filters at once? I got: ffmpeg -i input.mpg -vf "movie=watermark.png [logo]; [in][logo] overlay=W-w-10:H-h-10 [out]" output.mpg I'm trying to add fade=in:0:20, but if...
[ "filter", "ffmpeg" ]
91
117
94,808
2
0
2011-06-01T03:13:30.273000
2011-06-01T19:43:55.867000
6,195,877
6,196,103
(python) colour printing with decorator in a function
How can I decorate a function so that anything it prints to stdout is in green and anything it prints to stderr is in red? I have the termcolor module available. Bonus karma: How can I pass arguments to the decorator to specify the colours, defaulting them to red and green?
An interesting question. The simplest solution would be similar to what Pete suggest. Just print the escape codes before running the function to each of stderr and stdout. However, if both stderr and stdout feed the same terminal, as is usually the case, they will interfere. So, an alternative solution is to monkey-pat...
(python) colour printing with decorator in a function How can I decorate a function so that anything it prints to stdout is in green and anything it prints to stderr is in red? I have the termcolor module available. Bonus karma: How can I pass arguments to the decorator to specify the colours, defaulting them to red an...
TITLE: (python) colour printing with decorator in a function QUESTION: How can I decorate a function so that anything it prints to stdout is in green and anything it prints to stderr is in red? I have the termcolor module available. Bonus karma: How can I pass arguments to the decorator to specify the colours, default...
[ "python", "function", "decorator" ]
6
3
4,288
3
0
2011-06-01T03:14:00.770000
2011-06-01T03:56:56.357000
6,195,880
6,195,938
How do I make a line not return?
I'm working on this website.(http://kristinbecker.com/everydaypart1_test.htm) The client would like some space under the various jewelry pieces. How would I go about creaking a paragraph under the pieces but not have it return a line every time I create a new on. The length doesn't matter and the width is set. I just d...
This is pretty simple in CSS after you've changed your HTML a bit. Your current structure is a little like this: paragraph containing images first image second image third image fourth image paragraph about first image paragraph about second image paragraph about third image paragraph about fourth image You can start b...
How do I make a line not return? I'm working on this website.(http://kristinbecker.com/everydaypart1_test.htm) The client would like some space under the various jewelry pieces. How would I go about creaking a paragraph under the pieces but not have it return a line every time I create a new on. The length doesn't matt...
TITLE: How do I make a line not return? QUESTION: I'm working on this website.(http://kristinbecker.com/everydaypart1_test.htm) The client would like some space under the various jewelry pieces. How would I go about creaking a paragraph under the pieces but not have it return a line every time I create a new on. The l...
[ "html", "css" ]
0
3
73
3
0
2011-06-01T03:14:13.893000
2011-06-01T03:24:55.513000
6,195,881
6,196,783
What SQL databases support subqueries in CHECK constraints?
What SQL databases, if any, support subqueries in CHECK constraints? At present and as far as I know, Oracle, MySQL, and PostgreSQL do not. EDIT (Clarification based on initial answers.) I'm looking for something like this: CREATE TABLE personnel (..., department VARCHAR(64) NOT NULL, salary NUMERIC NOT NULL, CHECK (sa...
The Access database engine (ACE, Jet, whatever) supports subqueries in CHECK constraints but I hesitate to call it a SQL DBMS because it doesn't support entry level Standard SQL-92 and Access CHECK constraints are barely documented by MS and the Access Team. For example, I can demonstrate that Access CHECK constraints ...
What SQL databases support subqueries in CHECK constraints? What SQL databases, if any, support subqueries in CHECK constraints? At present and as far as I know, Oracle, MySQL, and PostgreSQL do not. EDIT (Clarification based on initial answers.) I'm looking for something like this: CREATE TABLE personnel (..., departm...
TITLE: What SQL databases support subqueries in CHECK constraints? QUESTION: What SQL databases, if any, support subqueries in CHECK constraints? At present and as far as I know, Oracle, MySQL, and PostgreSQL do not. EDIT (Clarification based on initial answers.) I'm looking for something like this: CREATE TABLE perso...
[ "sql", "subquery", "check-constraints" ]
9
7
11,083
6
0
2011-06-01T03:14:28.977000
2011-06-01T05:42:13.447000
6,195,885
6,197,179
Define an element as non-empty in RelaxNG
I've started using RelaxNG to specify XML message schemas, and using PHP DOMDocument to validate and parse incoming messages, but can't figure out how to define a text node so that it cannot be empty. Example schema: However, the message below is being validated as correct by the DOMDocument::relaxNGValidate method (si...
If your RELAX NG validator supports XSD data types (most do), then you can use regular expressions to refine the constraints for text content:.+.+
Define an element as non-empty in RelaxNG I've started using RelaxNG to specify XML message schemas, and using PHP DOMDocument to validate and parse incoming messages, but can't figure out how to define a text node so that it cannot be empty. Example schema: However, the message below is being validated as correct by t...
TITLE: Define an element as non-empty in RelaxNG QUESTION: I've started using RelaxNG to specify XML message schemas, and using PHP DOMDocument to validate and parse incoming messages, but can't figure out how to define a text node so that it cannot be empty. Example schema: However, the message below is being validat...
[ "xml", "relaxng" ]
3
4
1,282
3
0
2011-06-01T03:14:57.107000
2011-06-01T06:35:22.620000
6,195,886
6,195,909
Automatically mapping properties in Fluent NHibernate
I'm taking a complicated legacy schema and mapping it with Fluent NHibernate. The schema is wacky enough that I've given up on automapping; the relationships between tables are weird and complicated, and it would involve a ton of exceptions. The thing is, the simple properties are totally normal; a table's Title column...
How about using automapping and then overrides where things don't fit conventions? I don't think it's too much of a burden. You'll need to specify the complex relationships that don't fit a convention somewhere anyhow.
Automatically mapping properties in Fluent NHibernate I'm taking a complicated legacy schema and mapping it with Fluent NHibernate. The schema is wacky enough that I've given up on automapping; the relationships between tables are weird and complicated, and it would involve a ton of exceptions. The thing is, the simple...
TITLE: Automatically mapping properties in Fluent NHibernate QUESTION: I'm taking a complicated legacy schema and mapping it with Fluent NHibernate. The schema is wacky enough that I've given up on automapping; the relationships between tables are weird and complicated, and it would involve a ton of exceptions. The th...
[ "fluent-nhibernate" ]
1
1
387
4
0
2011-06-01T03:15:12.550000
2011-06-01T03:19:47.280000
6,195,892
6,195,984
Can I set the UIFont height?
Can I set the UIFont height as well as the line spacing? I googled this, it seems no way to set height for the IOS built-in font. One possible way is to use customized font. This seems too heavy since I just want to set line spacing and height. Thanks in advance!
Once you get an UIFont instance from iOS for the given size, you can't alter size later. because it define all of it's property as readonly. you could access the height of character for Caps and Lower using the properties. @property(nonatomic, readonly) CGFloat xHeight @property(nonatomic,readonly) CGFloat lineHeight @...
Can I set the UIFont height? Can I set the UIFont height as well as the line spacing? I googled this, it seems no way to set height for the IOS built-in font. One possible way is to use customized font. This seems too heavy since I just want to set line spacing and height. Thanks in advance!
TITLE: Can I set the UIFont height? QUESTION: Can I set the UIFont height as well as the line spacing? I googled this, it seems no way to set height for the IOS built-in font. One possible way is to use customized font. This seems too heavy since I just want to set line spacing and height. Thanks in advance! ANSWER: ...
[ "iphone", "uifont" ]
1
0
1,820
1
0
2011-06-01T03:16:37.573000
2011-06-01T03:32:48.143000
6,195,898
6,195,937
Javascript object definition techniques, pros and cons
What are the basic ways of defining reusable objects in Javascript? I say reusable to exclude singleton techniques, such as declaring a variable with object literal notation directly. I saw somewhere that Crockford defines four such ways in his book(s) but I would rather not have to buy a book for this short bit of inf...
Use the prototype. Returning specific objects from constructors makes them non-constructors, and assigning methods to this makes inheritance less convenient. Returning an object literal Pros: If a person forgets new, they still get the object. You can create truly private variables, since all methods of the object defi...
Javascript object definition techniques, pros and cons What are the basic ways of defining reusable objects in Javascript? I say reusable to exclude singleton techniques, such as declaring a variable with object literal notation directly. I saw somewhere that Crockford defines four such ways in his book(s) but I would ...
TITLE: Javascript object definition techniques, pros and cons QUESTION: What are the basic ways of defining reusable objects in Javascript? I say reusable to exclude singleton techniques, such as declaring a variable with object literal notation directly. I saw somewhere that Crockford defines four such ways in his bo...
[ "javascript", "object", "coding-style" ]
14
14
6,262
5
0
2011-06-01T03:17:12.520000
2011-06-01T03:24:48.290000
6,195,914
6,195,957
Weird behavior when converting byte from text box to byte array to characters?
I have a textbox that I use to convert things like: 74 00 65 00 73 00 74 00 Back into a string, the above says "test" but for some reason when I click the convert button it will display only the first letter "t" 74 00 and other byte arrays work just as expected, the entire text is converted. Here is the 2 codes I have ...
If you have the byte sequence var bytes = new byte[] { 0x74, 0x00, 0x65, 0x00, 0x73, 0x00, 0x74, 0x00 }; and you decode it to a string using ASCII encoding ( Encoding.ASCII ), then you get var result = Encoding.ASCII.GetString(bytes); // result == "\x74\x00\x65\x00\x73\x00\x74\x00" == "t\0e\0s\0t\0" Notice the Null \0 ...
Weird behavior when converting byte from text box to byte array to characters? I have a textbox that I use to convert things like: 74 00 65 00 73 00 74 00 Back into a string, the above says "test" but for some reason when I click the convert button it will display only the first letter "t" 74 00 and other byte arrays w...
TITLE: Weird behavior when converting byte from text box to byte array to characters? QUESTION: I have a textbox that I use to convert things like: 74 00 65 00 73 00 74 00 Back into a string, the above says "test" but for some reason when I click the convert button it will display only the first letter "t" 74 00 and o...
[ "c#", ".net", "string", "arrays" ]
3
9
1,986
4
0
2011-06-01T03:20:12.110000
2011-06-01T03:28:19.833000
6,195,916
6,196,209
ruby on rails has_many :through association which has two columns with same model
I have the following model: class UserShareTag < ActiveRecord::Base attr_protected:sharee_id,:post_id,:sharer_id belongs_to:sharer,:class_name => "User" belongs_to:post belongs_to:sharee,:class_name => "User" validates:sharer_id,:presence => true validates:sharee_id,:presence => true validates:post_id,:presence => tr...
You just need to add a:source parameter to your has_many associations (and you don't need the:class_name option): has_many:user_sharers,:through =>:user_share_tags,:source =>:sharer,:uniq => true,:class_name => "User" has_many:user_sharers,:through =>:user_share_tags,:source =>:sharee,:uniq => true,:class_name => "User...
ruby on rails has_many :through association which has two columns with same model I have the following model: class UserShareTag < ActiveRecord::Base attr_protected:sharee_id,:post_id,:sharer_id belongs_to:sharer,:class_name => "User" belongs_to:post belongs_to:sharee,:class_name => "User" validates:sharer_id,:presen...
TITLE: ruby on rails has_many :through association which has two columns with same model QUESTION: I have the following model: class UserShareTag < ActiveRecord::Base attr_protected:sharee_id,:post_id,:sharer_id belongs_to:sharer,:class_name => "User" belongs_to:post belongs_to:sharee,:class_name => "User" validates...
[ "ruby-on-rails", "model", "associations", "has-many-through" ]
3
3
2,411
1
0
2011-06-01T03:20:58.583000
2011-06-01T04:16:02.317000
6,195,933
6,195,977
Given a date in MySQL, how can I determine the relative start of the week?
I have a date_time column in my table. How do I get the date for the start of the week, i.e. the date 2011-01-09 13:44:00 would return 2011-01-07 00:00:00? I have looked over MySQL Date functions but wasn't able to figure out how to do it. I tried something like this... DATE_ADD( YEAR( NOW( ) ), INTERVAL WEEK( NOW( ) )...
If you don't mind converting to Date first (from DateTime) DATE_ADD(mydate, INTERVAL(1-DAYOFWEEK(mydate)) DAY) Also, the STR_TO_DATE function is a possibility. Feed it your year and week concatenated right together, followed by your desired string-date format, which could then be cast to a datetime. SELECT STR_TO_DATE(...
Given a date in MySQL, how can I determine the relative start of the week? I have a date_time column in my table. How do I get the date for the start of the week, i.e. the date 2011-01-09 13:44:00 would return 2011-01-07 00:00:00? I have looked over MySQL Date functions but wasn't able to figure out how to do it. I tri...
TITLE: Given a date in MySQL, how can I determine the relative start of the week? QUESTION: I have a date_time column in my table. How do I get the date for the start of the week, i.e. the date 2011-01-09 13:44:00 would return 2011-01-07 00:00:00? I have looked over MySQL Date functions but wasn't able to figure out h...
[ "mysql", "sql", "datetime" ]
1
1
152
2
0
2011-06-01T03:24:15.230000
2011-06-01T03:31:40.107000
6,195,936
6,195,996
C++ Guess Number game crashing on other computers and infinite loop fix
// Guess my number // My first text based game // Created by USDlades // http://www.USDgamedev.zxq.net #include #include #include #include using namespace std; int main() { srand(static_cast (time(0))); // seed the random number generator int guess; int secret = rand() % 100 + 1; // Generates a Random number betwee...
The "crash" is probably related to missing runtime libraries, which would result in an error message similar to The application failed to initialize properly [...]...requiring your friend to install the missing runtime libraries, e.g. http://www.microsoft.com/downloads/en/details.aspx?familyid=a5c84275-3b97-4ab7-a40d-3...
C++ Guess Number game crashing on other computers and infinite loop fix // Guess my number // My first text based game // Created by USDlades // http://www.USDgamedev.zxq.net #include #include #include #include using namespace std; int main() { srand(static_cast (time(0))); // seed the random number generator int g...
TITLE: C++ Guess Number game crashing on other computers and infinite loop fix QUESTION: // Guess my number // My first text based game // Created by USDlades // http://www.USDgamedev.zxq.net #include #include #include #include using namespace std; int main() { srand(static_cast (time(0))); // seed the random numbe...
[ "c++" ]
1
5
884
1
0
2011-06-01T03:24:44.170000
2011-06-01T03:36:42.380000
6,195,940
6,196,293
debugging server's cgi program
i am trying to make a webserver in C which can handle request to dynamic contents. the webserver part is finish already. i'm trying to execute the following command: http://localhost:1601/cgi-bin/test?3&7 with the code of program test is as follow: #include #include #include #include #include #include #include #include...
For starters you set the Content-length header to the length of the content, then sent the content, then sent more data in both threads. The browser is within its rights to ignore everything after content-length bytes in the output stream.
debugging server's cgi program i am trying to make a webserver in C which can handle request to dynamic contents. the webserver part is finish already. i'm trying to execute the following command: http://localhost:1601/cgi-bin/test?3&7 with the code of program test is as follow: #include #include #include #include #inc...
TITLE: debugging server's cgi program QUESTION: i am trying to make a webserver in C which can handle request to dynamic contents. the webserver part is finish already. i'm trying to execute the following command: http://localhost:1601/cgi-bin/test?3&7 with the code of program test is as follow: #include #include #inc...
[ "linux", "cgi", "webserver", "fork" ]
0
1
196
1
0
2011-06-01T03:25:04.373000
2011-06-01T04:30:13.353000
6,195,944
6,196,462
WCF 4.0 - How to route old service URL to new service URL?
I have an old WCF 3.5 RESTful service that was at: http://www.mydomain.com/rest/Service.svc I have migrated my service over to a WCF 4.0 RESTful service that now resides at: http://www.mydomain.com/rest/Service Due to the new WCF 4.0 routing in the Global.asax, it automatically removes the.svc extension for me. I was l...
You can still have both.svc file and the route-based activation, for the same service class, so the requests for both addresses would cause the service to be invoked. The endpoint from the.svc would be defined either using the Factory attribute on the <%@ ServiceHost %> directive or via web.config, and the endpoint fro...
WCF 4.0 - How to route old service URL to new service URL? I have an old WCF 3.5 RESTful service that was at: http://www.mydomain.com/rest/Service.svc I have migrated my service over to a WCF 4.0 RESTful service that now resides at: http://www.mydomain.com/rest/Service Due to the new WCF 4.0 routing in the Global.asax,...
TITLE: WCF 4.0 - How to route old service URL to new service URL? QUESTION: I have an old WCF 3.5 RESTful service that was at: http://www.mydomain.com/rest/Service.svc I have migrated my service over to a WCF 4.0 RESTful service that now resides at: http://www.mydomain.com/rest/Service Due to the new WCF 4.0 routing i...
[ "c#", ".net", "wcf", "rest", "url-routing" ]
2
1
477
1
0
2011-06-01T03:25:43.283000
2011-06-01T04:57:26.730000
6,195,951
6,196,046
In real world ASP.NET website developments, do developers normally use the set of login controls provided by VS, or develop their own controls?
The reason I'm asking this is I suspect the set of login controls are cumbersome to use/tweak. For example, I'd imagine it'd be hard to tell the user their password is not correct.
I've tried using them, and after a while I was ultimately left with just the login control itself. All the logic to authenticate, and manage users was written from scratch. I just didn't want to use the default MembershipProvider that comes with VS. You can customize the look at feel via CSS, and I believe there's an A...
In real world ASP.NET website developments, do developers normally use the set of login controls provided by VS, or develop their own controls? The reason I'm asking this is I suspect the set of login controls are cumbersome to use/tweak. For example, I'd imagine it'd be hard to tell the user their password is not corr...
TITLE: In real world ASP.NET website developments, do developers normally use the set of login controls provided by VS, or develop their own controls? QUESTION: The reason I'm asking this is I suspect the set of login controls are cumbersome to use/tweak. For example, I'd imagine it'd be hard to tell the user their pa...
[ "asp.net", "authentication" ]
3
2
196
5
0
2011-06-01T03:27:30.317000
2011-06-01T03:46:42.940000
6,195,958
6,196,168
iPhone POST JSON to PHP expecting return for login/receiving data
OK, I am quite new to this Objective-C and JSON thing, so please bare with my questions. I am using Stig Json Framework and ASIHTTPRequest. My overall objective is to send JSON data (containing login credential) to a PHP webservice and expecting a return once the PHP process the data. I need an authorize key from the r...
The data is returned as a JSON string and you need to convert it to Objective-C object using the " JSONValue " method before working with the returned data. For example: NSDictionary *results = [jsonString JSONValue]; Now you can work with the returned data as an NSDictionary.
iPhone POST JSON to PHP expecting return for login/receiving data OK, I am quite new to this Objective-C and JSON thing, so please bare with my questions. I am using Stig Json Framework and ASIHTTPRequest. My overall objective is to send JSON data (containing login credential) to a PHP webservice and expecting a return...
TITLE: iPhone POST JSON to PHP expecting return for login/receiving data QUESTION: OK, I am quite new to this Objective-C and JSON thing, so please bare with my questions. I am using Stig Json Framework and ASIHTTPRequest. My overall objective is to send JSON data (containing login credential) to a PHP webservice and ...
[ "php", "iphone", "objective-c", "xcode", "json" ]
1
0
1,045
2
0
2011-06-01T03:28:22.793000
2011-06-01T04:10:18.420000
6,195,964
6,196,056
Variables in both the interface and as a property using Objective-C
What is the difference between @interface URLCacheConnection: NSObject { id delegate; } @property (nonatomic, assign) id delegate; @end and @interface URLCacheConnection: NSObject { } @property (nonatomic, assign) id delegate; @end These two class definitions both seem to behave the same. What is the purpose of defi...
First, the two are not quite identical. For the first, the compiler will allow you to assign any object as the delegate, while for the second it will complain if the object you assign doesn't conform to the URLCacheConnectionDelegate protocol. That's easily enough fixed, of course. In earlier versions of Apple's Object...
Variables in both the interface and as a property using Objective-C What is the difference between @interface URLCacheConnection: NSObject { id delegate; } @property (nonatomic, assign) id delegate; @end and @interface URLCacheConnection: NSObject { } @property (nonatomic, assign) id delegate; @end These two class d...
TITLE: Variables in both the interface and as a property using Objective-C QUESTION: What is the difference between @interface URLCacheConnection: NSObject { id delegate; } @property (nonatomic, assign) id delegate; @end and @interface URLCacheConnection: NSObject { } @property (nonatomic, assign) id delegate; @end...
[ "objective-c", "ios4" ]
2
4
158
3
0
2011-06-01T03:29:05.820000
2011-06-01T03:48:05
6,195,973
6,198,541
GIT - pushing to (GitHub) origin master does nothing
I have forked someone's GIT repository: https://github.com/nippysaurus/toodledo-objc Cloned it to my local machine, showing the origin with the following information: * remote origin Fetch URL: https://nippysaurus@github.com/nippysaurus/toodledo-objc.git Push URL: https://nippysaurus@github.com/nippysaurus/toodledo-obj...
It might be the case that you are on another branch than the master branch, then type: git push origin HEAD:master so git understands that you want to push up current HEAD and not the master branch.
GIT - pushing to (GitHub) origin master does nothing I have forked someone's GIT repository: https://github.com/nippysaurus/toodledo-objc Cloned it to my local machine, showing the origin with the following information: * remote origin Fetch URL: https://nippysaurus@github.com/nippysaurus/toodledo-objc.git Push URL: ht...
TITLE: GIT - pushing to (GitHub) origin master does nothing QUESTION: I have forked someone's GIT repository: https://github.com/nippysaurus/toodledo-objc Cloned it to my local machine, showing the origin with the following information: * remote origin Fetch URL: https://nippysaurus@github.com/nippysaurus/toodledo-obj...
[ "git", "github" ]
21
33
33,251
3
0
2011-06-01T03:30:37.737000
2011-06-01T08:51:36.203000
6,195,985
6,196,145
How do I open Amazon reviews iframe with Nokogiri?
I am able to get the reviews iframe url from Amazon::AWS::ItemSearch but I'm having trouble loading the iframe content into Nokogiri. iframe_url = "http://www.amazon.com/reviews/iframe?[...snip...]" iframe = Nokogiri::HTML(open(iframe_url)) This gives a 403 error: OpenURI::HTTPError: 403 Forbidden If I paste the url in...
It looks like Amazon checks for the HTTP referer value and then returns the appropriate response. I recommend you to try Mechanize to retrieve that page with all of the headers correctly specified.
How do I open Amazon reviews iframe with Nokogiri? I am able to get the reviews iframe url from Amazon::AWS::ItemSearch but I'm having trouble loading the iframe content into Nokogiri. iframe_url = "http://www.amazon.com/reviews/iframe?[...snip...]" iframe = Nokogiri::HTML(open(iframe_url)) This gives a 403 error: Open...
TITLE: How do I open Amazon reviews iframe with Nokogiri? QUESTION: I am able to get the reviews iframe url from Amazon::AWS::ItemSearch but I'm having trouble loading the iframe content into Nokogiri. iframe_url = "http://www.amazon.com/reviews/iframe?[...snip...]" iframe = Nokogiri::HTML(open(iframe_url)) This gives...
[ "ruby", "ruby-on-rails-3", "iframe", "amazon-web-services", "nokogiri" ]
1
2
1,214
2
0
2011-06-01T03:32:53.780000
2011-06-01T04:05:30.110000
6,195,988
6,195,999
About mysql cursor and iterator
Imagine I have a mysql cursor and data read. The amount of data might be very big that I want to deal with one line each time. An easy and straight forward way might be like this: while True: row = cursor.fetchone() if not row: break..... But this doesn't look good, so I wonder whether this way works as imagined: for r...
The MySQLdb cursor class implements the iterator protocol, so you can simply do this: cursor.execute(sql) for row in cursor: print row... Relevant code from MySQLdb.cursors.BaseCursor: def __iter__(self): return iter(self.fetchone, None)
About mysql cursor and iterator Imagine I have a mysql cursor and data read. The amount of data might be very big that I want to deal with one line each time. An easy and straight forward way might be like this: while True: row = cursor.fetchone() if not row: break..... But this doesn't look good, so I wonder whether t...
TITLE: About mysql cursor and iterator QUESTION: Imagine I have a mysql cursor and data read. The amount of data might be very big that I want to deal with one line each time. An easy and straight forward way might be like this: while True: row = cursor.fetchone() if not row: break..... But this doesn't look good, so ...
[ "python", "mysql", "database-cursor", "fetchall" ]
24
49
20,828
1
0
2011-06-01T03:33:39.653000
2011-06-01T03:36:54.683000
6,196,007
6,197,765
OpenGL Shading Language Different Types of Variable (Qualifiers)
I've been writing programs using OpenGL. Recently, I started learning OpenGL Shading Language. I'm a newbie; so please be detailed in your answers. My questions are: What are different types of variable (qualifiers) in GLSL? What are they used for? How are they different from one another? I am only familiar with "varyi...
In OpenGL 3+: varying is deprecated const is for... well, constants! uniform is for per draw call (at most) values in is for input from the previous pipeline stage, i.e. per vertex (or per fragment) values at most, per primitive if using glAttribDivisor and hardware instanciation out is for output to the next stage Reg...
OpenGL Shading Language Different Types of Variable (Qualifiers) I've been writing programs using OpenGL. Recently, I started learning OpenGL Shading Language. I'm a newbie; so please be detailed in your answers. My questions are: What are different types of variable (qualifiers) in GLSL? What are they used for? How ar...
TITLE: OpenGL Shading Language Different Types of Variable (Qualifiers) QUESTION: I've been writing programs using OpenGL. Recently, I started learning OpenGL Shading Language. I'm a newbie; so please be detailed in your answers. My questions are: What are different types of variable (qualifiers) in GLSL? What are the...
[ "opengl", "glsl", "shader", "fragment-shader", "vertex" ]
13
21
6,485
3
0
2011-06-01T03:38:24.857000
2011-06-01T07:37:21.207000
6,196,012
6,196,025
will pagination - passing in an array variable
I have a very specific list of items I'd like to paginate. Up to now, I've been doing @company = Company.paginate(:page => params[:page],:conditions => ["activated=1... etc..."],:per_page => 6,:order => order_by) But I'd like to create my own array @company that wouldn't be possible to retrieve through a single query.....
When loaded, will_paginate extends all arrays with the paginate method: ruby-1.9.2-p180:014 > [].respond_to?(:paginate) => true You can just create your array instance however you want and call paginate on it.
will pagination - passing in an array variable I have a very specific list of items I'd like to paginate. Up to now, I've been doing @company = Company.paginate(:page => params[:page],:conditions => ["activated=1... etc..."],:per_page => 6,:order => order_by) But I'd like to create my own array @company that wouldn't b...
TITLE: will pagination - passing in an array variable QUESTION: I have a very specific list of items I'd like to paginate. Up to now, I've been doing @company = Company.paginate(:page => params[:page],:conditions => ["activated=1... etc..."],:per_page => 6,:order => order_by) But I'd like to create my own array @compa...
[ "ruby-on-rails", "will-paginate" ]
0
2
373
2
0
2011-06-01T03:39:29.643000
2011-06-01T03:42:41.367000
6,196,021
6,197,170
how to save and restore position of map in google map v3
I used Google API version 2 in my previous assignment. There I had used map.savePosition() to save the current position of map and map.returnToSavedPosition() to restore to the saved position. I have searched for the equivalent in api version 3 documentation but could not find relevant results. And if I use map.savePos...
As said above, there's no similar function in V3. It's really easy to implement yourself. Here's one way: var previousPosition; function savePosition(map) { previousPosition = map.getCenter(); } function returnToSavedPosition(map) { if (previousPosition) { map.panTo(previousPosition); // or setCenter } }... then just ...
how to save and restore position of map in google map v3 I used Google API version 2 in my previous assignment. There I had used map.savePosition() to save the current position of map and map.returnToSavedPosition() to restore to the saved position. I have searched for the equivalent in api version 3 documentation but ...
TITLE: how to save and restore position of map in google map v3 QUESTION: I used Google API version 2 in my previous assignment. There I had used map.savePosition() to save the current position of map and map.returnToSavedPosition() to restore to the saved position. I have searched for the equivalent in api version 3 ...
[ "google-maps", "google-maps-api-3" ]
4
6
3,764
2
0
2011-06-01T03:42:09.480000
2011-06-01T06:34:35.900000
6,196,022
6,196,050
Adding properties dynamically to a class
In my class I have private variables and properties like this. private string _itemCOde=string.Empty; private string _itemName=string.Empty; public string ItemCode { get { return _itemCode; } set { _itemCode = value == null? value: value.Trim();} } public string ItemName { get { return _itemName; } set { _itemName = ...
You could use an ExpandoObject: Represents an object whose members can be dynamically added and removed at run time. dynamic expando = new ExpandoObject(); expando.Cost= 42.0; expando.ItemName = "Shoes";
Adding properties dynamically to a class In my class I have private variables and properties like this. private string _itemCOde=string.Empty; private string _itemName=string.Empty; public string ItemCode { get { return _itemCode; } set { _itemCode = value == null? value: value.Trim();} } public string ItemName { get...
TITLE: Adding properties dynamically to a class QUESTION: In my class I have private variables and properties like this. private string _itemCOde=string.Empty; private string _itemName=string.Empty; public string ItemCode { get { return _itemCode; } set { _itemCode = value == null? value: value.Trim();} } public str...
[ "c#" ]
14
23
44,915
6
0
2011-06-01T03:42:15.293000
2011-06-01T03:47:03.997000
6,196,027
6,196,058
need of Static variables and their overhead on jvm
As per the concept about static members, they are created/loaded into the memory when there is first call made to its class. And they are common among all instances of that class. Means they are not re-created or re-itialized etc. In addition, They can be accessed by the class name only. There is no need to create obje...
1) Static members are garbage collected only when the class that defines them is itself collected; this in turn can only happen if the defining ClassLoader is collected. This is common in web application containers and plugin architectures. 2) Yes, defining a large amount of static data can be a bad idea. But it's like...
need of Static variables and their overhead on jvm As per the concept about static members, they are created/loaded into the memory when there is first call made to its class. And they are common among all instances of that class. Means they are not re-created or re-itialized etc. In addition, They can be accessed by t...
TITLE: need of Static variables and their overhead on jvm QUESTION: As per the concept about static members, they are created/loaded into the memory when there is first call made to its class. And they are common among all instances of that class. Means they are not re-created or re-itialized etc. In addition, They ca...
[ "java", "interface", "jvm", "static-members" ]
2
6
1,562
3
0
2011-06-01T03:43:25.370000
2011-06-01T03:48:56.557000
6,196,031
6,204,101
ImageView throwing NullReferenceException on Inflated LinearLayout
I'm having some problems with a NullReferenceExcpetion on an ImageView after I use a LayoutInflater to inflate the parent layout. As you can see in the Layout XML below, I have two TextView's and one ImageView. I can reference both of the TextViews just fine, but not the ImageView. When I drilldown into the properties ...
I somehow got this to work. I'm answering my own question due to the fact that the issue was resolved by other ways that then provided solutions, however, both answers by Jaydeep and CapDroid do work properly for inflating a view. After trying multiple different ways in Inflating my view, I recreated the Layout XML fil...
ImageView throwing NullReferenceException on Inflated LinearLayout I'm having some problems with a NullReferenceExcpetion on an ImageView after I use a LayoutInflater to inflate the parent layout. As you can see in the Layout XML below, I have two TextView's and one ImageView. I can reference both of the TextViews just...
TITLE: ImageView throwing NullReferenceException on Inflated LinearLayout QUESTION: I'm having some problems with a NullReferenceExcpetion on an ImageView after I use a LayoutInflater to inflate the parent layout. As you can see in the Layout XML below, I have two TextView's and one ImageView. I can reference both of ...
[ "android", "imageview", "nullreferenceexception", "layout-inflater" ]
1
1
641
3
0
2011-06-01T03:44:39.440000
2011-06-01T15:57:31.457000
6,196,041
6,196,345
Capturing EditText Lost Focus
I am a long-time, self-taught, amateur VB programmer who is now trying to teach himself Java and Android simultaneously. I say this so you will know that I don't speak the lingo well, and am very very new to these two pursuits. I have developed an Android form that has a series of EditText boxes, the contents of each w...
I just got done doing something similar to this. I handled it by making a for-loop that just got the contents of each edittext by id and added it's text to an array. I did this in the onclick method since i did it all after the user clicked a button. String ohhai; String duh = et.getText().toString(); int number = Inte...
Capturing EditText Lost Focus I am a long-time, self-taught, amateur VB programmer who is now trying to teach himself Java and Android simultaneously. I say this so you will know that I don't speak the lingo well, and am very very new to these two pursuits. I have developed an Android form that has a series of EditText...
TITLE: Capturing EditText Lost Focus QUESTION: I am a long-time, self-taught, amateur VB programmer who is now trying to teach himself Java and Android simultaneously. I say this so you will know that I don't speak the lingo well, and am very very new to these two pursuits. I have developed an Android form that has a ...
[ "java", "android", "android-edittext" ]
3
1
6,238
2
0
2011-06-01T03:46:02.813000
2011-06-01T04:39:14.617000