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,211,183
6,211,207
dynamic Javascript in asp.net
well. The problem i'm facing is i have my own custom control and i do a query, get records and dynamically add html controls to the page based on the data. Now there's the problem of adding some dynamic javascript I do this with the help of literal controls. This works like a charm I add the literal text dynamically fr...
Make use of ScriptManager.RegisterStartupScript() to register your script...may resolve problem... Check this resolve your problem: Add JavaScript programmatically using RegisterStartupScript during an Asynchronous postback
dynamic Javascript in asp.net well. The problem i'm facing is i have my own custom control and i do a query, get records and dynamically add html controls to the page based on the data. Now there's the problem of adding some dynamic javascript I do this with the help of literal controls. This works like a charm I add t...
TITLE: dynamic Javascript in asp.net QUESTION: well. The problem i'm facing is i have my own custom control and i do a query, get records and dynamically add html controls to the page based on the data. Now there's the problem of adding some dynamic javascript I do this with the help of literal controls. This works li...
[ "c#", "javascript", ".net", "asp.net", "registerstartupscript" ]
5
4
27,075
3
0
2011-06-02T06:24:41.703000
2011-06-02T06:29:09.363000
6,211,184
6,215,184
Why doesn't the Route tab appear in Glimpse Web Debuggger?
I've just installed Glimpse Web Debugger for ASP.NET (Beta) - version 0.82. I installed it via the Package Manager console in Visual Studio 2010 and the installation was successful. I'm trying to test it out using the ASP.NET Development server and the ASP.NET MVC 3 version of the MVCMusicStore demo site using the Razo...
It looks like you have only installed Glimpse, not Glimpse.MVC3 which adds in the MVC functionality. Go ahead and Install-Package Glimpse.MVC3 in the powershell console, or just use the GUI to install Glimpse.MVC3. In the future Glimpse may ship additional plugin packs similar to MVC3. Image we could have Glimpse.Share...
Why doesn't the Route tab appear in Glimpse Web Debuggger? I've just installed Glimpse Web Debugger for ASP.NET (Beta) - version 0.82. I installed it via the Package Manager console in Visual Studio 2010 and the installation was successful. I'm trying to test it out using the ASP.NET Development server and the ASP.NET ...
TITLE: Why doesn't the Route tab appear in Glimpse Web Debuggger? QUESTION: I've just installed Glimpse Web Debugger for ASP.NET (Beta) - version 0.82. I installed it via the Package Manager console in Visual Studio 2010 and the installation was successful. I'm trying to test it out using the ASP.NET Development serve...
[ "asp.net", "asp.net-mvc-3", "glimpse" ]
20
28
1,757
1
0
2011-06-02T06:24:54.277000
2011-06-02T13:29:08.547000
6,211,186
6,211,217
Does anyone know how to block browser back button?
Possible Duplicate: Disable browser's back button i have one button on page on that button click event page will redirect on the next page now i click on the browser back button but i want to restrict browser back button for some security purpose does any one know how to block browser back button so that page can not r...
Do not disable expected browser behaviour and you can handle the possiblity at your end, but if you really want to do so, there is one work around here... Just put this javascript on the html section of aspx page above head section. This causes every back to return with a forward.
Does anyone know how to block browser back button? Possible Duplicate: Disable browser's back button i have one button on page on that button click event page will redirect on the next page now i click on the browser back button but i want to restrict browser back button for some security purpose does any one know how ...
TITLE: Does anyone know how to block browser back button? QUESTION: Possible Duplicate: Disable browser's back button i have one button on page on that button click event page will redirect on the next page now i click on the browser back button but i want to restrict browser back button for some security purpose does...
[ "c#", ".net", "asp.net", "visual-studio" ]
1
1
648
2
0
2011-06-02T06:25:03.623000
2011-06-02T06:30:18.767000
6,211,198
6,211,981
3.4.2 Argument-dependent name lookup from n3290 Draft
A point from ISO draft n3290 section 3.4.2 paragraph 1: When the postfix-expression in a function call is an unqualified-id, other namespaces not considered during the usual unqualified lookup may be searched, and in those namespaces, namespace-scope friend function declarations not otherwise visible may be found. Thes...
Consider a simple unqualified function call: foo(x); ADL means that foo is looked up not just in the enclosing scope, and the namespace that the call is in, but also the namespace of the type of x. e.g. if x is a std::vector then namespace std is also searched. Thus: int main() { std::vector x,y; swap(x,y); } is OK, an...
3.4.2 Argument-dependent name lookup from n3290 Draft A point from ISO draft n3290 section 3.4.2 paragraph 1: When the postfix-expression in a function call is an unqualified-id, other namespaces not considered during the usual unqualified lookup may be searched, and in those namespaces, namespace-scope friend function...
TITLE: 3.4.2 Argument-dependent name lookup from n3290 Draft QUESTION: A point from ISO draft n3290 section 3.4.2 paragraph 1: When the postfix-expression in a function call is an unqualified-id, other namespaces not considered during the usual unqualified lookup may be searched, and in those namespaces, namespace-sco...
[ "c++", "c++11", "argument-dependent-lookup", "name-lookup" ]
10
18
441
1
0
2011-06-02T06:27:15.307000
2011-06-02T08:05:46.700000
6,211,202
6,213,120
Writing a Build Script for a Play! Framework application
How are people writing builds for their Play applications? I understand that you can run play auto-test on the command-line, however, I would like to do a bit more than just execute the tests. So for example, if I wanted to add checkstyle and clover to my build, I could easily write an Ant script that would check those...
not, not as far as I know, although there are addons to use ant/maven in Play, you could try to integrate them. But users may skip then and use the normal play. An idea would be to modify the Play python script to run these validations before any action, but that would require all developers to use that modified script...
Writing a Build Script for a Play! Framework application How are people writing builds for their Play applications? I understand that you can run play auto-test on the command-line, however, I would like to do a bit more than just execute the tests. So for example, if I wanted to add checkstyle and clover to my build, ...
TITLE: Writing a Build Script for a Play! Framework application QUESTION: How are people writing builds for their Play applications? I understand that you can run play auto-test on the command-line, however, I would like to do a bit more than just execute the tests. So for example, if I wanted to add checkstyle and cl...
[ "java", "build", "playframework" ]
2
1
749
2
0
2011-06-02T06:27:45.547000
2011-06-02T10:10:47.443000
6,211,211
6,211,376
Apache + PHP: how to change the value of $_SERVER['SERVER_NAME'] in apache?
for example, i have mysite.com and beta.mysite.com. both point to the same index file using the virtualHost directive. what will i do in the apache conf so that when i access the $_SERVER['SERVER_NAME'], the value would still be mysite.com? this should be flexible that only the beta would be removed.
Maybe you could use a ServerAlias in your VirtualHost directive, and use only one VirtualHost directive: ServerName mysite.com ServerAlias beta.mysite.com...
Apache + PHP: how to change the value of $_SERVER['SERVER_NAME'] in apache? for example, i have mysite.com and beta.mysite.com. both point to the same index file using the virtualHost directive. what will i do in the apache conf so that when i access the $_SERVER['SERVER_NAME'], the value would still be mysite.com? thi...
TITLE: Apache + PHP: how to change the value of $_SERVER['SERVER_NAME'] in apache? QUESTION: for example, i have mysite.com and beta.mysite.com. both point to the same index file using the virtualHost directive. what will i do in the apache conf so that when i access the $_SERVER['SERVER_NAME'], the value would still ...
[ "php", "apache" ]
4
5
6,419
2
0
2011-06-02T06:29:22.403000
2011-06-02T06:51:15.633000
6,211,216
6,211,380
How to create the following XML tag through DOM in Java
In the above xml tag, I want to add one more item as follows- So finally the XML tag will look like- I am getting the tag - Element paletteElement = (Element) doc.getElementsByTagName("tableCategory").item(0); //tag But not getting the clue after that.
Assuming you are using javax.xml.parsers, element.appendChild() will do. [edited] In case, you are looking for how to create a new Element, below is an example snippet Element newElem = doc.createElement("item"); newElem.setAttribute(...);...... elem.addChild(newElem);
How to create the following XML tag through DOM in Java In the above xml tag, I want to add one more item as follows- So finally the XML tag will look like- I am getting the tag - Element paletteElement = (Element) doc.getElementsByTagName("tableCategory").item(0); //tag But not getting the clue after that.
TITLE: How to create the following XML tag through DOM in Java QUESTION: In the above xml tag, I want to add one more item as follows- So finally the XML tag will look like- I am getting the tag - Element paletteElement = (Element) doc.getElementsByTagName("tableCategory").item(0); //tag But not getting the clue after...
[ "java", "xml", "dom", "xml-parsing", "domparser" ]
2
2
321
2
0
2011-06-02T06:30:02.967000
2011-06-02T06:51:43.593000
6,211,242
6,211,287
Can't get <select> input from form?
I can figure out how to loop through input and select. My function below does not include select lists. Any help welcome. $('input', '#consumer_form').each(function(key, value) { if ((this.type === "radio" || this.type === "checkbox") && this.checked === false) { return; } else { val = this.value; } //alert($('#'+this...
I believe it's $(":input") you're need if you want to loop through all the elements in the form http://api.jquery.com/input-selector/ (you don't have a colon there).
Can't get <select> input from form? I can figure out how to loop through input and select. My function below does not include select lists. Any help welcome. $('input', '#consumer_form').each(function(key, value) { if ((this.type === "radio" || this.type === "checkbox") && this.checked === false) { return; } else { val...
TITLE: Can't get <select> input from form? QUESTION: I can figure out how to loop through input and select. My function below does not include select lists. Any help welcome. $('input', '#consumer_form').each(function(key, value) { if ((this.type === "radio" || this.type === "checkbox") && this.checked === false) { re...
[ "jquery", "forms" ]
0
0
282
3
0
2011-06-02T06:33:08.673000
2011-06-02T06:40:05.450000
6,211,245
6,211,914
Efficient Dictionary lookup
For my C++ application, there is a requirement to check if a word is a valid English dictionary word or not. What is the best way to do it. Is there freely available dictionary that I can make use of. I just need a collection of all possible words. How to make this lookup least expensive. Do I need to hash it.
With regards to the presence of a word list, it depends on the platform. Under Linux, /usr/share/dict/words contains a list of English words that might meet your needs. Otherwise, there are doubtlessly such lists available on the network. Given the size of such lists, the most rapid access will be to load it into a has...
Efficient Dictionary lookup For my C++ application, there is a requirement to check if a word is a valid English dictionary word or not. What is the best way to do it. Is there freely available dictionary that I can make use of. I just need a collection of all possible words. How to make this lookup least expensive. Do...
TITLE: Efficient Dictionary lookup QUESTION: For my C++ application, there is a requirement to check if a word is a valid English dictionary word or not. What is the best way to do it. Is there freely available dictionary that I can make use of. I just need a collection of all possible words. How to make this lookup l...
[ "c++" ]
2
5
3,413
3
0
2011-06-02T06:34:17.867000
2011-06-02T07:56:48.260000
6,211,251
6,211,278
Java HTTP getResponseCode returns 200 for non-existent URL
I was expecting this code to return a 404, however it produces the output: "Response code is 200" Would it be possible to learn how to differentiate between existent and non-existent web pages... thanks so much, try { // create the HttpURLConnection URL url = new URL("http://www.thisurldoesnotexist"); HttpURLConnection...
EDIT: I see you've call openConnection() but not connect() - could that be the problem? I would expect getResponseCode() to actually make the request if it hasn't already, but it's worth just trying that... That suggests you've possible got some DNS resolver which redirects to a "helper" (spam) page, or something like ...
Java HTTP getResponseCode returns 200 for non-existent URL I was expecting this code to return a 404, however it produces the output: "Response code is 200" Would it be possible to learn how to differentiate between existent and non-existent web pages... thanks so much, try { // create the HttpURLConnection URL url = n...
TITLE: Java HTTP getResponseCode returns 200 for non-existent URL QUESTION: I was expecting this code to return a 404, however it produces the output: "Response code is 200" Would it be possible to learn how to differentiate between existent and non-existent web pages... thanks so much, try { // create the HttpURLConn...
[ "java", "networking" ]
2
2
6,489
5
0
2011-06-02T06:35:24.573000
2011-06-02T06:38:31.500000
6,211,254
6,217,964
Android browsable intent fails on gmail links, but works with default mail client
I have set up intent filters to handle certain email links with my app. This works well in Android's basic mail program. I click the link, I am prompted whether to open it using the browser or my app, and after selecting my app it is handled correctly. The same is not true for using the Gmail app. How can I be sure to ...
getIntent().getCategories() will return null if there are no categories. To fix the problem, I changed this if statement to: if (getIntent().getAction().equals("android.intent.action.VIEW")){...}
Android browsable intent fails on gmail links, but works with default mail client I have set up intent filters to handle certain email links with my app. This works well in Android's basic mail program. I click the link, I am prompted whether to open it using the browser or my app, and after selecting my app it is hand...
TITLE: Android browsable intent fails on gmail links, but works with default mail client QUESTION: I have set up intent filters to handle certain email links with my app. This works well in Android's basic mail program. I click the link, I am prompted whether to open it using the browser or my app, and after selecting...
[ "android", "gmail", "android-intent", "browsable" ]
1
2
631
1
0
2011-06-02T06:35:35.493000
2011-06-02T17:28:39.997000
6,211,255
6,214,611
What are the advantages of using bundles in iPhone development?
What is the advantage of using bundle during iPhone development? p.s. I see many SDK like Facebook SDK, Three20 are using bundles to contain images and other contents, but I am not sure why should I do so. What is the difference between using main bundle and a newly created bundle?
It's quite simple really. You use bundles just like you would use name spaces. Files in the newly created bundle could have files with the same names as files in the main bundle. Facebook SDK and Three20 have their own bundles, so that you can have any files you want in the main bundle without risking conflicts.
What are the advantages of using bundles in iPhone development? What is the advantage of using bundle during iPhone development? p.s. I see many SDK like Facebook SDK, Three20 are using bundles to contain images and other contents, but I am not sure why should I do so. What is the difference between using main bundle a...
TITLE: What are the advantages of using bundles in iPhone development? QUESTION: What is the advantage of using bundle during iPhone development? p.s. I see many SDK like Facebook SDK, Three20 are using bundles to contain images and other contents, but I am not sure why should I do so. What is the difference between u...
[ "ios", "ios4", "bundle" ]
1
3
259
1
0
2011-06-02T06:35:41.967000
2011-06-02T12:39:03.823000
6,211,257
6,211,437
google indexing text retrieved by ajax or javascript after page load
a couple of google questions: 1 - is there ANY chance that google will "see" text retrieved using ajax? the user selects from a chain of select boxes and some text from the Db is displayed. 2 - if i change the page title using javascript, outside the HEAD area, will google index the modified title? sorry if these are t...
What Google sees is what you see when you disable javascript on your browser. So the answer to both your questions is no. The correct way to have all the data of your site indexed is to degrade gracefully inside tags. For example, you could offer an interface to browse all the content of your database, using list and s...
google indexing text retrieved by ajax or javascript after page load a couple of google questions: 1 - is there ANY chance that google will "see" text retrieved using ajax? the user selects from a chain of select boxes and some text from the Db is displayed. 2 - if i change the page title using javascript, outside the ...
TITLE: google indexing text retrieved by ajax or javascript after page load QUESTION: a couple of google questions: 1 - is there ANY chance that google will "see" text retrieved using ajax? the user selects from a chain of select boxes and some text from the Db is displayed. 2 - if i change the page title using javasc...
[ "javascript", "ajax", "seo", "page-title" ]
2
2
2,111
3
0
2011-06-02T06:35:47.050000
2011-06-02T06:59:11.090000
6,211,258
6,214,220
Window Workflow SendReceive Activity timeout issue
I have hosted a state machine Worklow as a WCF service..And the workflow is called in an ASP.NET code. I used netTcpContextBinding for workflow hosting. Problem is that if a SendRecieve activity within the workflow is taking a lot of time (say 1 minute) to execute, then it will show transaction aborted error and will t...
A TransactionScope has a default timeout of 60 seconds so if whatever you are doing in there takes longer it will time out and abort. You can increase the timeout on the TransactionScope but quite frankly the 60 seconds is already quite long. In most cases you are better of at doing any long running work to collect dat...
Window Workflow SendReceive Activity timeout issue I have hosted a state machine Worklow as a WCF service..And the workflow is called in an ASP.NET code. I used netTcpContextBinding for workflow hosting. Problem is that if a SendRecieve activity within the workflow is taking a lot of time (say 1 minute) to execute, the...
TITLE: Window Workflow SendReceive Activity timeout issue QUESTION: I have hosted a state machine Worklow as a WCF service..And the workflow is called in an ASP.NET code. I used netTcpContextBinding for workflow hosting. Problem is that if a SendRecieve activity within the workflow is taking a lot of time (say 1 minut...
[ "windows", "workflow-foundation" ]
0
0
328
1
0
2011-06-02T06:36:00.860000
2011-06-02T11:59:33.833000
6,211,259
6,211,506
query database for results within a certain time using the user's timezone
How can I query a set of results that belong to a specific time period according to the user's time. For example: "select * from table where datestamp like ".date("Y-m-d",strtotime("-1 day"))."%" would give me results within the past 24 hours based on the server time. How can I do this query to be based on the user's t...
You can do this in 3 steps: 1. Detect the client timezone This is difficult: Different browsers use different acronyms and conventions for representing names of timezones. You should use an existing implementation, like jsTimezoneDetect. 2. Pass the timezone information to PHP If you need to use timezone dependent PHP ...
query database for results within a certain time using the user's timezone How can I query a set of results that belong to a specific time period according to the user's time. For example: "select * from table where datestamp like ".date("Y-m-d",strtotime("-1 day"))."%" would give me results within the past 24 hours ba...
TITLE: query database for results within a certain time using the user's timezone QUESTION: How can I query a set of results that belong to a specific time period according to the user's time. For example: "select * from table where datestamp like ".date("Y-m-d",strtotime("-1 day"))."%" would give me results within th...
[ "php", "mysql", "sql", "database" ]
0
0
131
3
0
2011-06-02T06:36:01.860000
2011-06-02T07:05:20.357000
6,211,264
6,211,658
Why can't I use a DataTrigger to set TextBox.IsEnabled = True?
In my application, I have a TextBox that I want to enable/disable based on an enum in my datacontext. The enum has three values (Anyone, Me, Someone) and I want to enable the Textbox when the value "Someone" is set. I am able to hack a solution by setting the value in reverse (see below). However, can someone please ex...
you have to set the initial isEnabled in your style too. otherwise your "local" IsEnabled=false will always win! change your style and it will work.
Why can't I use a DataTrigger to set TextBox.IsEnabled = True? In my application, I have a TextBox that I want to enable/disable based on an enum in my datacontext. The enum has three values (Anyone, Me, Someone) and I want to enable the Textbox when the value "Someone" is set. I am able to hack a solution by setting t...
TITLE: Why can't I use a DataTrigger to set TextBox.IsEnabled = True? QUESTION: In my application, I have a TextBox that I want to enable/disable based on an enum in my datacontext. The enum has three values (Anyone, Me, Someone) and I want to enable the Textbox when the value "Someone" is set. I am able to hack a sol...
[ "wpf", "data-binding", "binding", "datatrigger" ]
7
17
7,270
1
0
2011-06-02T06:36:37.053000
2011-06-02T07:24:20.147000
6,211,271
6,211,411
How to make the non visible part of a Gallery to be null
I have used gallery widget to display downloaded images.But unfortunately I am running into out of memory situation. So I am trying to null the invisible part of the gallery so that I can save my memory. Is it possible to hide the non visible parts of the gallery. Any help is appreciated.
Memory Issues is not because of Gallery, its because of adapter I guess that you are using Gallery itself use concept of recycling views that are non visible so its not responsible for out of memory. What I think is you are creating an adapter of bitmaps and that is what causing errors.
How to make the non visible part of a Gallery to be null I have used gallery widget to display downloaded images.But unfortunately I am running into out of memory situation. So I am trying to null the invisible part of the gallery so that I can save my memory. Is it possible to hide the non visible parts of the gallery...
TITLE: How to make the non visible part of a Gallery to be null QUESTION: I have used gallery widget to display downloaded images.But unfortunately I am running into out of memory situation. So I am trying to null the invisible part of the gallery so that I can save my memory. Is it possible to hide the non visible pa...
[ "android", "out-of-memory" ]
0
0
72
1
0
2011-06-02T06:37:35.947000
2011-06-02T06:55:39.877000
6,211,274
6,211,290
Encryption of contents in compiled iOS app ( IPA )
As IPA structure is just a zipped file containing compiled codes & media contents like images & audio, how can I protect the contents from being extracted and stolen by others? Is there any encryption I can add into the IPA?
This answer mentions that the application is already encrypted by the time it gets onto your users' devices: Does Apple modify iOS application executables on apps submitted to the App Store? Sorry, that's only the application binary. The other media are not encrypted, and no, there's no way to encrypt the.ipa. You coul...
Encryption of contents in compiled iOS app ( IPA ) As IPA structure is just a zipped file containing compiled codes & media contents like images & audio, how can I protect the contents from being extracted and stolen by others? Is there any encryption I can add into the IPA?
TITLE: Encryption of contents in compiled iOS app ( IPA ) QUESTION: As IPA structure is just a zipped file containing compiled codes & media contents like images & audio, how can I protect the contents from being extracted and stolen by others? Is there any encryption I can add into the IPA? ANSWER: This answer menti...
[ "ios", "encryption", "ipa" ]
11
20
13,323
1
0
2011-06-02T06:38:03.310000
2011-06-02T06:40:59.313000
6,211,282
6,212,902
Why would CURL time out in 1000ms when I have set up timeout upto 3000ms?
In one of my script I have set up curl time out, CURLOPT_CONNECTTIMEOUT_MS, to 3000ms, but curl time outs much before than that, at an average of 1000ms. Why would it time out so early?
I believe the timeout you are seeing is a CURL operation timeout, rather than a connection timeout. These two are different. CURLOPT_TIMEOUT (and CURLOPT_TIMEOUT_MS for millisecond values) control the timeout for the work CURL does after it's connected. CUROPT_CONNECTTIMEOUT (and CUROPT_CONNECTTIMEOUT_MS ) control the ...
Why would CURL time out in 1000ms when I have set up timeout upto 3000ms? In one of my script I have set up curl time out, CURLOPT_CONNECTTIMEOUT_MS, to 3000ms, but curl time outs much before than that, at an average of 1000ms. Why would it time out so early?
TITLE: Why would CURL time out in 1000ms when I have set up timeout upto 3000ms? QUESTION: In one of my script I have set up curl time out, CURLOPT_CONNECTTIMEOUT_MS, to 3000ms, but curl time outs much before than that, at an average of 1000ms. Why would it time out so early? ANSWER: I believe the timeout you are see...
[ "php", "curl" ]
4
7
9,593
2
0
2011-06-02T06:39:05.837000
2011-06-02T09:50:38.940000
6,211,301
6,211,353
Rails server reduce verbosity?
One method of debugging within the Controllers I have learnt from Django is to actually print out variables within the controllers itself. However, I realize that this method is not as practical in rails as the default rails webserver is pretty verbose and it's making me difficult to trace. FYI I read about the rails d...
You should be able to change the logging level in your config/environments/*.rb files. See: http://guides.rubyonrails.org/debugging_rails_applications.html#log-levels for the different log levels.
Rails server reduce verbosity? One method of debugging within the Controllers I have learnt from Django is to actually print out variables within the controllers itself. However, I realize that this method is not as practical in rails as the default rails webserver is pretty verbose and it's making me difficult to trac...
TITLE: Rails server reduce verbosity? QUESTION: One method of debugging within the Controllers I have learnt from Django is to actually print out variables within the controllers itself. However, I realize that this method is not as practical in rails as the default rails webserver is pretty verbose and it's making me...
[ "ruby-on-rails" ]
1
1
277
1
0
2011-06-02T06:42:03.310000
2011-06-02T06:48:25.163000
6,211,311
6,211,360
Logging in to a website with C#
I'm sorry if this subject has already been answered, but I couldn't find what I needed (yet). I'm working on a program that downloads files from university websites that use the same infrastructure. It's an open source project which I'm trying to support in my free time (hosted in goodle code: http://code.google.com/p/...
You could try to automate the process with WatiN library. It allows you to click buttons, submit forms, etc. using (var ie = new IE(loginUrl)) { if (ie.TextField("username").Exists && ie.TextField("password").Exists) { ie.TextField("username").Value = "username"; ie.TextField("password").Value = "password"; ie.Button(F...
Logging in to a website with C# I'm sorry if this subject has already been answered, but I couldn't find what I needed (yet). I'm working on a program that downloads files from university websites that use the same infrastructure. It's an open source project which I'm trying to support in my free time (hosted in goodle...
TITLE: Logging in to a website with C# QUESTION: I'm sorry if this subject has already been answered, but I couldn't find what I needed (yet). I'm working on a program that downloads files from university websites that use the same infrastructure. It's an open source project which I'm trying to support in my free time...
[ "c#", "browser", "web-crawler" ]
3
3
215
1
0
2011-06-02T06:42:44
2011-06-02T06:49:14.493000
6,211,318
6,211,348
What are the benefits of using the real image height and width?
What are the benefits to using an images real height and width when rendering HTML? That is if I have an image that 100x100 pixels but I want to display something that is 95x95 pixels, should I resize the image on the server or can I let the browser handle this? I'm really looking for a general rule along with the reas...
Browsers handle resampling/interpolation of bitmap images differently when they're the ones resizing the images, which may or may not be controllable with CSS. This is elaborated on in detail in this post on Flickr's dev blog. If you resize the image in an image editor or by using server technology, you'll get consiste...
What are the benefits of using the real image height and width? What are the benefits to using an images real height and width when rendering HTML? That is if I have an image that 100x100 pixels but I want to display something that is 95x95 pixels, should I resize the image on the server or can I let the browser handle...
TITLE: What are the benefits of using the real image height and width? QUESTION: What are the benefits to using an images real height and width when rendering HTML? That is if I have an image that 100x100 pixels but I want to display something that is 95x95 pixels, should I resize the image on the server or can I let ...
[ "html", "css", "image" ]
0
3
273
5
0
2011-06-02T06:44:04.883000
2011-06-02T06:48:11.473000
6,211,330
6,308,534
Most effective plugin to play Rtsp streams on a webpage with good browser compatibilty
Here is a overview of my code. User press a record button and it hits the server to start a surveillance stream,and it returns a rtsp url which I want to play on the website. I have tried vlc plugin, but it seems to be unreliable the following code creates the after-mentioned problems. Any other ideas to implement this...
Since you don't mention OS: Another windows-only option is to write your own RTSP DirectShow source filter. Such a filter can then be registered for the RTSP protocol. On the webpage you can insert it via: If the filter is registered correctly, the RTSP source filter is automatically loaded and an appropriate media pip...
Most effective plugin to play Rtsp streams on a webpage with good browser compatibilty Here is a overview of my code. User press a record button and it hits the server to start a surveillance stream,and it returns a rtsp url which I want to play on the website. I have tried vlc plugin, but it seems to be unreliable the...
TITLE: Most effective plugin to play Rtsp streams on a webpage with good browser compatibilty QUESTION: Here is a overview of my code. User press a record button and it hits the server to start a surveillance stream,and it returns a rtsp url which I want to play on the website. I have tried vlc plugin, but it seems to...
[ "javascript", "html", "ajax", "rtsp" ]
5
2
20,743
3
0
2011-06-02T06:46:29.313000
2011-06-10T15:27:08.577000
6,211,336
6,211,354
Javascript regexp problem
I'm trying to use a pattern like this in a javascript regexp: "foo.bar".match(/foo\.(buz|bar)/) but instead of returning foo.bar as I expect, it returns an array: ["foo.bar", "bar"] I don't get it. How do I match foo.bar and foo.buz?
You are correctly matching "foo.bar" or "foo.buz", but since you have a grouping ( (...) ), the returned array includes more than one item: [ Full Match, Match 1, Match 2,..., Match N ] According to the spec, the result is always an array, and the full matched text will be element 0. Elements 1...N will be the matches ...
Javascript regexp problem I'm trying to use a pattern like this in a javascript regexp: "foo.bar".match(/foo\.(buz|bar)/) but instead of returning foo.bar as I expect, it returns an array: ["foo.bar", "bar"] I don't get it. How do I match foo.bar and foo.buz?
TITLE: Javascript regexp problem QUESTION: I'm trying to use a pattern like this in a javascript regexp: "foo.bar".match(/foo\.(buz|bar)/) but instead of returning foo.bar as I expect, it returns an array: ["foo.bar", "bar"] I don't get it. How do I match foo.bar and foo.buz? ANSWER: You are correctly matching "foo.b...
[ "javascript", "regex" ]
2
3
255
2
0
2011-06-02T06:47:02.513000
2011-06-02T06:48:33.870000
6,211,341
6,211,407
Continue statement in Pl/sql
I am working Oracle 10g. I am running this pl/sql block Declare cursor Get_Data is select * from employee for update; data Get_Data%rowtype; Begin for data in Get_Data loop if(data.salary=5000) then continue; else update employee set salary= salary+3000 where current of Get_Data; end if; end loop; end; It is giving m...
Just a note: CONTINUE is supported only in Oracle 11g. Refer here: Oracle® Database PL/SQL Language Reference 11g Release 1 (11.1) > What's New in PL/SQL? > CONTINUE Statement
Continue statement in Pl/sql I am working Oracle 10g. I am running this pl/sql block Declare cursor Get_Data is select * from employee for update; data Get_Data%rowtype; Begin for data in Get_Data loop if(data.salary=5000) then continue; else update employee set salary= salary+3000 where current of Get_Data; end if; ...
TITLE: Continue statement in Pl/sql QUESTION: I am working Oracle 10g. I am running this pl/sql block Declare cursor Get_Data is select * from employee for update; data Get_Data%rowtype; Begin for data in Get_Data loop if(data.salary=5000) then continue; else update employee set salary= salary+3000 where current of ...
[ "oracle" ]
1
4
3,642
2
0
2011-06-02T06:47:34.670000
2011-06-02T06:55:20.717000
6,211,363
6,211,455
Replace characters in all tables in Database Postgres
I'm using PostgreSQL with pgadmin. I need to replace multiple characters in all fields of type string, and in all tables in my database.
Use the below with caution - adjust as necessary, and make sure you review each and every resultant query (yes - this generates a resultset of queries) before copying the results and executing - as this may include queries that would attempt to modify views, calculated fields, system tables etc. etc. I'm a T-SQL'er - b...
Replace characters in all tables in Database Postgres I'm using PostgreSQL with pgadmin. I need to replace multiple characters in all fields of type string, and in all tables in my database.
TITLE: Replace characters in all tables in Database Postgres QUESTION: I'm using PostgreSQL with pgadmin. I need to replace multiple characters in all fields of type string, and in all tables in my database. ANSWER: Use the below with caution - adjust as necessary, and make sure you review each and every resultant qu...
[ "sql", "replace", "character" ]
1
1
2,132
2
0
2011-06-02T06:49:34.063000
2011-06-02T07:00:29.530000
6,211,370
6,212,791
Error: model item passed into the dictionary is of type '....List', but this dictionary requires a model of type '...IEnumerable`
I encountered this error while trying to render an asp.net MVC 3.0 application. I am working with DAB Architecture (3 projects) CAFM.Web, CAFM.Business, and CAFM.Data projects. CAFM.Data includes CAFMEntities: Entity FrameWork ITabMaster: Interface namespace CAFM.Data.Interfaces { public interface ITabMaster { TabMaste...
I don't understand why do you want your repository in a view. Did you try to change model to @model List In MVC you should pass data between controller and view thru ViewModels
Error: model item passed into the dictionary is of type '....List', but this dictionary requires a model of type '...IEnumerable` I encountered this error while trying to render an asp.net MVC 3.0 application. I am working with DAB Architecture (3 projects) CAFM.Web, CAFM.Business, and CAFM.Data projects. CAFM.Data inc...
TITLE: Error: model item passed into the dictionary is of type '....List', but this dictionary requires a model of type '...IEnumerable` QUESTION: I encountered this error while trying to render an asp.net MVC 3.0 application. I am working with DAB Architecture (3 projects) CAFM.Web, CAFM.Business, and CAFM.Data proje...
[ "model-view-controller" ]
0
0
2,263
1
0
2011-06-02T06:50:25.887000
2011-06-02T09:40:47.527000
6,211,378
6,211,741
Image "gradient blur"
in my application, I need to apply a blur-filter to an image. However, the effect should get stronger, the further the pixel is away from a line the user may draw freely in the image. Lets assume the line the user draws splits the image horizontally exactly in the middle. Then along this line, the effect of the gradien...
Yes, the approach you have in mind will work just fine. Here are two images, the left is a normal image and the right is composed of two images on top of each other where the bottom is normal and the top is blurred and the top uses an opacity mask to blend the two together: And this is what it looks like with the right...
Image "gradient blur" in my application, I need to apply a blur-filter to an image. However, the effect should get stronger, the further the pixel is away from a line the user may draw freely in the image. Lets assume the line the user draws splits the image horizontally exactly in the middle. Then along this line, the...
TITLE: Image "gradient blur" QUESTION: in my application, I need to apply a blur-filter to an image. However, the effect should get stronger, the further the pixel is away from a line the user may draw freely in the image. Lets assume the line the user draws splits the image horizontally exactly in the middle. Then al...
[ "c#", "wpf", "image", "blur" ]
2
7
1,676
1
0
2011-06-02T06:51:25.977000
2011-06-02T07:34:46.210000
6,211,384
6,211,409
array sorting php
I've an array like this Array ( [0] => Array ( [result] => Array ( [0] => Array ( [type] => ABC [id] => 123232 [name] => Apple ) [1] => Array ( [type] => DEF [id] => 2323232 [name] => Banana ) ) [title] => Cool [rank] => 2 ) [1] => Array ( [result] => Array ( [0] => Array ( [type] => ZX [id] => 3223 [name] => D...
You can use the usort function: function cmp($a, $b) { return $a['rank'] - $b['rank']; } $arr = /* your array */ usort($arr, "cmp"); See it To sort on rank in descending order ( question asked in comments ), you just reverse the order in the compare function: function cmp($a, $b) { return $b['rank'] - $a['rank']; ^^ ...
array sorting php I've an array like this Array ( [0] => Array ( [result] => Array ( [0] => Array ( [type] => ABC [id] => 123232 [name] => Apple ) [1] => Array ( [type] => DEF [id] => 2323232 [name] => Banana ) ) [title] => Cool [rank] => 2 ) [1] => Array ( [result] => Array ( [0] => Array ( [type] => ZX [id] =...
TITLE: array sorting php QUESTION: I've an array like this Array ( [0] => Array ( [result] => Array ( [0] => Array ( [type] => ABC [id] => 123232 [name] => Apple ) [1] => Array ( [type] => DEF [id] => 2323232 [name] => Banana ) ) [title] => Cool [rank] => 2 ) [1] => Array ( [result] => Array ( [0] => Array ( [...
[ "php", "arrays", "sorting" ]
1
3
316
3
0
2011-06-02T06:52:27.817000
2011-06-02T06:55:30.560000
6,211,387
6,213,116
Will it be called augmented reality if I render a reality-based 3D model instead of render a camera view?
I've developed an application, and now I wonder if my work can be regarded as augmented reality: Instead of overlap something on a camera preview, I build and render 3D buildings on a mobile phone. These models are the same (or similar to) some real buildings. I use GPS and gyros to decide the player's position and hea...
In the academic papers applications like this are known as "situated simulations", see the work of Gunnar Liestøl: http://inventioproject.no/sitsim/
Will it be called augmented reality if I render a reality-based 3D model instead of render a camera view? I've developed an application, and now I wonder if my work can be regarded as augmented reality: Instead of overlap something on a camera preview, I build and render 3D buildings on a mobile phone. These models are...
TITLE: Will it be called augmented reality if I render a reality-based 3D model instead of render a camera view? QUESTION: I've developed an application, and now I wonder if my work can be regarded as augmented reality: Instead of overlap something on a camera preview, I build and render 3D buildings on a mobile phone...
[ "mobile", "augmented-reality" ]
1
0
161
2
0
2011-06-02T06:52:49.863000
2011-06-02T10:10:35.170000
6,211,388
6,211,462
How to convert "#00E4FF" to Brush in code?
I need to convert some color ( in Hex ) to Brush. I need to do it in the code. How can i do it?
//this would be initialized somewhere else, I assume string hex = "#00E4FF"; //strip out any # if they exist hex = hex.Replace("#", string.Empty); byte r = (byte)(Convert.ToUInt32(hex.Substring(0, 2), 16)); byte g = (byte)(Convert.ToUInt32(hex.Substring(2, 2), 16)); byte b = (byte)(Convert.ToUInt32(hex.Substring(4, 2...
How to convert "#00E4FF" to Brush in code? I need to convert some color ( in Hex ) to Brush. I need to do it in the code. How can i do it?
TITLE: How to convert "#00E4FF" to Brush in code? QUESTION: I need to convert some color ( in Hex ) to Brush. I need to do it in the code. How can i do it? ANSWER: //this would be initialized somewhere else, I assume string hex = "#00E4FF"; //strip out any # if they exist hex = hex.Replace("#", string.Empty); byte ...
[ "silverlight" ]
7
11
10,480
3
0
2011-06-02T06:53:05.100000
2011-06-02T07:01:35.600000
6,211,392
6,211,505
mySQL: Variable LIMIT
I'm using a SQL-statement to retrieve the top 5 entries in a list: SELECT... FROM table ORDER BY someColumn DESC LIMIT 5 The result will look something like this: Name Count Person B 10 Person D 8 Person A 5 Person E 5 Person C 4 If there are more results with a value like the fifth entry in the list (4 in the example)...
You mean you want the fist five results but also all other results which are tied in 5th place, right? One solution is to get the 5th result first - using a subquery - and then get what you need: SELECT... FROM table WHERE someColumn >= ( SELECT someColumn FROM table ORDER BY someColumn DESC LIMIT 4, 1 <-- only the 5th...
mySQL: Variable LIMIT I'm using a SQL-statement to retrieve the top 5 entries in a list: SELECT... FROM table ORDER BY someColumn DESC LIMIT 5 The result will look something like this: Name Count Person B 10 Person D 8 Person A 5 Person E 5 Person C 4 If there are more results with a value like the fifth entry in the l...
TITLE: mySQL: Variable LIMIT QUESTION: I'm using a SQL-statement to retrieve the top 5 entries in a list: SELECT... FROM table ORDER BY someColumn DESC LIMIT 5 The result will look something like this: Name Count Person B 10 Person D 8 Person A 5 Person E 5 Person C 4 If there are more results with a value like the fi...
[ "mysql", "sql", "limit" ]
1
5
1,294
2
0
2011-06-02T06:53:45.183000
2011-06-02T07:05:15.790000
6,211,395
6,211,435
Is + operator overloaded for primitive types?
Already overloaded operators <<,>>,= etc are used many times. An example that i was thinking of is when we add strings say: string name = string("munish") + "kumar"; the + operator is overloaded in the string class. but when we add numbers like 1 + 2( doesn't seem like an overloaded operator call) I was just wondering ...
Primitive types don't implement operator+ which is actually a function with a weird name. Addition for Primitive type is carried out by CPU instruction such as: addl %edx,(%eax) //this adds two integral values loaded at edx and eax You implement operator+ for user-defined types, and compiler generates lots of CPU instr...
Is + operator overloaded for primitive types? Already overloaded operators <<,>>,= etc are used many times. An example that i was thinking of is when we add strings say: string name = string("munish") + "kumar"; the + operator is overloaded in the string class. but when we add numbers like 1 + 2( doesn't seem like an o...
TITLE: Is + operator overloaded for primitive types? QUESTION: Already overloaded operators <<,>>,= etc are used many times. An example that i was thinking of is when we add strings say: string name = string("munish") + "kumar"; the + operator is overloaded in the string class. but when we add numbers like 1 + 2( does...
[ "c++", "operator-overloading" ]
5
8
4,222
3
0
2011-06-02T06:54:05.387000
2011-06-02T06:58:50.157000
6,211,398
6,211,605
From where can i get libmp3lame.so file?
can anybody give me links to dowlnload libmp3lame.so file.I want to convert mp3 stream to pcm. I want to do it using android ndk.
Try the following url http://mandrivausers.org/index.php?/topic/25941-where-to-get-libmp3lameso-solved/ http://hany.sk/~hany/RPM/libmp3lame.so.0.html Thanks Deepak
From where can i get libmp3lame.so file? can anybody give me links to dowlnload libmp3lame.so file.I want to convert mp3 stream to pcm. I want to do it using android ndk.
TITLE: From where can i get libmp3lame.so file? QUESTION: can anybody give me links to dowlnload libmp3lame.so file.I want to convert mp3 stream to pcm. I want to do it using android ndk. ANSWER: Try the following url http://mandrivausers.org/index.php?/topic/25941-where-to-get-libmp3lameso-solved/ http://hany.sk/~ha...
[ "android", "linux" ]
0
0
1,714
2
0
2011-06-02T06:54:27.170000
2011-06-02T07:18:05.600000
6,211,417
6,211,468
Reflection api - find subclass type
Hi I am trying to find out the subclass, form an superclass object. if Class Super is the super class. and Class Sub1 and Class Sub2 extends Class Super.(all classes are public) Lets say I have a object of Super type as Super superObject = new Sub1(); now for the superObject, is it possible to find which subclass the ...
The getClass() method will return the concrete type of the object at runtime, not the reference type. So simply doing: Super superObject = new Sub1(); Class klass = superObject.getClass(); Will give you Sub1.class It's not clear from your question what you then want to do with it. You can simply call getName() on it, c...
Reflection api - find subclass type Hi I am trying to find out the subclass, form an superclass object. if Class Super is the super class. and Class Sub1 and Class Sub2 extends Class Super.(all classes are public) Lets say I have a object of Super type as Super superObject = new Sub1(); now for the superObject, is it ...
TITLE: Reflection api - find subclass type QUESTION: Hi I am trying to find out the subclass, form an superclass object. if Class Super is the super class. and Class Sub1 and Class Sub2 extends Class Super.(all classes are public) Lets say I have a object of Super type as Super superObject = new Sub1(); now for the s...
[ "java", "inheritance", "reflection", "hierarchy" ]
0
2
3,723
3
0
2011-06-02T06:57:16.687000
2011-06-02T07:01:52.963000
6,211,428
6,211,517
Java Class turns invalid after a method call
I have a class that interfaces with an RPGLE program. The client will hold a reference to the class and perform certain operations. Calling methods etc. After a call to a particular method - endDocument(), the class is then is an invalid state because I call destroy() on a number of objects (which is required by the AP...
A more OO way would be to use the State pattern. You could have two object states; valid (which contains the logic) and invalid which throws IllegalStateExceptions. Object state would need to be changed in the endDocument method
Java Class turns invalid after a method call I have a class that interfaces with an RPGLE program. The client will hold a reference to the class and perform certain operations. Calling methods etc. After a call to a particular method - endDocument(), the class is then is an invalid state because I call destroy() on a n...
TITLE: Java Class turns invalid after a method call QUESTION: I have a class that interfaces with an RPGLE program. The client will hold a reference to the class and perform certain operations. Calling methods etc. After a call to a particular method - endDocument(), the class is then is an invalid state because I cal...
[ "java" ]
1
3
153
1
0
2011-06-02T06:58:24.357000
2011-06-02T07:06:56.427000
6,211,429
6,211,511
Callback on memory access?
Does there exist a way to allocate some memory and have some sort of callback (be it pointer to a function or signal) when the memory is being accessed (either read or written to)? For example, if I said allocate 1mb of memory, I would like to have a way to call a function when any of that 1mb is being accessed. The pl...
Yes, there is. Use the mprotect(2) system call (see: http://linux.die.net/man/2/mprotect ) to set read only or no access memory protection on the page and set a SIGEGVsignal handler that will be called when the memory has been accessed. Note that you will need to use mprotect in your signal handler to actually allow th...
Callback on memory access? Does there exist a way to allocate some memory and have some sort of callback (be it pointer to a function or signal) when the memory is being accessed (either read or written to)? For example, if I said allocate 1mb of memory, I would like to have a way to call a function when any of that 1m...
TITLE: Callback on memory access? QUESTION: Does there exist a way to allocate some memory and have some sort of callback (be it pointer to a function or signal) when the memory is being accessed (either read or written to)? For example, if I said allocate 1mb of memory, I would like to have a way to call a function w...
[ "c++", "c", "linux", "memory", "kernel" ]
7
8
3,951
4
0
2011-06-02T06:58:26.650000
2011-06-02T07:05:55.083000
6,211,431
6,211,484
hide text from printing but keeping the space
We have in-house server which brings the records by php from mysql. We have Dot matrix printer which we are using for printing on carbon less paper (2 copies:- one for official records,one for customer and one for gatekeeper). We tried to print the content by display:none but it was removing that space from that Div. T...
visibility: hidden; makes it invisible, but leaves the space. Check this
hide text from printing but keeping the space We have in-house server which brings the records by php from mysql. We have Dot matrix printer which we are using for printing on carbon less paper (2 copies:- one for official records,one for customer and one for gatekeeper). We tried to print the content by display:none b...
TITLE: hide text from printing but keeping the space QUESTION: We have in-house server which brings the records by php from mysql. We have Dot matrix printer which we are using for printing on carbon less paper (2 copies:- one for official records,one for customer and one for gatekeeper). We tried to print the content...
[ "html", "css" ]
9
30
8,560
2
0
2011-06-02T06:58:28.673000
2011-06-02T07:03:02.527000
6,211,434
6,211,544
Automatic update from database
I'm developing in WPF and want my DataGrid to automatically refresh when there's a change in the DB, and vice versa. Today I'm using Timers and simple Selects to perform the updates. Is there something in.Net that provides that functionality?
Unfortunately Database are "pull" data sources and doesn't provide any "Push" data model to make your code notify about the changes, until you implement pseudo push which is basically what you have mentioned i.e timers polling the database. Other option may be to implement a Trigger which calls a CLR SP and this SP is ...
Automatic update from database I'm developing in WPF and want my DataGrid to automatically refresh when there's a change in the DB, and vice versa. Today I'm using Timers and simple Selects to perform the updates. Is there something in.Net that provides that functionality?
TITLE: Automatic update from database QUESTION: I'm developing in WPF and want my DataGrid to automatically refresh when there's a change in the DB, and vice versa. Today I'm using Timers and simple Selects to perform the updates. Is there something in.Net that provides that functionality? ANSWER: Unfortunately Datab...
[ "c#", ".net", "wpf", "database", "ado.net" ]
1
2
1,206
3
0
2011-06-02T06:58:37.457000
2011-06-02T07:10:58.377000
6,211,440
6,211,481
linux recv() function flag parameter?
What will happen if I use recv(sockfd, buffer, len, 0); on a non-blocking socket? If the socket sockfd is closed or nothing to be read, does the recv() block? (note: the flag in recv () is 0 ).
If the socket is marked non blocking, recv will never block. period. If the socket is fine but there is no data to be read you will get -1 as return value and errno will be set to EAGAIN. If there is an error (closed socket etc.), you still get a -1 return value but errno will be set to the appropriate value.
linux recv() function flag parameter? What will happen if I use recv(sockfd, buffer, len, 0); on a non-blocking socket? If the socket sockfd is closed or nothing to be read, does the recv() block? (note: the flag in recv () is 0 ).
TITLE: linux recv() function flag parameter? QUESTION: What will happen if I use recv(sockfd, buffer, len, 0); on a non-blocking socket? If the socket sockfd is closed or nothing to be read, does the recv() block? (note: the flag in recv () is 0 ). ANSWER: If the socket is marked non blocking, recv will never block. ...
[ "linux", "function", "recv" ]
1
2
2,137
2
0
2011-06-02T06:59:26.140000
2011-06-02T07:02:50.373000
6,211,444
6,211,800
Finishing all activities started before the activity
I want to finish all the activities which are running in the application means want to remove all the parent activities from stack. I want to implement logout functionality locally in my application so what I was thinking, I will finish all the activities started before and will start login activity again..
I should let you know this is not a recommended behavior in android since you should let itself to manage life circles of activities. However if you really need to do this, you can use FLAG_ACTIVITY_CLEAR_TOP I give you some sample code here, where MainActivity is the first activity in the application: public static vo...
Finishing all activities started before the activity I want to finish all the activities which are running in the application means want to remove all the parent activities from stack. I want to implement logout functionality locally in my application so what I was thinking, I will finish all the activities started bef...
TITLE: Finishing all activities started before the activity QUESTION: I want to finish all the activities which are running in the application means want to remove all the parent activities from stack. I want to implement logout functionality locally in my application so what I was thinking, I will finish all the acti...
[ "android", "android-activity", "stack" ]
6
8
10,824
3
0
2011-06-02T06:59:35.977000
2011-06-02T07:41:50.807000
6,211,466
6,211,523
Call immediately executing function from outside
I've got an immediately executing function and I need to call it from outside: (function myFunc(){ console.log("Hello from myFunc"); })(); I'm using named function because I'm doing a recursion in it so I can reference it. but at some point recursion stops. and I need to invoke this function once again.
Is there a reason you have to wrap it like that? Why don't you just make a normal named function and call it: function myFunc(){ console.log("Hello from myFunc"); } myfunc();
Call immediately executing function from outside I've got an immediately executing function and I need to call it from outside: (function myFunc(){ console.log("Hello from myFunc"); })(); I'm using named function because I'm doing a recursion in it so I can reference it. but at some point recursion stops. and I need to...
TITLE: Call immediately executing function from outside QUESTION: I've got an immediately executing function and I need to call it from outside: (function myFunc(){ console.log("Hello from myFunc"); })(); I'm using named function because I'm doing a recursion in it so I can reference it. but at some point recursion st...
[ "javascript" ]
1
2
574
1
0
2011-06-02T07:01:44.280000
2011-06-02T07:08:22.950000
6,211,471
6,211,588
Table usage in the webpage in asp.net(C#)
int numcells = 2; foreach (System.IO.FileInfo fi in fileQuery) { Label1.Text = fileList.Count().ToString(); TableRow r = new TableRow(); for (int i = 0; i < numcells; i++) { if (i.Equals("0")) { TableCell c = new TableCell(); c.Controls.Add(new LiteralControl(fi.Name.ToString())); r.Cells.Add(c); } if (i.Equals("1"...
i.Equals("0") and i.Equals("1") is incorrect and should be i.Equals(0) and i.Equals(1) This will sort out your problem, Equals is used to determine if the specified object is equal to the current object, and in this case it is not because "1" is a string and 1 is an integer. have a look here for more info on equals
Table usage in the webpage in asp.net(C#) int numcells = 2; foreach (System.IO.FileInfo fi in fileQuery) { Label1.Text = fileList.Count().ToString(); TableRow r = new TableRow(); for (int i = 0; i < numcells; i++) { if (i.Equals("0")) { TableCell c = new TableCell(); c.Controls.Add(new LiteralControl(fi.Name.ToStrin...
TITLE: Table usage in the webpage in asp.net(C#) QUESTION: int numcells = 2; foreach (System.IO.FileInfo fi in fileQuery) { Label1.Text = fileList.Count().ToString(); TableRow r = new TableRow(); for (int i = 0; i < numcells; i++) { if (i.Equals("0")) { TableCell c = new TableCell(); c.Controls.Add(new LiteralContr...
[ "c#", "asp.net", "file" ]
0
1
143
1
0
2011-06-02T07:02:00.940000
2011-06-02T07:15:57.333000
6,211,473
6,211,693
WebView Back, Refresh, Forward? Simply doesn't work!
I have tried everything to get my 'forward' and 'back' to work. Refresh is working [I figured it out by changing the method to read 'webView.reload();' instead of 'webView.refresh();' Can anyone assist with the forward and back? I have tried 'forward', 'canGoForward' and 'goForward' as well as 'back', 'canGoBack' and '...
The code you shared doesn't include the portion where you are creating webview and navigating between urls. So I am just taking a guess at what might be happening. It seems that webview is an instance field of your class whose portion you have shown in the question. Could it be that webView is being recreated every tim...
WebView Back, Refresh, Forward? Simply doesn't work! I have tried everything to get my 'forward' and 'back' to work. Refresh is working [I figured it out by changing the method to read 'webView.reload();' instead of 'webView.refresh();' Can anyone assist with the forward and back? I have tried 'forward', 'canGoForward'...
TITLE: WebView Back, Refresh, Forward? Simply doesn't work! QUESTION: I have tried everything to get my 'forward' and 'back' to work. Refresh is working [I figured it out by changing the method to read 'webView.reload();' instead of 'webView.refresh();' Can anyone assist with the forward and back? I have tried 'forwar...
[ "android", "user-interface", "android-layout", "webview", "options-menu" ]
6
4
9,807
1
0
2011-06-02T07:02:14.260000
2011-06-02T07:28:36.487000
6,211,491
6,211,571
PHP naming conventions?
I'm coding smt right now, and am a little bit peeved by the fact that PHP sometimes calls its functions with underscore, and sometimes as one word. What's up with that? Example: int strlen(string $str) and bool in_array ( mixed $needle, array $haystack [, bool $strict = FALSE ] ) I'm hoping that there is a good reason ...
Quoted from: http://tnx.nl/php.html PHP has inconsistent function naming There is no apparent system in underscore(s) versus no underscore(s): underscore no underscore: stream_get_line readline disk_free_space diskfreespace is_object isset mcal_day_of_week jddayofweek set_error_handler setlocale snmp_get_quick_print s...
PHP naming conventions? I'm coding smt right now, and am a little bit peeved by the fact that PHP sometimes calls its functions with underscore, and sometimes as one word. What's up with that? Example: int strlen(string $str) and bool in_array ( mixed $needle, array $haystack [, bool $strict = FALSE ] ) I'm hoping that...
TITLE: PHP naming conventions? QUESTION: I'm coding smt right now, and am a little bit peeved by the fact that PHP sometimes calls its functions with underscore, and sometimes as one word. What's up with that? Example: int strlen(string $str) and bool in_array ( mixed $needle, array $haystack [, bool $strict = FALSE ]...
[ "php", "naming-conventions" ]
11
6
1,380
2
0
2011-06-02T07:04:17.503000
2011-06-02T07:14:17.657000
6,211,493
6,211,943
The cleaner approach to write code which parses DTO's
In the current project we have decided to use dto's to transfer data between the server and the client. Dto's are flat, flattering is not the issue, it can be done without much troubles. But dto unflattering may become much difficult to implement, because user may delete, create and update some parts of the flattened e...
For parsing entities to DTOs and vice-versa you can check AutoMapper. DTO can be hierarchy of objects(it doesn't have to be flatten). I'm afraid that you will never avoid some repeating code because each entity type is somehow special and you have to deal with it manually - that is the complexity included in using DTOs...
The cleaner approach to write code which parses DTO's In the current project we have decided to use dto's to transfer data between the server and the client. Dto's are flat, flattering is not the issue, it can be done without much troubles. But dto unflattering may become much difficult to implement, because user may d...
TITLE: The cleaner approach to write code which parses DTO's QUESTION: In the current project we have decided to use dto's to transfer data between the server and the client. Dto's are flat, flattering is not the issue, it can be done without much troubles. But dto unflattering may become much difficult to implement, ...
[ "c#", "entity-framework", "design-patterns" ]
2
4
414
1
0
2011-06-02T07:04:24.803000
2011-06-02T08:00:34.317000
6,211,494
6,218,473
Chrome giving error "Extra content at the end of the document" when adding another <h:column>
I have the following JSF table: List List ID #{item.id} Name #{item.name} The following part: is causing "error on line 361 at column 9: Extra content at the end of the document" error to show up in Chrome above the table. At the same time, an exception is shown in the server log saying: "Unable to generate Facelets er...
I understand that this happens only when there's a rendering exception, but it's been too late for Facelets to change the response into a fullworthy HTTP 500 error page. It's too late because a part of the response has already been committed, which is a point of no return. This explains the "Unable to generate Facelets...
Chrome giving error "Extra content at the end of the document" when adding another <h:column> I have the following JSF table: List List ID #{item.id} Name #{item.name} The following part: is causing "error on line 361 at column 9: Extra content at the end of the document" error to show up in Chrome above the table. At ...
TITLE: Chrome giving error "Extra content at the end of the document" when adding another <h:column> QUESTION: I have the following JSF table: List List ID #{item.id} Name #{item.name} The following part: is causing "error on line 361 at column 9: Extra content at the end of the document" error to show up in Chrome ab...
[ "java", "jsf", "jsf-2" ]
2
1
3,750
2
0
2011-06-02T07:04:29.983000
2011-06-02T18:10:28.993000
6,211,495
6,211,774
Data is not inserting in the database
I am creating a wbsite and I have the following code in c#.net public void btnSubmit_Click(TextBox txtEmailAdd, TextBox txtFirstName, TextBox txtLastName, TextBox txtDob, DropDownList drpdwnState, TextBox txtZipCode, DropDownList drpdwnCountry, Label lblMsg) { string[] ParameterName = { "@EmailId", "@FirstName", "@Last...
Use sqlprofiler, observe traces, you will be able to see what query dbms receives. but please use try catch first.
Data is not inserting in the database I am creating a wbsite and I have the following code in c#.net public void btnSubmit_Click(TextBox txtEmailAdd, TextBox txtFirstName, TextBox txtLastName, TextBox txtDob, DropDownList drpdwnState, TextBox txtZipCode, DropDownList drpdwnCountry, Label lblMsg) { string[] ParameterNam...
TITLE: Data is not inserting in the database QUESTION: I am creating a wbsite and I have the following code in c#.net public void btnSubmit_Click(TextBox txtEmailAdd, TextBox txtFirstName, TextBox txtLastName, TextBox txtDob, DropDownList drpdwnState, TextBox txtZipCode, DropDownList drpdwnCountry, Label lblMsg) { str...
[ "sql-server", "asp.net-3.5" ]
0
1
64
1
0
2011-06-02T07:04:31.670000
2011-06-02T07:38:37.180000
6,211,512
6,214,243
Oracle provider for .NET 4
HI, I'm developing a website on ASP.NET. The database is Oracle 10 g. When I deploy the website I get an exception message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.".The environment is Visual Studio 2010.I downloaded and installed ODAC 11.2 Release 3 (11.2.0.2.1) but I still ge...
Resolved. I could fix this problem by installing a patch provided by Oracle. If one uses typed Datasets they shoud install the patch as well after installing the ODP itself.Thanks whoever tried to answer.
Oracle provider for .NET 4 HI, I'm developing a website on ASP.NET. The database is Oracle 10 g. When I deploy the website I get an exception message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.".The environment is Visual Studio 2010.I downloaded and installed ODAC 11.2 Release 3 ...
TITLE: Oracle provider for .NET 4 QUESTION: HI, I'm developing a website on ASP.NET. The database is Oracle 10 g. When I deploy the website I get an exception message "System.Data.OracleClient requires Oracle client software version 8.1.7 or greater.".The environment is Visual Studio 2010.I downloaded and installed OD...
[ "oracle", ".net-4.0", "provider" ]
2
1
378
1
0
2011-06-02T07:06:07.613000
2011-06-02T12:01:43.427000
6,211,519
6,211,930
c# List view focus
I have a problem in focusing the listview.In my form i have a listview which contains two columns(Question_text, question_id).When a button is get clicked(Show button) a dialog box is get opened and it show show the selected question_text and question_id.Right now i am able to show the information in the dialog box.But...
private void btnAdd_Question_Click(object sender, EventArgs e) { var focusedItem = listView1.FocusedItem; add.ShowDialog(); listView1.FocusedItem = focusedItem; }
c# List view focus I have a problem in focusing the listview.In my form i have a listview which contains two columns(Question_text, question_id).When a button is get clicked(Show button) a dialog box is get opened and it show show the selected question_text and question_id.Right now i am able to show the information in...
TITLE: c# List view focus QUESTION: I have a problem in focusing the listview.In my form i have a listview which contains two columns(Question_text, question_id).When a button is get clicked(Show button) a dialog box is get opened and it show show the selected question_text and question_id.Right now i am able to show ...
[ "c#", ".net", "winforms", "showdialog" ]
0
1
6,566
2
0
2011-06-02T07:07:08.407000
2011-06-02T07:59:12.270000
6,211,525
6,211,552
Load Url in Web View
I have a small problem that I want to load a url in web view but it doesn't displayed in webview, it displayed in default Android browser. How can we resist this to open in webview and one thing more that if I will use any other web url then it simply displayed in web view. This problem with only my particular url. Wha...
use like this web.loadUrl("http://www.bizrate.com/rd?t=http%3A%2F%2Fclickfrom.buy.com%2Fdefault.asp%3Fadid%3D17865%26sURL%3Dhttp%3A%2F%2Fwww.buy.com%2Fprod%2F4x-silicone-skin-soft-gel-case-for-htc-droid-incredible%2Fq%2Floc%2F111%2F219945395.html∣=18893&cat_id=8515&atom=8517∏_id=2513751439&oid=2388674793&pos=1&b_id=18&...
Load Url in Web View I have a small problem that I want to load a url in web view but it doesn't displayed in webview, it displayed in default Android browser. How can we resist this to open in webview and one thing more that if I will use any other web url then it simply displayed in web view. This problem with only m...
TITLE: Load Url in Web View QUESTION: I have a small problem that I want to load a url in web view but it doesn't displayed in webview, it displayed in default Android browser. How can we resist this to open in webview and one thing more that if I will use any other web url then it simply displayed in web view. This p...
[ "android" ]
1
0
1,589
2
0
2011-06-02T07:08:38.500000
2011-06-02T07:12:02.463000
6,211,534
6,211,567
can any one suggest a good math function in javascript to round integer?
i have to round the value from 2.3456789 to 2.345. After. there must be three number only remaining should be removed
There is value.toFixed(3), but that will round up to 2.346. You could just parseInt(value * 1000) / 1000 if you really don't want to round. You may need to ensure value is a number first: value = new Number(value) Now if value is user input, it's possible that it might now be NaN (Not a Number). You can't do if(value =...
can any one suggest a good math function in javascript to round integer? i have to round the value from 2.3456789 to 2.345. After. there must be three number only remaining should be removed
TITLE: can any one suggest a good math function in javascript to round integer? QUESTION: i have to round the value from 2.3456789 to 2.345. After. there must be three number only remaining should be removed ANSWER: There is value.toFixed(3), but that will round up to 2.346. You could just parseInt(value * 1000) / 10...
[ "javascript", "math" ]
2
2
200
5
0
2011-06-02T07:09:29.250000
2011-06-02T07:13:40.930000
6,211,543
6,211,646
What is the difference between a normal file download and a PHP-driven download?
Is there a difference between directly downloading a file from a web server, and downloading the same file through a PHP script that uses these headers? (Assume that all of the variables here contain correct values for the file being downloaded.) header('Content-Description: File Transfer'); header('Content-Type: '. $m...
Not as far as the client is concerned, no. The difference for the server is that you have the full power of PHP to do something with before initiating the download, which is not the case if Apache handles the download directly. It also means that the whole cruft of PHP needs to be loaded and executed before a download ...
What is the difference between a normal file download and a PHP-driven download? Is there a difference between directly downloading a file from a web server, and downloading the same file through a PHP script that uses these headers? (Assume that all of the variables here contain correct values for the file being downl...
TITLE: What is the difference between a normal file download and a PHP-driven download? QUESTION: Is there a difference between directly downloading a file from a web server, and downloading the same file through a PHP script that uses these headers? (Assume that all of the variables here contain correct values for th...
[ "php", "download" ]
2
3
386
3
0
2011-06-02T07:10:50.203000
2011-06-02T07:23:09.647000
6,211,553
6,224,651
Is pyramid_who (repoze.who) the preferred way to do authentication for pyramid?
I am just starting to learn Pyramid Framework. Is pyramid_who (repoze.who) the preferred way to do authentication? What other options do I have?
pyramid_who is the best way to utilize repoze.who v2 for doing authentication. Whether this is the best authentication solution for you or not is dependent on your needs. Typically repoze.who is the best solution for doing SSO (single sign-on) solutions where you need to connect to a service like LDAP. If SSO is not a ...
Is pyramid_who (repoze.who) the preferred way to do authentication for pyramid? I am just starting to learn Pyramid Framework. Is pyramid_who (repoze.who) the preferred way to do authentication? What other options do I have?
TITLE: Is pyramid_who (repoze.who) the preferred way to do authentication for pyramid? QUESTION: I am just starting to learn Pyramid Framework. Is pyramid_who (repoze.who) the preferred way to do authentication? What other options do I have? ANSWER: pyramid_who is the best way to utilize repoze.who v2 for doing authe...
[ "python", "authentication", "pyramid", "repoze.who" ]
5
10
1,804
2
0
2011-06-02T07:12:04.197000
2011-06-03T08:19:07.103000
6,211,564
6,211,956
Gzipping data in GWT
I have a GWT application that created an XML structure and then posts this to a servlet. Is it possible to gzip this xml doc on the client side before sending it (I have a filter on the servlet that will decompress it) Thanks
I could´t find a javascript implementation for gzip, but I found this stackoverflow thread with basically the same discussion about compression in javascript: JavaScript implementation of Gzip Maybe you can use some of the suggestions and wrap them with JSNI.
Gzipping data in GWT I have a GWT application that created an XML structure and then posts this to a servlet. Is it possible to gzip this xml doc on the client side before sending it (I have a filter on the servlet that will decompress it) Thanks
TITLE: Gzipping data in GWT QUESTION: I have a GWT application that created an XML structure and then posts this to a servlet. Is it possible to gzip this xml doc on the client side before sending it (I have a filter on the servlet that will decompress it) Thanks ANSWER: I could´t find a javascript implementation for...
[ "gwt", "compression" ]
5
4
1,797
1
0
2011-06-02T07:13:22.137000
2011-06-02T08:02:33.660000
6,211,570
6,211,609
'Concatenate' a struct into a char array
I have a struct that's used in my internet application, which looks like: struct query { ushort trans_id; ushort flags; ushort opcode; ushort content_length; char content[512]; }; Basically, I'm just trying to take this structure and turn it into a "packet" to be sent. It must have the corresponding length and everythi...
You can indeed simply cast the pointer to your struct to a char *, such as: #include /* for size_t */.... struct query q; /* fill in the struct... */ char *packet = (char *)(&q); size_t packet_size = sizeof(struct query); If you want the packet size to trim the content of the query struct, you'll have to calculate the...
'Concatenate' a struct into a char array I have a struct that's used in my internet application, which looks like: struct query { ushort trans_id; ushort flags; ushort opcode; ushort content_length; char content[512]; }; Basically, I'm just trying to take this structure and turn it into a "packet" to be sent. It must h...
TITLE: 'Concatenate' a struct into a char array QUESTION: I have a struct that's used in my internet application, which looks like: struct query { ushort trans_id; ushort flags; ushort opcode; ushort content_length; char content[512]; }; Basically, I'm just trying to take this structure and turn it into a "packet" to ...
[ "c", "casting", "struct", "concatenation" ]
1
0
2,631
2
0
2011-06-02T07:14:00.280000
2011-06-02T07:18:20.093000
6,211,575
6,211,604
Proper way (move semantics) to return a std::vector from function calling in C++11
I want to fill std::vector (or some other STL container): class Foo { public: Foo(int _n, const Bar &_m); private: std::vector fooes_; } 1.Good looking ctor, expensive performance std::vector get_vector(int _n, const Bar &_m) { std::vector ret;... // filling ret depending from arguments return ret; } Foo::Foo(int _n, ...
If you're using a C++0x-compatible compiler and standard library, you get better performance from the first example without doing anything. The return value of get_vector(_n, _m) is a temporary, and the move constructor for std::vector (a constructor taking an rvalue reference) will automatically be called with no furt...
Proper way (move semantics) to return a std::vector from function calling in C++11 I want to fill std::vector (or some other STL container): class Foo { public: Foo(int _n, const Bar &_m); private: std::vector fooes_; } 1.Good looking ctor, expensive performance std::vector get_vector(int _n, const Bar &_m) { std::vect...
TITLE: Proper way (move semantics) to return a std::vector from function calling in C++11 QUESTION: I want to fill std::vector (or some other STL container): class Foo { public: Foo(int _n, const Bar &_m); private: std::vector fooes_; } 1.Good looking ctor, expensive performance std::vector get_vector(int _n, const Ba...
[ "c++", "stl", "c++11", "move-semantics", "return-value-optimization" ]
33
46
20,679
3
0
2011-06-02T07:14:47.330000
2011-06-02T07:17:46.363000
6,211,578
6,211,603
What is regular expression for "Test123"
I tried - "Test\d\d\d" and it works but problem is, String in expression could contain any number of digits so it could be "Test1" or "Test12" or "Test123". Hence it could be in range [000] to [999]
This should help Test[0-9]{1,3} [0-9] specifies any digits between 0 - 9 {1,3} specifies a range of number of digits ranging from 1 to 3
What is regular expression for "Test123" I tried - "Test\d\d\d" and it works but problem is, String in expression could contain any number of digits so it could be "Test1" or "Test12" or "Test123". Hence it could be in range [000] to [999]
TITLE: What is regular expression for "Test123" QUESTION: I tried - "Test\d\d\d" and it works but problem is, String in expression could contain any number of digits so it could be "Test1" or "Test12" or "Test123". Hence it could be in range [000] to [999] ANSWER: This should help Test[0-9]{1,3} [0-9] specifies any d...
[ "regex" ]
1
3
255
3
0
2011-06-02T07:14:59.667000
2011-06-02T07:17:37.067000
6,211,579
6,211,595
Add shared libraries references to enterprise applications whith Jython in Websphere application server
I would like to programmatically add the shared libraries to my deployed applications in websphere application server (WAS). I heard that it is possible using jython scripting. How can I achieve this? Can someone give some pratical example?
You can do this with the following script: # Map shared library AdminApp.edit('ApplicationName', ['-MapSharedLibForMod', [['.*', '.*', 'SharedLibName']]]) # Save configuration AdminConfig.save() # Synchronize nodes (if you don't have standalone server but network deployment) Sync1 = AdminControl.completeObjectName('t...
Add shared libraries references to enterprise applications whith Jython in Websphere application server I would like to programmatically add the shared libraries to my deployed applications in websphere application server (WAS). I heard that it is possible using jython scripting. How can I achieve this? Can someone giv...
TITLE: Add shared libraries references to enterprise applications whith Jython in Websphere application server QUESTION: I would like to programmatically add the shared libraries to my deployed applications in websphere application server (WAS). I heard that it is possible using jython scripting. How can I achieve thi...
[ "shared-libraries", "jython", "application-server", "websphere-7" ]
4
3
3,218
1
0
2011-06-02T07:15:15.163000
2011-06-02T07:16:41.840000
6,211,598
6,211,788
How to enable a button based on a TextBox in GridView in ASP.Net using JavaScript?
I have a TextBox in the TemplateField of a GridView. And I have one button below the GridView. I want to enable the Button when I enter some text in the TextBox in the GridView. How to do this? I am using ASP.Net and C#.Net. My Source Code of the GridView: QC Attribute Name PO Attribute Value Negative Tolerance Positiv...
use onkeypress or onkeyup event and check whether the textbox is empty. if not, then make the button enable else disable. function enableButton(){ if(document.getElementById('txtPOAttributeValue').value!= '' && document.getElementById('txtNegTolerance').value!= '' && document.getElementById('txtPosTolerance').value!= '...
How to enable a button based on a TextBox in GridView in ASP.Net using JavaScript? I have a TextBox in the TemplateField of a GridView. And I have one button below the GridView. I want to enable the Button when I enter some text in the TextBox in the GridView. How to do this? I am using ASP.Net and C#.Net. My Source Co...
TITLE: How to enable a button based on a TextBox in GridView in ASP.Net using JavaScript? QUESTION: I have a TextBox in the TemplateField of a GridView. And I have one button below the GridView. I want to enable the Button when I enter some text in the TextBox in the GridView. How to do this? I am using ASP.Net and C#...
[ "c#", "javascript", "asp.net", "gridview", "user-controls" ]
0
1
2,332
2
0
2011-06-02T07:16:58.410000
2011-06-02T07:40:22.413000
6,211,599
6,215,375
Root priv can't be dropped in python even after seteuid. A bug?
Root priv can't be dropped in python even after seteuid. A bug? EDIT Summary: I forgot to drop gid. The accepted answer may help you, though. Hi. I can't drop the root privilege in python 3.2 on my linux. In fact, even after seteuid(1000), it can read root-owned 400-mode files. The euid is surely set to 1000! I found a...
Manipulating process credentials on Unix systems is tricky. I highly recommend gaining a thorough understanding of how the Real, Effective, and Saved-Set user ids are interrelated. It's very easy to screw up "dropping privileges". As to your specific observations... I'm wondering if there's a simple cause you may have ...
Root priv can't be dropped in python even after seteuid. A bug? Root priv can't be dropped in python even after seteuid. A bug? EDIT Summary: I forgot to drop gid. The accepted answer may help you, though. Hi. I can't drop the root privilege in python 3.2 on my linux. In fact, even after seteuid(1000), it can read root...
TITLE: Root priv can't be dropped in python even after seteuid. A bug? QUESTION: Root priv can't be dropped in python even after seteuid. A bug? EDIT Summary: I forgot to drop gid. The accepted answer may help you, though. Hi. I can't drop the root privilege in python 3.2 on my linux. In fact, even after seteuid(1000)...
[ "python", "privilege" ]
4
8
2,450
1
0
2011-06-02T07:17:10.310000
2011-06-02T13:45:12.833000
6,211,602
6,211,666
find the corresponding control in repeater control
I have a Repeater control which contains a CheckBox and a lable control in each row. When a CheckBox is selected. I want to retrieve the text of the Label for the corresponding CheckBox. How to get it?
Add the following to the CheckBox.Checked event handler: CheckBox checkBox = (CheckBox) sender; Label label = (Label) checkBox.Parent.FindControl("LabelName"); String labelText = label.Text;
find the corresponding control in repeater control I have a Repeater control which contains a CheckBox and a lable control in each row. When a CheckBox is selected. I want to retrieve the text of the Label for the corresponding CheckBox. How to get it?
TITLE: find the corresponding control in repeater control QUESTION: I have a Repeater control which contains a CheckBox and a lable control in each row. When a CheckBox is selected. I want to retrieve the text of the Label for the corresponding CheckBox. How to get it? ANSWER: Add the following to the CheckBox.Checke...
[ "c#", ".net", "asp.net", "repeater" ]
2
4
1,567
3
0
2011-06-02T07:17:29.717000
2011-06-02T07:26:02.110000
6,211,613
6,211,660
Testing whether a value is odd or even
I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 ||!!(n &&!(n%2)); } function isOdd(n) { return isEven(Number(n) + 1); } That is OK if n is with certain parameters, but fails for many scenarios. So I set out to create robust functions...
Use modulus: function isEven(n) { return n % 2 == 0; } function isOdd(n) { return Math.abs(n % 2) == 1; } You can check that any value in Javascript can be coerced to a number with: Number.isFinite(parseFloat(n)) This check should preferably be done outside the isEven and isOdd functions, so you don't have to duplicat...
Testing whether a value is odd or even I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 ||!!(n &&!(n%2)); } function isOdd(n) { return isEven(Number(n) + 1); } That is OK if n is with certain parameters, but fails for many scenarios. ...
TITLE: Testing whether a value is odd or even QUESTION: I decided to create simple isEven and isOdd function with a very simple algorithm: function isEven(n) { n = Number(n); return n === 0 ||!!(n &&!(n%2)); } function isOdd(n) { return isEven(Number(n) + 1); } That is OK if n is with certain parameters, but fails fo...
[ "javascript", "numbers" ]
247
495
510,830
23
0
2011-06-02T07:19:01.787000
2011-06-02T07:24:34.467000
6,211,625
6,211,648
How to pass 2 javascript events in one click?
I want to pass 2 javascript events in one click, I put 2 of them into href and onclick. But when I click, it always executes the onclick action. Click again or a third time, the href action gets executed. I do not know how it was like this. How do I to solve it? If I combine 2 javascript events in one part(href or oncl...
Try this: Note that you do not need to put "javascript:" in the onclick event. And it is generally better to use onclick rather than href to execute javascript. You could even change href="#" to link to a page saying you need javascript enabled. return false; will cancel the link if javascript is working.
How to pass 2 javascript events in one click? I want to pass 2 javascript events in one click, I put 2 of them into href and onclick. But when I click, it always executes the onclick action. Click again or a third time, the href action gets executed. I do not know how it was like this. How do I to solve it? If I combin...
TITLE: How to pass 2 javascript events in one click? QUESTION: I want to pass 2 javascript events in one click, I put 2 of them into href and onclick. But when I click, it always executes the onclick action. Click again or a third time, the href action gets executed. I do not know how it was like this. How do I to sol...
[ "javascript" ]
1
2
4,014
3
0
2011-06-02T07:20:04.463000
2011-06-02T07:23:35.147000
6,211,628
6,211,655
mysql query: how to get the number of yes/no votes per day
I have to create a mysql query to get a voting distribution of each day exceeding a particular date, something like this... date yes_votes no_votes ------------------------------------------ 2010-01-07 21 22 2010-01-07 2 0 My table is like this.. post_votes -------------------------- id(longint) date(timestamp) flag(ti...
SELECT COUNT(*) AS count, DATE(date), SUM(flag = 1) AS yes_votes, SUM(flag = 2) AS no_votes FROM post_votes WHERE date > '2010-07-01' GROUP BY DATE(date) This is a trick that works in MySQL, as flag=1 will either be True or False. But True = 1 and False = 0 in MySQL so you can add the 1s and 0s using the SUM() function...
mysql query: how to get the number of yes/no votes per day I have to create a mysql query to get a voting distribution of each day exceeding a particular date, something like this... date yes_votes no_votes ------------------------------------------ 2010-01-07 21 22 2010-01-07 2 0 My table is like this.. post_votes ---...
TITLE: mysql query: how to get the number of yes/no votes per day QUESTION: I have to create a mysql query to get a voting distribution of each day exceeding a particular date, something like this... date yes_votes no_votes ------------------------------------------ 2010-01-07 21 22 2010-01-07 2 0 My table is like thi...
[ "mysql" ]
5
10
1,279
5
0
2011-06-02T07:21:05.787000
2011-06-02T07:24:05.663000
6,211,629
6,211,771
GCC inline assembly error: no such instruction: `stosd'
Oh man, I've got yet another error while compiling the following inline assembly code (with -fasm-blocks ) under GCC: _asm { mov ecx, esi shr ecx, 2 rep stosd }; GCC understands other stos instructions, why won't it accept stosd???
seeing as your using intel syntax, just go for the explicit version of the STOS command: REP STOS DWORD PTR:[EDI]. and iirc under gcc, stosd is called stosl.
GCC inline assembly error: no such instruction: `stosd' Oh man, I've got yet another error while compiling the following inline assembly code (with -fasm-blocks ) under GCC: _asm { mov ecx, esi shr ecx, 2 rep stosd }; GCC understands other stos instructions, why won't it accept stosd???
TITLE: GCC inline assembly error: no such instruction: `stosd' QUESTION: Oh man, I've got yet another error while compiling the following inline assembly code (with -fasm-blocks ) under GCC: _asm { mov ecx, esi shr ecx, 2 rep stosd }; GCC understands other stos instructions, why won't it accept stosd??? ANSWER: seein...
[ "visual-c++", "gcc", "assembly", "inline-assembly" ]
3
4
2,555
2
0
2011-06-02T07:21:10.823000
2011-06-02T07:38:21.293000
6,211,631
6,211,664
Changing CSS properties using jQuery for a markup and different CSS files
I've a HTML markup and I've several CSS files with different properties assigned for the HTML elements which will act as the theme of the markup. Say the Markup is something like {More HTML elements, divs, spans etc} {More HTML elements, divs, spans etc} And the css is like /*first.css*/ #main{ someProperty: values; } ...
I would say you can have single css with different properties you want to have in different classes. Whenever you want to change something. Just remove the current class using.removeClass() and add the new class using.addClass(). In case you want to switch the css files. Have a look here
Changing CSS properties using jQuery for a markup and different CSS files I've a HTML markup and I've several CSS files with different properties assigned for the HTML elements which will act as the theme of the markup. Say the Markup is something like {More HTML elements, divs, spans etc} {More HTML elements, divs, sp...
TITLE: Changing CSS properties using jQuery for a markup and different CSS files QUESTION: I've a HTML markup and I've several CSS files with different properties assigned for the HTML elements which will act as the theme of the markup. Say the Markup is something like {More HTML elements, divs, spans etc} {More HTML ...
[ "jquery", "css" ]
1
2
238
3
0
2011-06-02T07:21:29.670000
2011-06-02T07:24:57.010000
6,211,645
6,212,816
Android Market- Number of Active installs exceeds total downloads
I am wondering how the active installs exceeds the total installs. I suspect some one copied the app and installed on another phone...Can anyone post if it is possible some other way?
The market statistics are by no means perfect. They are only periodically updated, and have frequently bounced around like crazy. When I first published an app it was actually double counting one of the stats - Google fixed the bug that caused that but didn't fix the statistics. I've also seen people report issues with...
Android Market- Number of Active installs exceeds total downloads I am wondering how the active installs exceeds the total installs. I suspect some one copied the app and installed on another phone...Can anyone post if it is possible some other way?
TITLE: Android Market- Number of Active installs exceeds total downloads QUESTION: I am wondering how the active installs exceeds the total installs. I suspect some one copied the app and installed on another phone...Can anyone post if it is possible some other way? ANSWER: The market statistics are by no means perfe...
[ "android", "google-play" ]
4
5
1,386
1
0
2011-06-02T07:23:09.637000
2011-06-02T09:42:48.697000
6,211,654
6,211,958
Share a resource between two processes
I want to know the best practices followed to share a queue (resource) between two processes in Python. Here is a what each process is doing: Process_1: continuously gets data (in json format) from a streaming api Process_2: is a daemon (similar to Sander Marechal's code ) which commits data (one at a time) into a data...
multiprocessing.pool isn't what you want in this case - it is useful for having multiple units of work done 'in the background' (concurrently), not so much for managing a shared resource. Since you appear to have the format of the communications worked out, and they communicate in only one direction, what you want is a...
Share a resource between two processes I want to know the best practices followed to share a queue (resource) between two processes in Python. Here is a what each process is doing: Process_1: continuously gets data (in json format) from a streaming api Process_2: is a daemon (similar to Sander Marechal's code ) which c...
TITLE: Share a resource between two processes QUESTION: I want to know the best practices followed to share a queue (resource) between two processes in Python. Here is a what each process is doing: Process_1: continuously gets data (in json format) from a streaming api Process_2: is a daemon (similar to Sander Marecha...
[ "python", "producer-consumer", "shared-resource" ]
3
6
4,877
1
0
2011-06-02T07:24:03.490000
2011-06-02T08:03:01.133000
6,211,663
6,211,720
PostgreSQL allocated column length
I have an issue where I have one column in a database that might be anything from 10 to 10,000 bytes in size. Do you know if PostgreSQL supports sparse data (i.e. will it always set aside the 10,000 bytes fore every entry in the column... or only the space that is required for each entry)?
Postgres will store long varlena types in an extended storage called TOAST. In the case of strings, it keep things inline up to 126 bytes (potentially means less 126 characters for multibyte stuff), and then sends it to the external storage. You can see where the data is stored using psql: \dt+ yourtable As an aside, n...
PostgreSQL allocated column length I have an issue where I have one column in a database that might be anything from 10 to 10,000 bytes in size. Do you know if PostgreSQL supports sparse data (i.e. will it always set aside the 10,000 bytes fore every entry in the column... or only the space that is required for each en...
TITLE: PostgreSQL allocated column length QUESTION: I have an issue where I have one column in a database that might be anything from 10 to 10,000 bytes in size. Do you know if PostgreSQL supports sparse data (i.e. will it always set aside the 10,000 bytes fore every entry in the column... or only the space that is re...
[ "database", "postgresql" ]
0
2
644
2
0
2011-06-02T07:24:55.790000
2011-06-02T07:32:08.360000
6,211,668
6,211,808
get array values in python
I have the values arr1 as 25,26 and arr2 values as A,B Its always that the number of values in arr1 and arr2 are equal My question is that for i in arr1.split(","): print i //prints 25 and 26 is it not possible to get the values of arr2 in the same loop or should another loop be written only for this purpose.Basically ...
You should be able to do this with python's enumerate function. This lets you loop through a list and get both its numerical index and its value: array1 = arr1.split(',') array2 = arr2.split(',') for i,value in enumerate(array1): print value, array2[i] This produces: 25 A 26 B
get array values in python I have the values arr1 as 25,26 and arr2 values as A,B Its always that the number of values in arr1 and arr2 are equal My question is that for i in arr1.split(","): print i //prints 25 and 26 is it not possible to get the values of arr2 in the same loop or should another loop be written only ...
TITLE: get array values in python QUESTION: I have the values arr1 as 25,26 and arr2 values as A,B Its always that the number of values in arr1 and arr2 are equal My question is that for i in arr1.split(","): print i //prints 25 and 26 is it not possible to get the values of arr2 in the same loop or should another loo...
[ "python" ]
6
5
28,990
5
0
2011-06-02T07:26:18.390000
2011-06-02T07:42:35.923000
6,211,670
6,211,986
grails and AJAX dynamic search
I want to organize search by users usernames. When I write some letters, I want to see list of users, which usernames start with that letters. After clicking one of values I have to update users data. Is there any easy plugin or other way to do it? I use grail-1.3.2.
You may want to catch the keypress event at the text box: after the user has type, says, 2 letters, use ajax/jQuery to send a request to the server. Then the server perform searching the database and return a list of approriate user. I once used jquery-ui plugin, and the result is satisfactory.
grails and AJAX dynamic search I want to organize search by users usernames. When I write some letters, I want to see list of users, which usernames start with that letters. After clicking one of values I have to update users data. Is there any easy plugin or other way to do it? I use grail-1.3.2.
TITLE: grails and AJAX dynamic search QUESTION: I want to organize search by users usernames. When I write some letters, I want to see list of users, which usernames start with that letters. After clicking one of values I have to update users data. Is there any easy plugin or other way to do it? I use grail-1.3.2. AN...
[ "ajax", "grails", "groovy" ]
0
2
1,690
4
0
2011-06-02T07:26:23.523000
2011-06-02T08:06:24.173000
6,211,676
6,211,734
Perl WWW-Mechanize Module
I am using www-mechanize module to access website controls. Some html pages contains frames. I cant get the links names and i am unable to access the links in frames. Please any one suggest right solution to resolve this issue. Working Platform: Windows, Perl Thanks in advance
From what I see, WWW::Mechanize does not load frames automatically; you need to do so yourself. You can get links to the frames with: @frames = $mech->find_link( 'tag' => 'frame' ); and then $mech->get each one (cloning your mech object if necessary).
Perl WWW-Mechanize Module I am using www-mechanize module to access website controls. Some html pages contains frames. I cant get the links names and i am unable to access the links in frames. Please any one suggest right solution to resolve this issue. Working Platform: Windows, Perl Thanks in advance
TITLE: Perl WWW-Mechanize Module QUESTION: I am using www-mechanize module to access website controls. Some html pages contains frames. I cant get the links names and i am unable to access the links in frames. Please any one suggest right solution to resolve this issue. Working Platform: Windows, Perl Thanks in advanc...
[ "perl", "www-mechanize" ]
1
9
342
1
0
2011-06-02T07:27:05.683000
2011-06-02T07:33:54.740000
6,211,680
6,260,107
AudioQueueEnqueueBuffer returns -50
I got a filled buffer from the recording queue, then I tried to enqueue it to a playing queue, the AudioQueueEnqueueBuffer returns -50. Then I Alloc a new AudioQueueBuffer and copy the recorded buffer's data to it, and enqueue the new buffer to the playing queue, it succeeded. Could you tell me why can't I enqueue a re...
Nobody answers...ok... AudioQueueAllocBuffer( queue, buffersize, & buffer ); When alloc a AudioQueueBuffer, you must specify a AudioQueue, that means the audio queue own the buffer allocated, you cannot enqueue the buffer in another queue...
AudioQueueEnqueueBuffer returns -50 I got a filled buffer from the recording queue, then I tried to enqueue it to a playing queue, the AudioQueueEnqueueBuffer returns -50. Then I Alloc a new AudioQueueBuffer and copy the recorded buffer's data to it, and enqueue the new buffer to the playing queue, it succeeded. Could ...
TITLE: AudioQueueEnqueueBuffer returns -50 QUESTION: I got a filled buffer from the recording queue, then I tried to enqueue it to a playing queue, the AudioQueueEnqueueBuffer returns -50. Then I Alloc a new AudioQueueBuffer and copy the recorded buffer's data to it, and enqueue the new buffer to the playing queue, it...
[ "ios", "audio-streaming" ]
0
0
424
1
0
2011-06-02T07:27:15.147000
2011-06-07T02:33:58.943000
6,211,684
6,211,760
Triggering a long process by a user in a website
I want to create a web page where users can initiate a process, this process will take several minutes to complete. My question is: When the user clicks on a button, should I start the process on a different thread and send him to a different page? I don't want the process to end in case he closes the window or the con...
You could spawn a thread that is going to do the work and periodically checks whether it should still continue with his work. For the work you generate a certain ID (that you may or not couple to the user for extra security) that will be used to distinguish the work job. On the redirected page you could use some javasc...
Triggering a long process by a user in a website I want to create a web page where users can initiate a process, this process will take several minutes to complete. My question is: When the user clicks on a button, should I start the process on a different thread and send him to a different page? I don't want the proce...
TITLE: Triggering a long process by a user in a website QUESTION: I want to create a web page where users can initiate a process, this process will take several minutes to complete. My question is: When the user clicks on a button, should I start the process on a different thread and send him to a different page? I do...
[ "c#", "asp.net", "multithreading" ]
3
0
99
2
0
2011-06-02T07:27:32.547000
2011-06-02T07:36:40.873000
6,211,695
6,211,717
How to remove null rows from sql query result?
I have a SQL query in which I am getting some records. Query is: select c.Id, c.FirstName, dbo.GetClientStaffContacts(c.Id, '27,31') as Staff from Client c order by c.Id Result is: I want only those rows that are not having null values in column Staff. Any help would be appreciated. Thank you.
select c.Id, c.FirstName, dbo.GetClientStaffContacts(c.Id, '27,31') as Staff from Client c where dbo.GetClientStaffContacts(c.Id, '27,31') is not null order by c.Id
How to remove null rows from sql query result? I have a SQL query in which I am getting some records. Query is: select c.Id, c.FirstName, dbo.GetClientStaffContacts(c.Id, '27,31') as Staff from Client c order by c.Id Result is: I want only those rows that are not having null values in column Staff. Any help would be ap...
TITLE: How to remove null rows from sql query result? QUESTION: I have a SQL query in which I am getting some records. Query is: select c.Id, c.FirstName, dbo.GetClientStaffContacts(c.Id, '27,31') as Staff from Client c order by c.Id Result is: I want only those rows that are not having null values in column Staff. An...
[ "sql-server-2008", "null" ]
9
18
47,136
1
0
2011-06-02T07:29:04.083000
2011-06-02T07:31:47.910000
6,211,700
6,211,890
Populating and passing complex object from MVC2 view to controller action
I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.StartHour.Hour.ToString("0,0")))%> <%= Html.DropDownList("drpStartTimem", new SelectList(Model.M...
MVC provides some automatic mapping on form values from the view back into the controller action. Usually you would use a strongly type view i.e. at the top of the page you will have something like Control Language="C#" Inherits="System.Web.Mvc.ViewPage The names of the dropdown lists need to match those of the propert...
Populating and passing complex object from MVC2 view to controller action I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.StartHour.Hour.ToStrin...
TITLE: Populating and passing complex object from MVC2 view to controller action QUESTION: I have following code in my MVC2 view: <%= Html.DropDownList("drpFields", new SelectList(Model.Fields, "FieldID", "NiceName", whiteout.FieldID)) %> <%= Html.DropDownList("drpStartTimeh", new SelectList(Model.Hours, whiteout.Star...
[ "asp.net-mvc-2", "entity-framework-4" ]
0
0
378
1
0
2011-06-02T07:29:34.740000
2011-06-02T07:53:49.670000
6,211,701
6,220,524
How To Change the field on focus in blackberry
Hello Sir I m making an app in which i got stuck in a problem please help me out... in one page i m getting the data from server and displaying that data on the page now i m use Focusable for highlighting them...now my requirement is that when focus come on any data the it should change the field taking that name on wh...
I think you should implement the logic in " onFoucus() " method,instead of using " onfieldChanged() " for CrDrLabels[i];
How To Change the field on focus in blackberry Hello Sir I m making an app in which i got stuck in a problem please help me out... in one page i m getting the data from server and displaying that data on the page now i m use Focusable for highlighting them...now my requirement is that when focus come on any data the it...
TITLE: How To Change the field on focus in blackberry QUESTION: Hello Sir I m making an app in which i got stuck in a problem please help me out... in one page i m getting the data from server and displaying that data on the page now i m use Focusable for highlighting them...now my requirement is that when focus come ...
[ "blackberry", "java-me" ]
0
1
858
1
0
2011-06-02T07:29:37.797000
2011-06-02T21:19:13.700000
6,211,702
6,211,888
How do I work with "image data as a byte string", using Python?
First I'm going to explain what I'm trying to do and then explain my problem. Okay so I've been making prototypes on a project that I hope to be working on over the summer. The project is a small media player and one of the requirements is to display the albulm artwork of an mp3 file. After some research I found this l...
Have you tried pygame.image.fromstring()? note: since it's raw data, you'll need to know in advance a few details such as the resolution and colour depth.
How do I work with "image data as a byte string", using Python? First I'm going to explain what I'm trying to do and then explain my problem. Okay so I've been making prototypes on a project that I hope to be working on over the summer. The project is a small media player and one of the requirements is to display the a...
TITLE: How do I work with "image data as a byte string", using Python? QUESTION: First I'm going to explain what I'm trying to do and then explain my problem. Okay so I've been making prototypes on a project that I hope to be working on over the summer. The project is a small media player and one of the requirements i...
[ "python", "image", "pygame", "byte" ]
2
1
1,110
1
0
2011-06-02T07:29:44.440000
2011-06-02T07:53:39.767000
6,211,712
6,212,426
ASP.NET Web Service Application in .net 4
I was going through the MSDN walkthrough on using client application services. http://msdn.microsoft.com/en-us/library/bb546195.aspx This is for.net 3.5..but i need to do it in.net 4. The thing is that it doesn't have any ASP.NET Web Service Applications listed. Has it introduced any replacement for that? Or is there a...
One of the way is to select target platform as.NET 3.5 in the drop-down at the top of New Project dialog - this will allow you to select "ASP.NET Web Service Application" project template. Once you select the template, you may change the target platform to.NET 4 using project properties. I believe that the main reason ...
ASP.NET Web Service Application in .net 4 I was going through the MSDN walkthrough on using client application services. http://msdn.microsoft.com/en-us/library/bb546195.aspx This is for.net 3.5..but i need to do it in.net 4. The thing is that it doesn't have any ASP.NET Web Service Applications listed. Has it introduc...
TITLE: ASP.NET Web Service Application in .net 4 QUESTION: I was going through the MSDN walkthrough on using client application services. http://msdn.microsoft.com/en-us/library/bb546195.aspx This is for.net 3.5..but i need to do it in.net 4. The thing is that it doesn't have any ASP.NET Web Service Applications liste...
[ "asp.net", "web-services", "visual-studio-2010", ".net-4.0" ]
5
4
3,623
2
0
2011-06-02T07:30:49.700000
2011-06-02T09:00:23.700000
6,211,713
6,211,794
Does pthread_once_t variable need a mutex?
we use One-Time initialization for pthreads like this: /* define a statically initialized pthread_once_t variable */ pthread_once_t once_var = PTHREAD_ONCE_INIT; /* we call pthread_once function in threads */ int pthread_once(pthread_once_t *once_control, void (*init)(void)); when more than one thread is going to chan...
No, you don't need a mutex for this. The pthread_once call ( link here ) is guaranteed to be executed once and once only, even if multiple threads try it at the same time. It's the once_var that's protecting the call from being executed more than once. It will work as expected, provided that you: initialise the once_va...
Does pthread_once_t variable need a mutex? we use One-Time initialization for pthreads like this: /* define a statically initialized pthread_once_t variable */ pthread_once_t once_var = PTHREAD_ONCE_INIT; /* we call pthread_once function in threads */ int pthread_once(pthread_once_t *once_control, void (*init)(void));...
TITLE: Does pthread_once_t variable need a mutex? QUESTION: we use One-Time initialization for pthreads like this: /* define a statically initialized pthread_once_t variable */ pthread_once_t once_var = PTHREAD_ONCE_INIT; /* we call pthread_once function in threads */ int pthread_once(pthread_once_t *once_control, vo...
[ "c", "pthreads", "mutex" ]
3
8
1,298
3
0
2011-06-02T07:31:19.483000
2011-06-02T07:41:18.940000
6,211,714
6,211,790
Converting a String to ASCII format and then to HEX format
I have to convert a normal string array with the value {"STX","ETX"} into hex value and I should get {2,3} according to http://www.asciitable.com/.
It sounds like you want a Map such as: Map map = new HashMap (); map.put("STX", '\u0002'); map.put("ETX", '\u0003'); // etc I don't believe there's any such map built into the Java standard libraries. Converting the Char into a hex string is then a separate step. There are lots of options there, partly depending on whi...
Converting a String to ASCII format and then to HEX format I have to convert a normal string array with the value {"STX","ETX"} into hex value and I should get {2,3} according to http://www.asciitable.com/.
TITLE: Converting a String to ASCII format and then to HEX format QUESTION: I have to convert a normal string array with the value {"STX","ETX"} into hex value and I should get {2,3} according to http://www.asciitable.com/. ANSWER: It sounds like you want a Map such as: Map map = new HashMap (); map.put("STX", '\u000...
[ "java", "ascii", "hex" ]
2
2
1,967
1
0
2011-06-02T07:31:19.373000
2011-06-02T07:40:51.727000
6,211,723
6,211,817
Why HTTP was designed to be a pull protocol?
I was watching many presentations about Html 5 WebSockets, where server can initialize connection with client and push the data without the request from the client. We don't need Polling etc. And, I am curious, why Http was designed as a "pull" and not full duplex protocol in the first place? What where the reasons beh...
Because when http was first designed it was meant to be used to retrieve documents from a server. And the easiest way to do is when the client asks the server for a document and gets it delivered as response (or an error in case it does not exist). When you have push protocol that means the server would need to keep cl...
Why HTTP was designed to be a pull protocol? I was watching many presentations about Html 5 WebSockets, where server can initialize connection with client and push the data without the request from the client. We don't need Polling etc. And, I am curious, why Http was designed as a "pull" and not full duplex protocol i...
TITLE: Why HTTP was designed to be a pull protocol? QUESTION: I was watching many presentations about Html 5 WebSockets, where server can initialize connection with client and push the data without the request from the client. We don't need Polling etc. And, I am curious, why Http was designed as a "pull" and not full...
[ "http", "html" ]
4
10
4,044
3
0
2011-06-02T07:32:13.230000
2011-06-02T07:43:54.760000
6,211,728
6,211,964
Sending data from Android
I want to sent the data from an Android device to PHP. I have tried but where I am wrong I don't know. How do I correct this? This is the Android code that I have done. public class php_connect extends Activity { InputStream is; @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceSta...
From the PHP manual: In case of POST requests, it preferrable to $HTTP_RAW_POST_DATA as it does not depend on special php.ini directives. Moreover, for those cases where $HTTP_RAW_POST_DATA is not populated by default, it is a potentially less memory intensive alternative to activating always_populate_raw_post_data. ph...
Sending data from Android I want to sent the data from an Android device to PHP. I have tried but where I am wrong I don't know. How do I correct this? This is the Android code that I have done. public class php_connect extends Activity { InputStream is; @Override public void onCreate(Bundle savedInstanceState) { super...
TITLE: Sending data from Android QUESTION: I want to sent the data from an Android device to PHP. I have tried but where I am wrong I don't know. How do I correct this? This is the Android code that I have done. public class php_connect extends Activity { InputStream is; @Override public void onCreate(Bundle savedInst...
[ "java", "php", "android" ]
0
1
905
1
0
2011-06-02T07:32:57.500000
2011-06-02T08:03:22.270000
6,211,732
6,234,365
$content fields missing in node.tpl.php for teaser (Drupal 7)
In node.tpl.php I've got. When viewing the node as a full page, it prints this: Array ( [0] => links [1] => body [2] => field_address [3] => field_rating [4] => field_picture ) And when viewing the node as a teaser on the front page it prints this: Array ( [0] => links [1] => body ) How can I get field_rating and field...
You can turn fields on and off for the teaser in the following admin page: Administration > Structure > Content Types > Manage Display > Teaser (Tab)
$content fields missing in node.tpl.php for teaser (Drupal 7) In node.tpl.php I've got. When viewing the node as a full page, it prints this: Array ( [0] => links [1] => body [2] => field_address [3] => field_rating [4] => field_picture ) And when viewing the node as a teaser on the front page it prints this: Array ( [...
TITLE: $content fields missing in node.tpl.php for teaser (Drupal 7) QUESTION: In node.tpl.php I've got. When viewing the node as a full page, it prints this: Array ( [0] => links [1] => body [2] => field_address [3] => field_rating [4] => field_picture ) And when viewing the node as a teaser on the front page it prin...
[ "drupal", "drupal-7" ]
1
3
1,124
1
0
2011-06-02T07:33:27.093000
2011-06-04T02:42:59.387000
6,211,733
6,211,853
error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject'
I will specify the reason for my error. Please rectify my error: CODE private: CStringArray m_strMnemonicArray; public: CStringArray getMnemonicSet(); CStringArray CParserDlg::getMnemonicSet() { return m_strMnemonicArray; }
I have automated several tasks into a function shown below: CStringArray CParserDlg::getMnemonicSet(); return the CStringArray by reference, not value. CStringArray& CParserDlg::getMnemonicSet(); Not only would this get rid of the compiler error, it is also a rule of thumb in C++ to pass objects such as CStringArray by...
error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' I will specify the reason for my error. Please rectify my error: CODE private: CStringArray m_strMnemonicArray; public: CStringArray getMnemonicSet(); CStringArray CParserDlg::getMnemonicSet() { return m_strMnemonicArray; }
TITLE: error C2248: 'CObject::CObject' : cannot access private member declared in class 'CObject' QUESTION: I will specify the reason for my error. Please rectify my error: CODE private: CStringArray m_strMnemonicArray; public: CStringArray getMnemonicSet(); CStringArray CParserDlg::getMnemonicSet() { return m_strMne...
[ "visual-c++", "mfc" ]
0
0
3,929
1
0
2011-06-02T07:33:50.130000
2011-06-02T07:48:04.180000
6,211,748
6,211,772
Java Special Character Handling
I need to send a string to server. That string is having some special characters. Example, String abc = "ABC Farmacéutica Corporation"; When I am sending it, It is converted into, ABC Farmace@utica Corporation. I Tried using UTF-8 encoding. it is giving output as ABC+Farmac%C3%A9utica+Corporation please suggest me how ...
It entirely depends on how the server is set up to receive the string in the first place. Your second example is applying URL-encoding using UTF-8 where required, by the look of things. That might be appropriate - or it might not. If the data is within XML, for example, you shouldn't need to do anything special - whate...
Java Special Character Handling I need to send a string to server. That string is having some special characters. Example, String abc = "ABC Farmacéutica Corporation"; When I am sending it, It is converted into, ABC Farmace@utica Corporation. I Tried using UTF-8 encoding. it is giving output as ABC+Farmac%C3%A9utica+Co...
TITLE: Java Special Character Handling QUESTION: I need to send a string to server. That string is having some special characters. Example, String abc = "ABC Farmacéutica Corporation"; When I am sending it, It is converted into, ABC Farmace@utica Corporation. I Tried using UTF-8 encoding. it is giving output as ABC+Fa...
[ "java", "encoding", "special-characters" ]
1
1
2,466
1
0
2011-06-02T07:35:36.330000
2011-06-02T07:38:22.350000
6,211,749
6,215,294
Force an applyBinding in knockout.js
I'm using knockout to bind a dom-element to a view-model and everything works great the first time a view-model is applied to the dom-element. Later on a very similar view-model is applied to the same dom-element but the bindings won't update - probably because knockout believes it is the same view-model as before. Is ...
The most common approach is to use the template binding. It would look something like: var viewModel = { myData: ko.observable(), } Now, you can set myData to your new view model like: viewModel.myData(newData) and the template binding will handle re-rendering your content based on the new data. Otherwise, you can do s...
Force an applyBinding in knockout.js I'm using knockout to bind a dom-element to a view-model and everything works great the first time a view-model is applied to the dom-element. Later on a very similar view-model is applied to the same dom-element but the bindings won't update - probably because knockout believes it ...
TITLE: Force an applyBinding in knockout.js QUESTION: I'm using knockout to bind a dom-element to a view-model and everything works great the first time a view-model is applied to the dom-element. Later on a very similar view-model is applied to the same dom-element but the bindings won't update - probably because kno...
[ "javascript", "data-binding", "mvvm", "knockout.js" ]
1
4
3,495
1
0
2011-06-02T07:35:36.403000
2011-06-02T13:38:02.747000
6,211,758
6,212,124
Removal of 30-40 millions record without affecting performance
I have a SQL Server database running in Full recovery. I need to remove data (around 30-40 million records) but I cannot take the database offline as it's in constant use. I also cannot switch it to Simple recovery mode incase anything happens and we lose live data. When I try to remove the data in small chunks (around...
You have to use small chunks otherwise your transaction log will increases Every one one of 30-40 million deletes will be logged. If you create a new table and copy "to keep" rows you'll still have 50+ million logged rows. The fact of simple vs full recovery doesn't matter: each delete/insert is logged If the log incre...
Removal of 30-40 millions record without affecting performance I have a SQL Server database running in Full recovery. I need to remove data (around 30-40 million records) but I cannot take the database offline as it's in constant use. I also cannot switch it to Simple recovery mode incase anything happens and we lose l...
TITLE: Removal of 30-40 millions record without affecting performance QUESTION: I have a SQL Server database running in Full recovery. I need to remove data (around 30-40 million records) but I cannot take the database offline as it's in constant use. I also cannot switch it to Simple recovery mode incase anything hap...
[ "sql-server-2008", "large-data-volumes" ]
3
3
3,119
2
0
2011-06-02T07:36:34.447000
2011-06-02T08:25:20.760000
6,211,759
6,212,011
SQL - insert and limit the number of entries
I have a table that represents a user's entries: User_ID | Entry_ID Now I want to store only the last 20 entries (for example). What would be the best way to insert new entries while keeping the maximum number of entries per user at 20 (new entries will replace oldest entries)? I need to be able to insert also a list o...
Sounds like a job for a trigger... Add a statement-level after insert trigger, which deletes rows like: delete from yourtbl where yourid not in ( select yourid from yourtbl order by yourid desc limit 20 )
SQL - insert and limit the number of entries I have a table that represents a user's entries: User_ID | Entry_ID Now I want to store only the last 20 entries (for example). What would be the best way to insert new entries while keeping the maximum number of entries per user at 20 (new entries will replace oldest entrie...
TITLE: SQL - insert and limit the number of entries QUESTION: I have a table that represents a user's entries: User_ID | Entry_ID Now I want to store only the last 20 entries (for example). What would be the best way to insert new entries while keeping the maximum number of entries per user at 20 (new entries will rep...
[ "sql", "sqlite", "database-design", "insert" ]
0
4
1,251
1
0
2011-06-02T07:36:38.877000
2011-06-02T08:09:22.940000
6,211,763
6,222,490
What is the tech behind AdventureWorks installer?
Does the AdentureWorks installer use widely publicised installer techniques, such as a CustomAction, or does it use something more esoteric? What is it using?
It's a self extracting zip that exposes a custom DatabaseInstaller.exe. This EXE is a.NET 3.0 XAML/WPF application. You can look at it using Reflector to see the Microsoft.SqlServer.DatabaseInstaller namespace. To me, it's custom junk and just another example of different groups at Microsoft just doing whatever they pl...
What is the tech behind AdventureWorks installer? Does the AdentureWorks installer use widely publicised installer techniques, such as a CustomAction, or does it use something more esoteric? What is it using?
TITLE: What is the tech behind AdventureWorks installer? QUESTION: Does the AdentureWorks installer use widely publicised installer techniques, such as a CustomAction, or does it use something more esoteric? What is it using? ANSWER: It's a self extracting zip that exposes a custom DatabaseInstaller.exe. This EXE is ...
[ "database", "deployment", "installation", "installshield" ]
1
1
99
1
0
2011-06-02T07:36:56.333000
2011-06-03T02:48:52.670000
6,211,777
6,211,822
Why is the Array undefined?
When I alert my array "markerArray" outside the geocoder-function it says it's undefined. Can't figure out why? Is there a way to get the values from the array outside the function? var markerArray = new Array(); for(var i in opts.markers) { address = opts.markers[i].address; //alert(opts.markers[i].icon); var geocoder...
I suspect it's not markerArray that it's complaining about, but markerArray[0] that's undefined. You're calling an asynchronous API using functions you create in a loop. Those functions are closures. They each have an enduring reference to the i variable, not a copy of the value as it was when the function was defined....
Why is the Array undefined? When I alert my array "markerArray" outside the geocoder-function it says it's undefined. Can't figure out why? Is there a way to get the values from the array outside the function? var markerArray = new Array(); for(var i in opts.markers) { address = opts.markers[i].address; //alert(opts.ma...
TITLE: Why is the Array undefined? QUESTION: When I alert my array "markerArray" outside the geocoder-function it says it's undefined. Can't figure out why? Is there a way to get the values from the array outside the function? var markerArray = new Array(); for(var i in opts.markers) { address = opts.markers[i].addres...
[ "javascript", "function", "google-maps", "callback" ]
0
7
344
1
0
2011-06-02T07:39:04.893000
2011-06-02T07:44:32.560000
6,211,778
6,212,066
Problem with list-style-type: none; in FireFox
For example, in that html code I add list-style-type: none; in external test.css. When FireFox loads that page, the dots (list-style-type without none) could be seen for about a second. Only inline css works TODO write content Test1 Test2 Test3 ScreenShot
I have just tried it on both Windows and Mac in Firefox, and both worked fine for me. Apparently, this Flash Of Unstyled Content (FOUC) doesn't happen on everyone's browser. If you insist fixing this, you might think about using some workarounds, such as placing the in body, using @import to import your css, or google ...
Problem with list-style-type: none; in FireFox For example, in that html code I add list-style-type: none; in external test.css. When FireFox loads that page, the dots (list-style-type without none) could be seen for about a second. Only inline css works TODO write content Test1 Test2 Test3 ScreenShot
TITLE: Problem with list-style-type: none; in FireFox QUESTION: For example, in that html code I add list-style-type: none; in external test.css. When FireFox loads that page, the dots (list-style-type without none) could be seen for about a second. Only inline css works TODO write content Test1 Test2 Test3 ScreenShot...
[ "css" ]
1
3
7,966
2
0
2011-06-02T07:39:13.603000
2011-06-02T08:16:11.007000
6,211,787
6,215,244
how can I use the event parameter when the code is written inline in the mxml tag in flex
What is the difference between: giving a function reference in the result attribute of the HTTPService class like this: protected function httpserviceCheckUpdate_resultHandler(event:ResultEvent):void { var version:Number = event.result.text.version as Number; var xmldata:XML = XML(event.result); // and all the processi...
Using the tag is not a standard way of doing things. You can use tags for any events using MXML. It's made for quick prototyping but not code cleanliness. They're not exactly the same since the latter is an anonymous function with no parameters, however you can access the result using the httpserviceCheckUpdate.lastRes...
how can I use the event parameter when the code is written inline in the mxml tag in flex What is the difference between: giving a function reference in the result attribute of the HTTPService class like this: protected function httpserviceCheckUpdate_resultHandler(event:ResultEvent):void { var version:Number = event.r...
TITLE: how can I use the event parameter when the code is written inline in the mxml tag in flex QUESTION: What is the difference between: giving a function reference in the result attribute of the HTTPService class like this: protected function httpserviceCheckUpdate_resultHandler(event:ResultEvent):void { var versio...
[ "apache-flex", "mxml" ]
0
1
138
2
0
2011-06-02T07:40:15.350000
2011-06-02T13:33:58.783000
6,211,792
6,212,237
how to show a loading page for some n seconds
I want to show some loading content for some seconds then I want to show the first page, loading page content some thing lik Loading..
Ok, I'll guess... $.mobile.pageLoading(); //when it's loaded $.mobile.pageLoading( true ); http://jquerymobile.com/demos/1.0a4.1/#docs/api/methods.html
how to show a loading page for some n seconds I want to show some loading content for some seconds then I want to show the first page, loading page content some thing lik Loading..
TITLE: how to show a loading page for some n seconds QUESTION: I want to show some loading content for some seconds then I want to show the first page, loading page content some thing lik Loading.. ANSWER: Ok, I'll guess... $.mobile.pageLoading(); //when it's loaded $.mobile.pageLoading( true ); http://jquerymobile....
[ "jquery-mobile" ]
0
2
132
1
0
2011-06-02T07:41:10.003000
2011-06-02T08:38:07.697000
6,211,793
6,211,814
Retrieve characters from a string
What is the best way to get a list of characters [a-z] from a string ignoring any other special character or number?
You could use a regular expression: String lettersOnly = original.replaceAll("[^a-z]", ""); or String lettersOnly = original.replaceAll("[^a-zA-Z]", ""); While you can use Unicode groups too, I personally find it easier to recognise and understand a simple set such as a-z or a-zA-Z - it means I don't need to look up wh...
Retrieve characters from a string What is the best way to get a list of characters [a-z] from a string ignoring any other special character or number?
TITLE: Retrieve characters from a string QUESTION: What is the best way to get a list of characters [a-z] from a string ignoring any other special character or number? ANSWER: You could use a regular expression: String lettersOnly = original.replaceAll("[^a-z]", ""); or String lettersOnly = original.replaceAll("[^a-z...
[ "java" ]
2
7
368
2
0
2011-06-02T07:41:13.993000
2011-06-02T07:43:30.463000
6,211,799
6,212,083
Issue with detecting file moves using inotify.
I wanted to use inotify to monitor contents of a directory. Everything seems fine until I try to rename a file in the directory using mv command. I get IN_MOVED_FROM as expected but IN_MOVED_TO doesn't come. Below is my test program. Compile with: g++ -Wall -o test test.cpp Launch with:./test dir_to_watch #include #inc...
Self solved: it turns out that inotify can return multiple events in a single read() call. So the corrected source code looks like this: #include #include #include #include #include #include #include int main (int argc, char *argv[]) { int inotify_fd = inotify_init(); if (inotify_fd < 0) { fprintf(stderr, "Unable to i...
Issue with detecting file moves using inotify. I wanted to use inotify to monitor contents of a directory. Everything seems fine until I try to rename a file in the directory using mv command. I get IN_MOVED_FROM as expected but IN_MOVED_TO doesn't come. Below is my test program. Compile with: g++ -Wall -o test test.cp...
TITLE: Issue with detecting file moves using inotify. QUESTION: I wanted to use inotify to monitor contents of a directory. Everything seems fine until I try to rename a file in the directory using mv command. I get IN_MOVED_FROM as expected but IN_MOVED_TO doesn't come. Below is my test program. Compile with: g++ -Wa...
[ "linux", "inotify" ]
2
7
4,414
1
0
2011-06-02T07:41:38.750000
2011-06-02T08:18:40.057000
6,211,801
6,211,983
Problem in Punjabi font in the application?
I am developing an application in which i want Punjabi language text in my application. Therefore i save (AnmolUni.ttf)font file in the assets folder in my application. But still i didn't get the proper view. The emulator shows me boxes somewhere. here is my code Typeface myfont; myfont=Typeface.createFromAsset(getAsse...
A lot of languages (especially Indian ones) are not supported as yet on Android. The problem arises because of that. You might just have to wait for the release that does support. There are some threads on the web that allow you install fonts once you have rooted your phone, but you may not be able to do that with your...
Problem in Punjabi font in the application? I am developing an application in which i want Punjabi language text in my application. Therefore i save (AnmolUni.ttf)font file in the assets folder in my application. But still i didn't get the proper view. The emulator shows me boxes somewhere. here is my code Typeface myf...
TITLE: Problem in Punjabi font in the application? QUESTION: I am developing an application in which i want Punjabi language text in my application. Therefore i save (AnmolUni.ttf)font file in the assets folder in my application. But still i didn't get the proper view. The emulator shows me boxes somewhere. here is my...
[ "android", "text" ]
1
1
695
1
0
2011-06-02T07:41:51.933000
2011-06-02T08:05:49.563000
6,211,804
6,212,022
Rails 3, using mongoid but syntax error gets produced
In my development environment, which is windows 7, Ruby1.9.2p180, everything works fine. However, in production environment, which is Ubuntu 10.04, Ree 1.8.7 using rvm, following error gets produced. (I am using passenger-apache-module to run the application.) /home/randomapp/public_html/app/models/article.rb:14: synta...
You are using the 1.9.2 hash syntax. If you want to run on both 1.9.2 and 1.8.7 then try this: field:user_id,:type => Hash field:username,:type => String field:title,:type => String field:content,:type => String field:display_content,:type => String
Rails 3, using mongoid but syntax error gets produced In my development environment, which is windows 7, Ruby1.9.2p180, everything works fine. However, in production environment, which is Ubuntu 10.04, Ree 1.8.7 using rvm, following error gets produced. (I am using passenger-apache-module to run the application.) /home...
TITLE: Rails 3, using mongoid but syntax error gets produced QUESTION: In my development environment, which is windows 7, Ruby1.9.2p180, everything works fine. However, in production environment, which is Ubuntu 10.04, Ree 1.8.7 using rvm, following error gets produced. (I am using passenger-apache-module to run the a...
[ "ruby-on-rails", "apache2", "passenger", "mongoid" ]
2
8
545
1
0
2011-06-02T07:42:27.890000
2011-06-02T08:11:25.893000
6,211,805
6,211,872
Point in rectangle
What is the fastest way to find if a point is in a rectangle given in this form: I have two points which are the centers of opposite sides of the rectangle, and a number which is the height of those sides. I hope this is clear. The rectangle is (probably) not aligned with the axis. I am wondering if there may be a fast...
Not entirely sure it's the fastest, but this would likely work: Rather than placing D half in between the two centers, project C as D along the AB axis. Then check that a) D is between A and B and b) CD is less or equal to half of the rectangle's height. Re your idea of using the angles... using Pythagorus and or Al Ka...
Point in rectangle What is the fastest way to find if a point is in a rectangle given in this form: I have two points which are the centers of opposite sides of the rectangle, and a number which is the height of those sides. I hope this is clear. The rectangle is (probably) not aligned with the axis. I am wondering if ...
TITLE: Point in rectangle QUESTION: What is the fastest way to find if a point is in a rectangle given in this form: I have two points which are the centers of opposite sides of the rectangle, and a number which is the height of those sides. I hope this is clear. The rectangle is (probably) not aligned with the axis. ...
[ "algorithm", "point-in-polygon" ]
4
1
2,475
5
0
2011-06-02T07:42:29.230000
2011-06-02T07:50:56.937000