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,188,770
6,188,846
AS3 load symbol from external swf library
I have 2 SWF, one of them (let's call it Resources.swf ), that contains several symbols (most of them MovieClips) on its library, but, none of them are added into the stage ( the timeline contains only one empty frame), and then, the other swf ( Main.swf ), where I need to import some of the symbols from the other SWF....
After loading the Resources.swf you can create instances of the loaded classes. Here a snippet that may help: var dynClass: Class = Class(getDefinitionByName("fully.qualified.ClassName")); if(dynClass) { var app: Object = new dynClass(); addChild(app as DisplayObject); }
AS3 load symbol from external swf library I have 2 SWF, one of them (let's call it Resources.swf ), that contains several symbols (most of them MovieClips) on its library, but, none of them are added into the stage ( the timeline contains only one empty frame), and then, the other swf ( Main.swf ), where I need to impo...
TITLE: AS3 load symbol from external swf library QUESTION: I have 2 SWF, one of them (let's call it Resources.swf ), that contains several symbols (most of them MovieClips) on its library, but, none of them are added into the stage ( the timeline contains only one empty frame), and then, the other swf ( Main.swf ), wh...
[ "flash", "actionscript-3" ]
1
2
6,627
3
0
2011-05-31T14:02:49.690000
2011-05-31T14:09:21.793000
6,188,771
6,189,106
ZF: ZEND_SUBFORM - how to make element name like list[id][name]?
I create elements for subform: for($i = 1; $i<10; $i++) $name = new Zend_Form_Element_Text("[$i][name]"); But [ and ] will be deleted after dispatch page. So how to setup name like list[id][name]?
Create another Zend_Form_SubForm for each $i: for ($i = 1; $i < 10; $i++) { $subform = new Zend_Form_SubForm(); $subform->addElement('text', 'name'); $mainform->addSubForm($subform, $i); } Text elements will be named "1[name]", "2[name]", and so on. If you want them to be named "list[1][name]" then you need another lev...
ZF: ZEND_SUBFORM - how to make element name like list[id][name]? I create elements for subform: for($i = 1; $i<10; $i++) $name = new Zend_Form_Element_Text("[$i][name]"); But [ and ] will be deleted after dispatch page. So how to setup name like list[id][name]?
TITLE: ZF: ZEND_SUBFORM - how to make element name like list[id][name]? QUESTION: I create elements for subform: for($i = 1; $i<10; $i++) $name = new Zend_Form_Element_Text("[$i][name]"); But [ and ] will be deleted after dispatch page. So how to setup name like list[id][name]? ANSWER: Create another Zend_Form_SubFor...
[ "php", "zend-framework", "zend-form", "subform", "zend-form-sub-form" ]
1
1
381
2
0
2011-05-31T14:02:54.027000
2011-05-31T14:28:51.323000
6,188,780
6,190,412
git + LaTeX workflow
I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my server. I'm also using Kile + Okular...
Changes to your LaTeX workflow: The first step in efficiently managing a Git+LaTeX workflow is to make a few changes to your LaTeX habits. For starters, write each sentence on a separate line. Git was written to version control source code, where each line is distinct and has a specific purpose. When you write document...
git + LaTeX workflow I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on my server. I'm als...
TITLE: git + LaTeX workflow QUESTION: I'm writing a very long document in LaTeX. I have my work computer and my laptop, and I work on them both. I need to keep all the files synchronized between the two computers, and also would like to keep a revision history. I chose git as my DVCS, and I'm hosting my repository on ...
[ "git", "latex", "git-workflow" ]
306
436
101,341
4
0
2011-05-31T14:03:57.207000
2011-05-31T16:09:29.083000
6,188,782
6,192,267
How to add css class to Jquery ui plugin dropdownchecklist
I'm using http://code.google.com/p/dropdown-check-list/ And when dynamically disabling it (in some scenario), want it to be gray.. tried to use.addClass but didn't work.. Thanks!
The DDCL plugin has built-in support for disabling/enabling the widget. Simply call the dropdownchecklist method on your original select element with the 'disable' parameter: $('#myselect').dropdownchecklist('disable'); // to enable: $('#myselect').dropdownchecklist('enable'); When disabled, clicking the widget will no...
How to add css class to Jquery ui plugin dropdownchecklist I'm using http://code.google.com/p/dropdown-check-list/ And when dynamically disabling it (in some scenario), want it to be gray.. tried to use.addClass but didn't work.. Thanks!
TITLE: How to add css class to Jquery ui plugin dropdownchecklist QUESTION: I'm using http://code.google.com/p/dropdown-check-list/ And when dynamically disabling it (in some scenario), want it to be gray.. tried to use.addClass but didn't work.. Thanks! ANSWER: The DDCL plugin has built-in support for disabling/enab...
[ "jquery", "jquery-ui", "jquery-plugins" ]
0
2
2,684
3
0
2011-05-31T14:03:59.690000
2011-05-31T19:05:13.967000
6,188,787
6,189,219
Avoiding the window (WPF) to freeze while using TPL
I am building a WPF which has a button that execute a sql query in sql server (the query could take a long time to run). I want to use TPL for doing that. This code: var result = Task.Factory.StartNew(() => { command.ExecuteNonQuery(); }); gives this exception: ExecuteNonQuery requires an open and available Connection....
You will have to create and open the connection for this command within the Task's body. Either that or don't close the connection outside the Task, which I assume is what you're doing here, but can't tell from the one line of code you pasted. I would personally do it all inside the Task body. Why should the user have ...
Avoiding the window (WPF) to freeze while using TPL I am building a WPF which has a button that execute a sql query in sql server (the query could take a long time to run). I want to use TPL for doing that. This code: var result = Task.Factory.StartNew(() => { command.ExecuteNonQuery(); }); gives this exception: Execut...
TITLE: Avoiding the window (WPF) to freeze while using TPL QUESTION: I am building a WPF which has a button that execute a sql query in sql server (the query could take a long time to run). I want to use TPL for doing that. This code: var result = Task.Factory.StartNew(() => { command.ExecuteNonQuery(); }); gives this...
[ "wpf", "window", "freeze", "task-parallel-library", "ui-thread" ]
3
7
2,903
2
0
2011-05-31T14:04:17.760000
2011-05-31T14:35:26.183000
6,188,796
6,189,368
Reading Safari database contents
I'm writing data to the Safari database storage, this is written in a http page. I then try to read it from a https page, the database is there but all of the tables and rows have dissapeared. Is this expected bahviour as it's changing between secure and insecure connections? Thanks for your time.
As far as i know, all html5 webstorages are under same origin policy. So you can get data only if protocol, host and port are the same for both your pages.
Reading Safari database contents I'm writing data to the Safari database storage, this is written in a http page. I then try to read it from a https page, the database is there but all of the tables and rows have dissapeared. Is this expected bahviour as it's changing between secure and insecure connections? Thanks for...
TITLE: Reading Safari database contents QUESTION: I'm writing data to the Safari database storage, this is written in a http page. I then try to read it from a https page, the database is there but all of the tables and rows have dissapeared. Is this expected bahviour as it's changing between secure and insecure conne...
[ "javascript", "database", "http", "https", "safari" ]
0
0
57
1
0
2011-05-31T14:04:49.277000
2011-05-31T14:47:11.823000
6,188,799
6,213,358
looping mysql_real_connect or what
consider following c code: int main (int argc, char *argv[]) { MYSQL *sql_handle; fprintf(stdout,"initializing handle..\n"); sql_handle = mysql_init(sql_handle); fprintf(stdout,"connecting to database..\n"); mysql_real_connect(sql_handle,NULL,NULL, NULL,"test",0,NULL,0); fprintf(stdout,"connection established\n"); m...
renaming the method void connect(void) to void connect_to_database(void) solved that issue for me
looping mysql_real_connect or what consider following c code: int main (int argc, char *argv[]) { MYSQL *sql_handle; fprintf(stdout,"initializing handle..\n"); sql_handle = mysql_init(sql_handle); fprintf(stdout,"connecting to database..\n"); mysql_real_connect(sql_handle,NULL,NULL, NULL,"test",0,NULL,0); fprintf(st...
TITLE: looping mysql_real_connect or what QUESTION: consider following c code: int main (int argc, char *argv[]) { MYSQL *sql_handle; fprintf(stdout,"initializing handle..\n"); sql_handle = mysql_init(sql_handle); fprintf(stdout,"connecting to database..\n"); mysql_real_connect(sql_handle,NULL,NULL, NULL,"test",0,NU...
[ "mysql", "c" ]
1
1
1,270
3
0
2011-05-31T14:05:17.513000
2011-06-02T10:32:24.707000
6,188,812
6,188,969
Is it possible to track inventory and update item quanities in database for purchases made with Paypal?
I know Java, but am no expert. I use JSP pages and Java Servlets for my site, with a Mysql database. For a site that is selling products, I want to use Paypal payment buttons. Specifically the "Add to Cart" and "View Cart" buttons so the site can have a shopping cart feel. I want to keep track of inventory, so when a p...
Yes, you can use IPN (instant payment notification). Everything you need is here https://www.paypal.com/ipn with examples. Just simply update the inventory after the purchase is made and if it is down to zero, disable the payment button. The problem is very straightforward and all you have to do is go over the IPN docu...
Is it possible to track inventory and update item quanities in database for purchases made with Paypal? I know Java, but am no expert. I use JSP pages and Java Servlets for my site, with a Mysql database. For a site that is selling products, I want to use Paypal payment buttons. Specifically the "Add to Cart" and "View...
TITLE: Is it possible to track inventory and update item quanities in database for purchases made with Paypal? QUESTION: I know Java, but am no expert. I use JSP pages and Java Servlets for my site, with a Mysql database. For a site that is selling products, I want to use Paypal payment buttons. Specifically the "Add ...
[ "java", "jsp", "shopping-cart", "paypal" ]
0
0
731
1
0
2011-05-31T14:06:34.050000
2011-05-31T14:18:58.380000
6,188,813
6,188,881
File Delete and Rename in Java
I have the following Java code which will search in an xml for a specific tag and then will add some text to it and save that file. I couldnt find a way to rename the emporary file to the original file. Please suggest. import java.io.*; class ModifyXML { public void readMyFile(String inputLine) throws Exception { St...
First delete the original file and then rename the new file: File inputFile = new File("InfectiousDisease.xml"); File outFile = new File("tempFile.tmp"); if(inputFile.delete()){ outFile.renameTo(inputFile); }
File Delete and Rename in Java I have the following Java code which will search in an xml for a specific tag and then will add some text to it and save that file. I couldnt find a way to rename the emporary file to the original file. Please suggest. import java.io.*; class ModifyXML { public void readMyFile(String in...
TITLE: File Delete and Rename in Java QUESTION: I have the following Java code which will search in an xml for a specific tag and then will add some text to it and save that file. I couldnt find a way to rename the emporary file to the original file. Please suggest. import java.io.*; class ModifyXML { public void re...
[ "java", "file" ]
2
8
6,140
4
0
2011-05-31T14:06:35.887000
2011-05-31T14:12:35.147000
6,188,821
6,188,874
Can iMac use CLLocationManager?
Or is it just for IPhone? By extension, can IPhone simulator use CLLocationManager
Since Mac OS X Snow Leopard, an iMac (or any other Mac) has the CoreLocation framework, including CLLocationManager. The iPhone simulator uses directly CoreLocation on the Mac since the iOS 4 SDK if I'm correct (before that using CoreLocation on the simulator would always point to the Apple headquarters).
Can iMac use CLLocationManager? Or is it just for IPhone? By extension, can IPhone simulator use CLLocationManager
TITLE: Can iMac use CLLocationManager? QUESTION: Or is it just for IPhone? By extension, can IPhone simulator use CLLocationManager ANSWER: Since Mac OS X Snow Leopard, an iMac (or any other Mac) has the CoreLocation framework, including CLLocationManager. The iPhone simulator uses directly CoreLocation on the Mac si...
[ "objective-c", "xcode", "xcode4" ]
2
4
261
2
0
2011-05-31T14:06:55.973000
2011-05-31T14:12:11.097000
6,188,827
6,188,894
Inheritance vs. interface in C#
Possible Duplicates: Interface vs Base class When should I choose inheritance over an interface when designing C# class libraries? So I'm writing my first real program in C#. The program will scrape data from four different websites. My plan is to have one parent class that will look like this: class Scraper { string s...
Class inheritance represents an "is-a" relationship, e.g., a Tank is a Vehicle. If your situation doesn't at least meet this, choose interface over inheritance. If the proposed base class doesn't provide default implementations for your methods, this would be another reason to choose interface over inheritance. In C#, ...
Inheritance vs. interface in C# Possible Duplicates: Interface vs Base class When should I choose inheritance over an interface when designing C# class libraries? So I'm writing my first real program in C#. The program will scrape data from four different websites. My plan is to have one parent class that will look lik...
TITLE: Inheritance vs. interface in C# QUESTION: Possible Duplicates: Interface vs Base class When should I choose inheritance over an interface when designing C# class libraries? So I'm writing my first real program in C#. The program will scrape data from four different websites. My plan is to have one parent class ...
[ "c#", "inheritance", "interface" ]
37
60
52,896
9
0
2011-05-31T14:07:39.157000
2011-05-31T14:13:01.847000
6,188,833
6,188,918
Use KeyPress event logic for Textbox.Text assignment
I have the below code on the KeyPress event of a textbox howver a need has now come in meaning I have to do myTextbox.Text = "A input string" Private Sub ChequeAmountKeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles txtChequeAmount.KeyPress Dim tb As TextBox = sender I...
What you need to do is refactor this code into a method and then call that method from the relevant events.
Use KeyPress event logic for Textbox.Text assignment I have the below code on the KeyPress event of a textbox howver a need has now come in meaning I have to do myTextbox.Text = "A input string" Private Sub ChequeAmountKeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEventArgs) Handles tx...
TITLE: Use KeyPress event logic for Textbox.Text assignment QUESTION: I have the below code on the KeyPress event of a textbox howver a need has now come in meaning I have to do myTextbox.Text = "A input string" Private Sub ChequeAmountKeyPress(ByVal sender As System.Object, ByVal e As System.Windows.Forms.KeyPressEve...
[ "c#", "vb.net", "winforms" ]
0
0
887
2
0
2011-05-31T14:08:20.390000
2011-05-31T14:15:08.383000
6,188,837
6,188,892
Does the Facebook's live stream social plugin allow tag filtering?
I'd like to build a feature similar to Envolve's chat plugin on my site that would allow users to chat (no webcams) around specific topics, using Facebook Connect. Users must also be able to see present users that are not connected to them so the XMPP option is out. The live stream social plugin isn't sufficient becaus...
Can't you specify an xid... "If you have multiple live stream boxes on the same page, specify a unique xid for each." http://developers.facebook.com/docs/reference/plugins/live-stream/
Does the Facebook's live stream social plugin allow tag filtering? I'd like to build a feature similar to Envolve's chat plugin on my site that would allow users to chat (no webcams) around specific topics, using Facebook Connect. Users must also be able to see present users that are not connected to them so the XMPP o...
TITLE: Does the Facebook's live stream social plugin allow tag filtering? QUESTION: I'd like to build a feature similar to Envolve's chat plugin on my site that would allow users to chat (no webcams) around specific topics, using Facebook Connect. Users must also be able to see present users that are not connected to ...
[ "facebook", "facebook-social-plugins" ]
0
0
302
2
0
2011-05-31T14:08:51.393000
2011-05-31T14:13:00.567000
6,188,845
6,188,933
Accessing tweets from home timeline in Twitter using oAuth in PHP?
I am trying to print the first tweet in the user timeline. $hometimeline = $twitterObj->get_statusesHome_timeline(); $stream=$hometimeline->responseText; $user=$stream[0]->user; $tweet=$user->text; echo $tweet; This just won't print anything. What am I doing wrong here? If I echo $hometimeline->responseText it shows on...
Try this instead: $hometimeline = $twitterObj->get_statusesHome_timeline(); $stream = json_decode( $hometimeline->responseText ); $user=$stream[0]->user; $tweet=$user->text; echo $tweet; json_decode turns the JSON string that you are receiving into a PHP object.
Accessing tweets from home timeline in Twitter using oAuth in PHP? I am trying to print the first tweet in the user timeline. $hometimeline = $twitterObj->get_statusesHome_timeline(); $stream=$hometimeline->responseText; $user=$stream[0]->user; $tweet=$user->text; echo $tweet; This just won't print anything. What am I ...
TITLE: Accessing tweets from home timeline in Twitter using oAuth in PHP? QUESTION: I am trying to print the first tweet in the user timeline. $hometimeline = $twitterObj->get_statusesHome_timeline(); $stream=$hometimeline->responseText; $user=$stream[0]->user; $tweet=$user->text; echo $tweet; This just won't print an...
[ "php", "twitter", "twitter-oauth" ]
1
0
739
2
0
2011-05-31T14:09:19.673000
2011-05-31T14:16:16.677000
6,188,852
6,190,404
disable online driver search on windows 7 programatically
I am working on a program that requires to install a driver for Plug and Play. My issue is that the first time the device plugs into, by default, windows 7 32-bit automatically search online for drivers that better match to device. As i observe, it takes too long (15m) to correctly install the driver. How can i turn of...
Apparently you do this through GPO, as described here: http://www.verboon.info/index.php/2010/12/windows-7-device-installation-without-administrative-rights/ Look for "Prevent Clients from searching for drivers on Windows Update" on this page. Read up on applying GPO programatically and you should probably be able to g...
disable online driver search on windows 7 programatically I am working on a program that requires to install a driver for Plug and Play. My issue is that the first time the device plugs into, by default, windows 7 32-bit automatically search online for drivers that better match to device. As i observe, it takes too lon...
TITLE: disable online driver search on windows 7 programatically QUESTION: I am working on a program that requires to install a driver for Plug and Play. My issue is that the first time the device plugs into, by default, windows 7 32-bit automatically search online for drivers that better match to device. As i observe...
[ "winapi", "windows-7", "device-driver" ]
1
1
3,257
2
0
2011-05-31T14:09:56.523000
2011-05-31T16:08:40.660000
6,188,855
6,191,712
Change 'From' field of magento contact form email to the sender
How would one go about changing the 'From' field of the contact form email to that of the sender's? For instance, if a customer was to fill in the form with the email 'test@test.com', how can I make the generated email be from 'test@test.com'? I've looked at the 'email sender' field in the system admin panels, but this...
The place where this gets sent is in app/code/core/Mage/Contacts/controllers/IndexController.php at abouts line 100. It looks like the reply-to address for the emails is already set to the email address from the post, so if you're just looking to get easier replies, I'd suggest not fooling with it. Another issue that y...
Change 'From' field of magento contact form email to the sender How would one go about changing the 'From' field of the contact form email to that of the sender's? For instance, if a customer was to fill in the form with the email 'test@test.com', how can I make the generated email be from 'test@test.com'? I've looked ...
TITLE: Change 'From' field of magento contact form email to the sender QUESTION: How would one go about changing the 'From' field of the contact form email to that of the sender's? For instance, if a customer was to fill in the form with the email 'test@test.com', how can I make the generated email be from 'test@test....
[ "email", "magento", "contact-form" ]
4
7
8,374
2
0
2011-05-31T14:10:06.820000
2011-05-31T18:15:10.163000
6,188,860
6,191,623
Looping in JasperReports
Is there a way to do a single line loop in a TextField expression? I know that it allows for ternary operations, but what about loops. For example if I wanted a series of numbers of five numbers after a given field, in the detail, how would you display that? For example The field b has a value of 4. How would you make ...
The solution to this is to create a scriptlet. There is no functionality inside the expressions that would allow for a loop.
Looping in JasperReports Is there a way to do a single line loop in a TextField expression? I know that it allows for ternary operations, but what about loops. For example if I wanted a series of numbers of five numbers after a given field, in the detail, how would you display that? For example The field b has a value ...
TITLE: Looping in JasperReports QUESTION: Is there a way to do a single line loop in a TextField expression? I know that it allows for ternary operations, but what about loops. For example if I wanted a series of numbers of five numbers after a given field, in the detail, how would you display that? For example The fi...
[ "jasper-reports" ]
4
3
4,656
1
0
2011-05-31T14:10:39.470000
2011-05-31T18:06:15.147000
6,188,861
6,188,920
javascript anonymous function parameter passing
I have some javascript code (within an object): toggle: function() { var me = this; var handler = function() { me.progress() }; me.intervalId = setInterval(handler, me.intervalTime); //...More code } I'm kind of new to javascript, so doing the above as far as I can tell actually passes the me variable into anonymous th...
You can use ".bind()": var handler = function() { this.progress(); }.bind(this); New browsers have "bind()", and the Mozilla docs have a solid implementation you can use to patch older browsers.
javascript anonymous function parameter passing I have some javascript code (within an object): toggle: function() { var me = this; var handler = function() { me.progress() }; me.intervalId = setInterval(handler, me.intervalTime); //...More code } I'm kind of new to javascript, so doing the above as far as I can tell a...
TITLE: javascript anonymous function parameter passing QUESTION: I have some javascript code (within an object): toggle: function() { var me = this; var handler = function() { me.progress() }; me.intervalId = setInterval(handler, me.intervalTime); //...More code } I'm kind of new to javascript, so doing the above as f...
[ "javascript" ]
19
30
41,117
5
0
2011-05-31T14:10:52.403000
2011-05-31T14:15:12.807000
6,188,862
6,188,946
Access running java program from shell command
I am looking for a way to access running java program from command line. The best woud be something that does the following: Starting java app: bash$java -jar MyBundle.jar App Accessing app: bash$test.sh param1 param2 So, test.sh calls App from MyBundle.jar somehow and passes values param1 & param2. Important: I am loo...
I think you need to take a client-server approach. You app is the server, it runs as a background process and listens for connections on some port. And your client makes requests to the server and gets back the response. A fast and simple way of implementing this in java would be to wrap your app in the Jetty servlet c...
Access running java program from shell command I am looking for a way to access running java program from command line. The best woud be something that does the following: Starting java app: bash$java -jar MyBundle.jar App Accessing app: bash$test.sh param1 param2 So, test.sh calls App from MyBundle.jar somehow and pas...
TITLE: Access running java program from shell command QUESTION: I am looking for a way to access running java program from command line. The best woud be something that does the following: Starting java app: bash$java -jar MyBundle.jar App Accessing app: bash$test.sh param1 param2 So, test.sh calls App from MyBundle.j...
[ "java", "unix", "command-line", "nio" ]
0
1
795
2
0
2011-05-31T14:10:53.557000
2011-05-31T14:16:58.817000
6,188,863
6,195,379
CoreGraphics Pixel Manipulation Blue
I'm manipulating pixels to turn the greyscale and all appears well, except at the bottom of the image I have blue colored pixels. This appears more the smaller in dimensions the image is and disappears after a certain point. Can anyone see what I'm doing wrong? CGImageRef imageRef = image.CGImage; NSUInteger width = C...
The problem is I am assuming CGImageGetWidth(imageRef) == CGImageGetBytesPerRow(imageRef) - which isn't always the case. This was pointed out to me on the Apple developer forums and is correct. I've changed to use the length of the dataref and now it works as expected. NSUInteger length = CFDataGetLength(dataref);
CoreGraphics Pixel Manipulation Blue I'm manipulating pixels to turn the greyscale and all appears well, except at the bottom of the image I have blue colored pixels. This appears more the smaller in dimensions the image is and disappears after a certain point. Can anyone see what I'm doing wrong? CGImageRef imageRef =...
TITLE: CoreGraphics Pixel Manipulation Blue QUESTION: I'm manipulating pixels to turn the greyscale and all appears well, except at the bottom of the image I have blue colored pixels. This appears more the smaller in dimensions the image is and disappears after a certain point. Can anyone see what I'm doing wrong? CGI...
[ "iphone", "objective-c", "core-graphics", "pixel" ]
1
1
504
2
0
2011-05-31T14:10:56.840000
2011-06-01T01:38:43.097000
6,188,866
6,189,635
Are there tutorials of how to use NSOperationQueue without blocks?
My app must run on iOS 3.2 and the methods such as -addOperationWithBlock: only work in > 4.0. But NSOperationQueue was available since iOS 2.0 so I'd like to give it a try the "old way". Does anyone know of a handy tutorial that shows the basics of how to use NSOperationQueue without blocks?
it's pretty straightforward with Invocation operations. These are operations that allow you to send a message to a particular object with some object parameter (optional). So given this method that you want to invoke: - (void)doSomething { NSLog (@"Did it!"); } You can do something like this to make it happen: // Get ...
Are there tutorials of how to use NSOperationQueue without blocks? My app must run on iOS 3.2 and the methods such as -addOperationWithBlock: only work in > 4.0. But NSOperationQueue was available since iOS 2.0 so I'd like to give it a try the "old way". Does anyone know of a handy tutorial that shows the basics of how...
TITLE: Are there tutorials of how to use NSOperationQueue without blocks? QUESTION: My app must run on iOS 3.2 and the methods such as -addOperationWithBlock: only work in > 4.0. But NSOperationQueue was available since iOS 2.0 so I'd like to give it a try the "old way". Does anyone know of a handy tutorial that shows...
[ "multithreading", "ios", "performance", "nsoperation", "nsoperationqueue" ]
2
6
2,644
3
0
2011-05-31T14:11:10.383000
2011-05-31T15:06:44.190000
6,188,873
6,188,919
Event click on ListView (extends ListActivity)
i have this code but i can't see the action when i click on a item from the list. This code shows me the info on ArrayList profilesArrayList but i dont know how i check what item i am selecting form the listview. Anyone can help me? profilesArrayList = new ArrayList (); profilesArrayList = copyProfilesToArrayList(); Pr...
If your container class for this code is the ListActivity, just override the onListItemClick for that class, rather than set it as an OnItemClickListener for the view. That works for me public class ProfileList extends ListActivity { private ArrayList profilesArrayList; @Override public void onCreate ( Bundle savedInst...
Event click on ListView (extends ListActivity) i have this code but i can't see the action when i click on a item from the list. This code shows me the info on ArrayList profilesArrayList but i dont know how i check what item i am selecting form the listview. Anyone can help me? profilesArrayList = new ArrayList (); pr...
TITLE: Event click on ListView (extends ListActivity) QUESTION: i have this code but i can't see the action when i click on a item from the list. This code shows me the info on ArrayList profilesArrayList but i dont know how i check what item i am selecting form the listview. Anyone can help me? profilesArrayList = ne...
[ "java", "android", "expandablelistview" ]
1
0
1,344
2
0
2011-05-31T14:12:07.130000
2011-05-31T14:15:12.807000
6,188,879
6,189,375
Multiple patterns with ack-grep?
Is it possible (and how) to chain patterns with ack (ack-grep on some distributions of Linux) like I'm used to with grep? e.g. grep "foo" somefile.c | grep -v "bar"...to match all lines with "foo" but without "bar".
ack uses Perl regular expressions, and those allow lookahead assertions: ^(?!.*bar).*foo.*$ will match a line that contains foo but doesn't contain bar. I'm not familiar with the usage of ack, but something like this should work: ack '^(?!.*bar).*foo.*$' myfile
Multiple patterns with ack-grep? Is it possible (and how) to chain patterns with ack (ack-grep on some distributions of Linux) like I'm used to with grep? e.g. grep "foo" somefile.c | grep -v "bar"...to match all lines with "foo" but without "bar".
TITLE: Multiple patterns with ack-grep? QUESTION: Is it possible (and how) to chain patterns with ack (ack-grep on some distributions of Linux) like I'm used to with grep? e.g. grep "foo" somefile.c | grep -v "bar"...to match all lines with "foo" but without "bar". ANSWER: ack uses Perl regular expressions, and those...
[ "regex", "grep", "ack" ]
7
11
3,805
1
0
2011-05-31T14:12:28.330000
2011-05-31T14:47:26.017000
6,188,880
6,188,992
resource bundle java
Is it possible to maintain the resource bundle in a folder structure something similar to the following; 1. us\en 2. ae\en 3. ae\ar The resource bundle file name will be the same but maintained in different folders. I know Java recomends myresource_en_US.properties But I need to maintained them in folders and use the r...
Yes, you can control the loading with a custom Control. Here's a kickoff example: public class FolderControl extends Control { public ResourceBundle newBundle (String baseName, Locale locale, String format, ClassLoader loader, boolean reload) throws IllegalAccessException, InstantiationException, IOException { String r...
resource bundle java Is it possible to maintain the resource bundle in a folder structure something similar to the following; 1. us\en 2. ae\en 3. ae\ar The resource bundle file name will be the same but maintained in different folders. I know Java recomends myresource_en_US.properties But I need to maintained them in ...
TITLE: resource bundle java QUESTION: Is it possible to maintain the resource bundle in a folder structure something similar to the following; 1. us\en 2. ae\en 3. ae\ar The resource bundle file name will be the same but maintained in different folders. I know Java recomends myresource_en_US.properties But I need to m...
[ "java", "resourcebundle" ]
5
7
5,802
2
0
2011-05-31T14:12:32.963000
2011-05-31T14:21:15.163000
6,188,883
6,189,218
Set Default for Radio Button in C++
I have 2 Radio Buttons in a MFC application designed with C++, I would like to set the focus on the second Radio button when the app is launched. Does anyone know how I should do this? I am using VS2005. Thanks.
Something like this should do it: BOOL myDlg::OnInitDialog() { CDialog::OnInitDialog(); pButton2 = (CButton*)this->GetDlgItem(IDC_RADIO2); pButton2->SetFocus(); pButton2->SetCheck(true); }
Set Default for Radio Button in C++ I have 2 Radio Buttons in a MFC application designed with C++, I would like to set the focus on the second Radio button when the app is launched. Does anyone know how I should do this? I am using VS2005. Thanks.
TITLE: Set Default for Radio Button in C++ QUESTION: I have 2 Radio Buttons in a MFC application designed with C++, I would like to set the focus on the second Radio button when the app is launched. Does anyone know how I should do this? I am using VS2005. Thanks. ANSWER: Something like this should do it: BOOL myDlg:...
[ "visual-c++" ]
1
4
7,325
1
0
2011-05-31T14:12:40.593000
2011-05-31T14:35:26.143000
6,188,888
6,189,048
Search for a particular control from ControlCollection using LINQ or any fast way
I have a set of control collection, and I am looking for a way to get a particular control by ID added at runtime, is there any fast, optimized way to do this? Here is a code: HtmlTableRow row = new HtmlTableRow(); row.ID = string.Format("tr{0}", key); tableParameters.Rows.Add(row); HtmlTableCell cellParameterName = n...
What about Control.FindControl? Supose your table ID is tableExample: var tr = tableExample.FindControl("tr5"); But remember that it isn't recursive. So, if you want to get the lblParameter5, you could find each parent first until that element: var tr = tableExample.FindControl("tr5") as HtmlTableRow; var td = tr.FindC...
Search for a particular control from ControlCollection using LINQ or any fast way I have a set of control collection, and I am looking for a way to get a particular control by ID added at runtime, is there any fast, optimized way to do this? Here is a code: HtmlTableRow row = new HtmlTableRow(); row.ID = string.Format(...
TITLE: Search for a particular control from ControlCollection using LINQ or any fast way QUESTION: I have a set of control collection, and I am looking for a way to get a particular control by ID added at runtime, is there any fast, optimized way to do this? Here is a code: HtmlTableRow row = new HtmlTableRow(); row.I...
[ "c#", "asp.net", "controls" ]
1
3
4,656
1
0
2011-05-31T14:12:56.370000
2011-05-31T14:24:58.313000
6,188,895
6,189,385
Migration from NHibernate to Entity Framework 4.1?
I am aware that this question may be a little bit dangerous to ask, but I really need some opinion with this. We've got our system, it's an website (will be popular web portal, we use MVC3) and before I was here rest of my co-woorkers chose NHibernate as their OR Mapper solution, and they started to write criteria quer...
I have to agree with @Ladislav, EF and LINQ is nice it just works compared to NHibernate LINQ, however the SQL EF generates sometimes is pretty terrible and is not terribly performant and you will be forced to recode complex queries into views and SP's etc. Nhibernate also can fall into this trap however having many di...
Migration from NHibernate to Entity Framework 4.1? I am aware that this question may be a little bit dangerous to ask, but I really need some opinion with this. We've got our system, it's an website (will be popular web portal, we use MVC3) and before I was here rest of my co-woorkers chose NHibernate as their OR Mappe...
TITLE: Migration from NHibernate to Entity Framework 4.1? QUESTION: I am aware that this question may be a little bit dangerous to ask, but I really need some opinion with this. We've got our system, it's an website (will be popular web portal, we use MVC3) and before I was here rest of my co-woorkers chose NHibernate...
[ "c#", "linq", "nhibernate", "entity-framework", "entity-framework-4.1" ]
7
6
5,457
5
0
2011-05-31T14:13:09.017000
2011-05-31T14:48:26.160000
6,188,901
6,189,015
Reading the content of web page
Hi I want to read the content of a web page that contains a German characters using java, unfortunately, the German characters appear as strange characters. Any help please here is my code: String link = "some german link"; URL url = new URL(link); BufferedReader in = new BufferedReader(new InputStreamReader(url.openS...
You have to set the correct encoding. You can find the encoding in the HTTP header: Content-Type: text/html; charset=ISO-8859-1 This may be overwritten in the (X)HTML document, see HTML Character encodings I can imagine that you have to consider many different additional issues to pars a web page error free. But there ...
Reading the content of web page Hi I want to read the content of a web page that contains a German characters using java, unfortunately, the German characters appear as strange characters. Any help please here is my code: String link = "some german link"; URL url = new URL(link); BufferedReader in = new BufferedReader...
TITLE: Reading the content of web page QUESTION: Hi I want to read the content of a web page that contains a German characters using java, unfortunately, the German characters appear as strange characters. Any help please here is my code: String link = "some german link"; URL url = new URL(link); BufferedReader in = ...
[ "java", "character-encoding", "inputstreamreader" ]
2
2
6,128
4
0
2011-05-31T14:13:35.337000
2011-05-31T14:22:31.623000
6,188,902
6,189,168
Creating a vector from a file in R
I am new to R and my question should be trivial. I need to create a word cloud from a txt file containing the words and their occurrence number. For that purposes I am using the snippets package. As it can be seen at the bottom of the link, first I have to create a vector (is that right that words is a vector?) like be...
words is a named vector, the distinction is important in the context of the cloud() function if I read the help correctly. Write the data out correctly to a file: write.table(words, file = "words.txt") Create your word occurrence file like the txt file created. When you read it back in to R, you need to do a little man...
Creating a vector from a file in R I am new to R and my question should be trivial. I need to create a word cloud from a txt file containing the words and their occurrence number. For that purposes I am using the snippets package. As it can be seen at the bottom of the link, first I have to create a vector (is that rig...
TITLE: Creating a vector from a file in R QUESTION: I am new to R and my question should be trivial. I need to create a word cloud from a txt file containing the words and their occurrence number. For that purposes I am using the snippets package. As it can be seen at the bottom of the link, first I have to create a v...
[ "r" ]
9
5
16,396
2
0
2011-05-31T14:13:36.833000
2011-05-31T14:32:38.763000
6,188,907
6,189,009
timespec on windows compilers
On posix it is possible to use timespec to calculate accurate time length (like seconds and milliseconds). Unfortunately I need to migrate to windows with Visual Studio compiler. The VS time.h library doesn't declare timespec so I'm looking for other options. As far as could search is it possible to use clock and time_...
The function GetTickCount is usually used for that. Also a similiar thread: C++ timing, milliseconds since last whole second
timespec on windows compilers On posix it is possible to use timespec to calculate accurate time length (like seconds and milliseconds). Unfortunately I need to migrate to windows with Visual Studio compiler. The VS time.h library doesn't declare timespec so I'm looking for other options. As far as could search is it p...
TITLE: timespec on windows compilers QUESTION: On posix it is possible to use timespec to calculate accurate time length (like seconds and milliseconds). Unfortunately I need to migrate to windows with Visual Studio compiler. The VS time.h library doesn't declare timespec so I'm looking for other options. As far as co...
[ "c++", "visual-studio", "elapsedtime", "timespec" ]
2
2
7,898
2
0
2011-05-31T14:13:45.163000
2011-05-31T14:22:14.520000
6,188,909
6,190,520
Autofac class with default parameter -> Override att runtime
I want to be able to resolve a class with default parameters sent to the constructor but i want to be able to override this when i specify a parameter. Here is how i register: builder.RegisterType >().As >().WithParameter( new NamedParameter("solrUrl", ConfigurationManager.AppSettings["UrlWeb"])).SingleInstance(); buil...
Below is a complete and simple example showing how to override at runtime, a NamedParameter configured at registration time. Important: The parameter name you use for the NamedParameter must match the parameter name in the constructor of the class you register and then resolve. In the example below, the parameter for T...
Autofac class with default parameter -> Override att runtime I want to be able to resolve a class with default parameters sent to the constructor but i want to be able to override this when i specify a parameter. Here is how i register: builder.RegisterType >().As >().WithParameter( new NamedParameter("solrUrl", Config...
TITLE: Autofac class with default parameter -> Override att runtime QUESTION: I want to be able to resolve a class with default parameters sent to the constructor but i want to be able to override this when i specify a parameter. Here is how i register: builder.RegisterType >().As >().WithParameter( new NamedParameter...
[ "autofac" ]
0
6
2,326
1
0
2011-05-31T14:14:04.963000
2011-05-31T16:18:55.967000
6,188,914
6,189,175
Is there any way to prevent ncurses based programs from running?
Hey there, I'm building a remote shell server that interfaces between a text-only client and a virtual shell. It works perfectly when using regular shell commands, but the first thing that people try after that is vim, which promptly drives my server crazy and can't even be closed remotely. Is there any way to detect n...
You can declare the capabilities your shell has, by setting the TERM environment variable to the correct value. For instance, if your shell has the same capabilities as the vt100 terminal, export TERM to the correct value, and programs like vim will respect that. To run vim in vt100-mode, try: TERM=vt100 vim You could ...
Is there any way to prevent ncurses based programs from running? Hey there, I'm building a remote shell server that interfaces between a text-only client and a virtual shell. It works perfectly when using regular shell commands, but the first thing that people try after that is vim, which promptly drives my server craz...
TITLE: Is there any way to prevent ncurses based programs from running? QUESTION: Hey there, I'm building a remote shell server that interfaces between a text-only client and a virtual shell. It works perfectly when using regular shell commands, but the first thing that people try after that is vim, which promptly dri...
[ "ruby", "shell", "unix", "virtual", "ncurses" ]
0
5
191
1
0
2011-05-31T14:14:53.733000
2011-05-31T14:33:04.460000
6,188,916
6,198,080
UpdatePanel not firing inside Wizard
I have an Update panel within a wizard:...... protected void GoButton_Click(object sender, EventArgs e) { ProgressInd.Text = "Progress... Moving"; } When I take the update panel out of the wizard it works nicely but inside the wizard the click event just won't fire. I'm using Firefox to test, but IE doesn't work eithe...
For the record. Paolo spotted my problem. There were page validators that were preventing the event from firing.
UpdatePanel not firing inside Wizard I have an Update panel within a wizard:...... protected void GoButton_Click(object sender, EventArgs e) { ProgressInd.Text = "Progress... Moving"; } When I take the update panel out of the wizard it works nicely but inside the wizard the click event just won't fire. I'm using Firef...
TITLE: UpdatePanel not firing inside Wizard QUESTION: I have an Update panel within a wizard:...... protected void GoButton_Click(object sender, EventArgs e) { ProgressInd.Text = "Progress... Moving"; } When I take the update panel out of the wizard it works nicely but inside the wizard the click event just won't fir...
[ "c#", "asp.net", "updatepanel", "wizard" ]
0
1
1,536
1
0
2011-05-31T14:15:06.687000
2011-06-01T08:07:26.747000
6,188,921
6,189,171
Can EXISTS make this query more efficient?
I want to retrieve only students who have unacceptable grades. My original query is: SELECT ssm.STUDENT_ID,COUNT(srcg.GRADE_TITLE) AS POSTED_GRADES FROM STUDENT_ENROLLMENT ssm, STUDENT_REPORT_CARD_GRADES srcg WHERE ssm.SYEAR='2010' AND ssm.SCHOOL_ID='12' AND ssm.GRADE_ID IN ('140','141','142','143','144','145') AND src...
In my experience EXISTS is not something you should use if you're interested in efficiency. Try the following: SELECT DISTINCT ssm.STUDENT_ID FROM STUDENT_ENROLLMENT ssm INNER JOIN STUDENT_REPORT_CARD_GRADES srcg ON (srcg.STUDENT_ID = ssm.STUDENT_ID) WHERE ssm.SYEAR='2010' AND ssm.SCHOOL_ID = '12' AND ssm.GRADE_ID IN (...
Can EXISTS make this query more efficient? I want to retrieve only students who have unacceptable grades. My original query is: SELECT ssm.STUDENT_ID,COUNT(srcg.GRADE_TITLE) AS POSTED_GRADES FROM STUDENT_ENROLLMENT ssm, STUDENT_REPORT_CARD_GRADES srcg WHERE ssm.SYEAR='2010' AND ssm.SCHOOL_ID='12' AND ssm.GRADE_ID IN ('...
TITLE: Can EXISTS make this query more efficient? QUESTION: I want to retrieve only students who have unacceptable grades. My original query is: SELECT ssm.STUDENT_ID,COUNT(srcg.GRADE_TITLE) AS POSTED_GRADES FROM STUDENT_ENROLLMENT ssm, STUDENT_REPORT_CARD_GRADES srcg WHERE ssm.SYEAR='2010' AND ssm.SCHOOL_ID='12' AND ...
[ "sql", "select", "exists" ]
2
0
159
5
0
2011-05-31T14:15:21.080000
2011-05-31T14:32:51.520000
6,188,926
6,188,986
Write NSMutableArray to txt file
I have an NSMutableArray of NSStrings, which I want to write to a text file, so that each string has its own line. Any suggestions?
You can create a full string of your NSMutableArray with - (NSString *)componentsJoinedByString:(NSString *)separator Something like NSString* fullString = [yourArray componentsJoinedByString:@"\n"]; You can then use - (BOOL)writeToFile:(NSString *)path atomically:(BOOL)useAuxiliaryFile encoding:(NSStringEncoding)enc e...
Write NSMutableArray to txt file I have an NSMutableArray of NSStrings, which I want to write to a text file, so that each string has its own line. Any suggestions?
TITLE: Write NSMutableArray to txt file QUESTION: I have an NSMutableArray of NSStrings, which I want to write to a text file, so that each string has its own line. Any suggestions? ANSWER: You can create a full string of your NSMutableArray with - (NSString *)componentsJoinedByString:(NSString *)separator Something ...
[ "objective-c" ]
3
9
2,021
1
0
2011-05-31T14:15:46.163000
2011-05-31T14:20:22.030000
6,188,934
6,189,016
how to insert a variable with data in jquery?
If I have a variable defined in jquery as follows: var insertString = " "; insertString += " "; insertString += " "; Now, if I want to insert the above variable 'insertString' before some DOM element, how can I do it? I tried Something like below with no success insertString.insertBefore("body");
You should be able to wrap your html in a $() function thus passing it to jQuery and creating a jquery object. Then you can operate on that object by chaining jQuery functions like this: $(insertString).insertBefore("body"); But it would be pretty weird to put a div BEFORE the body... maybe it is better to prepend it t...
how to insert a variable with data in jquery? If I have a variable defined in jquery as follows: var insertString = " "; insertString += " "; insertString += " "; Now, if I want to insert the above variable 'insertString' before some DOM element, how can I do it? I tried Something like below with no success insertStrin...
TITLE: how to insert a variable with data in jquery? QUESTION: If I have a variable defined in jquery as follows: var insertString = " "; insertString += " "; insertString += " "; Now, if I want to insert the above variable 'insertString' before some DOM element, how can I do it? I tried Something like below with no s...
[ "jquery" ]
0
2
1,905
3
0
2011-05-31T14:16:16.787000
2011-05-31T14:22:33.870000
6,188,958
6,189,292
Can't figure out the bug in this code
So I'm doing one of the Princeton exercises here: http://www.cs.princeton.edu/courses/archive/fall10/cos126/assignments/lfsr.html and I've fully tested by LFSR class with the data that has been provided, so I'm sure I haven't gone wrong there. However, my PhotoMagic class yields an encrypted photo of the pipe as below:...
You need to pad the result of Integer.toBinaryString() when calculating newRed, newGreen and newBlue. It may not have length 8.
Can't figure out the bug in this code So I'm doing one of the Princeton exercises here: http://www.cs.princeton.edu/courses/archive/fall10/cos126/assignments/lfsr.html and I've fully tested by LFSR class with the data that has been provided, so I'm sure I haven't gone wrong there. However, my PhotoMagic class yields an...
TITLE: Can't figure out the bug in this code QUESTION: So I'm doing one of the Princeton exercises here: http://www.cs.princeton.edu/courses/archive/fall10/cos126/assignments/lfsr.html and I've fully tested by LFSR class with the data that has been provided, so I'm sure I haven't gone wrong there. However, my PhotoMag...
[ "java", "image", "encryption", "feedback" ]
1
2
1,572
3
0
2011-05-31T14:18:18.907000
2011-05-31T14:40:48.937000
6,188,964
6,220,225
Consuming SAP Web Service in ASP.NET fails
I'm working on a web service that will create orders in SAP using.NET. Right now when I run the code below, I receive no errors and no order is created. I was hoping someone could help. string message = ""; // create initial connection Z_SALESORDER_CREATE createOrder = new Z_SALESORDER_CREATE(); try { NetworkCredenti...
The issue is that I needed to build an array and insert it into the object. See Below. Bapisdhd1 order_header_in = new Bapisdhd1(); order_header_in.DocType = "OR"; order_header_in.CollectNo = "1109512"; order_header_in.SalesOrg = "10090"; order_header_in.DistrChan = "100"; order_header_in.Division = "000"; order_header...
Consuming SAP Web Service in ASP.NET fails I'm working on a web service that will create orders in SAP using.NET. Right now when I run the code below, I receive no errors and no order is created. I was hoping someone could help. string message = ""; // create initial connection Z_SALESORDER_CREATE createOrder = new Z_...
TITLE: Consuming SAP Web Service in ASP.NET fails QUESTION: I'm working on a web service that will create orders in SAP using.NET. Right now when I run the code below, I receive no errors and no order is created. I was hoping someone could help. string message = ""; // create initial connection Z_SALESORDER_CREATE cr...
[ "asp.net", ".net", "web-services", "sap-erp", "sap-basis" ]
1
2
1,714
3
0
2011-05-31T14:18:29.213000
2011-06-02T20:49:30.990000
6,188,967
6,189,288
sync two tables from two different PostgreSQL databases
I have two tables from two different databases and I want a php function to syncronize the data, so that the table number 2 can always verify the content on the table 1 and update it's information. Anyone has one example on how to do that? Thanks in advance.
this example will connect to both the databases, and for each of the first db's authors will update the destination db's author with the same id. Of course you have to set up any necessary check, search and other details before perform and update (or an insert or replace if you prefer), but it fully depends on what you...
sync two tables from two different PostgreSQL databases I have two tables from two different databases and I want a php function to syncronize the data, so that the table number 2 can always verify the content on the table 1 and update it's information. Anyone has one example on how to do that? Thanks in advance.
TITLE: sync two tables from two different PostgreSQL databases QUESTION: I have two tables from two different databases and I want a php function to syncronize the data, so that the table number 2 can always verify the content on the table 1 and update it's information. Anyone has one example on how to do that? Thanks...
[ "php", "postgresql" ]
3
1
4,388
3
0
2011-05-31T14:18:44.460000
2011-05-31T14:40:33.553000
6,188,970
6,189,676
How to make a ssh connection with python?
Can anyone recommend something for making a ssh connection in python? I need it to be compatible with any OS. I've already tried pyssh only to get an error with SIGCHLD, which I've read is because Windows lacks this. I've tried getting paramiko to work, but I've had errors between paramiko and Crypto to the point where...
Notice that this doesn't work in Windows. The module pxssh does exactly what you want: For example, to run 'ls -l' and to print the output, you need to do something like that: from pexpect import pxssh s = pxssh.pxssh() if not s.login ('localhost', 'myusername', 'mypassword'): print "SSH session failed on login." print...
How to make a ssh connection with python? Can anyone recommend something for making a ssh connection in python? I need it to be compatible with any OS. I've already tried pyssh only to get an error with SIGCHLD, which I've read is because Windows lacks this. I've tried getting paramiko to work, but I've had errors betw...
TITLE: How to make a ssh connection with python? QUESTION: Can anyone recommend something for making a ssh connection in python? I need it to be compatible with any OS. I've already tried pyssh only to get an error with SIGCHLD, which I've read is because Windows lacks this. I've tried getting paramiko to work, but I'...
[ "python" ]
26
47
145,077
3
0
2011-05-31T14:19:13.100000
2011-05-31T15:09:46.893000
6,188,975
6,189,852
How to get tap location on world coordinate?
Can we be known of where we have tapped(touched once) on a box2d world. As, location = [self convertCoordToLayer:location]; location.x,location.y returns screen coordinate. So is there any method to get world coordinate?
That depends on how you correlate your physical world and the graphics. Usually it's enough to divide the touch position relative to the layer by PTM_RATIO: CGPoint touchLocation = [touch locationInView:[touch view]]; touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation]; CGPoint nodePosition = [self ...
How to get tap location on world coordinate? Can we be known of where we have tapped(touched once) on a box2d world. As, location = [self convertCoordToLayer:location]; location.x,location.y returns screen coordinate. So is there any method to get world coordinate?
TITLE: How to get tap location on world coordinate? QUESTION: Can we be known of where we have tapped(touched once) on a box2d world. As, location = [self convertCoordToLayer:location]; location.x,location.y returns screen coordinate. So is there any method to get world coordinate? ANSWER: That depends on how you cor...
[ "iphone", "cocos2d-iphone", "box2d" ]
3
3
547
1
0
2011-05-31T14:19:35.523000
2011-05-31T15:23:06.357000
6,188,976
6,199,759
ViewModel has no properties set in Model using HttpPost Create method
I have a simple MVC3 app with an EF4 Model Log.Name.CreatedDate.LogTypeId LogTypes.Id.Description and a ViewModel LogViewModel Log MyLog List Options LogViewModel(){ Log = new Log(); } This displays in my view correctly and I can edit/update the values, display the drop down list and set the name to "MyTestValue". Ho...
The controller method should have a property named model [HttpPost] public ActionResult Create(LogViewModel **model**){ **model**.Log.Name == "MyTestvalue"; //true }
ViewModel has no properties set in Model using HttpPost Create method I have a simple MVC3 app with an EF4 Model Log.Name.CreatedDate.LogTypeId LogTypes.Id.Description and a ViewModel LogViewModel Log MyLog List Options LogViewModel(){ Log = new Log(); } This displays in my view correctly and I can edit/update the va...
TITLE: ViewModel has no properties set in Model using HttpPost Create method QUESTION: I have a simple MVC3 app with an EF4 Model Log.Name.CreatedDate.LogTypeId LogTypes.Id.Description and a ViewModel LogViewModel Log MyLog List Options LogViewModel(){ Log = new Log(); } This displays in my view correctly and I can ...
[ "asp.net-mvc-3", "viewmodel", "http-post" ]
0
0
1,347
2
0
2011-05-31T14:19:35.817000
2011-06-01T10:31:58.743000
6,188,981
6,191,068
Sending Ajax Request Using JavaScript to JSF
Currently, I am working on a web application that uses draw2d library to draw shapes and charts. On the server side I am using Java(JSF). I can say that 95% of this application is just pure JavaScript. I like to be able to send Ajax requests from inside my JavaScript with no need of using hidden fields such as (perhaps...
If you are up for a third party library Richfaces a4j:jsFunction offers the ability to invoke a server side method with a javascript function as well as the ability to pass a object serialized as json back to a callback function: And your Bean: @ManagedBean(name = "jsFunctionBean") @SessionScoped public class JsFunctio...
Sending Ajax Request Using JavaScript to JSF Currently, I am working on a web application that uses draw2d library to draw shapes and charts. On the server side I am using Java(JSF). I can say that 95% of this application is just pure JavaScript. I like to be able to send Ajax requests from inside my JavaScript with no...
TITLE: Sending Ajax Request Using JavaScript to JSF QUESTION: Currently, I am working on a web application that uses draw2d library to draw shapes and charts. On the server side I am using Java(JSF). I can say that 95% of this application is just pure JavaScript. I like to be able to send Ajax requests from inside my ...
[ "jquery", "ajax", "jsf", "draw2d" ]
5
6
13,047
3
0
2011-05-31T14:20:01.467000
2011-05-31T17:12:10.523000
6,188,991
6,189,247
Dynamically remove a choice option from a form
I have a form like this: RANGE_CHOICES = ( ('last', 'Last Year'), ('this', 'This Year'), ('next', 'Next Year'), ) class MonthlyTotalsForm(forms.Form): range = forms.ChoiceField(choices=RANGE_CHOICES, initial='this') It's displayed in the template like this: {{ form.range }} In some situations I don't want to show the ...
class MonthlyTotalsForm(forms.Form): range = forms.ChoiceField(choices=RANGE_CHOICES, initial='this') def __init__(self, *args, **kwargs): no_next_year = kwargs.pop('no_next_year', False) super(MonthlyTotalsForm, self).__init__(*args, **kwargs) if no_next_year: self.fields['range'].choices = RANGE_CHOICES[:-1] #views...
Dynamically remove a choice option from a form I have a form like this: RANGE_CHOICES = ( ('last', 'Last Year'), ('this', 'This Year'), ('next', 'Next Year'), ) class MonthlyTotalsForm(forms.Form): range = forms.ChoiceField(choices=RANGE_CHOICES, initial='this') It's displayed in the template like this: {{ form.range ...
TITLE: Dynamically remove a choice option from a form QUESTION: I have a form like this: RANGE_CHOICES = ( ('last', 'Last Year'), ('this', 'This Year'), ('next', 'Next Year'), ) class MonthlyTotalsForm(forms.Form): range = forms.ChoiceField(choices=RANGE_CHOICES, initial='this') It's displayed in the template like th...
[ "django" ]
6
11
3,406
1
0
2011-05-31T14:21:02.573000
2011-05-31T14:37:26.160000
6,188,994
6,189,021
`static` keyword inside function?
I was looking at the source for Drupal 7, and I found some things I hadn't seen before. I did some initial looking in the php manual, but it didn't explain these examples. What does the keyword static do to a variable inside a function? function module_load_all($bootstrap = FALSE) { static $has_run = FALSE
It makes the function remember the value of the given variable ( $has_run in your example) between multiple calls. You could use this for different purposes, for example: function doStuff() { static $cache = null; if ($cache === null) { $cache = '%heavy database stuff or something%'; } // code using $cache } In this ...
`static` keyword inside function? I was looking at the source for Drupal 7, and I found some things I hadn't seen before. I did some initial looking in the php manual, but it didn't explain these examples. What does the keyword static do to a variable inside a function? function module_load_all($bootstrap = FALSE) { st...
TITLE: `static` keyword inside function? QUESTION: I was looking at the source for Drupal 7, and I found some things I hadn't seen before. I did some initial looking in the php manual, but it didn't explain these examples. What does the keyword static do to a variable inside a function? function module_load_all($boots...
[ "php", "function", "static", "keyword" ]
137
199
71,917
7
0
2011-05-31T14:21:22.137000
2011-05-31T14:22:52.617000
6,188,997
6,211,922
How to cancel button tap if UIGestureRecognizer fires?
Update: The problem seems to be the dependency on another GestureRecognizer to fail. See comments and test project below this question! In my iPhone app I have a view with multiple UIButtons as subviews. The view also has a UITapGestureRecognizer which is listening for taps with two fingers. When a two-finger-tap occur...
According to an Apple dev this is a bug. I filed a bug report with Apple. Thanks a lot for your hints, Deepak and gcamp! Bug report: Summary: When adding two UITapGestureRecognizers to a view where one requires the other to fail (requiresGestureRecognizerToFail:) the cancelsTouchesInView property of the first gesture r...
How to cancel button tap if UIGestureRecognizer fires? Update: The problem seems to be the dependency on another GestureRecognizer to fail. See comments and test project below this question! In my iPhone app I have a view with multiple UIButtons as subviews. The view also has a UITapGestureRecognizer which is listening...
TITLE: How to cancel button tap if UIGestureRecognizer fires? QUESTION: Update: The problem seems to be the dependency on another GestureRecognizer to fail. See comments and test project below this question! In my iPhone app I have a view with multiple UIButtons as subviews. The view also has a UITapGestureRecognizer ...
[ "ios", "objective-c", "touch", "uigesturerecognizer" ]
4
2
8,133
4
0
2011-05-31T14:21:31.420000
2011-06-02T07:57:27.810000
6,189,000
6,199,708
WampServer Hosting
about 6 months ago I got into coding, and I've always wanted to start my own game just for fun on the side. I have wampserver on my computer, and was wondering if that server could publicly host things on the internet?
You need to: Make sure your server is available on the internet. If you have a router or firewall you may need to open it up. If you want to have a domain name you need to register that. If your ISP can give you a static IP address then ask for that. Whether you have a static IP or a dynamic one then you can use a serv...
WampServer Hosting about 6 months ago I got into coding, and I've always wanted to start my own game just for fun on the side. I have wampserver on my computer, and was wondering if that server could publicly host things on the internet?
TITLE: WampServer Hosting QUESTION: about 6 months ago I got into coding, and I've always wanted to start my own game just for fun on the side. I have wampserver on my computer, and was wondering if that server could publicly host things on the internet? ANSWER: You need to: Make sure your server is available on the ...
[ "hosting", "wampserver" ]
0
1
737
3
0
2011-05-31T14:21:40.187000
2011-06-01T10:27:28.657000
6,189,003
6,203,507
Corona - how to accommodate different device resolutions whilst retaining quality for hi-res devices?
How is it possible to accommodate lower resolutions from Corona but primarily target high resolution devices? I know you can specifically set content width and height via Corona, and scale the content, but this seems to be for scaling upwards (method detailed here http://blog.anscamobile.com/2011/01/use-dynamic-layouts...
There are two terms you need to pay attention to: dynamic content scaling and dynamic image resolution. The former refers to scaling the stage in Corona to fit on different displays, and the latter refers to swapping different versions of images on different displays. Here's documentation about both: http://blog.anscam...
Corona - how to accommodate different device resolutions whilst retaining quality for hi-res devices? How is it possible to accommodate lower resolutions from Corona but primarily target high resolution devices? I know you can specifically set content width and height via Corona, and scale the content, but this seems t...
TITLE: Corona - how to accommodate different device resolutions whilst retaining quality for hi-res devices? QUESTION: How is it possible to accommodate lower resolutions from Corona but primarily target high resolution devices? I know you can specifically set content width and height via Corona, and scale the content...
[ "iphone", "android", "coronasdk" ]
3
4
2,612
1
0
2011-05-31T14:21:48.660000
2011-06-01T15:16:27.427000
6,189,017
6,189,040
What is the best way to select an element if the element's index is over 3?
Pseudo Code $("#cool ul li.active:eq( > 3)") { // selector if the active li is over 3 $('#cool ul').animate({right: '+=984'},0); }; What is the best way to select if the li is over 3?
:gt selector if ($("#cool li:gt(3)").hasClass('active')) { $('#cool ul').animate({right: '+=984'},0); }; EDIT: Had it correct the first time, thought I had it wrong and made it incorrect, should be back to correct again:P
What is the best way to select an element if the element's index is over 3? Pseudo Code $("#cool ul li.active:eq( > 3)") { // selector if the active li is over 3 $('#cool ul').animate({right: '+=984'},0); }; What is the best way to select if the li is over 3?
TITLE: What is the best way to select an element if the element's index is over 3? QUESTION: Pseudo Code $("#cool ul li.active:eq( > 3)") { // selector if the active li is over 3 $('#cool ul').animate({right: '+=984'},0); }; What is the best way to select if the li is over 3? ANSWER: :gt selector if ($("#cool li:gt(3...
[ "javascript", "jquery", "indexing", "selector", "equals" ]
1
3
72
2
0
2011-05-31T14:22:42.403000
2011-05-31T14:24:29.780000
6,189,019
6,189,030
href is always "undefined"
On alert I always get undefined... why? Intro presentation pourquoi? forfaits
You need to select the a tag. var path = $('a', this).attr("href");
href is always "undefined" On alert I always get undefined... why? Intro presentation pourquoi? forfaits
TITLE: href is always "undefined" QUESTION: On alert I always get undefined... why? Intro presentation pourquoi? forfaits ANSWER: You need to select the a tag. var path = $('a', this).attr("href");
[ "javascript", "jquery", "href" ]
4
10
10,633
8
0
2011-05-31T14:22:48.313000
2011-05-31T14:24:06.737000
6,189,023
6,189,156
Design class to hold multiple instances of other classes
How do you design a class that can hold instances of other classes. I'll try to explain. A Customer class instance for every new customer. A customer buys cars and then does specific operations to each car. For example, Customer c = new Customer(); // customer buys cars c.buyMercedes(); c.buyBMW(); // operations done o...
Since you don't have operations specific to any car, you don't need to derive from Car. Let's assume that you have a Car class that has a Brand property, which is an enum. Then you could design your Customer class like this: Customer c = new Customer(); c.buy(Brands.Mercedes); c.buy(Brands.BMW); The buy method would cr...
Design class to hold multiple instances of other classes How do you design a class that can hold instances of other classes. I'll try to explain. A Customer class instance for every new customer. A customer buys cars and then does specific operations to each car. For example, Customer c = new Customer(); // customer bu...
TITLE: Design class to hold multiple instances of other classes QUESTION: How do you design a class that can hold instances of other classes. I'll try to explain. A Customer class instance for every new customer. A customer buys cars and then does specific operations to each car. For example, Customer c = new Customer...
[ "c#", "oop", "design-patterns" ]
0
1
2,995
6
0
2011-05-31T14:23:07.780000
2011-05-31T14:31:48.830000
6,189,025
6,189,090
SWT Image to/from String
I am trying to convert an SWT Image to String and vice versa: To String: Display display = new Display(); final Image image = new Image(display, "c:\test.png"); // Looks good showImage(image,600,400); ImageData imageData = testImage.getImageData(); byte[] data = imageData.data; String imageString = new String(Base64.en...
Certainly this is wrong: stringToInputStream(decode.toString()) If you call toString() on a byte array, you don't get the bytes converted to a String; you get a String that looks like byte[@6536753 You need to construct the ByteArrayInputStream from "decode" itself.
SWT Image to/from String I am trying to convert an SWT Image to String and vice versa: To String: Display display = new Display(); final Image image = new Image(display, "c:\test.png"); // Looks good showImage(image,600,400); ImageData imageData = testImage.getImageData(); byte[] data = imageData.data; String imageStri...
TITLE: SWT Image to/from String QUESTION: I am trying to convert an SWT Image to String and vice versa: To String: Display display = new Display(); final Image image = new Image(display, "c:\test.png"); // Looks good showImage(image,600,400); ImageData imageData = testImage.getImageData(); byte[] data = imageData.data...
[ "java", "image", "swt" ]
3
5
4,695
3
0
2011-05-31T14:23:16.380000
2011-05-31T14:28:08.437000
6,189,029
6,189,840
How to retrieve a polymorphic model from a single table in django - or how to implement polymorphic behaviour in django
Can I read polymorphic models from a single database table, with their behaviour depending on a (boolean) field of the model? In one of my models the behaviour is slightly different if the instance is 'forward' vs. 'backward' or 'left' vs. 'right'. That leads to a lot of if-clauses and code duplication. So I want to ha...
Proxy models: class Foo(models.Model): # all model attributes here class ForwardFooManager(models.Manager): def get_query_set(self, *args, **kwargs): qs = super(ForwardFooManager, self).get_query_set(*args, **kwargs) return qs.filter(forward=True) class ForwardFoo(Foo): class Meta: proxy = True objects = ForwardsFoo...
How to retrieve a polymorphic model from a single table in django - or how to implement polymorphic behaviour in django Can I read polymorphic models from a single database table, with their behaviour depending on a (boolean) field of the model? In one of my models the behaviour is slightly different if the instance is...
TITLE: How to retrieve a polymorphic model from a single table in django - or how to implement polymorphic behaviour in django QUESTION: Can I read polymorphic models from a single database table, with their behaviour depending on a (boolean) field of the model? In one of my models the behaviour is slightly different ...
[ "python", "django", "dry" ]
0
1
220
1
0
2011-05-31T14:24:01.437000
2011-05-31T15:22:30.960000
6,189,057
6,189,357
Why doesn't ice:commandButton accept onmouseover/onmouseout when it's disabled?
I'm working with ICEFaces components and I have the need of setting a tooltip on an ice:commandButton. The button can be enabled or not according to particular conditions, but my problems is that when the button is disabled the tooltip is not displayed. I display the tooltip by calling a Javascript method in the onmous...
Disabled components neither get focus nor react on any events. HTML Reference: When an element is disabled, it appears dimmed and does not respond to user input. Disabled elements do not respond to mouse events, nor will they respond to the contentEditable property. As a workaround you can assign the tooltip to a aroun...
Why doesn't ice:commandButton accept onmouseover/onmouseout when it's disabled? I'm working with ICEFaces components and I have the need of setting a tooltip on an ice:commandButton. The button can be enabled or not according to particular conditions, but my problems is that when the button is disabled the tooltip is n...
TITLE: Why doesn't ice:commandButton accept onmouseover/onmouseout when it's disabled? QUESTION: I'm working with ICEFaces components and I have the need of setting a tooltip on an ice:commandButton. The button can be enabled or not according to particular conditions, but my problems is that when the button is disable...
[ "icefaces-1.8" ]
0
0
581
1
0
2011-05-31T14:25:24.120000
2011-05-31T14:45:55.330000
6,189,062
6,201,374
Possible to extend static SQL statements with dynamic parts?
I'd like to create a Oracle package where I have a procedure that executes some dynamic SQL. This is no problem if I'm doing it all dynamic with EXECUTE IMMEDIATE but it would be better if the static parts of the query could be coded static (to have compile time checking). Example of fully dynamic query: -- v_stmt is b...
Sorry, but why the need to do this? Seems you're over complicating things by introducing a function that will return different types of data/tables depending on the parameter list. Very confusing imo. Besides, you have to do the work somewhere, you're just trying to hide it in this function (inside if param1=this then ...
Possible to extend static SQL statements with dynamic parts? I'd like to create a Oracle package where I have a procedure that executes some dynamic SQL. This is no problem if I'm doing it all dynamic with EXECUTE IMMEDIATE but it would be better if the static parts of the query could be coded static (to have compile t...
TITLE: Possible to extend static SQL statements with dynamic parts? QUESTION: I'd like to create a Oracle package where I have a procedure that executes some dynamic SQL. This is no problem if I'm doing it all dynamic with EXECUTE IMMEDIATE but it would be better if the static parts of the query could be coded static ...
[ "sql", "oracle", "plsql", "oracle11g", "dynamic-sql" ]
2
2
1,098
3
0
2011-05-31T14:25:39.350000
2011-06-01T12:47:52.593000
6,189,064
6,189,448
What is the simplest way to implement pure css show/hide?
I discovered the element for html5, and that made me want to determine whether it was possible to implement a simple and reusable show/hide via css alone. I have created a show/hide mechanism in the past for showing and hiding content by giving two elements relative positioning and one a negative z-index, and then decr...
there is a plethora of options based on the structure ( for modern browsers ). Have a look at the selector + selector adjacent sibling selector selector ~ selector general sibling selector selector selector descendant selector selector > selector child selector These can be combined with classes / ids / pseudo-selector...
What is the simplest way to implement pure css show/hide? I discovered the element for html5, and that made me want to determine whether it was possible to implement a simple and reusable show/hide via css alone. I have created a show/hide mechanism in the past for showing and hiding content by giving two elements rela...
TITLE: What is the simplest way to implement pure css show/hide? QUESTION: I discovered the element for html5, and that made me want to determine whether it was possible to implement a simple and reusable show/hide via css alone. I have created a show/hide mechanism in the past for showing and hiding content by giving...
[ "css", "show-hide" ]
7
8
10,575
4
0
2011-05-31T14:25:48.057000
2011-05-31T14:52:25.987000
6,189,085
6,189,116
Sharing files between iPhones and PC
Im looking to see how I can share / export content from my app to allow the content to be imported in the app running on another device. Something like if you get emailed a pdf file or word file it opens in the correct app when tapped. I tried using the iTunes sharing approach but that allowed full access to the apps d...
The 1Password app uses DropBox and it seems to work quiet well.
Sharing files between iPhones and PC Im looking to see how I can share / export content from my app to allow the content to be imported in the app running on another device. Something like if you get emailed a pdf file or word file it opens in the correct app when tapped. I tried using the iTunes sharing approach but t...
TITLE: Sharing files between iPhones and PC QUESTION: Im looking to see how I can share / export content from my app to allow the content to be imported in the app running on another device. Something like if you get emailed a pdf file or word file it opens in the correct app when tapped. I tried using the iTunes shar...
[ "iphone", "import", "export", "file-sharing" ]
0
1
172
1
0
2011-05-31T14:27:20.653000
2011-05-31T14:29:13.557000
6,189,096
6,189,124
Standard reference for int foo = foo
int foo = foo; compiles. Which part of the C++ standard allows this?
3.3.1 Point of declaration [basic.scope.pdecl] The point of declaration for a name is immediately after its complete declarator (clause 8) and before its initializer (if any), The behaviour is well defined if the declaration is at file scope. If you have the declaration at function scope and if you use foo later on [wh...
Standard reference for int foo = foo int foo = foo; compiles. Which part of the C++ standard allows this?
TITLE: Standard reference for int foo = foo QUESTION: int foo = foo; compiles. Which part of the C++ standard allows this? ANSWER: 3.3.1 Point of declaration [basic.scope.pdecl] The point of declaration for a name is immediately after its complete declarator (clause 8) and before its initializer (if any), The behavio...
[ "c++", "undefined-behavior" ]
19
26
562
2
0
2011-05-31T14:28:21.077000
2011-05-31T14:29:52.263000
6,189,099
6,189,131
Lazy-loaded singleton: Double-checked locking vs Initialization on demand holder idiom
I have a requirement to lazy-load resources in a concurrent environment. The code to load the resources should be executed only once. Both Double-checked locking (using JRE 5+ and the volatile keyword) and Initialization on demand holder idiom seems to fit the job well. Just by looking at the code, Initialization on de...
To add another, perhaps cleaner, option. I suggest the enum variation: What is the best approach for using an Enum as a singleton in Java?
Lazy-loaded singleton: Double-checked locking vs Initialization on demand holder idiom I have a requirement to lazy-load resources in a concurrent environment. The code to load the resources should be executed only once. Both Double-checked locking (using JRE 5+ and the volatile keyword) and Initialization on demand ho...
TITLE: Lazy-loaded singleton: Double-checked locking vs Initialization on demand holder idiom QUESTION: I have a requirement to lazy-load resources in a concurrent environment. The code to load the resources should be executed only once. Both Double-checked locking (using JRE 5+ and the volatile keyword) and Initializ...
[ "java", "concurrency", "singleton", "lazy-loading", "design-patterns" ]
9
7
6,689
5
0
2011-05-31T14:28:28.227000
2011-05-31T14:30:10.903000
6,189,100
6,202,353
Should I load an entire html page with AJAX?
My designer thought it was a good idea to create a transition between different pages. Essentially only the content part will reload (header and footer stay intact), and only the content div should have a transitional effect (fade or some sort). To create this sort of effect isn't really the problem, to make google (an...
Short answer: I would not recommend loading an entire page in this manner. Long answer: Not recommended. whilst possible, this is not really the intent of XHR/Ajax. Essentially what you're doing is replicating the native behaviour of the browser. Some of the problems you'll encounter: Support for the Back/Forward butto...
Should I load an entire html page with AJAX? My designer thought it was a good idea to create a transition between different pages. Essentially only the content part will reload (header and footer stay intact), and only the content div should have a transitional effect (fade or some sort). To create this sort of effect...
TITLE: Should I load an entire html page with AJAX? QUESTION: My designer thought it was a good idea to create a transition between different pages. Essentially only the content part will reload (header and footer stay intact), and only the content div should have a transitional effect (fade or some sort). To create t...
[ "ajax", "google-analytics" ]
11
10
4,799
4
0
2011-05-31T14:28:34.507000
2011-06-01T13:56:33.480000
6,189,102
6,189,203
wcf : Service + Client in same solution, how to debug? I don't want to run 2 versions of VS 2010 at the same time
I have created an application which has a client (WPF) and the Server (WCF), the service is IIS hosted, currently I am having to have 2 versions of vs 2010. One loads the wcf service in IIS and the other in my windows application. The problem with this is it takes so much resources. It appears if the wcf service is "NO...
You should be able to debug both from the same instance of Visual Studio if they are in the same solution. When you run your application from Visual Studio, open the Debug menu and choose Attach To Process, you need to attach the debugger to the ASP.NET worker process (aspnet_wp.exe), it should automatically attach to ...
wcf : Service + Client in same solution, how to debug? I don't want to run 2 versions of VS 2010 at the same time I have created an application which has a client (WPF) and the Server (WCF), the service is IIS hosted, currently I am having to have 2 versions of vs 2010. One loads the wcf service in IIS and the other in...
TITLE: wcf : Service + Client in same solution, how to debug? I don't want to run 2 versions of VS 2010 at the same time QUESTION: I have created an application which has a client (WPF) and the Server (WCF), the service is IIS hosted, currently I am having to have 2 versions of vs 2010. One loads the wcf service in II...
[ "wcf", "visual-studio-2010", "iis", "iis-7", "wcf-hosting" ]
5
3
4,158
3
0
2011-05-31T14:28:39
2011-05-31T14:34:28.580000
6,189,105
6,189,222
IOS: use navigation controller in a subview
In a view of my program I have a button and with this button I open a subview; this subview is a view with a tableview. I want go to another view when I push a row of the tableview so I want to make this with a navigation controller; how can I do this?
Your table view delegate will receive a tableView:didSelectRowAtIndexPath: message when you click on one of the table's rows. You can put there your code to create the UINavigationController and push on to it your new view. This sample code (from another answer of mine on S.O. ) shows how you can do that: UINavigationC...
IOS: use navigation controller in a subview In a view of my program I have a button and with this button I open a subview; this subview is a view with a tableview. I want go to another view when I push a row of the tableview so I want to make this with a navigation controller; how can I do this?
TITLE: IOS: use navigation controller in a subview QUESTION: In a view of my program I have a button and with this button I open a subview; this subview is a view with a tableview. I want go to another view when I push a row of the tableview so I want to make this with a navigation controller; how can I do this? ANSW...
[ "xcode", "ios", "uitableview", "uinavigationcontroller" ]
0
2
7,031
2
0
2011-05-31T14:28:49.127000
2011-05-31T14:35:38.617000
6,189,108
6,189,391
rails-settings: NoMethodError: undefined method `merge' for []:Array
I'm trying to implement the rails-settings gem (https://github.com/100hz/rails-settings) into my Rails 3 project using Ruby 1.8.7 Setting and retrieving the settings works perfectly, but I get an error if I try getting all settings of a specific user. So, in the 'rails console' the following works: user = User.find(123...
That's a Ruby 1.8.7 vs. 1.9.2 thing The Hash select method under ruby 1.8.7 will return an Array of Arrays. Example: {:a => 'a',:b => 'b',:c => 'c'}.select {|k, v| v > 'a'} #=> [[:b,'b'],[:c,'c']] While the same thing running Ruby 1.9.2 will return: {:a => 'a',:b => 'b',:c => 'c'}.select {|k, v| v > 'a'} #=> {:b => 'b'...
rails-settings: NoMethodError: undefined method `merge' for []:Array I'm trying to implement the rails-settings gem (https://github.com/100hz/rails-settings) into my Rails 3 project using Ruby 1.8.7 Setting and retrieving the settings works perfectly, but I get an error if I try getting all settings of a specific user....
TITLE: rails-settings: NoMethodError: undefined method `merge' for []:Array QUESTION: I'm trying to implement the rails-settings gem (https://github.com/100hz/rails-settings) into my Rails 3 project using Ruby 1.8.7 Setting and retrieving the settings works perfectly, but I get an error if I try getting all settings o...
[ "ruby", "ruby-on-rails-3" ]
3
3
9,860
2
0
2011-05-31T14:28:53.103000
2011-05-31T14:48:54.910000
6,189,112
6,189,148
C# API with XSD/WSDL
I'm used to adding a web reference in VS and building an API from there. I was handed on WSDL document and two XSD documents to build an API from. How do I go about creating the API? Thanks in advance.
Try reading about the Wsdl.exe tool, which should build the C# classes for you from the Wsdl definition file.
C# API with XSD/WSDL I'm used to adding a web reference in VS and building an API from there. I was handed on WSDL document and two XSD documents to build an API from. How do I go about creating the API? Thanks in advance.
TITLE: C# API with XSD/WSDL QUESTION: I'm used to adding a web reference in VS and building an API from there. I was handed on WSDL document and two XSD documents to build an API from. How do I go about creating the API? Thanks in advance. ANSWER: Try reading about the Wsdl.exe tool, which should build the C# classes...
[ "c#", "api", "xsd", "wsdl" ]
0
2
679
2
0
2011-05-31T14:29:07.240000
2011-05-31T14:31:12.460000
6,189,121
6,189,223
How to show superscript for "®" registered symbol?
I've a issue regarding showing registered symbol as superscript. I've used unicode value \u00AE, but it shows in same line. I'd like to have it a bit top of remaining texts. Done googling, but found superscripts for A-Z, 0-9 characters, which is mentioned in unicode's site. Sample code: UILabel *myLabel; //do initializ...
Unicode does not have a registered symbol in superscript form so the only way to do it is to use a HTML control and to include it into superscript tags: ® You can check it at http://rishida.net/scripts/uniview/
How to show superscript for "®" registered symbol? I've a issue regarding showing registered symbol as superscript. I've used unicode value \u00AE, but it shows in same line. I'd like to have it a bit top of remaining texts. Done googling, but found superscripts for A-Z, 0-9 characters, which is mentioned in unicode's ...
TITLE: How to show superscript for "®" registered symbol? QUESTION: I've a issue regarding showing registered symbol as superscript. I've used unicode value \u00AE, but it shows in same line. I'd like to have it a bit top of remaining texts. Done googling, but found superscripts for A-Z, 0-9 characters, which is menti...
[ "iphone", "unicode", "special-characters", "uilabel" ]
22
35
62,355
7
0
2011-05-31T14:29:35.833000
2011-05-31T14:35:40.670000
6,189,123
6,201,780
Limiting input to a vba class interface
I am trying to encapsulate the access of an XML configuration file within a (excel) vba custom class. A portion of the XML document is split into 4 or 5 repeated sections that are differentiated by an AreaID. MY question is: How can I limit the input of one of my class interfaces to the various AreaID 's that may be re...
I wanted to follow up with @Tim's comment regarding enums and provide some further information as to why enums in the class code may be a good way to limit the input. According to Chip Pearson's site: Enums cannot be declared within a procedure. They must be declared within the declarations part of a module, above and ...
Limiting input to a vba class interface I am trying to encapsulate the access of an XML configuration file within a (excel) vba custom class. A portion of the XML document is split into 4 or 5 repeated sections that are differentiated by an AreaID. MY question is: How can I limit the input of one of my class interfaces...
TITLE: Limiting input to a vba class interface QUESTION: I am trying to encapsulate the access of an XML configuration file within a (excel) vba custom class. A portion of the XML document is split into 4 or 5 repeated sections that are differentiated by an AreaID. MY question is: How can I limit the input of one of m...
[ "class", "vba", "properties" ]
1
1
638
1
0
2011-05-31T14:29:37.463000
2011-06-01T13:18:52.227000
6,189,127
6,189,174
How to implement the push AJAX model in ASP.NET?
Simple AJAX model is to request some information to the server and the server returns response. If i am correct then it is called as a pull model. However while reading some of the web 2.0 concepts i have came across push model stuff say for example the real time application like displaying the shock exchange price upd...
Please see the following link: Comet implementation for ASP.NET? you can use a framework like http://pokein.codeplex.com/ to achieve what you are looking for. Otherwise, for your stock exchange price example, most of them just have javascript that initiates a request to refresht the data from the client side.
How to implement the push AJAX model in ASP.NET? Simple AJAX model is to request some information to the server and the server returns response. If i am correct then it is called as a pull model. However while reading some of the web 2.0 concepts i have came across push model stuff say for example the real time applica...
TITLE: How to implement the push AJAX model in ASP.NET? QUESTION: Simple AJAX model is to request some information to the server and the server returns response. If i am correct then it is called as a pull model. However while reading some of the web 2.0 concepts i have came across push model stuff say for example the...
[ "javascript", "asp.net", "ajax" ]
1
2
2,261
2
0
2011-05-31T14:29:57.690000
2011-05-31T14:32:56.567000
6,189,132
6,190,024
Get bitness (32-bit/64-bit) from Process object
Duplicate: How can I tell if another process is 64bit? Can I detect the bitness of a process from a.net Process object? I'm not trying to detect the bitness of the running application, nor of the OS, but of a specific process where I have an active Process object that is tracking/associated with the process. Edit Looki...
To get your bitness you will have to call some native methods. A good writeup on how to do this can be found in this StackOverflow answer
Get bitness (32-bit/64-bit) from Process object Duplicate: How can I tell if another process is 64bit? Can I detect the bitness of a process from a.net Process object? I'm not trying to detect the bitness of the running application, nor of the OS, but of a specific process where I have an active Process object that is ...
TITLE: Get bitness (32-bit/64-bit) from Process object QUESTION: Duplicate: How can I tell if another process is 64bit? Can I detect the bitness of a process from a.net Process object? I'm not trying to detect the bitness of the running application, nor of the OS, but of a specific process where I have an active Proce...
[ ".net", ".net-4.0", "process" ]
3
0
1,813
1
0
2011-05-31T14:30:13.273000
2011-05-31T15:37:13.797000
6,189,141
6,189,157
Action<T> question
Given the code below: private static Dictionary > controlDefaults = new Dictionary >() { { typeof(TextBox), c => ((TextBox)c).Clear() } }; How would I invoke the action in this case? This is a code snippet taken from somewhere else, and the dictionary would contain many more instances of controls. This willbe used for ...
You can write controlDefaults[control.GetType()](control); You could also use a static generic class as the dictionary, and avoid casting: static class ControlDefaults where T: Control { public static Action Action { get; internal set; } } static void Populate() { //This method should be called once, and should be in ...
Action<T> question Given the code below: private static Dictionary > controlDefaults = new Dictionary >() { { typeof(TextBox), c => ((TextBox)c).Clear() } }; How would I invoke the action in this case? This is a code snippet taken from somewhere else, and the dictionary would contain many more instances of controls. Th...
TITLE: Action<T> question QUESTION: Given the code below: private static Dictionary > controlDefaults = new Dictionary >() { { typeof(TextBox), c => ((TextBox)c).Clear() } }; How would I invoke the action in this case? This is a code snippet taken from somewhere else, and the dictionary would contain many more instanc...
[ "c#", ".net", "action" ]
0
3
261
3
0
2011-05-31T14:30:50.747000
2011-05-31T14:31:53.143000
6,189,152
6,190,175
Why doesnt code inside ContentPlaceHolder cause an exception?
AFAIK anything placed inside ContentPlaceHolder is simply overwritten when the child merges with the Master. This can make for some interesting troubleshooting. I had a situation where all my javascript would simply not work. After a while I noticed somebody had placed all the header information for the.Master inside t...
I believe this is a way to supply a default template if no child overrides the content placeholder. If the child page doesn't implement that content section, then the default appears in its place. HTH.
Why doesnt code inside ContentPlaceHolder cause an exception? AFAIK anything placed inside ContentPlaceHolder is simply overwritten when the child merges with the Master. This can make for some interesting troubleshooting. I had a situation where all my javascript would simply not work. After a while I noticed somebody...
TITLE: Why doesnt code inside ContentPlaceHolder cause an exception? QUESTION: AFAIK anything placed inside ContentPlaceHolder is simply overwritten when the child merges with the Master. This can make for some interesting troubleshooting. I had a situation where all my javascript would simply not work. After a while ...
[ "asp.net", "master-pages" ]
1
1
112
1
0
2011-05-31T14:31:21.760000
2011-05-31T15:48:58.753000
6,189,155
6,189,331
static_cast dynamic_cast: expected constant expression?
In visual C++ 2010, when compiling the following codes, I get error message: static_cast error C2057: expected constant expression. what's wrong with that? struct A {}; struct B: A {}; struct XX { static const int offset = (long)static_cast ((B*)0x8) - 0x8; }; Thanks AProgrammer, the following is correct for VC 2010: ...
Your casts to A* and B* prevent the initializer of x to be a constant expression: 5.19/3 Cast operators in an arithmetic constant expression shall only convert arithmetic or enumeration types to arithmetic or enumeration types, excepted as part of an operand to the sizeof operator. which is needed in that context: 9.2/...
static_cast dynamic_cast: expected constant expression? In visual C++ 2010, when compiling the following codes, I get error message: static_cast error C2057: expected constant expression. what's wrong with that? struct A {}; struct B: A {}; struct XX { static const int offset = (long)static_cast ((B*)0x8) - 0x8; }; Th...
TITLE: static_cast dynamic_cast: expected constant expression? QUESTION: In visual C++ 2010, when compiling the following codes, I get error message: static_cast error C2057: expected constant expression. what's wrong with that? struct A {}; struct B: A {}; struct XX { static const int offset = (long)static_cast ((B*...
[ "c++", "visual-c++" ]
0
7
1,480
2
0
2011-05-31T14:31:40.653000
2011-05-31T14:43:32.133000
6,189,158
6,189,833
what is the correct way to clear quartz.net ramjobstore without re-starting app in c#
If there is a way to do this, can I also confirm by viewing the ramstore before and after clear. How can we view the contents of the ramstore programmatically? In my case I am reading all job and trigger info from file. On some custom event I need to stop the scheduler and start all over again without re-starting the a...
The RamJobStore from the Quartz.NET frameworks provides several methods to view it's contents, the easiest is the 'GetJobGroupNames()' and 'GetJobNames()' functions: public virtual string[] GetJobGroupNames( SchedulingContext ctxt ) public virtual string[] GetJobNames( SchedulingContext ctxt, string groupName ) You ca...
what is the correct way to clear quartz.net ramjobstore without re-starting app in c# If there is a way to do this, can I also confirm by viewing the ramstore before and after clear. How can we view the contents of the ramstore programmatically? In my case I am reading all job and trigger info from file. On some custom...
TITLE: what is the correct way to clear quartz.net ramjobstore without re-starting app in c# QUESTION: If there is a way to do this, can I also confirm by viewing the ramstore before and after clear. How can we view the contents of the ramstore programmatically? In my case I am reading all job and trigger info from fi...
[ "c#", "scheduled-tasks", "quartz-scheduler", "scheduler", "quartz.net" ]
1
1
2,525
2
0
2011-05-31T14:31:53.647000
2011-05-31T15:22:04.270000
6,189,161
6,189,235
OSX: Where to store SQLite file for application?
My OSX Cocoa application uses SQLite to manage data. When initializing, I need to specify where the database file will be stored. What is the standard way of handling this? This database file is required to run (the app will create it if it doesn't exist), and the data should be persisted for ever, even after software ...
The convention is to store it in the Application Support folder. i.e. in ~/Library/Application Support/*YourAppName*/database.db You can find the Application Support that you're searching with NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, NSUserDomainMask, YES);
OSX: Where to store SQLite file for application? My OSX Cocoa application uses SQLite to manage data. When initializing, I need to specify where the database file will be stored. What is the standard way of handling this? This database file is required to run (the app will create it if it doesn't exist), and the data s...
TITLE: OSX: Where to store SQLite file for application? QUESTION: My OSX Cocoa application uses SQLite to manage data. When initializing, I need to specify where the database file will be stored. What is the standard way of handling this? This database file is required to run (the app will create it if it doesn't exis...
[ "cocoa", "macos", "filesystems" ]
5
10
1,959
3
0
2011-05-31T14:32:14.147000
2011-05-31T14:36:32.553000
6,189,167
6,189,244
How to use a Python stream object?
I have a function that takes an opened file object file and writes data to it like so: def Write(self, file): file.write("Data") Now I would like to test that function and I thought it would be neat to do that with some kind of stream that is not writing data to a file. I could not find a Python2.7 class that does the ...
As the documentation of io states: Since this module has been designed primarily for Python 3.x, you have to be aware that all uses of “bytes” in this document refer to the str type (of which bytes is an alias), and all uses of “text” refer to the unicode type. Furthermore, those two types are not interchangeable in th...
How to use a Python stream object? I have a function that takes an opened file object file and writes data to it like so: def Write(self, file): file.write("Data") Now I would like to test that function and I thought it would be neat to do that with some kind of stream that is not writing data to a file. I could not fi...
TITLE: How to use a Python stream object? QUESTION: I have a function that takes an opened file object file and writes data to it like so: def Write(self, file): file.write("Data") Now I would like to test that function and I thought it would be neat to do that with some kind of stream that is not writing data to a fi...
[ "python", "stream", "io", "python-2.7" ]
2
1
16,176
1
0
2011-05-31T14:32:36.403000
2011-05-31T14:37:13.633000
6,189,169
6,189,230
Redirect to 404 page or display 404 message?
I am using a cms, and file-not-found errors can be handled in different ways: The page will not be redirected, but an error-msg will be displayed as content (using the default layout with menu/footer). The page will be redirected to error.php (the page looks the same like 1. but the address changed) The page will be re...
If it's not found, then you should issue a 404 page. Doing a redirect causes a 302 code, followed by a '200 OK', implying that there IS some content. A 404 flat out says "there is no file. stop bugging me". Something like this would present a 404 page with proper header code:
Redirect to 404 page or display 404 message? I am using a cms, and file-not-found errors can be handled in different ways: The page will not be redirected, but an error-msg will be displayed as content (using the default layout with menu/footer). The page will be redirected to error.php (the page looks the same like 1....
TITLE: Redirect to 404 page or display 404 message? QUESTION: I am using a cms, and file-not-found errors can be handled in different ways: The page will not be redirected, but an error-msg will be displayed as content (using the default layout with menu/footer). The page will be redirected to error.php (the page look...
[ "php", "content-management-system", "seo", "search-engine" ]
11
17
29,494
2
0
2011-05-31T14:32:46.003000
2011-05-31T14:36:25.037000
6,189,176
6,189,469
How to get provider specific ConnectionString from Entity Framework
using ado.net tipically we need to define a connectionstring to create a sqlconnection object, and if we use the entity framework, we have to dedine a connectionstring too. is threre any way to get the specific provider connectionstring used by entity framework? Assuming that originally on ado.net we define the CS like...
string entityConnectionString =... var builder = new EntityConnectionStringBuilder(entityConnectionString); string providerConnectionString = builder.ProviderConnectionString;
How to get provider specific ConnectionString from Entity Framework using ado.net tipically we need to define a connectionstring to create a sqlconnection object, and if we use the entity framework, we have to dedine a connectionstring too. is threre any way to get the specific provider connectionstring used by entity ...
TITLE: How to get provider specific ConnectionString from Entity Framework QUESTION: using ado.net tipically we need to define a connectionstring to create a sqlconnection object, and if we use the entity framework, we have to dedine a connectionstring too. is threre any way to get the specific provider connectionstri...
[ ".net", "entity-framework", "ado.net", "connection-string" ]
14
31
6,909
2
0
2011-05-31T14:33:05.793000
2011-05-31T14:53:55.737000
6,189,180
6,189,408
CSS Class & ID Structure / Naming
I am a web developer for almost 2 years now and I am still learning new things every day, but since my knowledge gets bigger, I came across some fundamental question and couldnt find a good discussion about it. How do you name your DIVs, IDs, Classes? Do you give them specific content related names? (i.e. ) Or do you n...
HTML should be used as semantically as possible, so your classes and IDs should be named for their content, not for their style, or their position within the site (these things should be able to change without effecting your HTML. For example, if you name a and then later decide you'd like to move that element, the id ...
CSS Class & ID Structure / Naming I am a web developer for almost 2 years now and I am still learning new things every day, but since my knowledge gets bigger, I came across some fundamental question and couldnt find a good discussion about it. How do you name your DIVs, IDs, Classes? Do you give them specific content ...
TITLE: CSS Class & ID Structure / Naming QUESTION: I am a web developer for almost 2 years now and I am still learning new things every day, but since my knowledge gets bigger, I came across some fundamental question and couldnt find a good discussion about it. How do you name your DIVs, IDs, Classes? Do you give them...
[ "html", "css", "syntax" ]
3
6
825
5
0
2011-05-31T14:33:17.613000
2011-05-31T14:49:56.937000
6,189,181
6,189,336
Reading my Serialized Object from File in Android
This is my first attempt at serializing/deserializing objects on any platform and, to put it mildly, I'm confused. After implementing Serializable to my game object I output it to a file thus: public void saveGameState(){ ByteArrayOutputStream bos = new ByteArrayOutputStream(); try { ObjectOutput out = new ObjectOut...
The error you've shown is not at all related to serialization: its actually a video display error. I'd suggest looking at the object BEFORE you serialize to make sure its not null, and I'd also suggest serializing to a file on the SD card to make sure you actually had data output (so use new FileOutputStream("/mnt/sdca...
Reading my Serialized Object from File in Android This is my first attempt at serializing/deserializing objects on any platform and, to put it mildly, I'm confused. After implementing Serializable to my game object I output it to a file thus: public void saveGameState(){ ByteArrayOutputStream bos = new ByteArrayOutput...
TITLE: Reading my Serialized Object from File in Android QUESTION: This is my first attempt at serializing/deserializing objects on any platform and, to put it mildly, I'm confused. After implementing Serializable to my game object I output it to a file thus: public void saveGameState(){ ByteArrayOutputStream bos = n...
[ "android", "serialization", "file-io" ]
1
0
5,799
3
0
2011-05-31T14:33:27.440000
2011-05-31T14:43:50.920000
6,189,183
6,192,079
How to draw cube at some world coordinates, OpenGL
I have this code that doing this, but it don't work at all! GLdouble *posv = Utils::worldToScreen(px, py, pz); GLdouble x = posv[0]; GLdouble y = posv[1]; GLdouble z = posv[2]; GLdouble *sizev = Utils::worldToScreen(1.0f, 1.0f, 1.0f); GLdouble sizex = sizev[0]; GLdouble sizey = sizev[1]; GLdouble sizez = sizev[2]; glB...
Rather than drawing vertices at x+/-size, y+/-size, z+/-size, why don't you just translate to x, y, z with glTranslatef() and then do your drawing? Try this as your draw function: void drawCube(float x, float y, float z) { const float sizex = 0.5f; const float sizey = 0.5f; const float sizez = 0.5f glTranslatef(-x, -y...
How to draw cube at some world coordinates, OpenGL I have this code that doing this, but it don't work at all! GLdouble *posv = Utils::worldToScreen(px, py, pz); GLdouble x = posv[0]; GLdouble y = posv[1]; GLdouble z = posv[2]; GLdouble *sizev = Utils::worldToScreen(1.0f, 1.0f, 1.0f); GLdouble sizex = sizev[0]; GLdoubl...
TITLE: How to draw cube at some world coordinates, OpenGL QUESTION: I have this code that doing this, but it don't work at all! GLdouble *posv = Utils::worldToScreen(px, py, pz); GLdouble x = posv[0]; GLdouble y = posv[1]; GLdouble z = posv[2]; GLdouble *sizev = Utils::worldToScreen(1.0f, 1.0f, 1.0f); GLdouble sizex =...
[ "c++", "opengl", "3d", "projection" ]
0
2
3,792
1
0
2011-05-31T14:33:30.410000
2011-05-31T18:47:39.213000
6,189,194
6,189,380
I'm trying to connect to a mysql database using PHP but it won't work
I've Installed mysql, php, apache using a wamp configuration Where to access localhost is would be http://localhost:81 the PHP script I'm using is if(mysql_connect('localhost', 'root', 'exobytes15')) { mysql_select_db('testDB'); } else { echo 'Could not Connect to the database'; } But this gives me the error 1045: Acce...
Either you didn't grant root@localhost the necessary rights to access the database or you're providing the wrong password. Note: granting access to root@`%` does NOT grant access to root@localhost...
I'm trying to connect to a mysql database using PHP but it won't work I've Installed mysql, php, apache using a wamp configuration Where to access localhost is would be http://localhost:81 the PHP script I'm using is if(mysql_connect('localhost', 'root', 'exobytes15')) { mysql_select_db('testDB'); } else { echo 'Could ...
TITLE: I'm trying to connect to a mysql database using PHP but it won't work QUESTION: I've Installed mysql, php, apache using a wamp configuration Where to access localhost is would be http://localhost:81 the PHP script I'm using is if(mysql_connect('localhost', 'root', 'exobytes15')) { mysql_select_db('testDB'); } e...
[ "php", "mysql", "wamp", "mysql-error-1045" ]
1
1
2,851
4
0
2011-05-31T14:34:08.373000
2011-05-31T14:48:02.293000
6,189,196
6,191,286
counting letters for each word in a text with Perl
I am trying to write a program wit Perl which should returns the frequency of all words in the file and the length of each word in the file (not the sum of all characters!) to produce a Zipf curve from a Spanish text (is not a big deal if you don't know what a Zipf's curve is). Now my problem is: I can do the first par...
You can use hash of hashes if you want to store the length of the word. while (my $line = <>) { foreach my $word (split /\s+/, $line) { $count_of{$word}{word_count}++; $count_of{$word}{word_length} = length($word); } } print "All words and their counts and length: \n"; for my $word (sort keys %count_of) { print "$word...
counting letters for each word in a text with Perl I am trying to write a program wit Perl which should returns the frequency of all words in the file and the length of each word in the file (not the sum of all characters!) to produce a Zipf curve from a Spanish text (is not a big deal if you don't know what a Zipf's c...
TITLE: counting letters for each word in a text with Perl QUESTION: I am trying to write a program wit Perl which should returns the frequency of all words in the file and the length of each word in the file (not the sum of all characters!) to produce a Zipf curve from a Spanish text (is not a big deal if you don't kn...
[ "perl", "count", "words", "letters" ]
2
2
2,442
3
0
2011-05-31T14:34:11.263000
2011-05-31T17:34:08.770000
6,189,205
6,189,239
Problems with "this" in JavaScript namespaces and event listeners
First of all, I'm attempting to use faux namespaces in my JavaScript program like so: // Ish.Com namespace declaration var Ish = Ish || {}; Ish.Com = Ish.Com || {}; // begin Ish.Com.View namespace Ish.Com.View = new function() { var privateVariable; this.publicFunction = function() { this.publicFunction2() }; this.p...
Seems like I've been answering every question this morning the same way:-) You can use ".bind()": var eventHandler = yourObject.someFunction.bind(yourObject); That'll guarantee that this will refer to "yourObject" whenever the "eventHandler" is called by anything. The "bind()" function is there on the Function.prototyp...
Problems with "this" in JavaScript namespaces and event listeners First of all, I'm attempting to use faux namespaces in my JavaScript program like so: // Ish.Com namespace declaration var Ish = Ish || {}; Ish.Com = Ish.Com || {}; // begin Ish.Com.View namespace Ish.Com.View = new function() { var privateVariable; th...
TITLE: Problems with "this" in JavaScript namespaces and event listeners QUESTION: First of all, I'm attempting to use faux namespaces in my JavaScript program like so: // Ish.Com namespace declaration var Ish = Ish || {}; Ish.Com = Ish.Com || {}; // begin Ish.Com.View namespace Ish.Com.View = new function() { var pr...
[ "javascript", "dom-events", "javascript-namespaces" ]
2
4
1,155
3
0
2011-05-31T14:34:36.317000
2011-05-31T14:36:48.407000
6,189,207
6,189,271
Several Visual Studio projects are complaining that a temp file is missing and therefore cannot be opened. Error code &H80070003
I'm running Visual Studio 2010 on a terminal server, and have been, with relatively few problems, for some time. This morning I fired up my PC and over the UK's long weekend, the following issue seems to have developed. I've got a bunch of projects (but not all of my projects, and not all of the projects in a given sol...
If you've verified the file doesn't exist and are still getting that message the most likely answer is that the permissions on that directory don't allow your user account to write to them. Try creating a file in that directory and see if it succeeds. If it doesn't then you know this is the problem and you will need to...
Several Visual Studio projects are complaining that a temp file is missing and therefore cannot be opened. Error code &H80070003 I'm running Visual Studio 2010 on a terminal server, and have been, with relatively few problems, for some time. This morning I fired up my PC and over the UK's long weekend, the following is...
TITLE: Several Visual Studio projects are complaining that a temp file is missing and therefore cannot be opened. Error code &H80070003 QUESTION: I'm running Visual Studio 2010 on a terminal server, and have been, with relatively few problems, for some time. This morning I fired up my PC and over the UK's long weekend...
[ ".net", "vb.net", "visual-studio", "visual-studio-2010" ]
15
17
14,719
3
0
2011-05-31T14:34:45.600000
2011-05-31T14:39:05.553000
6,189,216
6,189,418
How to detect browser rendering engine in javascript?
I read a book calls 'Professional Javascript For Web Developers 2nd edition' and it state that this code can detect browser rendering engine: but it seems like doesn't work, so how this code work to detect browser rendering engine?Thanks
If you read the rest of the chapter and download the source then you can look at client.js: It still works in IE10 on win7 and Chrome 67 on Win10 It needs a little change to handle IE11 (Trident/) and Edge(Edge/) - see later var client = function() { //rendering engines var engine = { ie: 0, gecko: 0, webkit: 0,...
How to detect browser rendering engine in javascript? I read a book calls 'Professional Javascript For Web Developers 2nd edition' and it state that this code can detect browser rendering engine: but it seems like doesn't work, so how this code work to detect browser rendering engine?Thanks
TITLE: How to detect browser rendering engine in javascript? QUESTION: I read a book calls 'Professional Javascript For Web Developers 2nd edition' and it state that this code can detect browser rendering engine: but it seems like doesn't work, so how this code work to detect browser rendering engine?Thanks ANSWER: I...
[ "javascript", "rendering-engine" ]
9
15
16,055
3
0
2011-05-31T14:35:25.240000
2011-05-31T14:50:22.993000
6,189,221
6,189,721
Hoare logic: how does a strictly decreasing loop variant by itself prove termination?
Referring to the while rule for total correctness, WP seems to tell me that just finding a loop variant that strictly decreases is enough to prove termination. I can't accept that, either because I'm missing something or the rule is wrong. Consider int i = 1000; while(true) i--; in which the value of variable i is a st...
The loop-variant must be a natural number. A natural number cannot decrease past zero. Using big words, the loop variant is a value that is monotonically decreasing with respect to a well-founded relation. It's the well-foundedness that's missing from your reasoning.
Hoare logic: how does a strictly decreasing loop variant by itself prove termination? Referring to the while rule for total correctness, WP seems to tell me that just finding a loop variant that strictly decreases is enough to prove termination. I can't accept that, either because I'm missing something or the rule is w...
TITLE: Hoare logic: how does a strictly decreasing loop variant by itself prove termination? QUESTION: Referring to the while rule for total correctness, WP seems to tell me that just finding a loop variant that strictly decreases is enough to prove termination. I can't accept that, either because I'm missing somethin...
[ "language-agnostic", "logic", "verification", "variant" ]
1
5
464
3
0
2011-05-31T14:35:37.767000
2011-05-31T15:12:52.587000
6,189,231
6,189,532
Byte array marshaling for PostMessage
I'm trying to port some C++ code to C#, and one of the things that I need to do is use PostMessage to pass a byte array to another process' window. I'm trying to get the source code to the other program so I can see exactly what it's expecting, but in the meantime, here's what the original C++ code looks like: unsigned...
The problem is that COPYDATASTRUCT is supposed to contain a pointer as the last member, and you're passing the entire array. Take a look at the example on pinvoke.net: http://www.pinvoke.net/default.aspx/Structures/COPYDATASTRUCT.html More info after comments: Given these definitions: const int WM_COPYDATA = 0x004A; [...
Byte array marshaling for PostMessage I'm trying to port some C++ code to C#, and one of the things that I need to do is use PostMessage to pass a byte array to another process' window. I'm trying to get the source code to the other program so I can see exactly what it's expecting, but in the meantime, here's what the ...
TITLE: Byte array marshaling for PostMessage QUESTION: I'm trying to port some C++ code to C#, and one of the things that I need to do is use PostMessage to pass a byte array to another process' window. I'm trying to get the source code to the other program so I can see exactly what it's expecting, but in the meantime...
[ "c#", "mfc" ]
4
8
5,334
4
0
2011-05-31T14:36:28.063000
2011-05-31T14:58:22.227000
6,189,232
6,190,255
How to manage static files in django project with many apps?
I am developing a web app based on django for a while. At the beginning, I just put all the static files such as css, js and some icons in one folder and served the folder as static files. While the project evolves, more and more apps added, and there are too many files stored in the folder. Therefore, I would like to ...
You could probably do a mix. Project wide templates and static files could be stored in one central location. And all the app related files would be stored in a dedicated static-subdirectory in each app's folder. If you use Django 1.3 contrib.staticfiles makes this really easy. It even provides a handy collectstatic co...
How to manage static files in django project with many apps? I am developing a web app based on django for a while. At the beginning, I just put all the static files such as css, js and some icons in one folder and served the folder as static files. While the project evolves, more and more apps added, and there are too...
TITLE: How to manage static files in django project with many apps? QUESTION: I am developing a web app based on django for a while. At the beginning, I just put all the static files such as css, js and some icons in one folder and served the folder as static files. While the project evolves, more and more apps added,...
[ "django" ]
2
3
992
3
0
2011-05-31T14:36:28.897000
2011-05-31T15:55:22.067000
6,189,234
6,189,255
Simple Regex help
I have a format of 0000.00 that a number must fit. If I receive 1, 12, 123, 1234, 1.23, 12.34, 123.45, 1234.56 I can accept them. If they are in a different format eg. lengths are larger for instance or format is ABCDE then I need to reject them Is there a Regex that will fit these formats?
You can do this with: ^\d{1,4}(\.\d\d)?$ Captures 1 to 4 digits, then an optional. which must be followed by exactly two more digits (if it is present).
Simple Regex help I have a format of 0000.00 that a number must fit. If I receive 1, 12, 123, 1234, 1.23, 12.34, 123.45, 1234.56 I can accept them. If they are in a different format eg. lengths are larger for instance or format is ABCDE then I need to reject them Is there a Regex that will fit these formats?
TITLE: Simple Regex help QUESTION: I have a format of 0000.00 that a number must fit. If I receive 1, 12, 123, 1234, 1.23, 12.34, 123.45, 1234.56 I can accept them. If they are in a different format eg. lengths are larger for instance or format is ABCDE then I need to reject them Is there a Regex that will fit these f...
[ "c#", "regex", "vb.net" ]
1
5
54
4
0
2011-05-31T14:36:32.040000
2011-05-31T14:37:50.433000
6,189,236
6,189,347
Parsing XML problem with LINQ
I want to get some values from the XML file and insert them into a ListBox using LINQ. Where am I wrong? Code-behind: protected void Button1_Click(object sender, EventArgs e) { XDocument owlXML = XDocument.Load(Server.MapPath("App_Data\\myFile.xml")); var items = from item in owlXML.Descendants("instanceof") where ite...
var names = from item in owlXML.Descendants("instanceof") let name = item.Element("catom").Attribute("name") // cache where name.Value == "value" select name; foreach (var name in names.ToArray()) { ListBox1.Items.Add(name); } or var items = from item in owlXML.Descendants("instanceof") let name = item.Element("catom"...
Parsing XML problem with LINQ I want to get some values from the XML file and insert them into a ListBox using LINQ. Where am I wrong? Code-behind: protected void Button1_Click(object sender, EventArgs e) { XDocument owlXML = XDocument.Load(Server.MapPath("App_Data\\myFile.xml")); var items = from item in owlXML.Desce...
TITLE: Parsing XML problem with LINQ QUESTION: I want to get some values from the XML file and insert them into a ListBox using LINQ. Where am I wrong? Code-behind: protected void Button1_Click(object sender, EventArgs e) { XDocument owlXML = XDocument.Load(Server.MapPath("App_Data\\myFile.xml")); var items = from it...
[ "c#", "asp.net", "linq", ".net-3.5", "linq-to-xml" ]
1
0
147
1
0
2011-05-31T14:36:40.123000
2011-05-31T14:44:42.673000
6,189,237
6,189,500
Return to app after call ends
Possible Duplicate: How to make a phone call in android and come back to my activity when the call is done? The call is being initiated from the app via startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phNo)));. After the call ends, I do not return to the app, but to the phone's desktop. What am I doing ...
After you start the phone call have a listener, finish the call activity, and it will redirect back to the last activity (your app). Here is a link to some sample code (it's in spanish but you should be able to make out the code at least): Returning to App After Phone Call
Return to app after call ends Possible Duplicate: How to make a phone call in android and come back to my activity when the call is done? The call is being initiated from the app via startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phNo)));. After the call ends, I do not return to the app, but to the pho...
TITLE: Return to app after call ends QUESTION: Possible Duplicate: How to make a phone call in android and come back to my activity when the call is done? The call is being initiated from the app via startActivity(new Intent(Intent.ACTION_CALL, Uri.parse("tel:" + phNo)));. After the call ends, I do not return to the a...
[ "android" ]
3
2
5,944
2
0
2011-05-31T14:36:41.757000
2011-05-31T14:56:23.570000
6,189,242
6,215,893
AS2: Mouse moves too fast messes up function
I am using the following code as part of a set of scrollable bars to change each bar in relation to another when one is dragged. It works until the user swipes the bar as fast as possible then the numbers go wrong... I'm sure this is the function unable to process as fast as the mouse but anyone know a way around this?...
This problem still occurs and I don't think it can be avoided but I use another function ( Slider_checker ) that runs once 20ms after the mouse is idle everytime the mouse scrolls a scrollbar (the 20ms allows it to ensure that all loops of Food_Scroll_ratio are finished so nothing interferes with it and saves some cpu ...
AS2: Mouse moves too fast messes up function I am using the following code as part of a set of scrollable bars to change each bar in relation to another when one is dragged. It works until the user swipes the bar as fast as possible then the numbers go wrong... I'm sure this is the function unable to process as fast as...
TITLE: AS2: Mouse moves too fast messes up function QUESTION: I am using the following code as part of a set of scrollable bars to change each bar in relation to another when one is dragged. It works until the user swipes the bar as fast as possible then the numbers go wrong... I'm sure this is the function unable to ...
[ "flash", "function", "actionscript", "actionscript-2", "mousemove" ]
0
0
492
1
0
2011-05-31T14:36:56.353000
2011-06-02T14:28:02.937000
6,189,246
6,189,293
PHP How to test whether one of the values of an array exists (partly) in a string?
Must be simple but cant find my answer. How to test whether one of the values in the array is contained in the string? Output should be true or false. $array = Array( 0 => 'word1', 1 => 'word2', 2 => 'New York' 3 => 'New car' ); $string = "Its a sunny day in New York"; Trying to clarify. In this case array[3] should n...
Update: A word boundary independent solution would be to add spaces around the input string and the search words: $str = ' '. $str. ' '; function quote($a) { return ' '. preg_quote($a, '/'). ' '; } $word_pattern = '/'. implode('|', array_map('quote', $array)). '/'; if(preg_match($word_pattern, $str) > 0) { } or by ...
PHP How to test whether one of the values of an array exists (partly) in a string? Must be simple but cant find my answer. How to test whether one of the values in the array is contained in the string? Output should be true or false. $array = Array( 0 => 'word1', 1 => 'word2', 2 => 'New York' 3 => 'New car' ); $string...
TITLE: PHP How to test whether one of the values of an array exists (partly) in a string? QUESTION: Must be simple but cant find my answer. How to test whether one of the values in the array is contained in the string? Output should be true or false. $array = Array( 0 => 'word1', 1 => 'word2', 2 => 'New York' 3 => 'Ne...
[ "php", "string", "if-statement" ]
4
1
378
7
0
2011-05-31T14:37:21.233000
2011-05-31T14:40:49.110000
6,189,275
6,194,600
How do I generate random sample data in my Oracle database?
Does anyone know of a tool that can inspect a specified schema and generate random data based on the tables and columns of that schema?
Another alternative is Swingbench Data Generator It is useful to use the SAMPLE clause (for example generating order lines for a random combination of orders and products)
How do I generate random sample data in my Oracle database? Does anyone know of a tool that can inspect a specified schema and generate random data based on the tables and columns of that schema?
TITLE: How do I generate random sample data in my Oracle database? QUESTION: Does anyone know of a tool that can inspect a specified schema and generate random data based on the tables and columns of that schema? ANSWER: Another alternative is Swingbench Data Generator It is useful to use the SAMPLE clause (for examp...
[ "java", "sql", "oracle", "dataset" ]
17
4
11,418
5
0
2011-05-31T14:39:35.900000
2011-05-31T23:12:28.407000
6,189,301
6,189,412
How to access an IMAP Server using the iOS SDK
Are there any classes/frameworks within the iOS SDK which can be used to easily access an IMAP server? I do NOT what to write a new Mail app. I just need the basic IMAP functions like check for new message, download messages, etc. So far I have found MailCore but as far as I can tell it is for MacOS and not iOS. Thank ...
There is a remail project so you can look into it... there is no public iOS framework for dealing with IMAP as much as I know...
How to access an IMAP Server using the iOS SDK Are there any classes/frameworks within the iOS SDK which can be used to easily access an IMAP server? I do NOT what to write a new Mail app. I just need the basic IMAP functions like check for new message, download messages, etc. So far I have found MailCore but as far as...
TITLE: How to access an IMAP Server using the iOS SDK QUESTION: Are there any classes/frameworks within the iOS SDK which can be used to easily access an IMAP server? I do NOT what to write a new Mail app. I just need the basic IMAP functions like check for new message, download messages, etc. So far I have found Mail...
[ "ios", "frameworks", "imap" ]
0
0
681
1
0
2011-05-31T14:41:24.053000
2011-05-31T14:50:08.797000
6,189,309
6,189,425
Ruby Permutation (Builtin) - Result does not contain adjacent identical letters
Thank you for your help yesterday and for teaching me something new as well.:) I have another question based on permutation... the algorithm I have works however I have the issue that identical adjacent characters are missing from the list generated. For example, if I have the character list a-z,0-9,- and let's say tha...
I think you want to use repeated_permutation instead of permutation. http://www.ruby-doc.org/core/classes/Array.html#M000289 It will generate all permutations including "file-bb.txt".
Ruby Permutation (Builtin) - Result does not contain adjacent identical letters Thank you for your help yesterday and for teaching me something new as well.:) I have another question based on permutation... the algorithm I have works however I have the issue that identical adjacent characters are missing from the list ...
TITLE: Ruby Permutation (Builtin) - Result does not contain adjacent identical letters QUESTION: Thank you for your help yesterday and for teaching me something new as well.:) I have another question based on permutation... the algorithm I have works however I have the issue that identical adjacent characters are miss...
[ "ruby", "permutation", "ruby-1.8" ]
0
3
930
2
0
2011-05-31T14:42:04.443000
2011-05-31T14:50:52.323000
6,189,318
6,190,155
Push Notification for iphone
i want to develope a windows service which sends a push notification to iphone for content update. is there any sample code or project available to do so and is there any API or helper class to implement push notification.
Go through follwowing two links http://mobiforge.com/developing/story/programming-apple-push-notification-services and http://www.macoscoders.com/2009/05/17/iphone-apple-push-notification-service-apns/ Hope this helps.
Push Notification for iphone i want to develope a windows service which sends a push notification to iphone for content update. is there any sample code or project available to do so and is there any API or helper class to implement push notification.
TITLE: Push Notification for iphone QUESTION: i want to develope a windows service which sends a push notification to iphone for content update. is there any sample code or project available to do so and is there any API or helper class to implement push notification. ANSWER: Go through follwowing two links http://mo...
[ "c#", "iphone", "windows-services" ]
1
1
2,207
3
0
2011-05-31T14:42:36.563000
2011-05-31T15:47:08.853000
6,189,329
6,194,327
PHP error message on form after enabling intl.so extension
Here is my controller: fname; $user->lname; $user->bday; $form = $this->get('form.factory') ->createBuilder('form', $user) ->add('fname', 'text', array('label' => 'First Name: ')) ->add('lname', 'text', array('label' => 'Last Name: ')) ->add('bday', 'birthday', array('input' => 'array', 'widget' => 'choice')) ->getFor...
It's strange that the default value isn't working, but try this out (doing the same thing it should be doing by default as detailed in http://symfony.com/doc/current/reference/forms/types/birthday.html $dater = new \IntlDateFormatter(); $form = $this->get('form.factory') ->createBuilder('form', $user) ->add('fname', 't...
PHP error message on form after enabling intl.so extension Here is my controller: fname; $user->lname; $user->bday; $form = $this->get('form.factory') ->createBuilder('form', $user) ->add('fname', 'text', array('label' => 'First Name: ')) ->add('lname', 'text', array('label' => 'Last Name: ')) ->add('bday', 'birthday'...
TITLE: PHP error message on form after enabling intl.so extension QUESTION: Here is my controller: fname; $user->lname; $user->bday; $form = $this->get('form.factory') ->createBuilder('form', $user) ->add('fname', 'text', array('label' => 'First Name: ')) ->add('lname', 'text', array('label' => 'Last Name: ')) ->add(...
[ "php", "frameworks", "symfony", "intl" ]
1
1
1,225
1
0
2011-05-31T14:43:25.193000
2011-05-31T22:32:50.577000
6,189,340
6,192,039
What's a recommendable way to search/sort I18n'ed strings with DataTables when using AJAX as a data source?
So, my team and I are working on this application, where we use the DataTables jQuery plugin ( http://datatables.net/ ) to present tabular data provided by our Rails (3.0.7) backend. We're having a problem with the interaction between the datatable's builtin AJAX search and sorting functionalities and Rails' I18n suppo...
We had a similar problem: We had to maintain a db table with artwork names. Occasionally, artworks have different names in other languages. In order for those (we ended up calling them) synonyms to be searcheable, we inserted them into a synonyms table. This might not be a solution for your case. Have a look at the fer...
What's a recommendable way to search/sort I18n'ed strings with DataTables when using AJAX as a data source? So, my team and I are working on this application, where we use the DataTables jQuery plugin ( http://datatables.net/ ) to present tabular data provided by our Rails (3.0.7) backend. We're having a problem with t...
TITLE: What's a recommendable way to search/sort I18n'ed strings with DataTables when using AJAX as a data source? QUESTION: So, my team and I are working on this application, where we use the DataTables jQuery plugin ( http://datatables.net/ ) to present tabular data provided by our Rails (3.0.7) backend. We're havin...
[ "jquery", "ruby-on-rails", "ajax", "internationalization", "datatables" ]
0
0
567
1
0
2011-05-31T14:44:18.033000
2011-05-31T18:43:25.187000
6,189,341
6,189,854
Limiting processes to 0.5s in Bash
How can I limit processes to less than 1s CPU time in Bash? I am using version 4.1.5(1) and if I type ulimit -t 0.5 command, I get: -bash: ulimit: 0.5: invalid number I am using ulimit -t 1 command as an imperfect substitute, but for technical reasons I don't need to bother you with, I would very much like command to b...
As other people said, you can't do it with the standard built-in Bash commands. It is possible to create your own command to limit the elapsed time for a command (distinct from the actual CPU time used by the command; see also the comments from Rob, for which, thanks!). I've previously published on SO code to do timeou...
Limiting processes to 0.5s in Bash How can I limit processes to less than 1s CPU time in Bash? I am using version 4.1.5(1) and if I type ulimit -t 0.5 command, I get: -bash: ulimit: 0.5: invalid number I am using ulimit -t 1 command as an imperfect substitute, but for technical reasons I don't need to bother you with, ...
TITLE: Limiting processes to 0.5s in Bash QUESTION: How can I limit processes to less than 1s CPU time in Bash? I am using version 4.1.5(1) and if I type ulimit -t 0.5 command, I get: -bash: ulimit: 0.5: invalid number I am using ulimit -t 1 command as an imperfect substitute, but for technical reasons I don't need to...
[ "linux", "bash", "shell", "unix" ]
1
4
1,614
3
0
2011-05-31T14:44:18.670000
2011-05-31T15:23:18.260000
6,189,342
6,189,722
PHP to populate drop down list with specific dates
I'm looking to populate a drop down list in a form with dates of the next 4 Fridays and Saturdays. This is for a reservation system of sorts. I'm thinking I should be using the strtotime function. However, I'd like to order this drop down menu so that if the user tries the operation on a Saturday, the first saturday op...
I assume this string is getting passed to strtotime()? Don't use "next friday" and "next saturday". Saying "next friday" always gets you the next Friday after today. Just use "friday" instead, it returns the same as "today" if today is Friday, otherwise it returns the same as "next friday". To get the next four Fridays...
PHP to populate drop down list with specific dates I'm looking to populate a drop down list in a form with dates of the next 4 Fridays and Saturdays. This is for a reservation system of sorts. I'm thinking I should be using the strtotime function. However, I'd like to order this drop down menu so that if the user tries...
TITLE: PHP to populate drop down list with specific dates QUESTION: I'm looking to populate a drop down list in a form with dates of the next 4 Fridays and Saturdays. This is for a reservation system of sorts. I'm thinking I should be using the strtotime function. However, I'd like to order this drop down menu so that...
[ "php", "forms", "strtotime" ]
0
1
1,058
1
0
2011-05-31T14:44:22.090000
2011-05-31T15:13:00.007000