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,221,679
6,222,728
node.js POST request fails
I'm trying to perform a POST request with node.js, but it always seems to time out. I also tried doing the request with cURL in PHP just to make sure and that works fine. Also, when performing the exact same request on my local server (127.0.0.1) instead of the remote server, it works perfectly fine too. node.js: var p...
You're passing the headers to the http request call and then trying to add the Content-Length header after the fact. You should be doing that before you pass in the values, as it changes the way http request sets up Transfer-Encoding: var body = "postdata"; var postRequest = { host: "www.facepunch.com", path: "/newrep...
node.js POST request fails I'm trying to perform a POST request with node.js, but it always seems to time out. I also tried doing the request with cURL in PHP just to make sure and that works fine. Also, when performing the exact same request on my local server (127.0.0.1) instead of the remote server, it works perfect...
TITLE: node.js POST request fails QUESTION: I'm trying to perform a POST request with node.js, but it always seems to time out. I also tried doing the request with cURL in PHP just to make sure and that works fine. Also, when performing the exact same request on my local server (127.0.0.1) instead of the remote server...
[ "php", "post", "curl", "node.js", "request" ]
2
3
3,345
1
0
2011-06-02T23:56:56.977000
2011-06-03T03:39:16.533000
6,221,682
6,221,718
How to select an element within a jquery dialog
let me start by qualifying that I am very new to jquery. I've been using it for a month or so now with moderate success. I'm hoping my question is easily answered. Basically, I have a dialog on a page that contains content that is generated within a DWR Ajax call. What I want to do is define a couple of divs in my cont...
You have defined the click event for.expansion-header before it exists! should attach the click event in showdialog() or consider binding it using.live()
How to select an element within a jquery dialog let me start by qualifying that I am very new to jquery. I've been using it for a month or so now with moderate success. I'm hoping my question is easily answered. Basically, I have a dialog on a page that contains content that is generated within a DWR Ajax call. What I ...
TITLE: How to select an element within a jquery dialog QUESTION: let me start by qualifying that I am very new to jquery. I've been using it for a month or so now with moderate success. I'm hoping my question is easily answered. Basically, I have a dialog on a page that contains content that is generated within a DWR ...
[ "jquery" ]
1
1
4,949
3
0
2011-06-02T23:57:07.560000
2011-06-03T00:05:13.637000
6,221,690
6,221,736
erasing a shape in java
i am trying to draw circles that appear every second, i was able to do so but how do i make the old shape disappear? public void paint(Graphics g) { try { while (true) { Shape circle = new Ellipse2D.Double(500*Math.random(),500*Math.random(), 50.0f, 50.0f); Graphics2D ga = (Graphics2D)g; ga.draw(circle); ga.setPaint(Co...
Just get the background color and use it to cover the old circle with a background-color circle.
erasing a shape in java i am trying to draw circles that appear every second, i was able to do so but how do i make the old shape disappear? public void paint(Graphics g) { try { while (true) { Shape circle = new Ellipse2D.Double(500*Math.random(),500*Math.random(), 50.0f, 50.0f); Graphics2D ga = (Graphics2D)g; ga.draw...
TITLE: erasing a shape in java QUESTION: i am trying to draw circles that appear every second, i was able to do so but how do i make the old shape disappear? public void paint(Graphics g) { try { while (true) { Shape circle = new Ellipse2D.Double(500*Math.random(),500*Math.random(), 50.0f, 50.0f); Graphics2D ga = (Gra...
[ "java", "drawing", "jpanel", "erase" ]
1
1
8,450
3
0
2011-06-02T23:59:02.827000
2011-06-03T00:07:25.983000
6,221,691
6,221,807
TextBoxFor Helper retains previous value even when model value is empty
I have an MVC form for adding a simple entity. I am using TextBoxFor(model => model.FieldName) to create the input fields. I have a Save button and a Save and New button. The Save and New button is supposed to post back to the Save action and then return the current View with an empty model to enable the user to add an...
The issue here is that your ViewData.ModelState is still populated with the values from the original post, even if the Model is null and you don't explicitly pass any values into your view. I actually don't think redirecting to the original action is that ugly of a solution, but if you don't want to do that then cleari...
TextBoxFor Helper retains previous value even when model value is empty I have an MVC form for adding a simple entity. I am using TextBoxFor(model => model.FieldName) to create the input fields. I have a Save button and a Save and New button. The Save and New button is supposed to post back to the Save action and then ...
TITLE: TextBoxFor Helper retains previous value even when model value is empty QUESTION: I have an MVC form for adding a simple entity. I am using TextBoxFor(model => model.FieldName) to create the input fields. I have a Save button and a Save and New button. The Save and New button is supposed to post back to the Sav...
[ "asp.net-mvc-3" ]
11
13
4,209
3
0
2011-06-02T23:59:09.223000
2011-06-03T00:19:13.933000
6,221,693
6,221,702
Is the BOM an OS(Win, Nix . . . ) or encoding standard (UTF-8, ASCII . . .) concept?
Is the BOM a Windows characterisitc or a characteristic of some encoding method? I write code in Windows 7 and Linux. I have the option of choosing how I want my code encoded. I want to be able to switch between both OS's with out a headache. I'm somewhat sure I have acesss to all the characters I need using ASCII. Wha...
BOM is a Unicode encoding thing, nothing to do with Windows and/or UNIX specifically. Probably the most ubiquitous encoding is UTF-8 and this is happily totally compatible with ASCII if you only use the ASCII character set.
Is the BOM an OS(Win, Nix . . . ) or encoding standard (UTF-8, ASCII . . .) concept? Is the BOM a Windows characterisitc or a characteristic of some encoding method? I write code in Windows 7 and Linux. I have the option of choosing how I want my code encoded. I want to be able to switch between both OS's with out a he...
TITLE: Is the BOM an OS(Win, Nix . . . ) or encoding standard (UTF-8, ASCII . . .) concept? QUESTION: Is the BOM a Windows characterisitc or a characteristic of some encoding method? I write code in Windows 7 and Linux. I have the option of choosing how I want my code encoded. I want to be able to switch between both ...
[ "text", "encoding", "byte-order-mark" ]
0
1
164
1
0
2011-06-02T23:59:33.840000
2011-06-03T00:02:31.430000
6,221,695
6,221,729
Where can I find a video component or library for C#?
Is there a video library that will enable me to do basic functionality with videos such as splitting a video into two, capturing a frame from a video, converting video between different formats, etc.?
Well what type of client technology are you using? Silverlight has a lot of really great video functionality but you need to be comfortable with XAML. Silverlight Video Player
Where can I find a video component or library for C#? Is there a video library that will enable me to do basic functionality with videos such as splitting a video into two, capturing a frame from a video, converting video between different formats, etc.?
TITLE: Where can I find a video component or library for C#? QUESTION: Is there a video library that will enable me to do basic functionality with videos such as splitting a video into two, capturing a frame from a video, converting video between different formats, etc.? ANSWER: Well what type of client technology ar...
[ "c#", "video", "components" ]
1
0
299
2
0
2011-06-03T00:00:01.780000
2011-06-03T00:06:15.780000
6,221,696
6,221,836
Installing setup tools for python
I'm trying to install setuptools on centos 5.6 for python 2.7.1. The system version is python 2.4 I found a similar question here but the solution still brings up the same error: setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found Python is located in /usr/bin/python2.7.1 Any ideas?
Looks like the installer wants to execute python2.7, whereas your binary is called python2.7.1. Try making a symlink in your /usr/bin/ directory. sudo ln -s /usr/bin/python2.7.1 /usr/bin/python2.7
Installing setup tools for python I'm trying to install setuptools on centos 5.6 for python 2.7.1. The system version is python 2.4 I found a similar question here but the solution still brings up the same error: setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found Python is located in /usr/bin/python2.7.1 A...
TITLE: Installing setup tools for python QUESTION: I'm trying to install setuptools on centos 5.6 for python 2.7.1. The system version is python 2.4 I found a similar question here but the solution still brings up the same error: setuptools-0.6c11-py2.7.egg: line 3: exec: python2.7: not found Python is located in /usr...
[ "python" ]
3
6
2,377
1
0
2011-06-03T00:00:19.340000
2011-06-03T00:24:59.360000
6,221,697
6,221,713
http response - domain does not exist?
Is there any http header response code for domain name does not exist? similar to 404 not found? Just wondering if it is possible or any other better suggestions to achieve this would be helpful.
If the domain does not exist, then the HTTP client will not be able to connect to any HTTP server, and thus you will not get any HTTP response at all, because the lower layer protocols cannot connect to provide the conduit for the higher level HTTP connection.
http response - domain does not exist? Is there any http header response code for domain name does not exist? similar to 404 not found? Just wondering if it is possible or any other better suggestions to achieve this would be helpful.
TITLE: http response - domain does not exist? QUESTION: Is there any http header response code for domain name does not exist? similar to 404 not found? Just wondering if it is possible or any other better suggestions to achieve this would be helpful. ANSWER: If the domain does not exist, then the HTTP client will no...
[ "http", "response" ]
4
7
2,382
2
0
2011-06-03T00:00:54.277000
2011-06-03T00:04:39.620000
6,221,700
6,222,311
How do I cache values in .NET 4 so that they are available across multiple applications?
I have created a website in Visual Studio 2010 (File -> New Web Site), and to the resulting solution file I have added two more web sites. I know that for any one of the web sites I can use context.Application to share values among multiple users. But is there a way to share values among users of the different web site...
When I need to share data between Webware, I prefer to develop a WCF service and provide those data via a Singleton service. Then, each client can get same data from the Singleton service.
How do I cache values in .NET 4 so that they are available across multiple applications? I have created a website in Visual Studio 2010 (File -> New Web Site), and to the resulting solution file I have added two more web sites. I know that for any one of the web sites I can use context.Application to share values among...
TITLE: How do I cache values in .NET 4 so that they are available across multiple applications? QUESTION: I have created a website in Visual Studio 2010 (File -> New Web Site), and to the resulting solution file I have added two more web sites. I know that for any one of the web sites I can use context.Application to ...
[ "asp.net", "c#-4.0" ]
0
0
156
4
0
2011-06-03T00:01:52.927000
2011-06-03T02:07:21.473000
6,221,711
6,221,897
Replace a word in MySql database
Hi Is there a way to write a sql statement to search and replace a word in a mySql database? For example Find "word1" in "testDatabase" and replace it with "word2".
$tables = table_list; foreach($tables as $t) mysql_query("Update $t SET wordcol = 'word2' WHERE wordcol = 'word1' If it's more complicated than that you should look at not changing the sql and simply altering the phrasing in the php/html when that word gets output. You could even do something like: function my_sql_fet...
Replace a word in MySql database Hi Is there a way to write a sql statement to search and replace a word in a mySql database? For example Find "word1" in "testDatabase" and replace it with "word2".
TITLE: Replace a word in MySql database QUESTION: Hi Is there a way to write a sql statement to search and replace a word in a mySql database? For example Find "word1" in "testDatabase" and replace it with "word2". ANSWER: $tables = table_list; foreach($tables as $t) mysql_query("Update $t SET wordcol = 'word2' WHER...
[ "mysql", "database", "replace" ]
0
0
630
2
0
2011-06-03T00:04:08.823000
2011-06-03T00:40:44
6,221,712
6,221,721
Javascript tag ? syntax question
I came across the following code snippet and am confused about what the not: is doing. Is it a tag? If so, are there any other uses for it? var foo = { not: function(bool) { return!bool; } } Can you provide me with a possible use scenario for this kind of syntax?
This is not a tag. It is declaring an object with a property called "not" which is a function. You can find more details at JSON and Javascript syntax
Javascript tag ? syntax question I came across the following code snippet and am confused about what the not: is doing. Is it a tag? If so, are there any other uses for it? var foo = { not: function(bool) { return!bool; } } Can you provide me with a possible use scenario for this kind of syntax?
TITLE: Javascript tag ? syntax question QUESTION: I came across the following code snippet and am confused about what the not: is doing. Is it a tag? If so, are there any other uses for it? var foo = { not: function(bool) { return!bool; } } Can you provide me with a possible use scenario for this kind of syntax? ANSW...
[ "javascript" ]
2
6
80
2
0
2011-06-03T00:04:25.463000
2011-06-03T00:05:29.650000
6,221,716
6,221,829
Variable scope + eval in Clojure
In Clojure, (def x 3) (eval '(prn x)) prints 3, whereas (let [y 3] (eval '(prn y))) and (binding [z 3] (eval '(prn z))) generate an 'Unable to resolve var' exception. According to http://clojure.org/evaluation, eval, load-string, etc generate temporary namespaces to evaluate their contents. Therefore, I'd expect neithe...
1.: The reason this doesn't work is (more or less) given on the page you linked: It is an error if there is no global var named by the symbol […] And: […] A lookup is done in the current namespace to see if there is a mapping from the symbol to a var. If so, the value is the value of the binding of the var referred-to ...
Variable scope + eval in Clojure In Clojure, (def x 3) (eval '(prn x)) prints 3, whereas (let [y 3] (eval '(prn y))) and (binding [z 3] (eval '(prn z))) generate an 'Unable to resolve var' exception. According to http://clojure.org/evaluation, eval, load-string, etc generate temporary namespaces to evaluate their conte...
TITLE: Variable scope + eval in Clojure QUESTION: In Clojure, (def x 3) (eval '(prn x)) prints 3, whereas (let [y 3] (eval '(prn y))) and (binding [z 3] (eval '(prn z))) generate an 'Unable to resolve var' exception. According to http://clojure.org/evaluation, eval, load-string, etc generate temporary namespaces to ev...
[ "binding", "clojure", "eval", "let" ]
21
17
3,516
1
0
2011-06-03T00:05:02.643000
2011-06-03T00:22:36.560000
6,221,717
6,221,786
Exclude certain TagNames from * selection
Using the statement: var children = document.getElementById('id').getElementsByTagName('*'); I'd like to exclude all elements, is there a syntax for getElementsByTagName that lets me do that, or some other nice way?
You can't do it with a native function, but you can easily filter. http://jsfiddle.net/idbentley/ncH95/4/ It would be easier to use jQuery or a similar library (Zepto is a good tiny lib), but if you want to use raw javascript you can use the above.
Exclude certain TagNames from * selection Using the statement: var children = document.getElementById('id').getElementsByTagName('*'); I'd like to exclude all elements, is there a syntax for getElementsByTagName that lets me do that, or some other nice way?
TITLE: Exclude certain TagNames from * selection QUESTION: Using the statement: var children = document.getElementById('id').getElementsByTagName('*'); I'd like to exclude all elements, is there a syntax for getElementsByTagName that lets me do that, or some other nice way? ANSWER: You can't do it with a native funct...
[ "javascript", "syntax", "wildcard" ]
0
2
300
4
0
2011-06-03T00:05:09.393000
2011-06-03T00:15:29.910000
6,221,722
6,222,242
How to show more than one image as splash screen in android?
I am fairly new to android. I want to show two images back to back(each one for a small duration) as splash screens in android. I am able to show a single image but struggling to show the other image. public class SplashScreen extends Activity { /** * The thread to process splash screen events */ private Thread mSplas...
Create a little animation like this... http://www.codeproject.com/KB/android/AndroidSplash.aspx And put your two images one by one to show on screen... Happy Coding!
How to show more than one image as splash screen in android? I am fairly new to android. I want to show two images back to back(each one for a small duration) as splash screens in android. I am able to show a single image but struggling to show the other image. public class SplashScreen extends Activity { /** * The th...
TITLE: How to show more than one image as splash screen in android? QUESTION: I am fairly new to android. I want to show two images back to back(each one for a small duration) as splash screens in android. I am able to show a single image but struggling to show the other image. public class SplashScreen extends Activi...
[ "android", "screen", "splash-screen" ]
0
1
4,803
3
0
2011-06-03T00:05:29.900000
2011-06-03T01:55:39.737000
6,221,728
6,222,138
Java SWT Text control not showing until Shell resize
My attempt here is basically to hot-switch a component while the program is running. If the user presses a button then the control that is a browser turns into a Text control. I use a control to point to the browser and then switch it to point to the Text control(which is drawn offscreen on a non-showing shell) However...
It seems you may need to flush the layout cache. See this Why does an SWT Composite sometimes require a call to resize() to layout correctly?
Java SWT Text control not showing until Shell resize My attempt here is basically to hot-switch a component while the program is running. If the user presses a button then the control that is a browser turns into a Text control. I use a control to point to the browser and then switch it to point to the Text control(whi...
TITLE: Java SWT Text control not showing until Shell resize QUESTION: My attempt here is basically to hot-switch a component while the program is running. If the user presses a button then the control that is a browser turns into a Text control. I use a control to point to the browser and then switch it to point to th...
[ "java", "resize", "swt", "screen" ]
2
5
4,412
1
0
2011-06-03T00:06:10.580000
2011-06-03T01:36:10.863000
6,221,739
6,221,769
PHP loop through months array
This should be easy but I'm having trouble... In PHP how can I echo out a select drop down box that defaults to the current month and has options for 8 months prior (even if it goes in the last year). For example, for this month it would default to June and end at November.
$months = array(); for ($i = 0; $i < 8; $i++) { $timestamp = mktime(0, 0, 0, date('n') - $i, 1); $months[date('n', $timestamp)] = date('F', $timestamp); } Alternative for "custom" month names: $months = array(1 => 'Jan.', 2 => 'Feb.', 3 => 'Mar.', 4 => 'Apr.', 5 => 'May', 6 => 'Jun.', 7 => 'Jul.', 8 => 'Aug.', 9 => 'Se...
PHP loop through months array This should be easy but I'm having trouble... In PHP how can I echo out a select drop down box that defaults to the current month and has options for 8 months prior (even if it goes in the last year). For example, for this month it would default to June and end at November.
TITLE: PHP loop through months array QUESTION: This should be easy but I'm having trouble... In PHP how can I echo out a select drop down box that defaults to the current month and has options for 8 months prior (even if it goes in the last year). For example, for this month it would default to June and end at Novembe...
[ "php", "arrays", "date" ]
22
40
104,445
9
0
2011-06-03T00:07:44.337000
2011-06-03T00:12:18.187000
6,221,742
6,233,331
Where can I find a Gherkin language spec/guide?
I'm trying to find out all available syntax/format in Gherkin, such as about multiline argument and everything else I don't know yet. After digging Google search results though, it seems that the comprehensive guide is located in here: I thought that was pretty good, and it has a link to a page that supposedly describe...
The best place I know of to understand the Gherkin language is the wiki that you link to. However, as you found there's sometimes a broken link there. What I tend to do is to click the "Pages" link at the bottom of the gray bar with all the GitHub links in it. That takes you to an alphabetical listing of all the wiki p...
Where can I find a Gherkin language spec/guide? I'm trying to find out all available syntax/format in Gherkin, such as about multiline argument and everything else I don't know yet. After digging Google search results though, it seems that the comprehensive guide is located in here: I thought that was pretty good, and ...
TITLE: Where can I find a Gherkin language spec/guide? QUESTION: I'm trying to find out all available syntax/format in Gherkin, such as about multiline argument and everything else I don't know yet. After digging Google search results though, it seems that the comprehensive guide is located in here: I thought that was...
[ "cucumber", "specflow", "gherkin" ]
20
6
18,929
4
0
2011-06-03T00:08:01.407000
2011-06-03T22:38:05.493000
6,221,743
6,221,892
How should I distribute an iOS SDK in the form of a static library?
I'm currently compiling a static library for iOS, let's call it libMySDK.a. I copy any header files that the end user will need and put them into a folder with libMySDK.a. This folder can be dragged into a new Xcode project and everything works as expected if I set the -all_load linker flag in the build settings of the...
Openfeint provides its framework as a Static Framework. We can use the framework as a Framework from iOS SDK. "Add OpenFeint as a framework" in Readme for OpenFeint iOS SDK 2.10.1 Please take a look at github - Eskipol/OpenFeint-iOS-Framework. Open OpenFeint project and dive into the "OpenFeint-iOS" target. It has 'Bui...
How should I distribute an iOS SDK in the form of a static library? I'm currently compiling a static library for iOS, let's call it libMySDK.a. I copy any header files that the end user will need and put them into a folder with libMySDK.a. This folder can be dragged into a new Xcode project and everything works as expe...
TITLE: How should I distribute an iOS SDK in the form of a static library? QUESTION: I'm currently compiling a static library for iOS, let's call it libMySDK.a. I copy any header files that the end user will need and put them into a folder with libMySDK.a. This folder can be dragged into a new Xcode project and everyt...
[ "xcode", "ios", "sdk", "distribution", "static-libraries" ]
4
2
2,362
1
0
2011-06-03T00:08:05.213000
2011-06-03T00:39:18.160000
6,221,770
6,221,819
How can I strip a single quote from a dataTable.Select( ) query in C#?
So I have a list of dealers names and I am searching them in my datatable -- problem is, some chucklehead HAS to be named 'Young's' --- this causes an error. drs = dtDealers.Select("DealerName = '" + dealerName + "'"); So I tried to replace the string (although it didnt work for me - maybe I dont know how to use replac...
You can use the @ operator called the verbatim operator which means literal in latin. It will not do any interpretation of the characters within the string that would otherwise mean something.
How can I strip a single quote from a dataTable.Select( ) query in C#? So I have a list of dealers names and I am searching them in my datatable -- problem is, some chucklehead HAS to be named 'Young's' --- this causes an error. drs = dtDealers.Select("DealerName = '" + dealerName + "'"); So I tried to replace the stri...
TITLE: How can I strip a single quote from a dataTable.Select( ) query in C#? QUESTION: So I have a list of dealers names and I am searching them in my datatable -- problem is, some chucklehead HAS to be named 'Young's' --- this causes an error. drs = dtDealers.Select("DealerName = '" + dealerName + "'"); So I tried t...
[ "c#", "datatable.select" ]
2
4
7,167
6
0
2011-06-03T00:12:24.830000
2011-06-03T00:20:06.087000
6,221,777
6,221,877
How to add/reference attributes in a Django Model?
I wasn't sure how to word this exactly. But I have a model that lists a bunch of stores (complete with name, address, phone, etc). I also want to list and store links attributed to the store, so like say a Yelp Review, Yellowpages link, etc. Instead of constantly adding columns, I was kind of thinking having a differen...
You basically have two options based on what kind of relationship you want to model with your 'references': models.ForeignKey (if the model with the ForeignKey should have a link to exactly one model of a specific type in another django model) or models.ManyToManyField (if its a many to many relationship). Use the cont...
How to add/reference attributes in a Django Model? I wasn't sure how to word this exactly. But I have a model that lists a bunch of stores (complete with name, address, phone, etc). I also want to list and store links attributed to the store, so like say a Yelp Review, Yellowpages link, etc. Instead of constantly addin...
TITLE: How to add/reference attributes in a Django Model? QUESTION: I wasn't sure how to word this exactly. But I have a model that lists a bunch of stores (complete with name, address, phone, etc). I also want to list and store links attributed to the store, so like say a Yelp Review, Yellowpages link, etc. Instead o...
[ "django", "django-models" ]
1
3
1,320
2
0
2011-06-03T00:13:25.540000
2011-06-03T00:35:28.553000
6,221,779
6,221,831
php mysql wrapper class __destruct method fails to close database
Can anyone explain why mysql_close() fails when called from a class destructor? mysql_error() reports "Connection close failed." link_id = @mysql_connect($server, $user, $pass, false); if (!$this->link_id) { $this->DisplayError("Could not connect to server: $this->server."); die(mysql_error()); } if(!@mysql_select_db...
According to bug report #27903, it appears some resources are already cleaned up by the time class destructors are called due to end of script execution. In any case, as indicated in the manual... Using mysql_close() isn't usually necessary, as non-persistent open links are automatically closed at the end of the script...
php mysql wrapper class __destruct method fails to close database Can anyone explain why mysql_close() fails when called from a class destructor? mysql_error() reports "Connection close failed." link_id = @mysql_connect($server, $user, $pass, false); if (!$this->link_id) { $this->DisplayError("Could not connect to ser...
TITLE: php mysql wrapper class __destruct method fails to close database QUESTION: Can anyone explain why mysql_close() fails when called from a class destructor? mysql_error() reports "Connection close failed." link_id = @mysql_connect($server, $user, $pass, false); if (!$this->link_id) { $this->DisplayError("Could ...
[ "php", "mysql" ]
1
2
1,546
1
0
2011-06-03T00:13:51.360000
2011-06-03T00:23:15.497000
6,221,783
6,223,997
Add a header to a Word document?
I would like to add a custom header to a.doc file using PowerShell (I mean the actual Header, not a heading). This SHOULD work: $Word=New-Object -ComObject "Word.Application" $wdSeekPrimaryHeader = 1 $Doc=$Word.Documents.Open("C:\test.doc") $Selection=$Word.Selection $Doc.ActiveWindow.ActivePane.View.SeekView=$wdSeekPr...
I'm not sure the [ref] works anyway but you've got it referencing DoNotSaveChanges. wouldn't you want save changes?
Add a header to a Word document? I would like to add a custom header to a.doc file using PowerShell (I mean the actual Header, not a heading). This SHOULD work: $Word=New-Object -ComObject "Word.Application" $wdSeekPrimaryHeader = 1 $Doc=$Word.Documents.Open("C:\test.doc") $Selection=$Word.Selection $Doc.ActiveWindow.A...
TITLE: Add a header to a Word document? QUESTION: I would like to add a custom header to a.doc file using PowerShell (I mean the actual Header, not a heading). This SHOULD work: $Word=New-Object -ComObject "Word.Application" $wdSeekPrimaryHeader = 1 $Doc=$Word.Documents.Open("C:\test.doc") $Selection=$Word.Selection $...
[ "powershell", "powershell-2.0" ]
2
2
1,916
2
0
2011-06-03T00:14:51.677000
2011-06-03T06:59:48.850000
6,221,784
6,221,789
Do I have to return something in javascript function?
In JavaScript functions, do I need to return something (true or false)? So far, all the functions I wrote without returning anything work just fine. I'm just curious.
No; Javascript functions are not required to return a value. If you call a function that doesn't return a value, you'll get undefined as the return value.
Do I have to return something in javascript function? In JavaScript functions, do I need to return something (true or false)? So far, all the functions I wrote without returning anything work just fine. I'm just curious.
TITLE: Do I have to return something in javascript function? QUESTION: In JavaScript functions, do I need to return something (true or false)? So far, all the functions I wrote without returning anything work just fine. I'm just curious. ANSWER: No; Javascript functions are not required to return a value. If you call...
[ "javascript", "function", "return" ]
26
29
16,792
3
0
2011-06-03T00:14:51.677000
2011-06-03T00:16:07.303000
6,221,787
6,221,814
How to turn off a monitor using VB.NET code
How do I turn off a monitor using VB.NET code? OK, actually I found the C# solution. But I need the VB.NET solution. I have tried an online C# to VB.NET converter, but the converter is complaining that there are errors in it. How can the following C# code be translated to VB.NET? using System.Runtime.InteropServices; /...
Try this Public WM_SYSCOMMAND As Integer = &H112 Public SC_MONITORPOWER As Integer = &Hf170 _ Private Shared Function SendMessage(hWnd As Integer, hMsg As Integer, wParam As Integer, lParam As Integer) As Integer End Function Private Sub button1_Click(sender As Object, e As System.EventArgs) SendMessage(Me.Handle.ToIn...
How to turn off a monitor using VB.NET code How do I turn off a monitor using VB.NET code? OK, actually I found the C# solution. But I need the VB.NET solution. I have tried an online C# to VB.NET converter, but the converter is complaining that there are errors in it. How can the following C# code be translated to VB....
TITLE: How to turn off a monitor using VB.NET code QUESTION: How do I turn off a monitor using VB.NET code? OK, actually I found the C# solution. But I need the VB.NET solution. I have tried an online C# to VB.NET converter, but the converter is complaining that there are errors in it. How can the following C# code be...
[ "c#", ".net", "vb.net", "visual-studio-2010", "screen" ]
18
17
8,650
3
0
2011-06-03T00:15:32
2011-06-03T00:19:27.723000
6,221,793
6,233,960
How to configure mercurial to push with OSX 10.4
When attempting to push changes to bitbucket.org I receive an error "abort: authorization failed". I have configured my ~//.hgrc file to the following [web] cacerts = /etc/hg-ca-roots.pem allow_push = * push_ssl = false I know my login credential are correct because they work perfectly on bitbucket.org. I am able to pu...
If it's not a private repo you'd be able to pull and do outgoing without authenticating, so it's still possible your credentials are wrong. Try using --debug next time.
How to configure mercurial to push with OSX 10.4 When attempting to push changes to bitbucket.org I receive an error "abort: authorization failed". I have configured my ~//.hgrc file to the following [web] cacerts = /etc/hg-ca-roots.pem allow_push = * push_ssl = false I know my login credential are correct because they...
TITLE: How to configure mercurial to push with OSX 10.4 QUESTION: When attempting to push changes to bitbucket.org I receive an error "abort: authorization failed". I have configured my ~//.hgrc file to the following [web] cacerts = /etc/hg-ca-roots.pem allow_push = * push_ssl = false I know my login credential are co...
[ "macos", "mercurial" ]
1
0
332
1
0
2011-06-03T00:16:29.227000
2011-06-04T00:54:01.493000
6,221,798
6,221,827
Can you connect multiple USB Credit Card Readers to a single PC?
I realize this might not be the best setup, but humor me, is it possible to connect multiple USB Credit Card Readers to a single PC? Have anyone tried this before? How do you differentiate the data between the different readers?
USB MSRs (magnetic stripe readers) are often set up as "HID" devices, which means that input looks just like it's coming in over the keyboard. If you need to have multiple, you want USB MSRs that have drivers that do other things. A common solution is to have drivers that make the input come in on a virtual serial port...
Can you connect multiple USB Credit Card Readers to a single PC? I realize this might not be the best setup, but humor me, is it possible to connect multiple USB Credit Card Readers to a single PC? Have anyone tried this before? How do you differentiate the data between the different readers?
TITLE: Can you connect multiple USB Credit Card Readers to a single PC? QUESTION: I realize this might not be the best setup, but humor me, is it possible to connect multiple USB Credit Card Readers to a single PC? Have anyone tried this before? How do you differentiate the data between the different readers? ANSWER:...
[ "credit-card" ]
1
0
308
2
0
2011-06-03T00:17:06.820000
2011-06-03T00:22:11.280000
6,221,799
6,221,809
std::string == not working?
When I do: std::string name = targetBone->getName(); if(name == "Pelvis") { return; } I get: Error 1 error C2678: binary '==': no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) How do I resolve this error? Thanks
Have you included string in your cpp file #include This usually happens because the compiler need to see the definition of string class that resides in that included file to verify that it indeed declares an operator that takes a char*
std::string == not working? When I do: std::string name = targetBone->getName(); if(name == "Pelvis") { return; } I get: Error 1 error C2678: binary '==': no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) How do I resolve this error? Thanks
TITLE: std::string == not working? QUESTION: When I do: std::string name = targetBone->getName(); if(name == "Pelvis") { return; } I get: Error 1 error C2678: binary '==': no operator found which takes a left-hand operand of type 'std::string' (or there is no acceptable conversion) How do I resolve this error? Thanks ...
[ "c++", "visual-studio" ]
2
7
3,516
2
0
2011-06-03T00:18:02.810000
2011-06-03T00:19:15.167000
6,221,812
6,221,948
Using in line anonymous structures for organization
In the following code I have placed anonymous structures inside of my class declaration to hopefully improve the readability of it. class example { private: struct barrier { boost::barrier playlist_avaliable; boost::barrier display_sync; barrier( ): playlist_avaliable( 2 ), display_sync( 3 ) { } } barrier; public: exam...
Ok, some random thoughts: Leave out the 'barrier' after struct. It is redundant. It's barely more than syntactic sugar. It is a nice way to group variables. Whether you should use the struct may be influenced by the question how much transparent the inner struct should be to the class example. For example, do you want ...
Using in line anonymous structures for organization In the following code I have placed anonymous structures inside of my class declaration to hopefully improve the readability of it. class example { private: struct barrier { boost::barrier playlist_avaliable; boost::barrier display_sync; barrier( ): playlist_avaliable...
TITLE: Using in line anonymous structures for organization QUESTION: In the following code I have placed anonymous structures inside of my class declaration to hopefully improve the readability of it. class example { private: struct barrier { boost::barrier playlist_avaliable; boost::barrier display_sync; barrier( ): ...
[ "c++", "coding-style" ]
1
0
89
1
0
2011-06-03T00:19:24.213000
2011-06-03T00:53:46.067000
6,221,813
6,223,077
WPF ListView no scrollbar if height set to auto
Hi i have a ListView that binds to a collection. I set the height of the ListView to auto for it to take up all the space in the region. However there is not scrollbar after i set the height to auto. If i give it a height then the scrollbar would show up. the markup is pretty much like the following
I have a hunch that your ListView is inside a panel that allows it to expand vertically without limit. If you put a ListView inside a StackPanel, for example, the ListView 's height can exceed the height of the StackPanel. The ListView has increased its height to show all its items, as far as it's concerned, thus no sc...
WPF ListView no scrollbar if height set to auto Hi i have a ListView that binds to a collection. I set the height of the ListView to auto for it to take up all the space in the region. However there is not scrollbar after i set the height to auto. If i give it a height then the scrollbar would show up. the markup is pr...
TITLE: WPF ListView no scrollbar if height set to auto QUESTION: Hi i have a ListView that binds to a collection. I set the height of the ListView to auto for it to take up all the space in the region. However there is not scrollbar after i set the height to auto. If i give it a height then the scrollbar would show up...
[ "wpf", "listview", "layout", "scrollbar" ]
25
65
40,619
3
0
2011-06-03T00:19:25.390000
2011-06-03T04:51:06.440000
6,221,821
6,221,906
Extract a search string in context
I'm trying to do a MySQL query where I extract the search string in context. So if the search is "mysql" I'd like to return something like this from the 'body' column "It only takes minutes from downloading the MySQL Installer to having a ready to use" This is what I've got now but it doesn't work because it just grabs...
Here's the SQL you need: SELECT id, title, substring(body, case when locate('mysql', lower(body)) <= 20 then 1 else locate('mysql', lower(body)) - 20 end, case when locate('mysql', lower(body)) + 20 > length(body) then length(body) else locate('mysql', lower(body)) + 20 end) FROM content WHERE lower(body) LIKE '%mysql%...
Extract a search string in context I'm trying to do a MySQL query where I extract the search string in context. So if the search is "mysql" I'd like to return something like this from the 'body' column "It only takes minutes from downloading the MySQL Installer to having a ready to use" This is what I've got now but it...
TITLE: Extract a search string in context QUESTION: I'm trying to do a MySQL query where I extract the search string in context. So if the search is "mysql" I'd like to return something like this from the 'body' column "It only takes minutes from downloading the MySQL Installer to having a ready to use" This is what I...
[ "mysql", "search" ]
2
2
1,262
2
0
2011-06-03T00:20:47.160000
2011-06-03T00:42:15.607000
6,221,830
6,222,335
Is there any way to make an - XML element value - dynamic?
I know that this question seems illogical, but I have to try, and I hope to find a way, I've a DLL assembly reading a variable, "GalleryID", from an XML file. I can't modify the assembly, so I am wondering if I can make the XML element value dynamic? For example, to get this value from a querystring or any other scenar...
I am going to restate what I understand from your question to make sure I 'get it'. You have an assembly (from a.dll) that reads an XML file as a data source to get the "GalleryID" out of a node that looks like: 2 You want to be able to change the GalleryID before the assembly reads it. I assume (yes, dangerous...) tha...
Is there any way to make an - XML element value - dynamic? I know that this question seems illogical, but I have to try, and I hope to find a way, I've a DLL assembly reading a variable, "GalleryID", from an XML file. I can't modify the assembly, so I am wondering if I can make the XML element value dynamic? For exampl...
TITLE: Is there any way to make an - XML element value - dynamic? QUESTION: I know that this question seems illogical, but I have to try, and I hope to find a way, I've a DLL assembly reading a variable, "GalleryID", from an XML file. I can't modify the assembly, so I am wondering if I can make the XML element value d...
[ "c#", ".net", "asp.net", "xml", "vb.net" ]
0
0
447
2
0
2011-06-03T00:22:39.953000
2011-06-03T02:12:19.740000
6,221,847
6,221,860
Question about mysql_fetch_array?
How does mysql_fetch_array work? Is it a stack/queue?
It fetches the current row from the open cursor and hydrates it into an array using one or both of two methods: MYSQL_ASSOC - column names as array key MYSQL_NUM - column position as array index See http://en.wikipedia.org/wiki/Cursor_(databases)
Question about mysql_fetch_array? How does mysql_fetch_array work? Is it a stack/queue?
TITLE: Question about mysql_fetch_array? QUESTION: How does mysql_fetch_array work? Is it a stack/queue? ANSWER: It fetches the current row from the open cursor and hydrates it into an array using one or both of two methods: MYSQL_ASSOC - column names as array key MYSQL_NUM - column position as array index See http:/...
[ "php", "mysql", "sql", "arrays" ]
1
3
176
1
0
2011-06-03T00:28:26.603000
2011-06-03T00:31:06.980000
6,221,849
6,221,958
string match function
Hi I like to build a string function: if member of a list of string: "Nissan" from "Honda, Toyota, Nissan, Mazda" if start with or end with "Nissan" from "Nis*" as start with "Nissan" from "*san" as end with if not start with or end with "Ford" from "^Nis*" as start with "Ford" from "^*san" as end with if Not member...
Difficult to understand what you are asking for, but I will do my best to guess: To check if string is one of the following: Honda, Toyota, Nissan, Mazda ^(Honda|Toyota|Nissan|Mazda)$ Starts with Nis ^Nis.*$ Ends with san ^.*san$ Not starts with Nis ^(?!Nis).* Not ends with san ^.*(? Does not contain any of Hon*, Toy*,...
string match function Hi I like to build a string function: if member of a list of string: "Nissan" from "Honda, Toyota, Nissan, Mazda" if start with or end with "Nissan" from "Nis*" as start with "Nissan" from "*san" as end with if not start with or end with "Ford" from "^Nis*" as start with "Ford" from "^*san" as e...
TITLE: string match function QUESTION: Hi I like to build a string function: if member of a list of string: "Nissan" from "Honda, Toyota, Nissan, Mazda" if start with or end with "Nissan" from "Nis*" as start with "Nissan" from "*san" as end with if not start with or end with "Ford" from "^Nis*" as start with "Ford"...
[ "c#", ".net", "regex", "string", ".net-4.0" ]
0
2
363
2
0
2011-06-03T00:28:51.857000
2011-06-03T00:55:05.433000
6,221,854
6,242,898
Problem with Rails 3 and MySQL related to JSON dependency in ActiveSupport
I built my Rails 3 app using sqlite and now I'm trying to switch over to MySQL. I created a new MySQL db, changed database.yml accordingly, and I added an older version of the mysql2 gem to my gemfile ( gem 'mysql2', '< 0.3' ) which is supposed to play nicer with Rails 3. I can start the dev server fine. When I visit a...
The issue(s) you are experiencing could be due to 3 things: The version of Ruby you are using The use of the SystemTimer gem with Ruby 1.9 The JSON gem I've elaborated below... The first thing I would suggest is to upgrade your version of Ruby 1.9. The latest stable is: ruby 1.9.2p180 (2011-02-18 revision 30909) I woul...
Problem with Rails 3 and MySQL related to JSON dependency in ActiveSupport I built my Rails 3 app using sqlite and now I'm trying to switch over to MySQL. I created a new MySQL db, changed database.yml accordingly, and I added an older version of the mysql2 gem to my gemfile ( gem 'mysql2', '< 0.3' ) which is supposed ...
TITLE: Problem with Rails 3 and MySQL related to JSON dependency in ActiveSupport QUESTION: I built my Rails 3 app using sqlite and now I'm trying to switch over to MySQL. I created a new MySQL db, changed database.yml accordingly, and I added an older version of the mysql2 gem to my gemfile ( gem 'mysql2', '< 0.3' ) ...
[ "mysql", "json", "ruby-on-rails-3", "mysql2" ]
6
1
450
2
0
2011-06-03T00:29:58.067000
2011-06-05T12:27:26.090000
6,221,863
6,221,997
track how many numbers and counter in array
I need to find how many votes each one has. I have a count that counted how many candidates there are in play which was 5. And now I have a bunch of numbers from the arraylist that I need to count happy voted each candidate and the number of candidates changes depending on which arraylist I use but for test purposes I ...
I think you should get rid of oldvalue and use ++candidate[c]; instead of those three lines. Assuming I understand your code, and I barely do.
track how many numbers and counter in array I need to find how many votes each one has. I have a count that counted how many candidates there are in play which was 5. And now I have a bunch of numbers from the arraylist that I need to count happy voted each candidate and the number of candidates changes depending on wh...
TITLE: track how many numbers and counter in array QUESTION: I need to find how many votes each one has. I have a count that counted how many candidates there are in play which was 5. And now I have a bunch of numbers from the arraylist that I need to count happy voted each candidate and the number of candidates chang...
[ "java", "arrays", "counter" ]
0
2
400
2
0
2011-06-03T00:31:52.387000
2011-06-03T01:03:51.047000
6,221,868
6,221,887
Why does this print 12 times?
I am learning Perl's multithreading. My code: use warnings; use threads; use threads::shared; $howmany = 10; $threads = 5; $to = int($howmany / $threads); for (0.. $threads) {$trl[$_] = threads->create(\&main, $_);} for (@trl) {$_->join;} sub main { for (1.. $to) { print "test\n"; } } exit(0); I want to print the ...
Then I think you want for (0..$threads-1) or for (1..$threads), not for (0..$threads):-)
Why does this print 12 times? I am learning Perl's multithreading. My code: use warnings; use threads; use threads::shared; $howmany = 10; $threads = 5; $to = int($howmany / $threads); for (0.. $threads) {$trl[$_] = threads->create(\&main, $_);} for (@trl) {$_->join;} sub main { for (1.. $to) { print "test\n"; } } ...
TITLE: Why does this print 12 times? QUESTION: I am learning Perl's multithreading. My code: use warnings; use threads; use threads::shared; $howmany = 10; $threads = 5; $to = int($howmany / $threads); for (0.. $threads) {$trl[$_] = threads->create(\&main, $_);} for (@trl) {$_->join;} sub main { for (1.. $to) { pr...
[ "perl" ]
5
10
1,596
3
0
2011-06-03T00:33:15.710000
2011-06-03T00:38:01.427000
6,221,870
6,232,343
ASP.NET MVC how to achieve to use the same model with different error message
I am having this issue at the moment, I had address model (use required attribute to decorate) which can be used more than once on the same page, one is billing address and the other one is shipping address. when validation failed, I'd like to have suffix in front of my generic error message indicate which address is r...
You could create a custom attribute that does the dynamic formatting for you. You would just tag your address fields with the Address attribute like this: [Address] public string AddressLine1 { get; set; } You would need to add a property in the AddressBaseModel where you tell the system what type of address this is (y...
ASP.NET MVC how to achieve to use the same model with different error message I am having this issue at the moment, I had address model (use required attribute to decorate) which can be used more than once on the same page, one is billing address and the other one is shipping address. when validation failed, I'd like t...
TITLE: ASP.NET MVC how to achieve to use the same model with different error message QUESTION: I am having this issue at the moment, I had address model (use required attribute to decorate) which can be used more than once on the same page, one is billing address and the other one is shipping address. when validation ...
[ "asp.net", "asp.net-mvc-3" ]
0
0
741
3
0
2011-06-03T00:33:43.733000
2011-06-03T20:30:43.873000
6,221,886
6,221,919
Calculating LRC in java
I want to calculate LRC for the following message: T = 0101 0100 P = 0101 0000 1 = 0011 0001 2 = 0011 0010 Starting with 0x00 as the initial byte. 0 XOR ‘T’: 0000 0000 0101 0100 Result, LRC = 0101 0100 LRC XOR ‘P’: 0101 0100 0101 0000 Result, LRC = 0000 0100 LRC XOR ‘1’: 0000 0100 0011 0001 Result, LRC = 0011 0101 ...
Assuming you are talking about a longitudinal redundancy check; when in doubt, check you algorithm against published examples. Here's one in Java, which seems quite different than yours. Perhaps yours is some attempt to optimize the LRC using DeMorgan's theorm, but odds are good it picked up a mistake along the way.
Calculating LRC in java I want to calculate LRC for the following message: T = 0101 0100 P = 0101 0000 1 = 0011 0001 2 = 0011 0010 Starting with 0x00 as the initial byte. 0 XOR ‘T’: 0000 0000 0101 0100 Result, LRC = 0101 0100 LRC XOR ‘P’: 0101 0100 0101 0000 Result, LRC = 0000 0100 LRC XOR ‘1’: 0000 0100 0011 0001 ...
TITLE: Calculating LRC in java QUESTION: I want to calculate LRC for the following message: T = 0101 0100 P = 0101 0000 1 = 0011 0001 2 = 0011 0010 Starting with 0x00 as the initial byte. 0 XOR ‘T’: 0000 0000 0101 0100 Result, LRC = 0101 0100 LRC XOR ‘P’: 0101 0100 0101 0000 Result, LRC = 0000 0100 LRC XOR ‘1’: 00...
[ "java" ]
0
4
9,436
4
0
2011-06-03T00:37:24.650000
2011-06-03T00:46:29.140000
6,221,891
6,223,066
boost::asio async_read/async_send are bypassing it's handler
I made a static-lib. And I created this three classes in Connection Class #ifndef _CONNECTION_H_ #define _CONNECTION_H_ #include #include #include #include #include #include #include "ByteBuffer.h" class Connection: public boost::enable_shared_from_this { public: typedef boost::shared_ptr pointer; explicit Connectio...
boost::asio::async_read seems to call the read handler only when it reaches the "amount of data" passed to it. Quoting boost's 1.46.0 reference: async_read Start an asynchronous operation to read a certain amount of data from a stream. So as a solution, use socket_.async_read_some instead of boost::asio::async_read if ...
boost::asio async_read/async_send are bypassing it's handler I made a static-lib. And I created this three classes in Connection Class #ifndef _CONNECTION_H_ #define _CONNECTION_H_ #include #include #include #include #include #include #include "ByteBuffer.h" class Connection: public boost::enable_shared_from_this { p...
TITLE: boost::asio async_read/async_send are bypassing it's handler QUESTION: I made a static-lib. And I created this three classes in Connection Class #ifndef _CONNECTION_H_ #define _CONNECTION_H_ #include #include #include #include #include #include #include "ByteBuffer.h" class Connection: public boost::enable_sh...
[ "c++", "boost", "synchronization", "boost-asio" ]
1
4
2,889
1
0
2011-06-03T00:39:12.513000
2011-06-03T04:48:37.023000
6,221,893
6,224,981
MKMapKit - EXC_BAD_ACCESS when looping through MKAnnotations
I've been stuck on this EXC_BAD_ACCESS error 2 days now. I have a reloadAnnotations method that removes all annotations before adding new annotations. Before removing the annotation this method should be checking to see if the new set contains the same location so it's not removed and re-added. But as soon as I try to ...
The initializer in ParkAnnotation.m isn't written following ObjC conventions. The self variable is never set, the designated initializer of a class should follow the following pattern: - (id)init { self = [super init]; if (self) { /* custom initialization here... */ } return self; } Since self is not set, the accessor ...
MKMapKit - EXC_BAD_ACCESS when looping through MKAnnotations I've been stuck on this EXC_BAD_ACCESS error 2 days now. I have a reloadAnnotations method that removes all annotations before adding new annotations. Before removing the annotation this method should be checking to see if the new set contains the same locati...
TITLE: MKMapKit - EXC_BAD_ACCESS when looping through MKAnnotations QUESTION: I've been stuck on this EXC_BAD_ACCESS error 2 days now. I have a reloadAnnotations method that removes all annotations before adding new annotations. Before removing the annotation this method should be checking to see if the new set contai...
[ "objective-c", "ios", "ios4", "mkmapview", "mkannotation" ]
1
0
1,184
2
0
2011-06-03T00:39:38.597000
2011-06-03T08:57:38.673000
6,221,896
6,258,956
VS2010 Web Installer Project not recognizing IIS Express
I built an installer for a ASP.net web application and installing from Visual Studio fails to recognize IIS Express as a version of IIS. Is this expected behavior? If so is there a workaround?
Yes... It's expected behavior, but Visual Studio 2010 SP1 recognizes IIS Express and you can use it instead of Cassini(Visual Studio Development Server). http://blogs.msdn.com/b/webdevtools/archive/2010/12/11/visual-studio-2010-sp1-beta-iis-express-integration.aspx
VS2010 Web Installer Project not recognizing IIS Express I built an installer for a ASP.net web application and installing from Visual Studio fails to recognize IIS Express as a version of IIS. Is this expected behavior? If so is there a workaround?
TITLE: VS2010 Web Installer Project not recognizing IIS Express QUESTION: I built an installer for a ASP.net web application and installing from Visual Studio fails to recognize IIS Express as a version of IIS. Is this expected behavior? If so is there a workaround? ANSWER: Yes... It's expected behavior, but Visual S...
[ "asp.net", "installation", "iis-express" ]
0
1
155
1
0
2011-06-03T00:40:08.487000
2011-06-06T22:59:16.963000
6,221,904
6,233,122
Size of Background image in Flash
I have a swf and the background image looks bad in a monitor 1680 x 1050, it get cut, To define this in flash, I hace to edit my image to this size 1680 x 1050, but in flash How would I define this?. Can it be done in html code?
you have to edit your image in flash, right click-> properties->smooth
Size of Background image in Flash I have a swf and the background image looks bad in a monitor 1680 x 1050, it get cut, To define this in flash, I hace to edit my image to this size 1680 x 1050, but in flash How would I define this?. Can it be done in html code?
TITLE: Size of Background image in Flash QUESTION: I have a swf and the background image looks bad in a monitor 1680 x 1050, it get cut, To define this in flash, I hace to edit my image to this size 1680 x 1050, but in flash How would I define this?. Can it be done in html code? ANSWER: you have to edit your image in...
[ "flash", "size" ]
0
0
234
1
0
2011-06-03T00:42:01.497000
2011-06-03T22:04:16.270000
6,221,910
6,221,922
Copy structure member to an array
struct { char a[10]; char b[5]; char c[10]; } info; How can I concatenate all the struct data members into one single array?
With memcpy(): // Assign a buffer big enough to hold everything char *buf = malloc(sizeof(info.a) + sizeof(info.b) + sizeof(info.c)); // Get a pointer to the beginning of the buffer char *p = buf; // Copy sizeof(info.a) bytes of stuff from info.a to p memcpy(p, info.a, sizeof(info.a)); // Advance p to point immediately...
Copy structure member to an array struct { char a[10]; char b[5]; char c[10]; } info; How can I concatenate all the struct data members into one single array?
TITLE: Copy structure member to an array QUESTION: struct { char a[10]; char b[5]; char c[10]; } info; How can I concatenate all the struct data members into one single array? ANSWER: With memcpy(): // Assign a buffer big enough to hold everything char *buf = malloc(sizeof(info.a) + sizeof(info.b) + sizeof(info.c)); ...
[ "c", "arrays", "struct" ]
1
5
1,610
2
0
2011-06-03T00:43:40.067000
2011-06-03T00:47:21.233000
6,221,925
6,222,551
regex for currency (euro)
i am trying this code for make a validation for a value. (regex from this site ) UPDATE: Now i have $value1=250; $value2=10000; if (!preg_match("/^(([^0]{1})([0-9])*|(0{1}))(\,\d{2}){0,1}€?$/", $form['salary']) || (!$form['salary'])>$value1."€" && (!$form['salary'])<$value2."€" ){ echo ("invalido"); return false; } e...
This code below solved my problem: if (!preg_match("/^(([^0]{1})([0-9])*|(0{1}))(\,\d{2}){0,1}€?$/", $form['salary'])) { echo "invalid"; return false; } else { $value1 = 400; $value2 = 10000; $salary = $form['salary']; $salary = preg_replace('/[€]/i', '', $salary); if($salary < $value1 || $salary > $value2) { echo "bad...
regex for currency (euro) i am trying this code for make a validation for a value. (regex from this site ) UPDATE: Now i have $value1=250; $value2=10000; if (!preg_match("/^(([^0]{1})([0-9])*|(0{1}))(\,\d{2}){0,1}€?$/", $form['salary']) || (!$form['salary'])>$value1."€" && (!$form['salary'])<$value2."€" ){ echo ("inv...
TITLE: regex for currency (euro) QUESTION: i am trying this code for make a validation for a value. (regex from this site ) UPDATE: Now i have $value1=250; $value2=10000; if (!preg_match("/^(([^0]{1})([0-9])*|(0{1}))(\,\d{2}){0,1}€?$/", $form['salary']) || (!$form['salary'])>$value1."€" && (!$form['salary'])<$value2...
[ "php", "regex", "validation" ]
1
3
10,572
3
0
2011-06-03T00:48:26.957000
2011-06-03T03:01:52.187000
6,221,933
6,221,943
What's wrong with following google ecommerce analytics code
I have waited for more than 72 hours but ecommerce data is not tracked. Tracking is enabled in the analytics account.
I think you are missing a closing bracket: //Add each items in the order _gaq.push(['_addItem', '650', // order ID - necessary to associate item with transaction '29', // SKU/code - required 'bags set of 4', // product name 'Cleaning Supplies', // category or variation '15.99', // unit price - required '1' ]); //right ...
What's wrong with following google ecommerce analytics code I have waited for more than 72 hours but ecommerce data is not tracked. Tracking is enabled in the analytics account.
TITLE: What's wrong with following google ecommerce analytics code QUESTION: I have waited for more than 72 hours but ecommerce data is not tracked. Tracking is enabled in the analytics account. ANSWER: I think you are missing a closing bracket: //Add each items in the order _gaq.push(['_addItem', '650', // order ID ...
[ "google-analytics", "e-commerce" ]
0
5
320
1
0
2011-06-03T00:49:52.497000
2011-06-03T00:53:13.930000
6,221,934
6,223,012
How to go back to the beginning of a file after reaching .eof() in C++?
I just tried this, but don't work, maybe because I'm reading character by character? char character; while (!file.eof()) { character = file.get(); cout << character; }
OK, it works. The trick is call file.clear(); file.seekg(0, ios::beg); just after the iteration. Sorry:(
How to go back to the beginning of a file after reaching .eof() in C++? I just tried this, but don't work, maybe because I'm reading character by character? char character; while (!file.eof()) { character = file.get(); cout << character; }
TITLE: How to go back to the beginning of a file after reaching .eof() in C++? QUESTION: I just tried this, but don't work, maybe because I'm reading character by character? char character; while (!file.eof()) { character = file.get(); cout << character; } ANSWER: OK, it works. The trick is call file.clear(); file...
[ "c++" ]
1
0
2,985
3
0
2011-06-03T00:50:18.053000
2011-06-03T04:37:59.113000
6,221,939
6,222,034
can I send serialized data along with other variables through JQuery $.post?
so lets say I wanted to essentially do this: $.post( 'search_item.php', { serialzed_data, save: form.save.value, is_correct: form.is_correct.value, etc... } ) What is the correct syntax to do so? many thanks, EDIT to specify: lets say I have this: $.post( 'search_item.php', { 'checks':post_data, 'option[]':option, save...
You want to use serializeArray instead (.serialize turns the elements into a string, not an array) like so: $.post('search_item.php', { serializedData: $('input[name^="checks"]:checked').serializeArray(), extraVar: value }, function(output) { $('#return2').html(output).show(); }); The serializedData will be an array, n...
can I send serialized data along with other variables through JQuery $.post? so lets say I wanted to essentially do this: $.post( 'search_item.php', { serialzed_data, save: form.save.value, is_correct: form.is_correct.value, etc... } ) What is the correct syntax to do so? many thanks, EDIT to specify: lets say I have t...
TITLE: can I send serialized data along with other variables through JQuery $.post? QUESTION: so lets say I wanted to essentially do this: $.post( 'search_item.php', { serialzed_data, save: form.save.value, is_correct: form.is_correct.value, etc... } ) What is the correct syntax to do so? many thanks, EDIT to specify:...
[ "jquery", "ajax" ]
3
1
5,362
4
0
2011-06-03T00:51:14.430000
2011-06-03T01:12:58.687000
6,221,947
6,222,458
Ensuring that a static method gets called before main()
I have a collection of worker classes, and I need to be able to construct instances of these classes dynamically with a single factory. The reasoning behind this is that new worker classes are written frequently and I'd rather not have to update a factory class per worker type every time I add a new worker class. The w...
This sounds like the linker pulling in only the objects it needs, and not pulling in the one with the global variable. Then the global simply doesn't exist, so initialization order is a moot point. It's a real problem with static libraries, with no universal solution. Armed with the knowledge that the linker grabs an e...
Ensuring that a static method gets called before main() I have a collection of worker classes, and I need to be able to construct instances of these classes dynamically with a single factory. The reasoning behind this is that new worker classes are written frequently and I'd rather not have to update a factory class pe...
TITLE: Ensuring that a static method gets called before main() QUESTION: I have a collection of worker classes, and I need to be able to construct instances of these classes dynamically with a single factory. The reasoning behind this is that new worker classes are written frequently and I'd rather not have to update ...
[ "c++" ]
3
3
1,848
3
0
2011-06-03T00:53:44.430000
2011-06-03T02:40:58.693000
6,221,951
6,222,003
How to catch a specific SqlException error?
Q: Is there a better way to handle SqlExceptions? The below examples rely on interpreting the text in the message. Eg1: I have an existing try catch to handle if a table does not exist. Ignore the fact that I could check if the table exists in the first place. try { //code } catch(SqlException sqlEx) { if (sqlEx.Messag...
The SqlException has a Number property that you can check. For duplicate error the number is 2601. catch (SqlException e) { switch (e.Number) { case 2601: // Do something. break; default: throw; } } To get a list of all SQL errors from you server, try this: SELECT * FROM sysmessages Update This can now be simplified in...
How to catch a specific SqlException error? Q: Is there a better way to handle SqlExceptions? The below examples rely on interpreting the text in the message. Eg1: I have an existing try catch to handle if a table does not exist. Ignore the fact that I could check if the table exists in the first place. try { //code } ...
TITLE: How to catch a specific SqlException error? QUESTION: Q: Is there a better way to handle SqlExceptions? The below examples rely on interpreting the text in the message. Eg1: I have an existing try catch to handle if a table does not exist. Ignore the fact that I could check if the table exists in the first plac...
[ "c#", "exception", "sqlexception" ]
73
156
181,676
9
0
2011-06-03T00:54:03.120000
2011-06-03T01:04:51.837000
6,221,955
6,230,537
Struts tag in Javascript call
I have a JSP page where I want to say something like: <... onclick="alert(' ')"... /> This does not work. The page is not rendered. It works fine if I have just: <... onclick="f('Oops!')"... /> How should this be done?
Use bean:define to copy the message, then use a JSP expression. <... onclick="alert('<%= oops %>')... />
Struts tag in Javascript call I have a JSP page where I want to say something like: <... onclick="alert(' ')"... /> This does not work. The page is not rendered. It works fine if I have just: <... onclick="f('Oops!')"... /> How should this be done?
TITLE: Struts tag in Javascript call QUESTION: I have a JSP page where I want to say something like: <... onclick="alert(' ')"... /> This does not work. The page is not rendered. It works fine if I have just: <... onclick="f('Oops!')"... /> How should this be done? ANSWER: Use bean:define to copy the message, then us...
[ "javascript", "jsp", "struts" ]
0
1
1,234
1
0
2011-06-03T00:54:28.347000
2011-06-03T17:29:37.950000
6,221,960
6,231,488
how to load a url with URLLoader in Adobe Air with javascript disabled?
i am writing an Adobe Air application using flex builder.the application loads a URL using HTML control and URLLoader. the problem that the page has an instant redirection JavaScript that redirects the page to another one. I would like to disable that redirection. I think this can be achieved either by disabling JavaSc...
hey, i found a solution to load html source for a remote html document without loading it in htmlloader.so the javascript will not redirect me. here is the code (from htmlscout sample application of adobe dev). var loader:URLLoader = new URLLoader(); loader.addEventListener(Event.COMPLETE, function(e:Event):void { tryt...
how to load a url with URLLoader in Adobe Air with javascript disabled? i am writing an Adobe Air application using flex builder.the application loads a URL using HTML control and URLLoader. the problem that the page has an instant redirection JavaScript that redirects the page to another one. I would like to disable t...
TITLE: how to load a url with URLLoader in Adobe Air with javascript disabled? QUESTION: i am writing an Adobe Air application using flex builder.the application loads a URL using HTML control and URLLoader. the problem that the page has an instant redirection JavaScript that redirects the page to another one. I would...
[ "javascript", "air" ]
0
1
931
1
0
2011-06-03T00:55:33.807000
2011-06-03T19:02:07.107000
6,221,965
6,222,108
C++ multi dimensional array function parameter
How can I pass a two or multi dimensional array as a parameter of a function without defining its size?? Here is my example code: void test(int *a) { a[0][0] = 100; } int main() { int a[2][2]; test(a); cout<
If you're working exclusively with statically-sized, stack-allocated arrays, then a function template will do exactly what you're asking for: #include #include #include template void func(int (&arr)[N][M]) { std::cout << "int[" << N << "][" << M << "]\n"; for (std::size_t n = 0; n!= N; ++n) for (std::size_t m = 0; m!= ...
C++ multi dimensional array function parameter How can I pass a two or multi dimensional array as a parameter of a function without defining its size?? Here is my example code: void test(int *a) { a[0][0] = 100; } int main() { int a[2][2]; test(a); cout<
TITLE: C++ multi dimensional array function parameter QUESTION: How can I pass a two or multi dimensional array as a parameter of a function without defining its size?? Here is my example code: void test(int *a) { a[0][0] = 100; } int main() { int a[2][2]; test(a); cout< ANSWER: If you're working exclusively with sta...
[ "c++" ]
0
3
7,854
5
0
2011-06-03T00:57:35.753000
2011-06-03T01:28:27.810000
6,221,982
6,222,027
how to hook up the moment when a Thread has been destroyed
Is there any place to hook up when a Thread has been killed? Something like: onDestroy{ //do something... } EDIT: Sorry. I should have stated it more clearly. The thread termination is not because all the job has done but because it has been killed by the client code using ThreadGroup.destroy(). As my singleton is bein...
You can wrap both the action and the hook like this. public final class HookOnDestroy implements Runnable { private final Runnable action; private final Runnable hook; public HookOnDestroy(Runnable action, Runnable hook) { this.hook = hook; this.action = action; } @Override public void run() { try { action.run(); } fi...
how to hook up the moment when a Thread has been destroyed Is there any place to hook up when a Thread has been killed? Something like: onDestroy{ //do something... } EDIT: Sorry. I should have stated it more clearly. The thread termination is not because all the job has done but because it has been killed by the clien...
TITLE: how to hook up the moment when a Thread has been destroyed QUESTION: Is there any place to hook up when a Thread has been killed? Something like: onDestroy{ //do something... } EDIT: Sorry. I should have stated it more clearly. The thread termination is not because all the job has done but because it has been k...
[ "java", "multithreading" ]
4
8
2,776
5
0
2011-06-03T01:00:12.667000
2011-06-03T01:11:51.963000
6,221,984
6,232,823
EF4.0 - Is there a way to see what entities are attached to what ObjectContext during debugging?
This is in continuation with my problem here. I'm trying to use the solution Julie Lerman gave me a few months ago. I'm currently using the following to generate a new Game entity pre-attached to my ObjectContext: Game game = _gameRepository.GetGame(formData.GameID); AutoMapper.Mapper.Map (formData, game); In the repos...
You can ask the ObjectContext if it has a reference to a certain object by: ObjectStateEntry ose; bool isInContext = someContext.ObjectStateManager.TryGetObjectStateEntry(someObject, out ose);
EF4.0 - Is there a way to see what entities are attached to what ObjectContext during debugging? This is in continuation with my problem here. I'm trying to use the solution Julie Lerman gave me a few months ago. I'm currently using the following to generate a new Game entity pre-attached to my ObjectContext: Game game...
TITLE: EF4.0 - Is there a way to see what entities are attached to what ObjectContext during debugging? QUESTION: This is in continuation with my problem here. I'm trying to use the solution Julie Lerman gave me a few months ago. I'm currently using the following to generate a new Game entity pre-attached to my Object...
[ "c#", "asp.net-mvc-2", "entity-framework-4", "ninject", "objectcontext" ]
0
2
286
2
0
2011-06-03T01:00:40.933000
2011-06-03T21:22:01.290000
6,221,990
6,222,012
Adding namespaces to ASP.NET MVC 3 views
I tried adding namespaces to configuration/system.web/pages/namespaces in the web.config of my ASP.NET MVC 3 application so I could use classes in those namespaces in my views without needing a @using, however this has no effect. How can I add namespaces to my views?
MVC razor has a different area for namespaces. Look in the second web.config, the one in your Views folder and add namespaces this way.
Adding namespaces to ASP.NET MVC 3 views I tried adding namespaces to configuration/system.web/pages/namespaces in the web.config of my ASP.NET MVC 3 application so I could use classes in those namespaces in my views without needing a @using, however this has no effect. How can I add namespaces to my views?
TITLE: Adding namespaces to ASP.NET MVC 3 views QUESTION: I tried adding namespaces to configuration/system.web/pages/namespaces in the web.config of my ASP.NET MVC 3 application so I could use classes in those namespaces in my views without needing a @using, however this has no effect. How can I add namespaces to my ...
[ "asp.net-mvc", "asp.net-mvc-3", "namespaces" ]
11
28
4,708
3
0
2011-06-03T01:02:18
2011-06-03T01:07:07.907000
6,222,001
6,222,056
How to decouple my data layer better and restrict the scope of my unit tests?
I'm getting to grips with unit testing and learning how to break up my code into testable bits, but one thing I'm not clear on is how I can write my 'higher-level' code, such as my controller actions, so that testing the controller doesn't require going through the actual data layer (which is independently tested elsew...
I'm from the.net world, but we use Inversion of Control containers to allow us to inject any dependencies into the controller. This way you can mock any dependencies to behave how you want and focus your testing on the actions.
How to decouple my data layer better and restrict the scope of my unit tests? I'm getting to grips with unit testing and learning how to break up my code into testable bits, but one thing I'm not clear on is how I can write my 'higher-level' code, such as my controller actions, so that testing the controller doesn't re...
TITLE: How to decouple my data layer better and restrict the scope of my unit tests? QUESTION: I'm getting to grips with unit testing and learning how to break up my code into testable bits, but one thing I'm not clear on is how I can write my 'higher-level' code, such as my controller actions, so that testing the con...
[ "php", "unit-testing", "zend-framework", "architecture" ]
3
1
174
1
0
2011-06-03T01:04:20.450000
2011-06-03T01:16:19.153000
6,222,008
6,222,100
How do I remove a wrapper from a JSON Object?
I have a JSON object with a wrapper which contains information about the service it came from. Before parsing the object I really care about I would like to take off the wrapper and then just parse the object. How do I turn this JSON object: {"object":{"id_object": 1, "description": "Black" }, "origin":"colors"} Into t...
Since the whole thing is a blob of json, it doesn't make sense to 'unwrap it.' Just parse the whole thing, and and grab the value of the 'object' key, and go along from there.
How do I remove a wrapper from a JSON Object? I have a JSON object with a wrapper which contains information about the service it came from. Before parsing the object I really care about I would like to take off the wrapper and then just parse the object. How do I turn this JSON object: {"object":{"id_object": 1, "desc...
TITLE: How do I remove a wrapper from a JSON Object? QUESTION: I have a JSON object with a wrapper which contains information about the service it came from. Before parsing the object I really care about I would like to take off the wrapper and then just parse the object. How do I turn this JSON object: {"object":{"id...
[ "java", "json", "gson" ]
4
5
3,228
2
0
2011-06-03T01:06:33.717000
2011-06-03T01:25:58.513000
6,222,009
6,222,022
How do I repeat an ASIHTTPRequest?
Given the example code below: // ExampleModel.h @interface ExampleModel: NSObject { } @property (nonatomic, retain) ASIFormDataRequest *request; @property (nonatomic, copy) NSString *iVar; - (void)sendRequest; // ExampleModel.m @implementation ExampleModel @synthesize request; @synthesize iVar; # pragma mark NS...
I think I found the answer: https://groups.google.com/d/msg/asihttprequest/E-QrhJApsrk/Yc4aYCM3tssJ
How do I repeat an ASIHTTPRequest? Given the example code below: // ExampleModel.h @interface ExampleModel: NSObject { } @property (nonatomic, retain) ASIFormDataRequest *request; @property (nonatomic, copy) NSString *iVar; - (void)sendRequest; // ExampleModel.m @implementation ExampleModel @synthesize request; ...
TITLE: How do I repeat an ASIHTTPRequest? QUESTION: Given the example code below: // ExampleModel.h @interface ExampleModel: NSObject { } @property (nonatomic, retain) ASIFormDataRequest *request; @property (nonatomic, copy) NSString *iVar; - (void)sendRequest; // ExampleModel.m @implementation ExampleModel @sy...
[ "iphone", "objective-c", "asihttprequest", "nsoperationqueue" ]
2
2
4,318
3
0
2011-06-03T01:06:40.217000
2011-06-03T01:10:11.773000
6,222,017
6,222,399
Google Places JSON Throws a Parsing Error in Android
I'm writing an android app that takes your current location and returns a list of the stores near you using the Google Places web service. I'm able to get back (what I think is) valid JSON, but when I go to parse the JSON using the Android JSONObject library, I get a parsing error. Here is my class: public class Stores...
The problem is that you're trying to read an array in as an object. Change JSONObject results = completeJSONObj.getJSONObject("results"); to JSONArray results = completeJSONObj.getJSONArray("results"); and the parse exception goes away.
Google Places JSON Throws a Parsing Error in Android I'm writing an android app that takes your current location and returns a list of the stores near you using the Google Places web service. I'm able to get back (what I think is) valid JSON, but when I go to parse the JSON using the Android JSONObject library, I get a...
TITLE: Google Places JSON Throws a Parsing Error in Android QUESTION: I'm writing an android app that takes your current location and returns a list of the stores near you using the Google Places web service. I'm able to get back (what I think is) valid JSON, but when I go to parse the JSON using the Android JSONObjec...
[ "android", "json", "google-maps" ]
0
3
2,010
2
0
2011-06-03T01:07:52.967000
2011-06-03T02:25:28.320000
6,222,020
6,222,029
Running a C# console application as a Windows service
I have a basic C# console application that I would like to run as a Windows Service. I have created the Windows service using sc create. This worked fine, and I can see my service under services.msc. When I try and start this service I get the following error: Could not start the PROJECT service on Local Computer. Erro...
You cannot just take any console application and run as Windows service. First you need to implement your service class that would inherit from ServiceBase, then in entry point ( Main ) you need to run the service with ServiceBase.Run(new YourService()). In your service class you need to define what happens when servic...
Running a C# console application as a Windows service I have a basic C# console application that I would like to run as a Windows Service. I have created the Windows service using sc create. This worked fine, and I can see my service under services.msc. When I try and start this service I get the following error: Could...
TITLE: Running a C# console application as a Windows service QUESTION: I have a basic C# console application that I would like to run as a Windows Service. I have created the Windows service using sc create. This worked fine, and I can see my service under services.msc. When I try and start this service I get the foll...
[ "c#", ".net", "c#-4.0", "windows-services", "console-application" ]
7
9
14,324
6
0
2011-06-03T01:08:33.590000
2011-06-03T01:12:02.500000
6,222,021
6,222,818
does an entry in Instruments "leaked block" during application running imply memory leak?
does an entry in Instruments "leaked block" during application running imply memory leak? That is, if one is half way through using the iPhone application, where you might have some variables that have been retained but it hasn't got to the part of the application where it gets released, then do these show up as leaked...
A leak in Instruments indicates that Instruments cannot find a pointer to the allocated memory starting at any of a group of "root" pointers. Specifically, from the Memory Usage Performance Guidelines: The Leaks instrument records all allocation events that occur in your application and then periodically searches the a...
does an entry in Instruments "leaked block" during application running imply memory leak? does an entry in Instruments "leaked block" during application running imply memory leak? That is, if one is half way through using the iPhone application, where you might have some variables that have been retained but it hasn't ...
TITLE: does an entry in Instruments "leaked block" during application running imply memory leak? QUESTION: does an entry in Instruments "leaked block" during application running imply memory leak? That is, if one is half way through using the iPhone application, where you might have some variables that have been retai...
[ "iphone", "xcode", "memory-leaks", "xcode4", "instruments" ]
0
2
276
2
0
2011-06-03T01:09:20.887000
2011-06-03T03:57:58.757000
6,222,042
6,225,552
Design considerations for an error logging/notification library in C
I'm working on several programs right now, and have become frustrated over some of the haphazard ways I'm debugging my programs and logging errors. As such, I've decided to take a couple days to write an error library that I can use across all of my programs. I do most of my development in Windows, making extensive use...
In the case of not CRITICALERROR | CRASH, where the app would be expected to continue after the logging call, it would be better to queue, (thread-safe producer-consumer queue), off each log struct to a logging thread that performs the requested action/s. The logging thread would normally free the structs after handlin...
Design considerations for an error logging/notification library in C I'm working on several programs right now, and have become frustrated over some of the haphazard ways I'm debugging my programs and logging errors. As such, I've decided to take a couple days to write an error library that I can use across all of my p...
TITLE: Design considerations for an error logging/notification library in C QUESTION: I'm working on several programs right now, and have become frustrated over some of the haphazard ways I'm debugging my programs and logging errors. As such, I've decided to take a couple days to write an error library that I can use ...
[ "c", "error-handling" ]
2
1
862
2
0
2011-06-03T01:14:15.913000
2011-06-03T09:55:03.277000
6,222,043
6,223,484
Ant mapper and retaining folder structure
Not sure if there's documentation out there specifically for this, couldn't find it after perusing the ant docs and experimenting a bit, but the main just is this: Let's say in my Ant build I want to collect all the images in a certain folder and all subfolders in that folder so I can run them through ImageMagick to co...
Glob mapping isn't useful here, because you want to interpose something in the middle of the matched 'atom'. There is an example in the Ant documentation of this type of mapping that uses a regexpmapper, something like: The from says: grab the directory path to \1, grab the filename to \2. Then in the to the prefix is ...
Ant mapper and retaining folder structure Not sure if there's documentation out there specifically for this, couldn't find it after perusing the ant docs and experimenting a bit, but the main just is this: Let's say in my Ant build I want to collect all the images in a certain folder and all subfolders in that folder s...
TITLE: Ant mapper and retaining folder structure QUESTION: Not sure if there's documentation out there specifically for this, couldn't find it after perusing the ant docs and experimenting a bit, but the main just is this: Let's say in my Ant build I want to collect all the images in a certain folder and all subfolder...
[ "java", "ant" ]
1
2
1,377
2
0
2011-06-03T01:14:32.320000
2011-06-03T05:55:00.320000
6,222,044
6,222,171
Python - PyQT - How to detect mouse events when clicking text/points in a pixmap
Suppose I have drawn simple text (say just the letter 'x') with some font parameters (like size 20 font, etc.) onto an (x,y) location in a QLabel that holds a QPixmap. What are the relevant methods that I will need to override in order to detect a mouse event when a click occurs "precisely" over one of these drawn x's....
Although you alluded to your plans for user interaction in your previous question, it is now clear that the Graphics View Framework may be more appropriate for what you are trying to do. This is distinctly different from drawing in a widget. With this framework, you create a scene composed of graphic items (QGraphicsIt...
Python - PyQT - How to detect mouse events when clicking text/points in a pixmap Suppose I have drawn simple text (say just the letter 'x') with some font parameters (like size 20 font, etc.) onto an (x,y) location in a QLabel that holds a QPixmap. What are the relevant methods that I will need to override in order to ...
TITLE: Python - PyQT - How to detect mouse events when clicking text/points in a pixmap QUESTION: Suppose I have drawn simple text (say just the letter 'x') with some font parameters (like size 20 font, etc.) onto an (x,y) location in a QLabel that holds a QPixmap. What are the relevant methods that I will need to ove...
[ "python", "image-processing", "pyqt", "pixmap" ]
1
0
1,524
1
0
2011-06-03T01:14:37.710000
2011-06-03T01:44:28.213000
6,222,053
6,222,199
Problem reading JPEG Metadata (Orientation)
I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using plupload). I've got some server-side code to process images, including reading EXIF...
It appears that you forgotten that the orientation id values you looked up are in hex. Where you use 112, you should have used 0x112. This article explains how Windows ballsed-up orientation handing, and this one seems pretty relevant to what you are doing.
Problem reading JPEG Metadata (Orientation) I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using plupload). I've got some server-side co...
TITLE: Problem reading JPEG Metadata (Orientation) QUESTION: I've got a JPEG image which was taken on an iphone. On my desktop PC (Windows Photo Viewer, Google Chrome, etc) the orientation is incorrect. I'm working on an ASP.NET MVC 3 web application where i need to upload photos (currently using plupload). I've got s...
[ "c#", "image-processing", "metadata", "jpeg", "gdi" ]
71
17
41,956
6
0
2011-06-03T01:15:56.673000
2011-06-03T01:48:24.857000
6,222,062
6,222,137
How to set the value of a text input with MooTools
I have just begun playing with MooTools, and I don't understand why the following happens: var input = new Element('input'); input.set('type','text'); input.set('value','this is the value'); console.log(input); results in: ​, so setting the value hasn't worked. But if I do this: var input = new Element('input'); input....
Are you sure the value isn't being set? What do you get when you call: input.get('value') I tested this (in firefox) and even though the console just logs the value does in fact get set. Try adding the element to the page and you'll see it:)
How to set the value of a text input with MooTools I have just begun playing with MooTools, and I don't understand why the following happens: var input = new Element('input'); input.set('type','text'); input.set('value','this is the value'); console.log(input); results in: ​, so setting the value hasn't worked. But if ...
TITLE: How to set the value of a text input with MooTools QUESTION: I have just begun playing with MooTools, and I don't understand why the following happens: var input = new Element('input'); input.set('type','text'); input.set('value','this is the value'); console.log(input); results in: ​, so setting the value hasn...
[ "javascript", "mootools", "forms", "html-input" ]
1
2
6,388
2
0
2011-06-03T01:17:37.633000
2011-06-03T01:35:43.833000
6,222,064
6,222,121
sharpziplib compressed files to be uncompressed externally
I have a scenario where by I want to zip an email attachment using SharpZipLib. Then the end user will open the attachment and will unzip the attached file. Will the file originally zipped file using SharpZipLib be easily unzipped by other programs for my end user?
It depends on how you use SharpZipLib. There is more than one way to compress the data with this library. Here is example of method that will create a zip file that you will be able to open in pretty much any zip aware application: private static byte[] CreateZip(byte[] fileBytes, string fileName) { using (var memorySt...
sharpziplib compressed files to be uncompressed externally I have a scenario where by I want to zip an email attachment using SharpZipLib. Then the end user will open the attachment and will unzip the attached file. Will the file originally zipped file using SharpZipLib be easily unzipped by other programs for my end u...
TITLE: sharpziplib compressed files to be uncompressed externally QUESTION: I have a scenario where by I want to zip an email attachment using SharpZipLib. Then the end user will open the attachment and will unzip the attached file. Will the file originally zipped file using SharpZipLib be easily unzipped by other pro...
[ "c#", ".net", "asp.net", "compression", "sharpziplib" ]
2
4
909
1
0
2011-06-03T01:17:41.493000
2011-06-03T01:30:31.653000
6,222,085
6,222,200
set default drop down value on php generated form
I generated a drop down menu with the code below. How can I set the field to the GET variable after submit is clicked? ".$c; }?> C
'. $c. ' '; else echo ' '. $c. ' '; }?> Basic idea is compare value GET data with database data and using if else condition add selected="selected" if condition matched. I am directly printing string as they will not be getting use later on.
set default drop down value on php generated form I generated a drop down menu with the code below. How can I set the field to the GET variable after submit is clicked? ".$c; }?> C
TITLE: set default drop down value on php generated form QUESTION: I generated a drop down menu with the code below. How can I set the field to the GET variable after submit is clicked? ".$c; }?> C ANSWER: '. $c. ' '; else echo ' '. $c. ' '; }?> Basic idea is compare value GET data with database data and using if els...
[ "php", "html", "html-select" ]
1
1
3,186
2
0
2011-06-03T01:20:45.667000
2011-06-03T01:48:35.263000
6,222,086
6,237,325
Scrollbar arrows do not get redrawn while thumbtrack gets redrawn correctly
I have created a custom control by registering a new class for it and instantiating it as a child to a top-level window. The control is basically a list. In order to save some effort, I decided to use the WS_VSCROLL window class in order to add scrollbars to my custom control. My trouble is that when I resize the windo...
You could try sending an extra WM_NCPAINT message to the column in your WM_SIZE handler. But I thought that happens automatically. But I find the solution proposed by BrendanMcK to make use of a default listbox the winner. Pity it's not an answer.
Scrollbar arrows do not get redrawn while thumbtrack gets redrawn correctly I have created a custom control by registering a new class for it and instantiating it as a child to a top-level window. The control is basically a list. In order to save some effort, I decided to use the WS_VSCROLL window class in order to add...
TITLE: Scrollbar arrows do not get redrawn while thumbtrack gets redrawn correctly QUESTION: I have created a custom control by registering a new class for it and instantiating it as a child to a top-level window. The control is basically a list. In order to save some effort, I decided to use the WS_VSCROLL window cla...
[ "c++", "winapi" ]
0
0
1,452
2
0
2011-06-03T01:21:09.457000
2011-06-04T14:33:57.673000
6,222,093
6,222,649
Change current folder
I'd like to specify the current folder. I can find the current folder: libname _dummy_ "."; %let folder = %NRBQUOTE(%SYSFUNC(PATHNAME(_DUMMY_))); %put &folder and change it manually by double clicking the current folder status bar, but I'd prefer to code it. Is this possible?
Like this: x 'cd '; for example x 'cd C:\Users\foo'; SAS recognizes that a change directory command was issued to the OS and changes it's current working directory.
Change current folder I'd like to specify the current folder. I can find the current folder: libname _dummy_ "."; %let folder = %NRBQUOTE(%SYSFUNC(PATHNAME(_DUMMY_))); %put &folder and change it manually by double clicking the current folder status bar, but I'd prefer to code it. Is this possible?
TITLE: Change current folder QUESTION: I'd like to specify the current folder. I can find the current folder: libname _dummy_ "."; %let folder = %NRBQUOTE(%SYSFUNC(PATHNAME(_DUMMY_))); %put &folder and change it manually by double clicking the current folder status bar, but I'd prefer to code it. Is this possible? AN...
[ "sas" ]
8
10
7,401
2
0
2011-06-03T01:23:06.890000
2011-06-03T03:22:27.683000
6,222,102
6,222,136
How do i replace this contentbox div with a textbox?
I got this script off 9lessons.info and it is supposed to auto suggest friends when you type an @ simbol. It works great! But it uses a contentbox enabled div as a text box, but as this is a HTML5 feature but i need a more compatible solution like a text area. But a textarea isnt working with the current jQuery, even w...
Try: var html = $('#contentbox').html(); var textarea = $(' ').attr('id', 'contentbox').html(html); $('#contentbox').replaceWith(textarea); See: http://jsfiddle.net/yFKRX/1/
How do i replace this contentbox div with a textbox? I got this script off 9lessons.info and it is supposed to auto suggest friends when you type an @ simbol. It works great! But it uses a contentbox enabled div as a text box, but as this is a HTML5 feature but i need a more compatible solution like a text area. But a ...
TITLE: How do i replace this contentbox div with a textbox? QUESTION: I got this script off 9lessons.info and it is supposed to auto suggest friends when you type an @ simbol. It works great! But it uses a contentbox enabled div as a text box, but as this is a HTML5 feature but i need a more compatible solution like a...
[ "jquery", "html", "xhtml" ]
1
0
1,285
1
0
2011-06-03T01:26:54.147000
2011-06-03T01:35:37.827000
6,222,112
6,222,298
Counting Rows/Columns of Selected Range Error
I am trying to determine if a selected range is within a set area... This toggles Copy/Paste restrictions in the spreadsheet. I have figured it out, I think, but I'm getting a run-time error 6 (Overflow) if you select an entire row or column. This is what I've got.. Function BETWEENROWS(ByVal Selected As Range, ByVal M...
Your LastRow variable is not the correct type for a number as large as the max columns/rows of the spreadsheet. Change the type to Long: Dim LastRow As Long
Counting Rows/Columns of Selected Range Error I am trying to determine if a selected range is within a set area... This toggles Copy/Paste restrictions in the spreadsheet. I have figured it out, I think, but I'm getting a run-time error 6 (Overflow) if you select an entire row or column. This is what I've got.. Functio...
TITLE: Counting Rows/Columns of Selected Range Error QUESTION: I am trying to determine if a selected range is within a set area... This toggles Copy/Paste restrictions in the spreadsheet. I have figured it out, I think, but I'm getting a run-time error 6 (Overflow) if you select an entire row or column. This is what ...
[ "vba", "excel" ]
1
4
1,988
2
0
2011-06-03T01:29:24.027000
2011-06-03T02:04:50.903000
6,222,114
6,222,422
Implementing IEventDispatcher in AS3
I haven't used the implements keyword before, and I've been trying to use it to implement the IEventDispatcher class to see if this would allow me to use addEventListener() in a class that extends Object (this is my understanding of what it's for - correct me if I'm wrong). My class is like this: package { import flash...
The problem is just as the error message says. You are not implementing the methods defined in the IEventDispatcher interface. If you want to use implements you must explicitly define the functions declared in the interface. That means you actually have to write those functions in your class. On the other hand if you d...
Implementing IEventDispatcher in AS3 I haven't used the implements keyword before, and I've been trying to use it to implement the IEventDispatcher class to see if this would allow me to use addEventListener() in a class that extends Object (this is my understanding of what it's for - correct me if I'm wrong). My class...
TITLE: Implementing IEventDispatcher in AS3 QUESTION: I haven't used the implements keyword before, and I've been trying to use it to implement the IEventDispatcher class to see if this would allow me to use addEventListener() in a class that extends Object (this is my understanding of what it's for - correct me if I'...
[ "actionscript-3" ]
1
4
4,309
2
0
2011-06-03T01:29:36.240000
2011-06-03T02:31:26.290000
6,222,116
6,222,388
Do I need to assign a Grails hasOne relationship in both directions?
Must I assign the relationship in each direction? Using the textbook domain classes for the hasOne relationship, this appears necessary from my testing so far to get the instances to recognize each other: def face = new Face() def nose = new Nose() face.nose = nose nose.face = face I don't know why, though. And it's un...
Direct Answer The need to set up the relationships, i.e. to assign nose to face and face to node, isn't really awkward. Hibernate is a RELATIONSHIP mapper, so you need to make the relationships explicit. That said, you can write less code by defining a setNose(nose){ this.nose = nose nose.face = this } on Face. Now whe...
Do I need to assign a Grails hasOne relationship in both directions? Must I assign the relationship in each direction? Using the textbook domain classes for the hasOne relationship, this appears necessary from my testing so far to get the instances to recognize each other: def face = new Face() def nose = new Nose() fa...
TITLE: Do I need to assign a Grails hasOne relationship in both directions? QUESTION: Must I assign the relationship in each direction? Using the textbook domain classes for the hasOne relationship, this appears necessary from my testing so far to get the instances to recognize each other: def face = new Face() def no...
[ "grails", "grails-orm" ]
7
17
4,831
1
0
2011-06-03T01:30:03.193000
2011-06-03T02:24:06.407000
6,222,118
6,240,593
Adding Data to a ComboBox (Not bound data)
I wish to add data to a comboboxlist but am unsure of the correct method in which to do this. The data comes from a raw SQL statement. I have looked at the binding data directly from the database but it is not clear how all this binding and datasets work for me so I have decided to skip this and insert the data to the ...
SOURCE: http://tipsntricksbd.blogspot.com/2007/12/combobox-is-one-of-most-common-gui.html ComboBox is one of the most common GUI elements. It is used to provide the user the facility of selecting an item from a list or enter a new text. Here I’ll show you some common and useful functionalities of ComboBox in C# using M...
Adding Data to a ComboBox (Not bound data) I wish to add data to a comboboxlist but am unsure of the correct method in which to do this. The data comes from a raw SQL statement. I have looked at the binding data directly from the database but it is not clear how all this binding and datasets work for me so I have decid...
TITLE: Adding Data to a ComboBox (Not bound data) QUESTION: I wish to add data to a comboboxlist but am unsure of the correct method in which to do this. The data comes from a raw SQL statement. I have looked at the binding data directly from the database but it is not clear how all this binding and datasets work for ...
[ "c#", "user-interface" ]
7
12
44,290
4
0
2011-06-03T01:30:17.397000
2011-06-05T02:06:33.863000
6,222,120
6,222,202
scala: parallel collections not working?
i'm trying to usage parallel collections in a very basic way via.par - i expect the collection to be acted on out of order, but that doesn't seem the case: scala> (1 to 10) map println 1 2 3 4 5 6 7 8 9 10 and scala> (1 to 10).par map println 1 2 3 4 5 6 7 8 9 10 seems like the order shouldn't be sequential in the latt...
YMMV: scala> (1 to 10).par map println 1 6 2 3 4 7 5 8 9 This is on a dual core too... I think if you try enough run you may see different results. Here is a piece of code that shows some of what happens: import collection.parallel._ import collection.parallel.immutable._ class ParRangeEx(range: Range) extends ParRang...
scala: parallel collections not working? i'm trying to usage parallel collections in a very basic way via.par - i expect the collection to be acted on out of order, but that doesn't seem the case: scala> (1 to 10) map println 1 2 3 4 5 6 7 8 9 10 and scala> (1 to 10).par map println 1 2 3 4 5 6 7 8 9 10 seems like the ...
TITLE: scala: parallel collections not working? QUESTION: i'm trying to usage parallel collections in a very basic way via.par - i expect the collection to be acted on out of order, but that doesn't seem the case: scala> (1 to 10) map println 1 2 3 4 5 6 7 8 9 10 and scala> (1 to 10).par map println 1 2 3 4 5 6 7 8 9 ...
[ "scala" ]
7
11
1,841
2
0
2011-06-03T01:30:22.147000
2011-06-03T01:48:45.777000
6,222,134
6,222,396
Opening an excel template for editing in VB.NET via Process.Start()
I need to open a.xlt for editing, like so: System.Diagnostics.Process.Start("Template.xlt", "Editable=True") But I don't know the correct switch in Excel. This is the same as right-clicking on an.xlt and choosing "Open", whereas the default action is "New". Thanks.
Process.Start("Excel.exe", @"C:\Users\Master\Desktop\Book1.xltx"); (Looks like in VB you just omit the @ and;.)
Opening an excel template for editing in VB.NET via Process.Start() I need to open a.xlt for editing, like so: System.Diagnostics.Process.Start("Template.xlt", "Editable=True") But I don't know the correct switch in Excel. This is the same as right-clicking on an.xlt and choosing "Open", whereas the default action is "...
TITLE: Opening an excel template for editing in VB.NET via Process.Start() QUESTION: I need to open a.xlt for editing, like so: System.Diagnostics.Process.Start("Template.xlt", "Editable=True") But I don't know the correct switch in Excel. This is the same as right-clicking on an.xlt and choosing "Open", whereas the d...
[ "vb.net", "excel" ]
1
3
1,187
1
0
2011-06-03T01:34:08.170000
2011-06-03T02:25:09.047000
6,222,144
6,222,286
Start storyboard on a different control on a trigger in WPF
If a storyboard animation is running on ellipse1 changing the opacity, can I trigger on its opacity at a certain value and start a storyboard animation on ellipse2 that will start a fade in on it? do something here to start a opacity fade in on ellipse2
You could use a DataTrigger in ellipse2 to observe ellipse1:
Start storyboard on a different control on a trigger in WPF If a storyboard animation is running on ellipse1 changing the opacity, can I trigger on its opacity at a certain value and start a storyboard animation on ellipse2 that will start a fade in on it? do something here to start a opacity fade in on ellipse2
TITLE: Start storyboard on a different control on a trigger in WPF QUESTION: If a storyboard animation is running on ellipse1 changing the opacity, can I trigger on its opacity at a certain value and start a storyboard animation on ellipse2 that will start a fade in on it? do something here to start a opacity fade in ...
[ "wpf", "animation", "storyboard" ]
0
2
1,504
1
0
2011-06-03T01:37:05.050000
2011-06-03T02:02:05.867000
6,222,147
6,222,195
SQL to answer: which customers were active in a given month, based on activate/deactivate records
Given a table custid | date | action 1 | 2011-04-01 | activate 1 | 2011-04-10 | deactivate 1 | 2011-05-02 | activate 2 | 2011-04-01 | activate 3 | 2011-03-01 | activate 3 | 2011-04-01 | deactivate The database is PostgreSQL. I want an SQL query to show customers that were active at any stage during May. So, in the abov...
Try this select t2.custid from ( -- select the most recent entry for each customer select custid, date, action from cust_table t1 where date = (select max(date) from cust_table where custid = t1.custid) ) as t2 where t2.date < '2011-06-01' -- where the most recent entry is in May or is an activate entry -- assumes they...
SQL to answer: which customers were active in a given month, based on activate/deactivate records Given a table custid | date | action 1 | 2011-04-01 | activate 1 | 2011-04-10 | deactivate 1 | 2011-05-02 | activate 2 | 2011-04-01 | activate 3 | 2011-03-01 | activate 3 | 2011-04-01 | deactivate The database is PostgreSQ...
TITLE: SQL to answer: which customers were active in a given month, based on activate/deactivate records QUESTION: Given a table custid | date | action 1 | 2011-04-01 | activate 1 | 2011-04-10 | deactivate 1 | 2011-05-02 | activate 2 | 2011-04-01 | activate 3 | 2011-03-01 | activate 3 | 2011-04-01 | deactivate The dat...
[ "sql", "postgresql", "group-by" ]
1
2
713
3
0
2011-06-03T01:38:09.323000
2011-06-03T01:47:51.620000
6,222,150
6,222,907
When iterating through a set of numbers, will time increase at a constant exponential rate
Hello good people of stackoverflow, this is a conceptual question and could possibly belong in math.stackexchange.com, however since this relates to the processing speed of a CPU, I put it in here. Anyways, my question is pretty simple. I have to calculate the sum of the cubes of 3 numbers in a range of numbers. That s...
The time to add two numbers is logarithmic with the magnitude of the numbers, or linear with the size (length) of the numbers. For a 32-bit computer, numbers up to 2^32 will take 1 unit of time to add, numbers up to 2^64 will take 2 units, etc.
When iterating through a set of numbers, will time increase at a constant exponential rate Hello good people of stackoverflow, this is a conceptual question and could possibly belong in math.stackexchange.com, however since this relates to the processing speed of a CPU, I put it in here. Anyways, my question is pretty ...
TITLE: When iterating through a set of numbers, will time increase at a constant exponential rate QUESTION: Hello good people of stackoverflow, this is a conceptual question and could possibly belong in math.stackexchange.com, however since this relates to the processing speed of a CPU, I put it in here. Anyways, my q...
[ "math", "time", "cpu" ]
0
1
121
3
0
2011-06-03T01:38:45.117000
2011-06-03T04:17:54.210000
6,222,153
6,225,471
retrieving 'pre windows 2000 logon' name from LDAPMessage object in win32api C++
I've been asked to look at windows service which retrieves data from an Active Directory tree using the win32 LDAP API and outputs JSON data to a text file. It works fine but I need to modify it so that the i get the 'pre windows 2000' login name. The service is written in c++. The service already successfully retrieve...
Be careful, the Domain part of the 'pre windows 2000 domain' can be completly different from the user Principal Name (user@domain) use to logon onto Active-Directory. the DOMAIN is the Primary Domain Controleur name or the Netbios domain name. DOMAIN is created during domain creation, by default it's part of the DNS na...
retrieving 'pre windows 2000 logon' name from LDAPMessage object in win32api C++ I've been asked to look at windows service which retrieves data from an Active Directory tree using the win32 LDAP API and outputs JSON data to a text file. It works fine but I need to modify it so that the i get the 'pre windows 2000' log...
TITLE: retrieving 'pre windows 2000 logon' name from LDAPMessage object in win32api C++ QUESTION: I've been asked to look at windows service which retrieves data from an Active Directory tree using the win32 LDAP API and outputs JSON data to a text file. It works fine but I need to modify it so that the i get the 'pre...
[ "c++", "winapi", "active-directory", "ldap" ]
2
2
6,329
2
0
2011-06-03T01:40:48.053000
2011-06-03T09:46:35.187000
6,222,156
6,222,207
Select list item <li> of an ordered list using jquery?
I want to be able to change the html of the LI tag using some kind of jquery code. The idea is to change the class of the anchor tag from "btnsignin" to another class called "btnsignout" once the user has logged in. I will use this code inside the ajaxForm success callback function to change the class of anchor tag. He...
You can access the link directly by it's id and then chain the commands to modify the class: $('#login-link').removeClass('btnsignin').addClass('btnsignout');
Select list item <li> of an ordered list using jquery? I want to be able to change the html of the LI tag using some kind of jquery code. The idea is to change the class of the anchor tag from "btnsignin" to another class called "btnsignout" once the user has logged in. I will use this code inside the ajaxForm success ...
TITLE: Select list item <li> of an ordered list using jquery? QUESTION: I want to be able to change the html of the LI tag using some kind of jquery code. The idea is to change the class of the anchor tag from "btnsignin" to another class called "btnsignout" once the user has logged in. I will use this code inside the...
[ "jquery" ]
1
2
1,144
2
0
2011-06-03T01:41:08.787000
2011-06-03T01:49:43.143000
6,222,166
6,227,422
Remove BlackBerry PIMListListener
How do i remove or clear the PIMListListeners for a BlackBerryContactList? I added a Listener like so: BlackBerryContactList contactList = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE); contactList.addListener(new ContactsChangeListener()); So now when i start my app it adds ano...
You'll probably just need to reboot the device to clear them out. To keep this from happening again, store a reference to your ContactsChangeListener, and then in your app's onClose() method add a removeListener() call so when the user ends your app it gets cleaned up.
Remove BlackBerry PIMListListener How do i remove or clear the PIMListListeners for a BlackBerryContactList? I added a Listener like so: BlackBerryContactList contactList = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE); contactList.addListener(new ContactsChangeListener()); So n...
TITLE: Remove BlackBerry PIMListListener QUESTION: How do i remove or clear the PIMListListeners for a BlackBerryContactList? I added a Listener like so: BlackBerryContactList contactList = (BlackBerryContactList)PIM.getInstance().openPIMList(PIM.CONTACT_LIST, PIM.READ_WRITE); contactList.addListener(new ContactsChang...
[ "blackberry" ]
0
0
116
1
0
2011-06-03T01:43:46.717000
2011-06-03T13:02:21.547000
6,222,172
6,222,794
How to change attribute value of dynamically added element with javascript?
I initially create a table using some data loaded from a php mySQL query. I can dynamically add a row to this table using a Javascript function on the click of a button. Within this Javascript function the "id" and "name" attributes are successfully created. I have another Javascript function that can delete any row in...
I think the problem is with this line in your for loop: document.getElementById(tableID).rows[i].cells[0].childNodes[1].childNodes[0].id = "ing"+i; And the other three lines like it. The first reference to childNodes[1] should be childNodes[0]. Even if I'm wrong about that you can debug it by putting an alert there to ...
How to change attribute value of dynamically added element with javascript? I initially create a table using some data loaded from a php mySQL query. I can dynamically add a row to this table using a Javascript function on the click of a button. Within this Javascript function the "id" and "name" attributes are success...
TITLE: How to change attribute value of dynamically added element with javascript? QUESTION: I initially create a table using some data loaded from a php mySQL query. I can dynamically add a row to this table using a Javascript function on the click of a button. Within this Javascript function the "id" and "name" attr...
[ "php", "javascript", "dynamic", "element" ]
1
0
2,861
2
0
2011-06-03T01:44:34.853000
2011-06-03T03:53:08.583000
6,222,175
6,223,522
Why is maven looking for artifact in the wrong repo?
I'm defining a dependency in pom.xml in a Maven 3 project. Dependency is as follows: org.glassfish.web el-impl runtime 2.2 Repostory is described in pom as follows: java.net java.net http://download.java.net/maven/2 Artifact is indeed present in the repository. It's easy to check. Despite that, Maven is trying to obtai...
The repository that you have defined is used for dependencies, but not for plugins. Hence the error. To address this, you need to define pluginRepositories: {repo.id} {repo.url} As to where you should specify - in pom.xml or settings.xml, read this SO post.
Why is maven looking for artifact in the wrong repo? I'm defining a dependency in pom.xml in a Maven 3 project. Dependency is as follows: org.glassfish.web el-impl runtime 2.2 Repostory is described in pom as follows: java.net java.net http://download.java.net/maven/2 Artifact is indeed present in the repository. It's ...
TITLE: Why is maven looking for artifact in the wrong repo? QUESTION: I'm defining a dependency in pom.xml in a Maven 3 project. Dependency is as follows: org.glassfish.web el-impl runtime 2.2 Repostory is described in pom as follows: java.net java.net http://download.java.net/maven/2 Artifact is indeed present in the...
[ "maven", "jetty", "maven-3" ]
14
26
21,186
5
0
2011-06-03T01:45:07.637000
2011-06-03T06:01:01.913000
6,222,178
6,222,226
returning boolean on class method
I have a class with a couple of methods deleteUploadedFile() and currentUploadedFiles(). currentUploadedFiles(), basically loops over a session array and displays it on screen, simple as. Code sample: function currentUploadedFiles() { if(isset($_SESSION['fileArray']) && $this->count > 0) { echo ' Current files uploaded...
Looks like $deleted is in the local scope of the delete function. Something like the following should work. class theClass { function __construct() { $this->deleted = false } function delete() { $this->deleted = true; } function upload() { var_dump($this->deleted); } }
returning boolean on class method I have a class with a couple of methods deleteUploadedFile() and currentUploadedFiles(). currentUploadedFiles(), basically loops over a session array and displays it on screen, simple as. Code sample: function currentUploadedFiles() { if(isset($_SESSION['fileArray']) && $this->count > ...
TITLE: returning boolean on class method QUESTION: I have a class with a couple of methods deleteUploadedFile() and currentUploadedFiles(). currentUploadedFiles(), basically loops over a session array and displays it on screen, simple as. Code sample: function currentUploadedFiles() { if(isset($_SESSION['fileArray']) ...
[ "php" ]
0
2
1,312
1
0
2011-06-03T01:45:35.740000
2011-06-03T01:52:29.247000
6,222,184
6,222,703
Android onTouch animation removed on ACTION_UP
This should be fairly simple, but it is turning out to be more complicated than I thought. How can I apply a ScaleAnimation to a view and get it to stay for the entire duration of a finger press? In other words, while he finger is down shrink the view until the finger is removed, then return it to its original size? Th...
It's a bit unclear what you have and haven't tried in what combination, so here's an example that works: Animation shrink, grow; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); //I chose onCreate(), but make the animations however suits yo...
Android onTouch animation removed on ACTION_UP This should be fairly simple, but it is turning out to be more complicated than I thought. How can I apply a ScaleAnimation to a view and get it to stay for the entire duration of a finger press? In other words, while he finger is down shrink the view until the finger is r...
TITLE: Android onTouch animation removed on ACTION_UP QUESTION: This should be fairly simple, but it is turning out to be more complicated than I thought. How can I apply a ScaleAnimation to a view and get it to stay for the entire duration of a finger press? In other words, while he finger is down shrink the view unt...
[ "java", "android", "animation" ]
2
2
1,865
2
0
2011-06-03T01:46:32.083000
2011-06-03T03:34:08.730000
6,222,192
6,227,490
ExtJS 4 - Update/Refresh single record
I have a problem that's bugging me. I have a grid and when i dblclick on a item I want to open a window to edit that item. Pretty standard stuff. The problem is, i want to be sure the record is up to date, because other people using the program may have changed it or even deleted it. I could reload the store, but i onl...
The best way to do something like this would be to reload the record in the event which opens the window. So where you would for example load the record from the grid store into a form within the window, you can use your model to load from the id. Item.load(id, { success: function(r) { form.loadRecord(r); } }); Once sa...
ExtJS 4 - Update/Refresh single record I have a problem that's bugging me. I have a grid and when i dblclick on a item I want to open a window to edit that item. Pretty standard stuff. The problem is, i want to be sure the record is up to date, because other people using the program may have changed it or even deleted ...
TITLE: ExtJS 4 - Update/Refresh single record QUESTION: I have a problem that's bugging me. I have a grid and when i dblclick on a item I want to open a window to edit that item. Pretty standard stuff. The problem is, i want to be sure the record is up to date, because other people using the program may have changed i...
[ "javascript", "extjs", "extjs4", "extjs-mvc" ]
9
4
21,098
4
0
2011-06-03T01:47:21.857000
2011-06-03T13:08:55.930000
6,222,193
6,224,066
Silverlight 4 Datagrid, Set RowBackground
I know that the data grid isn't designed to directly access each row. My problem is I need to highlight rows based on certain conditions but not just at loading time. After the grid has been loaded there can be changes that occur on a collection that is not the collection that the grid is populated from so changes to t...
This would be really easy to achieve by using Prism's EventAggregator: Make sure the items in GridCollection implement INotifyPropertyChanged Add a boolean IsHighlight property to the class of items in GridCollection When an item is added to SecondaryCollection, fire an event using the event aggregator, using the GridC...
Silverlight 4 Datagrid, Set RowBackground I know that the data grid isn't designed to directly access each row. My problem is I need to highlight rows based on certain conditions but not just at loading time. After the grid has been loaded there can be changes that occur on a collection that is not the collection that ...
TITLE: Silverlight 4 Datagrid, Set RowBackground QUESTION: I know that the data grid isn't designed to directly access each row. My problem is I need to highlight rows based on certain conditions but not just at loading time. After the grid has been loaded there can be changes that occur on a collection that is not th...
[ "silverlight-4.0", "datagrid" ]
0
1
240
1
0
2011-06-03T01:47:46.847000
2011-06-03T07:08:49.067000
6,222,203
6,222,251
mysql inserting data from one schema to another
Is there a way to insert data from a table in schema1 to a table in schema2 in mysql. Also, I assume there will be any access/privilege issues. My environment is Joomla using Fabrik extension, PHP, MySQL Kindly share some tips Thanks in advance
This query does that: INSERT INTO db2.table1 SELECT * FROM db1.table1; Not tested but should do the job. If you do this as root user, you will have no permission issues. Backup your data first, though.
mysql inserting data from one schema to another Is there a way to insert data from a table in schema1 to a table in schema2 in mysql. Also, I assume there will be any access/privilege issues. My environment is Joomla using Fabrik extension, PHP, MySQL Kindly share some tips Thanks in advance
TITLE: mysql inserting data from one schema to another QUESTION: Is there a way to insert data from a table in schema1 to a table in schema2 in mysql. Also, I assume there will be any access/privilege issues. My environment is Joomla using Fabrik extension, PHP, MySQL Kindly share some tips Thanks in advance ANSWER: ...
[ "mysql", "joomla1.5", "database-schema" ]
2
1
3,940
2
0
2011-06-03T01:49:06.927000
2011-06-03T01:57:22.950000
6,222,205
6,222,236
Passing a 2d vector into a function c++
I have a function (assign) in a class (graph) in a header file. The objective of this function is to print a 2d vector: class Graph { public: void printvec(vector< vector >&PRRMap); }; I call this function from a cpp file such as: Graph G; G.printvec(vector< vector > &PRRmap); I get the following error: error: expected...
void printvec(vector< vector >&PRRMap); This is a declaration. It includes formal parameters, each of which specifies a type and an optional name. G.printvec(a_map); This is a function call. It includes actual parameters, each of which is an expression, aka value. The type is not named during a function call. But you d...
Passing a 2d vector into a function c++ I have a function (assign) in a class (graph) in a header file. The objective of this function is to print a 2d vector: class Graph { public: void printvec(vector< vector >&PRRMap); }; I call this function from a cpp file such as: Graph G; G.printvec(vector< vector > &PRRmap); I ...
TITLE: Passing a 2d vector into a function c++ QUESTION: I have a function (assign) in a class (graph) in a header file. The objective of this function is to print a 2d vector: class Graph { public: void printvec(vector< vector >&PRRMap); }; I call this function from a cpp file such as: Graph G; G.printvec(vector< vec...
[ "c++" ]
0
4
2,049
2
0
2011-06-03T01:49:31.507000
2011-06-03T01:54:54.033000
6,222,209
6,222,260
For CSS, vertical margin collapses, but why floated divs don't collapse vertical margins?
For CSS, we know that vertical margin collapses, such as in example: http://jsfiddle.net/rbxL7/5/ (The vertical margin between the divs are only 30px.) But what about floated divs? Why do the vertical margins not collapse? example: http://jsfiddle.net/rbxL7/3/ (the horizontal and vertical margins between the divs both ...
According to W3C: In CSS, the adjoining margins of two or more boxes (which might or might not be siblings) can combine to form a single margin. and... Two margins are adjoining if and only if: 1) both belong to in-flow block-level boxes that participate in the same block formatting context which leads to... Floats, ab...
For CSS, vertical margin collapses, but why floated divs don't collapse vertical margins? For CSS, we know that vertical margin collapses, such as in example: http://jsfiddle.net/rbxL7/5/ (The vertical margin between the divs are only 30px.) But what about floated divs? Why do the vertical margins not collapse? example...
TITLE: For CSS, vertical margin collapses, but why floated divs don't collapse vertical margins? QUESTION: For CSS, we know that vertical margin collapses, such as in example: http://jsfiddle.net/rbxL7/5/ (The vertical margin between the divs are only 30px.) But what about floated divs? Why do the vertical margins not...
[ "css" ]
1
5
1,067
2
0
2011-06-03T01:49:57.857000
2011-06-03T01:58:49.320000
6,222,215
6,222,291
regex for validating folder name & file name
I want to validate a file name Name of file or folder should not contain \ /? % *: | " < >. Could you please suggest me the regex expression to use in preg_match()? Thanks.
It would be more efficient to use the strpbrk() function. if (strpbrk($filename, "\\/?%*:|\"<>") === FALSE) { /* $filename is legal; doesn't contain illegal character. */ } else { /* $filename contains at least one illegal character. */ }
regex for validating folder name & file name I want to validate a file name Name of file or folder should not contain \ /? % *: | " < >. Could you please suggest me the regex expression to use in preg_match()? Thanks.
TITLE: regex for validating folder name & file name QUESTION: I want to validate a file name Name of file or folder should not contain \ /? % *: | " < >. Could you please suggest me the regex expression to use in preg_match()? Thanks. ANSWER: It would be more efficient to use the strpbrk() function. if (strpbrk($file...
[ "regex", "preg-match", "validation" ]
8
14
21,193
4
0
2011-06-03T01:50:51.053000
2011-06-03T02:03:33.593000
6,222,222
6,222,285
How to change Directory Name and file name in IsolatedStorage
Say I have created a few Directories in IsolatedStorage. Here are my problems: 1) How do I change the name of the Directory in IsoloatedStorage? 2) What happens to the files stored in the directory which I have change the name. 3) How do I change the file name that stored in Isolatedstorage Example: MyCity.txt to FunCi...
You'll have to copy the files and write them again with a new name as described in this post. You can then delete the old file/directory using the DeleteFile or DeleteDirectory methods. If you're creating a Mango app, then you have access to the MoveFile and MoveDirectory methods.
How to change Directory Name and file name in IsolatedStorage Say I have created a few Directories in IsolatedStorage. Here are my problems: 1) How do I change the name of the Directory in IsoloatedStorage? 2) What happens to the files stored in the directory which I have change the name. 3) How do I change the file na...
TITLE: How to change Directory Name and file name in IsolatedStorage QUESTION: Say I have created a few Directories in IsolatedStorage. Here are my problems: 1) How do I change the name of the Directory in IsoloatedStorage? 2) What happens to the files stored in the directory which I have change the name. 3) How do I ...
[ "windows-phone-7" ]
1
0
986
1
0
2011-06-03T01:52:03.970000
2011-06-03T02:02:00.850000
6,222,223
6,222,782
Need a simple open source solution to export 2D table data into PDF and Word format
guys. In our project, we need to add a new feature which is to export some test result data into PDF and Word format file for user. The structure of test result data in our system is generally simple 2D table (some may be a little complex that has cell consolidation). Is there any stable and mature java open source sol...
JasperReports allow export to PDF and DOC, it might be easier than using POI and iText.
Need a simple open source solution to export 2D table data into PDF and Word format guys. In our project, we need to add a new feature which is to export some test result data into PDF and Word format file for user. The structure of test result data in our system is generally simple 2D table (some may be a little compl...
TITLE: Need a simple open source solution to export 2D table data into PDF and Word format QUESTION: guys. In our project, we need to add a new feature which is to export some test result data into PDF and Word format file for user. The structure of test result data in our system is generally simple 2D table (some may...
[ "java", "swing", "report" ]
3
2
200
2
0
2011-06-03T01:52:08.717000
2011-06-03T03:49:20.330000
6,222,225
6,222,317
Using cat to join mp3 files. What is this black sorcery?
A friend of mine just used plain-old cat to concatenate two mp3 files,... cat file1.mp3 file2.mp3 > out.mp3...and the resulting file is perfectly reproducible, playing one song and then the next. What is this black magic? What happened to headers, metadata? How can this work? The duration is even displayed correctly.
An MP3 file is nothing more than the raw MPEG2-Layer 3 (audio) stream data, there is no file level header structure with, for example, duration, original source, encoding info. An MP3 stream is made of blocks starting with a synchronization marker FF Fx, so arbitrary data, such as ID3 tags, can be placed anywhere and w...
Using cat to join mp3 files. What is this black sorcery? A friend of mine just used plain-old cat to concatenate two mp3 files,... cat file1.mp3 file2.mp3 > out.mp3...and the resulting file is perfectly reproducible, playing one song and then the next. What is this black magic? What happened to headers, metadata? How c...
TITLE: Using cat to join mp3 files. What is this black sorcery? QUESTION: A friend of mine just used plain-old cat to concatenate two mp3 files,... cat file1.mp3 file2.mp3 > out.mp3...and the resulting file is perfectly reproducible, playing one song and then the next. What is this black magic? What happened to header...
[ "mp3" ]
22
10
4,049
2
0
2011-06-03T01:52:26.780000
2011-06-03T02:09:05.997000
6,222,227
6,222,296
What is the difference between html and htmls
I'm wrote this site for work with HTML and PHP and I'm being told it needs to be htmls not html. What does this mean? What is the difference between the two? Thanks
If they meant HTTPS then you will need to set up your server to use SSL. Simply put, HTTPS is different from HTTP as it encrypts the communications between the server and connecting clients. It is generally used to transmit confidential data that you want to protect. A good starting point on information is here:http://...
What is the difference between html and htmls I'm wrote this site for work with HTML and PHP and I'm being told it needs to be htmls not html. What does this mean? What is the difference between the two? Thanks
TITLE: What is the difference between html and htmls QUESTION: I'm wrote this site for work with HTML and PHP and I'm being told it needs to be htmls not html. What does this mean? What is the difference between the two? Thanks ANSWER: If they meant HTTPS then you will need to set up your server to use SSL. Simply pu...
[ "html" ]
2
2
3,679
4
0
2011-06-03T01:52:32.630000
2011-06-03T02:04:24.017000
6,222,228
6,222,295
Using PDO insert values in the limit clause of an SQL statement?
In my PDO implementation, I am attempting to use an inserted value in the limit clause of the SQL statement: $sql = "SELECT * FROM table ORDER BY datetime DESC LIMIT:limit"; $params = array(":limit" => 5); $query = $dbh->prepare($sql); $query->execute($params); $result = $query->fetchall(PDO::FETCH_ASSOC); $params and ...
See PHP PDO bindValue in LIMIT Basically, you need to cast the limit value to int using intval() when binding.
Using PDO insert values in the limit clause of an SQL statement? In my PDO implementation, I am attempting to use an inserted value in the limit clause of the SQL statement: $sql = "SELECT * FROM table ORDER BY datetime DESC LIMIT:limit"; $params = array(":limit" => 5); $query = $dbh->prepare($sql); $query->execute($pa...
TITLE: Using PDO insert values in the limit clause of an SQL statement? QUESTION: In my PDO implementation, I am attempting to use an inserted value in the limit clause of the SQL statement: $sql = "SELECT * FROM table ORDER BY datetime DESC LIMIT:limit"; $params = array(":limit" => 5); $query = $dbh->prepare($sql); $...
[ "php", "sql", "pdo" ]
0
2
2,065
2
0
2011-06-03T01:52:44.390000
2011-06-03T02:04:23.383000
6,222,234
6,222,364
Prevent Activity From Launching
Is there a good way of preventing an activity from launching? I'd like to build either a whitelist or blacklist of applications, then prevent those instances from being started. One potential solution is to poll the running tasks every so often and shut them down, but this seems like it could eat through a lot of batte...
Ok so this doesnt count as a "GOOD WAY", could very well be as draining if not more so on your battery, but in line with your polling method: you could create a service that monitors the log cat ( http://www.helloandroid.com/tutorials/reading-logs-programatically ) need permission in manifest: then in your service some...
Prevent Activity From Launching Is there a good way of preventing an activity from launching? I'd like to build either a whitelist or blacklist of applications, then prevent those instances from being started. One potential solution is to poll the running tasks every so often and shut them down, but this seems like it ...
TITLE: Prevent Activity From Launching QUESTION: Is there a good way of preventing an activity from launching? I'd like to build either a whitelist or blacklist of applications, then prevent those instances from being started. One potential solution is to poll the running tasks every so often and shut them down, but t...
[ "android" ]
0
2
869
2
0
2011-06-03T01:54:36.763000
2011-06-03T02:18:52.300000
6,222,237
6,222,265
Persistence within jquery .getJSON()
I'm using.getJSON to send a search query to my PHP server and am returning an array which has been json_encode'd. I'd like to use the resulting object after the jQuery function completes (ideally, pushing it into an array, and use it like any other object elsewhere in the page. But, the object ceases to exist after the...
The getJSON call is happening asynchronously or independent of the rest of your JavaScript. Your issue is most likely because your getJSON call is not completed before your are attempting to manipulate your widgets array. You need to make sure any manipulation of widgets occurs after getJSON has completed. Part of the ...
Persistence within jquery .getJSON() I'm using.getJSON to send a search query to my PHP server and am returning an array which has been json_encode'd. I'd like to use the resulting object after the jQuery function completes (ideally, pushing it into an array, and use it like any other object elsewhere in the page. But,...
TITLE: Persistence within jquery .getJSON() QUESTION: I'm using.getJSON to send a search query to my PHP server and am returning an array which has been json_encode'd. I'd like to use the resulting object after the jQuery function completes (ideally, pushing it into an array, and use it like any other object elsewhere...
[ "jquery", "json", "persistence", "getjson" ]
0
0
965
3
0
2011-06-03T01:55:01.333000
2011-06-03T01:59:36.827000