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,263,690
6,264,041
First letter is number in string
I was trying to find a quick and easy method to check if the first letter in a string is a number. A lot of the functions and methods I've seen on S.O seem over complicated. I'm wondering, would something like this work: is_numeric($string[0]);
An easier way might be: is_numeric(substr($string, 0, 1)) It tackles the problem of a possible empty string (that has no first character) by using substr(). substr() returns false in the case of an empty string, and false is not recognized as a number by is_numeric().
First letter is number in string I was trying to find a quick and easy method to check if the first letter in a string is a number. A lot of the functions and methods I've seen on S.O seem over complicated. I'm wondering, would something like this work: is_numeric($string[0]);
TITLE: First letter is number in string QUESTION: I was trying to find a quick and easy method to check if the first letter in a string is a number. A lot of the functions and methods I've seen on S.O seem over complicated. I'm wondering, would something like this work: is_numeric($string[0]); ANSWER: An easier way m...
[ "php" ]
16
27
20,709
5
0
2011-06-07T10:08:21.293000
2011-06-07T10:42:06.600000
6,263,693
6,263,782
ASPxGridView and LinqServerModeDataSource, inserting rows by stored procedure
I have a page using ASPxGridView and to fill the GridView I use a LinqServerModeDataSource control who fetches it data through a SQL View from a MS SQL Server. So far so good but here comes the problem. I want to insert data in the database so I'm building a custom form Company Name: Company Mail: Here is an example of...
"I want to insert data in the database so I'm building a custom form" ASPxGridView can do all that for you without you having to make a custom template at least with sqldb If i would define a delete command and or edit command below to the sqldatasource i could already delete and edit the information in the gridview Bu...
ASPxGridView and LinqServerModeDataSource, inserting rows by stored procedure I have a page using ASPxGridView and to fill the GridView I use a LinqServerModeDataSource control who fetches it data through a SQL View from a MS SQL Server. So far so good but here comes the problem. I want to insert data in the database s...
TITLE: ASPxGridView and LinqServerModeDataSource, inserting rows by stored procedure QUESTION: I have a page using ASPxGridView and to fill the GridView I use a LinqServerModeDataSource control who fetches it data through a SQL View from a MS SQL Server. So far so good but here comes the problem. I want to insert data...
[ "devexpress", "aspxgridview" ]
0
1
2,876
1
0
2011-06-07T10:08:31.217000
2011-06-07T10:17:06.470000
6,263,696
6,264,454
Zend how to use cache component
Let's say you have this scenario:a simple blog home-page that loads both static content as well as dynamic content. The static content is composed of images that rarely changes.I also have database-driven,dynamic content.The dynamic content consists in all of your blog posts (text and image) and related users comments....
So the basic usage of cache is shown by @mingos. He talks about generic cache, which is good. However, ZF has few different cache mechanisms that you can use for different things. You don't need to limit yourself for one type of cache. You can use a mixture of them. For example, for caching your static content Zend_Cac...
Zend how to use cache component Let's say you have this scenario:a simple blog home-page that loads both static content as well as dynamic content. The static content is composed of images that rarely changes.I also have database-driven,dynamic content.The dynamic content consists in all of your blog posts (text and im...
TITLE: Zend how to use cache component QUESTION: Let's say you have this scenario:a simple blog home-page that loads both static content as well as dynamic content. The static content is composed of images that rarely changes.I also have database-driven,dynamic content.The dynamic content consists in all of your blog ...
[ "php", "zend-framework", "cache-control" ]
3
4
9,033
4
0
2011-06-07T10:08:35.850000
2011-06-07T11:23:26.933000
6,263,697
6,263,774
textbox is not validated as empty if text is entered and then deleted
i have an annoying issue with watermarked text for a textbox. what i want is if user click away of the textbox and there is no text in the textbox than the default text should appear (e.g. Search...) i have this function to check it: document.getElementById("searchtextbox").onblur = function() { if (document.getElemen...
As bazmegakapa suggested, consider the placeholder attribute. To answer your question, your code isn't working because you're using setAttribute, while the user just modified the property value. Instead of using setAttribute, try using.value = 'Search...'
textbox is not validated as empty if text is entered and then deleted i have an annoying issue with watermarked text for a textbox. what i want is if user click away of the textbox and there is no text in the textbox than the default text should appear (e.g. Search...) i have this function to check it: document.getElem...
TITLE: textbox is not validated as empty if text is entered and then deleted QUESTION: i have an annoying issue with watermarked text for a textbox. what i want is if user click away of the textbox and there is no text in the textbox than the default text should appear (e.g. Search...) i have this function to check it...
[ "javascript", "html", "forms", "placeholder" ]
1
2
976
2
0
2011-06-07T10:08:48.497000
2011-06-07T10:16:16.170000
6,263,711
6,264,437
Silverlight datagrid elapsed time cell
In my silverlight application I use a data grid. I have a column with session started time and a column with elapsed time. The elapsed time is "total minutes: seconds". In my model I have a property ElapsedTimeDisplay that compute and transform the elapsed time into a string. How can update that each second? Is there a...
This depends on your setup, it could be as easy as adding a timer in your ViewModel (or maybe your model) that ticks every second, and raise the PropertyChanged event on the ElapsedTimeDisplay (which I suppose does the calculation in the getter). To do this, you need to have your ViewModel (or model) implement INotifyP...
Silverlight datagrid elapsed time cell In my silverlight application I use a data grid. I have a column with session started time and a column with elapsed time. The elapsed time is "total minutes: seconds". In my model I have a property ElapsedTimeDisplay that compute and transform the elapsed time into a string. How ...
TITLE: Silverlight datagrid elapsed time cell QUESTION: In my silverlight application I use a data grid. I have a column with session started time and a column with elapsed time. The elapsed time is "total minutes: seconds". In my model I have a property ElapsedTimeDisplay that compute and transform the elapsed time i...
[ "silverlight", "datagrid" ]
0
0
92
1
0
2011-06-07T10:10:01.243000
2011-06-07T11:21:20.030000
6,263,714
6,264,118
JSF: rendered attribute
I have a panelGroup with a rendered attribute. Why is it that the component values in the panelGroup are even called if the rendered attribute is set to false? Do I missunderstand the rendered attribute here? What I want to do is: I have a selectManyCheckbox before the panelGroup and everything in the panelGroup should...
The rendered attribute simply states if the following component should be rendered on the client side DOM. These components will still follow the JSF lifecycle events and will maintain the value of a managed bean. EDIT: In response to a request for a workaround: The simplest way I can see to workaround this, if you do ...
JSF: rendered attribute I have a panelGroup with a rendered attribute. Why is it that the component values in the panelGroup are even called if the rendered attribute is set to false? Do I missunderstand the rendered attribute here? What I want to do is: I have a selectManyCheckbox before the panelGroup and everything ...
TITLE: JSF: rendered attribute QUESTION: I have a panelGroup with a rendered attribute. Why is it that the component values in the panelGroup are even called if the rendered attribute is set to false? Do I missunderstand the rendered attribute here? What I want to do is: I have a selectManyCheckbox before the panelGro...
[ "jsf" ]
6
8
27,667
1
0
2011-06-07T10:10:35.583000
2011-06-07T10:49:56.377000
6,263,715
6,270,936
Test protected methods of ZF controllers with PHPUnit
I want to test a protected method which is inside a controller: class AuthenticateController extends Zend_Controller_Action { protected function getAuthAdapter(){} } My test (following this post) look like this: public function testGetAuthAdapterShouldReturnZendAuthAdapterDbTable() { require_once(APPLICATION_PATH.'/con...
You need to pass in a request and response to the controller's constructor. $class = new AuthenticateController( new Zend_Controller_Request_HttpTestCase(), new Zend_Controller_Response_HttpTestCase() );
Test protected methods of ZF controllers with PHPUnit I want to test a protected method which is inside a controller: class AuthenticateController extends Zend_Controller_Action { protected function getAuthAdapter(){} } My test (following this post) look like this: public function testGetAuthAdapterShouldReturnZendAuth...
TITLE: Test protected methods of ZF controllers with PHPUnit QUESTION: I want to test a protected method which is inside a controller: class AuthenticateController extends Zend_Controller_Action { protected function getAuthAdapter(){} } My test (following this post) look like this: public function testGetAuthAdapterSh...
[ "zend-framework", "reflection", "phpunit", "controllers" ]
1
0
655
1
0
2011-06-07T10:10:39.110000
2011-06-07T20:01:43.937000
6,263,722
6,263,755
Android apk file Installation error
Possible Duplicate: Problem installing my Android apps Any body can tell me how can I solve this error. Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED It generates when I am trying to install apk file into emulator or mobile. Thank You.
check this, http://groups.google.com/group/android-beginners/browse_thread/thread/d7e87b5aaed14d54/0a384df6ea35f367?lnk=gst&q=Mark+Murphy
Android apk file Installation error Possible Duplicate: Problem installing my Android apps Any body can tell me how can I solve this error. Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED It generates when I am trying to install apk file into emulator or mobile. Thank You.
TITLE: Android apk file Installation error QUESTION: Possible Duplicate: Problem installing my Android apps Any body can tell me how can I solve this error. Installation error: INSTALL_PARSE_FAILED_MANIFEST_MALFORMED It generates when I am trying to install apk file into emulator or mobile. Thank You. ANSWER: check t...
[ "android", "android-emulator", "android-sdk-2.1" ]
1
0
924
1
0
2011-06-07T10:11:04.877000
2011-06-07T10:14:33.447000
6,263,725
6,263,825
Need help with PHP array
Can anybody help me out, I'm stuck, don't know how to write a php nested for loop to convert into a key value array. This is the array structure. Needed to turn into key value array( combining JobDescription and userdetail array together) array(2) { ["jobDescription"]=> array(5) { ["funeralFor"]=> string(6) "Myself" ["...
You have two arrays stored in an array. You want the values of both arrays under one array instead of two subarrays? $newArray = array_merge($array['jobDescription'], $array['userDetail']);
Need help with PHP array Can anybody help me out, I'm stuck, don't know how to write a php nested for loop to convert into a key value array. This is the array structure. Needed to turn into key value array( combining JobDescription and userdetail array together) array(2) { ["jobDescription"]=> array(5) { ["funeralFor"...
TITLE: Need help with PHP array QUESTION: Can anybody help me out, I'm stuck, don't know how to write a php nested for loop to convert into a key value array. This is the array structure. Needed to turn into key value array( combining JobDescription and userdetail array together) array(2) { ["jobDescription"]=> array(...
[ "php" ]
0
4
129
5
0
2011-06-07T10:11:15.630000
2011-06-07T10:21:30.633000
6,263,729
6,263,805
MongoDB - file size is huge and growing
I have an application that use mongo for storing short living data. All data older than 45 minutes is removed by script something like: oldSearches = [list of old searches] connection = Connection() db = connection.searchDB res = db.results.remove{'search_id':{"$in":oldSearches}}) I've checked current status - >db.resu...
Virtual memory size and resident size will appear to be very large for the mongod process. This is benign: virtual memory space will be just larger than the size of the datafiles open and mapped; resident size will vary depending on the amount of memory not used by other processes on the machine. http://www.mongodb.org...
MongoDB - file size is huge and growing I have an application that use mongo for storing short living data. All data older than 45 minutes is removed by script something like: oldSearches = [list of old searches] connection = Connection() db = connection.searchDB res = db.results.remove{'search_id':{"$in":oldSearches}}...
TITLE: MongoDB - file size is huge and growing QUESTION: I have an application that use mongo for storing short living data. All data older than 45 minutes is removed by script something like: oldSearches = [list of old searches] connection = Connection() db = connection.searchDB res = db.results.remove{'search_id':{"...
[ "mongodb" ]
19
31
36,669
1
0
2011-06-07T10:11:29.213000
2011-06-07T10:19:45.723000
6,263,762
6,263,878
Generate sequence diagram using C#
Hello is there any tool/api available to generate a customize sequence diagram based on certain user input?
One way to attack this would be to use Visio (if your licensing scheme is compatible): Here is a codeplex project that is supposed to make this easier from.NET (I haven't used it): http://visioautomation.codeplex.com/ Another way to do this would be to just write some WPF code. I think that there are a number of open s...
Generate sequence diagram using C# Hello is there any tool/api available to generate a customize sequence diagram based on certain user input?
TITLE: Generate sequence diagram using C# QUESTION: Hello is there any tool/api available to generate a customize sequence diagram based on certain user input? ANSWER: One way to attack this would be to use Visio (if your licensing scheme is compatible): Here is a codeplex project that is supposed to make this easier...
[ "c#", ".net" ]
0
1
2,156
2
0
2011-06-07T10:15:01.647000
2011-06-07T10:25:46.287000
6,263,779
6,263,787
jquery get target value for href
Using jquery how do I find out the target value of a href link. e.g. if my link was link the target would be _blank
Using attr() $('#the_link').attr('target'); Example on jsfiddle.
jquery get target value for href Using jquery how do I find out the target value of a href link. e.g. if my link was link the target would be _blank
TITLE: jquery get target value for href QUESTION: Using jquery how do I find out the target value of a href link. e.g. if my link was link the target would be _blank ANSWER: Using attr() $('#the_link').attr('target'); Example on jsfiddle.
[ "jquery" ]
3
9
19,354
6
0
2011-06-07T10:16:36.530000
2011-06-07T10:17:52.990000
6,263,802
6,263,823
Select random item with double bias
I have already read a lot of posts around this subject but I am not satisfied with what I have found. I have a list of objects, lets call them "L". "L" has two properties, " L.small " and " L.big ". I want to select a random "L", but bias the selection so that I am more likely to select objects with a lower "L.small" a...
EDIT: Okay, I'd misinterpreted the question. The exact algorithm you use will depend on how you want things to be biased. For example, you could effectively just treat each object as having a "weight" of big - small... then add up all the weights of the items in the list: int totalWeight = 0; for (Foo foo: list) { tota...
Select random item with double bias I have already read a lot of posts around this subject but I am not satisfied with what I have found. I have a list of objects, lets call them "L". "L" has two properties, " L.small " and " L.big ". I want to select a random "L", but bias the selection so that I am more likely to sel...
TITLE: Select random item with double bias QUESTION: I have already read a lot of posts around this subject but I am not satisfied with what I have found. I have a list of objects, lets call them "L". "L" has two properties, " L.small " and " L.big ". I want to select a random "L", but bias the selection so that I am ...
[ "java", "random" ]
0
2
349
2
0
2011-06-07T10:19:08.080000
2011-06-07T10:21:21.547000
6,263,813
6,264,378
What is the default WCF Binding?
I've been struggling for a few days with this problem, learning a lot of things on bindings in the process. One thing puzzles me, though: various links (see this or that for example) explicitly state "By default, WCF project is created using WsHttpBinding", but that's not what I see. This is what I do: Open Visual Stud...
When hosting WCF service in IIS (using WCF Service application project template) with default.svc file (without changing its service host factory) the default binding is basicHttpBinding. If you want to change default binding to wsHttpBinding you must use: In your service's configuration file but it will not solve your...
What is the default WCF Binding? I've been struggling for a few days with this problem, learning a lot of things on bindings in the process. One thing puzzles me, though: various links (see this or that for example) explicitly state "By default, WCF project is created using WsHttpBinding", but that's not what I see. Th...
TITLE: What is the default WCF Binding? QUESTION: I've been struggling for a few days with this problem, learning a lot of things on bindings in the process. One thing puzzles me, though: various links (see this or that for example) explicitly state "By default, WCF project is created using WsHttpBinding", but that's ...
[ "wcf", "wcf-binding" ]
13
12
11,425
2
0
2011-06-07T10:20:22.293000
2011-06-07T11:15:36.900000
6,263,817
6,263,877
Reports by month with php and mysql?
I want to know how to display report by month using PHP and Mysql Example of Report on the web page: January 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP B | £100 February 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP B | £100 SHOP C | £99.40 I have mysql tables tbl_shop ...
You will need to iterate trough the result of the query and create an multidimensional array using the month/year combination as keys. The query below should be a good indication on how to fetch the required information from your database. SELECT MONTH(to.OrderDate), YEAR(to.OrderDate), SUM(to.Total), to.* FROM tbl_ord...
Reports by month with php and mysql? I want to know how to display report by month using PHP and Mysql Example of Report on the web page: January 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP B | £100 February 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP B | £100 SHOP C |...
TITLE: Reports by month with php and mysql? QUESTION: I want to know how to display report by month using PHP and Mysql Example of Report on the web page: January 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP B | £100 February 2011 ============== Store Name | Total Order Cost SHOP A | £123 SHOP...
[ "php", "mysql", "sql", "database" ]
0
2
7,117
3
0
2011-06-07T10:20:51.600000
2011-06-07T10:25:45.843000
6,263,821
6,263,847
visibility of side effects when creating and joining threads
When are writes that are performed by one thread visible to a different thread when there are no synchronized blocks and no volatile variables? Here is a simplified quicksort example: int middle = partitionForTheFirstTime(array); Thread t = new Thread(new Quicksorter(array, 0, middle - 1)); Thread u = new Thread(new Q...
From section 17.4.5 of the JLS: It follows from the above definitions that: An unlock on a monitor happens-before every subsequent lock on that monitor. A write to a volatile field (§8.3.1.4) happens-before every subsequent read of that field. A call to start() on a thread happens-before any actions in the started thre...
visibility of side effects when creating and joining threads When are writes that are performed by one thread visible to a different thread when there are no synchronized blocks and no volatile variables? Here is a simplified quicksort example: int middle = partitionForTheFirstTime(array); Thread t = new Thread(new Qu...
TITLE: visibility of side effects when creating and joining threads QUESTION: When are writes that are performed by one thread visible to a different thread when there are no synchronized blocks and no volatile variables? Here is a simplified quicksort example: int middle = partitionForTheFirstTime(array); Thread t =...
[ "java", "multithreading", "concurrency", "synchronization", "memory-model" ]
4
8
567
2
0
2011-06-07T10:21:17.257000
2011-06-07T10:23:32.607000
6,263,829
6,263,870
Receive packet by packet data from TCP socket?
I have a tcp socket on which I receive video stream. I want to receive data as packet by packet from socket so that I could remove the packet header and keep the only stream data. How can I do this?? any help will be appreciated.
You can't. TCP doesn't work with packets / messages etc. TCP works with bytes. You get a stream of bytes. The problem is that there's no guarantee reagarding the number of bytes you'll get each time you read from a socket. The usual way to handle this: When you want to send a "packet" include as the first thing a lengt...
Receive packet by packet data from TCP socket? I have a tcp socket on which I receive video stream. I want to receive data as packet by packet from socket so that I could remove the packet header and keep the only stream data. How can I do this?? any help will be appreciated.
TITLE: Receive packet by packet data from TCP socket? QUESTION: I have a tcp socket on which I receive video stream. I want to receive data as packet by packet from socket so that I could remove the packet header and keep the only stream data. How can I do this?? any help will be appreciated. ANSWER: You can't. TCP d...
[ "c++", "c", "sockets", "tcp" ]
13
20
15,650
4
0
2011-06-07T10:21:39.400000
2011-06-07T10:25:20.310000
6,263,835
6,263,853
recursive loop is updating all properties in generic list
I have the following method it creates a generic list recursively. I'm getting some interesting results. The property CurrentAllocation is always overwritten with the last value. Here is the line in question. courierTypeRegion.CurrentAllocation = remaining; courierTypeRegionOutput.Add(courierTypeRegion); Here is the wh...
'CourierTypeRegion' is one instance that lives for the entire foreach loop, it is not instantiated and destroyed every loop iteration. You are repeatedly adding the same instance to your list. You end up with a list where all items reference the the last value in the loop. You need to change your foreach loop as follow...
recursive loop is updating all properties in generic list I have the following method it creates a generic list recursively. I'm getting some interesting results. The property CurrentAllocation is always overwritten with the last value. Here is the line in question. courierTypeRegion.CurrentAllocation = remaining; cour...
TITLE: recursive loop is updating all properties in generic list QUESTION: I have the following method it creates a generic list recursively. I'm getting some interesting results. The property CurrentAllocation is always overwritten with the last value. Here is the line in question. courierTypeRegion.CurrentAllocation...
[ "c#" ]
0
1
432
1
0
2011-06-07T10:22:06.973000
2011-06-07T10:23:58.293000
6,263,849
6,263,950
Set UIImageVIew frame according to Image's Frame contain By UIImageView
I want to set the UIImage View Frame according to frame of Image which will show in UIImge View.I am using below code for that:- [mainImageView.image drawInRect:CGRectMake(0, 0,mainImageView.image.frame.size.width,mainImageView.image.frame.size.height)]; But This Code Shown An Error.
A UIImage doesn't have a frame property. Try mainImageView.image.size.width. (I haven't tested this.)
Set UIImageVIew frame according to Image's Frame contain By UIImageView I want to set the UIImage View Frame according to frame of Image which will show in UIImge View.I am using below code for that:- [mainImageView.image drawInRect:CGRectMake(0, 0,mainImageView.image.frame.size.width,mainImageView.image.frame.size.hei...
TITLE: Set UIImageVIew frame according to Image's Frame contain By UIImageView QUESTION: I want to set the UIImage View Frame according to frame of Image which will show in UIImge View.I am using below code for that:- [mainImageView.image drawInRect:CGRectMake(0, 0,mainImageView.image.frame.size.width,mainImageView.im...
[ "iphone", "ipad", "uiimageview" ]
1
0
692
1
0
2011-06-07T10:23:35.603000
2011-06-07T10:32:05.933000
6,263,881
6,263,982
Should I factor out error reporting in catch statements by re-throwing errors?
I have an error/exception that is thrown by a particular method. Any time this error occurs, I want to log it. Would it be good practice to log the error within the initial method, and then re-throw it? That way I would not need to log it in the catch statements of any function that calls this method. It would look som...
It really depends on your logging preferences. For example you database access layer may have a method that takes a SQL query as a String as an argument and executes it in the DB. Now you may want to log any SQLException in that layer and then wrap the SQLException by a custom exception [like a DatabaseException ] and ...
Should I factor out error reporting in catch statements by re-throwing errors? I have an error/exception that is thrown by a particular method. Any time this error occurs, I want to log it. Would it be good practice to log the error within the initial method, and then re-throw it? That way I would not need to log it in...
TITLE: Should I factor out error reporting in catch statements by re-throwing errors? QUESTION: I have an error/exception that is thrown by a particular method. Any time this error occurs, I want to log it. Would it be good practice to log the error within the initial method, and then re-throw it? That way I would not...
[ "java", "error-handling", "coding-style" ]
0
0
147
6
0
2011-06-07T10:25:58.307000
2011-06-07T10:34:41.127000
6,263,896
6,263,971
Dealing with tel: anchor
I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it's good. The problem is on desktops that just don't know how to deal with that. What should I do? Detect if it's not mobile and change the link? I still want the link to show, just the URL to be different. Is there a be...
To detect if the browser is launching from a mobile in JavaScript: http://detectmobilebrowser.com/ Then you can detect a phone number in JavaScript using a regular expression, such as one of those: http://www.regxlib.com/DisplayPatterns.aspx?cattabindex=6&categoryId=7 And finally rewrite the link: aLink.href="..." The ...
Dealing with tel: anchor I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it's good. The problem is on desktops that just don't know how to deal with that. What should I do? Detect if it's not mobile and change the link? I still want the link to show, just the URL to be...
TITLE: Dealing with tel: anchor QUESTION: I have an anchor to a telephone number. On phones is great. On desktops with Skype or Google Voice it's good. The problem is on desktops that just don't know how to deal with that. What should I do? Detect if it's not mobile and change the link? I still want the link to show, ...
[ "javascript", "mobile", "desktop", "detect", "tel" ]
5
3
4,168
2
0
2011-06-07T10:27:30.450000
2011-06-07T10:33:46.573000
6,263,898
6,263,932
I have a problem with my SQL statement
Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date Here is my statement: StringBuilder insertCommand = new StringBuilder(); insertCommand.Append("DECLARE @TopicsID int"); insertCommand.Append("INSERT INTO Topics(Theme,Topics,Date)"); insertCommand.App...
Try insertCommand.AppendLine SQL sees DECLARE @TopicsID intINSERT INTO Topics(Theme,Topics,Date)... You need to separate the distinct statements
I have a problem with my SQL statement Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date Here is my statement: StringBuilder insertCommand = new StringBuilder(); insertCommand.Append("DECLARE @TopicsID int"); insertCommand.Append("INSERT INTO Topics(...
TITLE: I have a problem with my SQL statement QUESTION: Threads ------- ThreadID UsersID Date ThreadTitle ThreadParagraph ThreadClosed Topics ----- TopicsID Theme Topics Date Here is my statement: StringBuilder insertCommand = new StringBuilder(); insertCommand.Append("DECLARE @TopicsID int"); insertCommand.Append("I...
[ "asp.net", "sql", "identity-insert" ]
1
1
147
4
0
2011-06-07T10:27:33.400000
2011-06-07T10:30:46.690000
6,263,905
6,264,040
Can I create a wsdl from a c# WCF service the same as I used to do with c# web service?
I have to write a web service and I want to use WCF. The developer im working with wants me to provide a wsdl. What im wondering is will I be able to use the WCF service we have in place and use a credential header like I used to with web services?
Yes you can. You need to add a mex endpoint (meta data exchange) and allow http get for metadata exchange. All of these are on by default. You just browse your service and click on the wsdl link.
Can I create a wsdl from a c# WCF service the same as I used to do with c# web service? I have to write a web service and I want to use WCF. The developer im working with wants me to provide a wsdl. What im wondering is will I be able to use the WCF service we have in place and use a credential header like I used to wi...
TITLE: Can I create a wsdl from a c# WCF service the same as I used to do with c# web service? QUESTION: I have to write a web service and I want to use WCF. The developer im working with wants me to provide a wsdl. What im wondering is will I be able to use the WCF service we have in place and use a credential header...
[ "asp.net", "wcf", "web-services" ]
1
0
141
1
0
2011-06-07T10:27:54.423000
2011-06-07T10:41:55.707000
6,263,909
6,264,110
Using C MPI syntax in a C++ application
I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the code (or rewrite it in a cleaner C++ way) into my new program. Since the C++ interface to MPI is being deprecated (and it is much harder to find documentation...
There is no harm in using a C API from a C++ application. Many popular APIs are written in C (the Windows API comes to mind as an example. Or POSIX. Or SQLite, zlib, Python or dozens and dozens of others). So if that seems like the most convenient solution, go ahead and use the C API. It should be fairly easy to write ...
Using C MPI syntax in a C++ application I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the code (or rewrite it in a cleaner C++ way) into my new program. Since the C++ interface to MPI is being deprecated (and...
TITLE: Using C MPI syntax in a C++ application QUESTION: I am developing a C++ MPI application. I have some existing code that is a C MPI application which partly do what I want, so I should be able to copy some of the code (or rewrite it in a cleaner C++ way) into my new program. Since the C++ interface to MPI is bei...
[ "c++", "c", "mpi" ]
3
5
1,828
1
0
2011-06-07T10:28:21.990000
2011-06-07T10:49:17.573000
6,263,912
6,263,934
Form won't reset after alert (when validated)
I validate my form with jquery validate and everything goes fine. What won't work is that, after successfully validating I want it to send an alert and clear the form. The alert will pop but the form won't reset. I can make it reset if I don't have the alert, but both won't work at the same time: $(document).ready(func...
$(document).ready(function() { var validator = $("#contacto").validate({ errorLabelContainer: "#messageBox", wrapper: "li", submitHandler: function() { alert("Formulario enviado"); validator.resetForm(); $("#contacto")[0].reset(); } }) }); your reset call was outside. so it will be only call once after page load.
Form won't reset after alert (when validated) I validate my form with jquery validate and everything goes fine. What won't work is that, after successfully validating I want it to send an alert and clear the form. The alert will pop but the form won't reset. I can make it reset if I don't have the alert, but both won't...
TITLE: Form won't reset after alert (when validated) QUESTION: I validate my form with jquery validate and everything goes fine. What won't work is that, after successfully validating I want it to send an alert and clear the form. The alert will pop but the form won't reset. I can make it reset if I don't have the ale...
[ "jquery", "forms", "jquery-validate" ]
0
1
566
2
0
2011-06-07T10:28:51.520000
2011-06-07T10:31:03.253000
6,263,913
6,264,324
I want to create a Visual Recipe site on WordPress, any suggestions or tips on how i can do it?
I would like to create a visual recipe site, which lists how to make a dish in step by step through pictures.. Is it possible to create a custom page template where I can the following fields. 1.Dishname(title) 2.Introduction(Brief info) 3.Ingredients 4.upload photo input.. followed by add more pic Is it possible in Wo...
sure it's possible. I recommend you to create a new custom post type 'recipe' And add custom fields as you please. This article should definitely get you started: http://kovshenin.com/archives/custom-post-types-in-wordpress-3-0/
I want to create a Visual Recipe site on WordPress, any suggestions or tips on how i can do it? I would like to create a visual recipe site, which lists how to make a dish in step by step through pictures.. Is it possible to create a custom page template where I can the following fields. 1.Dishname(title) 2.Introductio...
TITLE: I want to create a Visual Recipe site on WordPress, any suggestions or tips on how i can do it? QUESTION: I would like to create a visual recipe site, which lists how to make a dish in step by step through pictures.. Is it possible to create a custom page template where I can the following fields. 1.Dishname(ti...
[ "drupal", "joomla", "wordpress" ]
0
0
231
1
0
2011-06-07T10:28:54.720000
2011-06-07T11:10:49.147000
6,263,915
6,263,975
Velocity evaluate expression to Boolean
Is there a way to simplify this assignmet in Velocity? #if($errors.contains("Field required.") #set($requiredFieldErrors = true) #else #set($requiredFieldErrors = false) #end So I need the $requiredFieldErrors as boolean so I can use the value later on in a if-else statement. A definition in one line would be great.
You can modify this to: #set($reqField = $errors.contains("Field Required.") Or directly test it in the if statement (assuming you're not using the $reqField reference in other places). Edit: #set($reqField = $errors && $errors.contains("Field Required.") The above line will check to make sure $errors is a valid refere...
Velocity evaluate expression to Boolean Is there a way to simplify this assignmet in Velocity? #if($errors.contains("Field required.") #set($requiredFieldErrors = true) #else #set($requiredFieldErrors = false) #end So I need the $requiredFieldErrors as boolean so I can use the value later on in a if-else statement. A d...
TITLE: Velocity evaluate expression to Boolean QUESTION: Is there a way to simplify this assignmet in Velocity? #if($errors.contains("Field required.") #set($requiredFieldErrors = true) #else #set($requiredFieldErrors = false) #end So I need the $requiredFieldErrors as boolean so I can use the value later on in a if-e...
[ "templates", "boolean", "eval", "velocity" ]
1
4
5,622
1
0
2011-06-07T10:29:03.313000
2011-06-07T10:34:06.597000
6,263,917
6,264,163
Struggling to join multiple tables correctly to receive correct data
The situation: I have MySQL 5. I am trying to produce a report of companies and some profit details. Each company has jobs that we do for them. Each job has pieces of work involved in that job. Each piece of work has a task type What I want to retrieve: I want to know the total profit for each company from all jobs The...
The first two can be found with this query: select c.name as company_name, sum(hour(end_time) - hour(start_time)) * hourly_rate - sum(costs) as total_profit, sum(costs) as total_costs from companies c join jobs j on j.company_id = c.id join work w on w.job_id = j.id join types t on t.id = w.type_id group by 1; the last...
Struggling to join multiple tables correctly to receive correct data The situation: I have MySQL 5. I am trying to produce a report of companies and some profit details. Each company has jobs that we do for them. Each job has pieces of work involved in that job. Each piece of work has a task type What I want to retriev...
TITLE: Struggling to join multiple tables correctly to receive correct data QUESTION: The situation: I have MySQL 5. I am trying to produce a report of companies and some profit details. Each company has jobs that we do for them. Each job has pieces of work involved in that job. Each piece of work has a task type What...
[ "mysql", "database", "join", "mysql5" ]
0
2
141
1
0
2011-06-07T10:29:19.930000
2011-06-07T10:55:01.420000
6,263,923
6,263,967
Regex inverse matching on specific string?
I would like to match the following com.my.company. moduleA.MyClassName com.my.company. moduleB.MyClassName com.my.company. anythingElse.MyClassName but not the following com.my.company. core.MyClassName My current simple regex pattern is: Pattern PATTERN_MODULE_NAME = Pattern.compile("com\\.my\\.company\\.(.*?)\\..*")...
You can use the following regex: ^com\\.my\\.company\\.(?!core).+?\\.MyClassName$
Regex inverse matching on specific string? I would like to match the following com.my.company. moduleA.MyClassName com.my.company. moduleB.MyClassName com.my.company. anythingElse.MyClassName but not the following com.my.company. core.MyClassName My current simple regex pattern is: Pattern PATTERN_MODULE_NAME = Pattern...
TITLE: Regex inverse matching on specific string? QUESTION: I would like to match the following com.my.company. moduleA.MyClassName com.my.company. moduleB.MyClassName com.my.company. anythingElse.MyClassName but not the following com.my.company. core.MyClassName My current simple regex pattern is: Pattern PATTERN_MOD...
[ "java", "regex", "regex-negation" ]
4
6
3,442
2
0
2011-06-07T10:30:00.497000
2011-06-07T10:33:27.917000
6,263,955
6,265,823
get custom attributes from an Mage_Sales_Model_Order_Item object
I’m writing an Observer for manage the order’s items, I need to send an email for every order based on some custom attributes. The item object is Mage_Sales_Model_Order_Item and searching around I’ve tried methods like getData(’my_code’), getCustomAttribute, getAttributeText without success. I need to get the category,...
You'll probably want to load up the product object, and then get your data off of that object. That will allow you to utilize all the methods you are looking for: $product = Mage::getModel('catalog/product')->load($item->getProductId()); $size = $product->getAttributeText('size');
get custom attributes from an Mage_Sales_Model_Order_Item object I’m writing an Observer for manage the order’s items, I need to send an email for every order based on some custom attributes. The item object is Mage_Sales_Model_Order_Item and searching around I’ve tried methods like getData(’my_code’), getCustomAttribu...
TITLE: get custom attributes from an Mage_Sales_Model_Order_Item object QUESTION: I’m writing an Observer for manage the order’s items, I need to send an email for every order based on some custom attributes. The item object is Mage_Sales_Model_Order_Item and searching around I’ve tried methods like getData(’my_code’)...
[ "magento" ]
5
6
14,520
4
0
2011-06-07T10:32:33.793000
2011-06-07T13:20:55.150000
6,263,968
6,264,557
Error in creating Cache in Google Apps Engine. net.sf.jsr107cache.CacheException
I just started to play with MemCache in Google Apps Engine and every time I create CacheFactory I get this error: net.sf.jsr107cache.CacheException: Could not find class: 'com.google.appengine.api.memcache.jsr107cache.GCacheFactory' at net.sf.jsr107cache.CacheManager.getCacheFactory(CacheManager.java:46) I'm using Apps...
This should be fixed in App Engine SDK 1.5.0.1. Make sure you are importing: import net.sf.jsr107cache.CacheException; import net.sf.jsr107cache.CacheFactory; import net.sf.jsr107cache.CacheManager; I don't have any "Could not find class" error with the following sample code package classnotfoundtest; import net.sf.js...
Error in creating Cache in Google Apps Engine. net.sf.jsr107cache.CacheException I just started to play with MemCache in Google Apps Engine and every time I create CacheFactory I get this error: net.sf.jsr107cache.CacheException: Could not find class: 'com.google.appengine.api.memcache.jsr107cache.GCacheFactory' at net...
TITLE: Error in creating Cache in Google Apps Engine. net.sf.jsr107cache.CacheException QUESTION: I just started to play with MemCache in Google Apps Engine and every time I create CacheFactory I get this error: net.sf.jsr107cache.CacheException: Could not find class: 'com.google.appengine.api.memcache.jsr107cache.GCa...
[ "google-app-engine" ]
0
1
532
2
0
2011-06-07T10:33:35.010000
2011-06-07T11:32:47.450000
6,263,969
6,264,102
Hosting ASP.NET MVC 3 application using MongoDB
I'd like to hear if any of you had experiences developing and hosting such an application? What do you think about combining the two? Is there a way to host it somewhere in cloud (Azure, Amazon...)? What resources (tools, drivers, documentation) have you used for development? Thanks!:)
I have a couple of applications with asp.net mvc 3 and mongodb. For the asp.net mvc app regular windows hosting. For the mongodb i am using unix hosting (since it cost in several times lower than windows hosting). Also you may need: Official c# driver for mongodb: github Official driver documentation: docs Great ui too...
Hosting ASP.NET MVC 3 application using MongoDB I'd like to hear if any of you had experiences developing and hosting such an application? What do you think about combining the two? Is there a way to host it somewhere in cloud (Azure, Amazon...)? What resources (tools, drivers, documentation) have you used for developm...
TITLE: Hosting ASP.NET MVC 3 application using MongoDB QUESTION: I'd like to hear if any of you had experiences developing and hosting such an application? What do you think about combining the two? Is there a way to host it somewhere in cloud (Azure, Amazon...)? What resources (tools, drivers, documentation) have you...
[ "asp.net-mvc", "asp.net-mvc-3", "mongodb", "cloud" ]
6
9
2,732
2
0
2011-06-07T10:33:44.420000
2011-06-07T10:48:17.503000
6,263,974
6,264,293
MVVM and Dependency Injection
I am currently learning the MVVM pattern, and the tutorial I am following uses Unity for DI. I haven't really used DI in this way before and just wanted clarification of my thoughts on how this specific code works. In the View I have: private ViewModel vm; [Dependency] public ViewModel VM { set { vm = value; this.Data...
This doesn't have much to do with the MVVM pattern per se, other than the fact that the view's dependency on its ViewModel is resolved via dependency injection. For how this works, it's pretty simple. There are 3 simple concepts for DI: The first is declaring a dependency, where some object specifies that it depends on...
MVVM and Dependency Injection I am currently learning the MVVM pattern, and the tutorial I am following uses Unity for DI. I haven't really used DI in this way before and just wanted clarification of my thoughts on how this specific code works. In the View I have: private ViewModel vm; [Dependency] public ViewModel VM...
TITLE: MVVM and Dependency Injection QUESTION: I am currently learning the MVVM pattern, and the tutorial I am following uses Unity for DI. I haven't really used DI in this way before and just wanted clarification of my thoughts on how this specific code works. In the View I have: private ViewModel vm; [Dependency] p...
[ "c#", "mvvm", "unity-container" ]
6
6
2,019
2
0
2011-06-07T10:34:03.263000
2011-06-07T11:07:55.370000
6,263,980
6,263,995
How to read an image file from hard to memory using C
I want to read an image(JPEG) file from hard disk to memory. How can I do this? What kind of variable type should I use?
Use a big char array char data[4096] And fread(3) chunks into it. Of course an entire JPEG won't fit in 4096 bytes, but perhaps you can work with chunks instead of the entire file?
How to read an image file from hard to memory using C I want to read an image(JPEG) file from hard disk to memory. How can I do this? What kind of variable type should I use?
TITLE: How to read an image file from hard to memory using C QUESTION: I want to read an image(JPEG) file from hard disk to memory. How can I do this? What kind of variable type should I use? ANSWER: Use a big char array char data[4096] And fread(3) chunks into it. Of course an entire JPEG won't fit in 4096 bytes, bu...
[ "c" ]
1
3
1,908
1
0
2011-06-07T10:34:27.520000
2011-06-07T10:35:44.380000
6,263,984
6,264,036
decode eval function in javascript?
I got this a function eval in javascript - http://pastebin.com/E1PXQeKj but i don't know how read it? how does this generate or decode the string? or simply how is this code? thanks for help!
Here is unpacker for code encoded in such a way http://www.strictly-software.com/unpacker. It seems the only thing this code do is: ver secret = 'dGd3bWw1QWVrUDh1a242dXlNaUFyOVE6MQ';
decode eval function in javascript? I got this a function eval in javascript - http://pastebin.com/E1PXQeKj but i don't know how read it? how does this generate or decode the string? or simply how is this code? thanks for help!
TITLE: decode eval function in javascript? QUESTION: I got this a function eval in javascript - http://pastebin.com/E1PXQeKj but i don't know how read it? how does this generate or decode the string? or simply how is this code? thanks for help! ANSWER: Here is unpacker for code encoded in such a way http://www.strict...
[ "javascript", "encoding", "eval", "decode" ]
1
2
10,682
2
0
2011-06-07T10:34:47.493000
2011-06-07T10:41:30.203000
6,263,989
6,264,011
How to do push notification in j2me?
I want to implement push notification in j2me application. In this the want to keep notification when i get the certain value from the web service. I had never done this functionality.Can anyone please help me how to get the notification message at particular time interval.
Java ME phones don't have a regular platform for push notifications. At least not like Apple does in iOS. What exactly are you trying to do? Do you need your notifications to arrive when your app is not running? Because that's impossible in most phones supporting Java ME...
How to do push notification in j2me? I want to implement push notification in j2me application. In this the want to keep notification when i get the certain value from the web service. I had never done this functionality.Can anyone please help me how to get the notification message at particular time interval.
TITLE: How to do push notification in j2me? QUESTION: I want to implement push notification in j2me application. In this the want to keep notification when i get the certain value from the web service. I had never done this functionality.Can anyone please help me how to get the notification message at particular time ...
[ "java-me", "push-notification" ]
2
2
1,770
2
0
2011-06-07T10:35:13.163000
2011-06-07T10:38:34.813000
6,263,992
6,264,018
Is it bad practice to store a relatively large amount of non persistent data in lists?
I'm working on an iPhone app in which I manage some kind of "agendas". The app needs to be authenticated on a server to work ( = no offline mode ) so I don't need any kind of persistence on the iPhone. Is it bad practice if, once I retrieved datas for the agendas from the servers ( around 10-50 lists of ~30 days ) I st...
No, it is no bad practice. You don't need to persist this data, so no need for a local DB or XML. You need to load the data into memory anyway to search it...
Is it bad practice to store a relatively large amount of non persistent data in lists? I'm working on an iPhone app in which I manage some kind of "agendas". The app needs to be authenticated on a server to work ( = no offline mode ) so I don't need any kind of persistence on the iPhone. Is it bad practice if, once I r...
TITLE: Is it bad practice to store a relatively large amount of non persistent data in lists? QUESTION: I'm working on an iPhone app in which I manage some kind of "agendas". The app needs to be authenticated on a server to work ( = no offline mode ) so I don't need any kind of persistence on the iPhone. Is it bad pra...
[ "c#", "iphone", ".net", "xamarin.ios" ]
3
4
236
3
0
2011-06-07T10:35:31.833000
2011-06-07T10:39:30.627000
6,264,006
6,264,097
Find third Sunday of each month occur between given two dates
Find third Sunday of each month occur between given below two dates. Start Date:- 07-06-2011 // dd-mm-yyyy End Date:- 07-06-2012 // dd-mm-yyyy USE C#.NET
This should do the trick: public List ThirdSundayOfEachMonth( DateTime startdate, DateTime enddate ) { List result = new List (); int sundaymonthcount = 0; for( DateTime traverser = new DateTime(startdate.Year, startdate.Month, 1); traverser <= enddate; traverser = traverser.AddDays(1) ){ if( traverser.DayOfWeek == Day...
Find third Sunday of each month occur between given two dates Find third Sunday of each month occur between given below two dates. Start Date:- 07-06-2011 // dd-mm-yyyy End Date:- 07-06-2012 // dd-mm-yyyy USE C#.NET
TITLE: Find third Sunday of each month occur between given two dates QUESTION: Find third Sunday of each month occur between given below two dates. Start Date:- 07-06-2011 // dd-mm-yyyy End Date:- 07-06-2012 // dd-mm-yyyy USE C#.NET ANSWER: This should do the trick: public List ThirdSundayOfEachMonth( DateTime startd...
[ "c#", ".net" ]
2
3
1,700
3
0
2011-06-07T10:37:20.543000
2011-06-07T10:47:42.230000
6,264,007
6,264,520
TDD: possible to bootstrap when enhancing existing large app?
Chapter about TDD from Martin's "Clean Code" caught my imagination. However. These days I am mostly expanding or fixing large existing apps. TDD, on the other hand, seems to only be working only for writing from scratch. Talking about these large existing apps: 1. they were not writted with TDD (of course). 2. I cannot...
The bootstrap is to isolate the area you're working on and add tests for behavior you want to preserve and behavior you want to add. The hard part of course is making it possible, as untested code tends to be tangled together in ways that make it difficult to isolate an area of code to make it testable. Buy Working Eff...
TDD: possible to bootstrap when enhancing existing large app? Chapter about TDD from Martin's "Clean Code" caught my imagination. However. These days I am mostly expanding or fixing large existing apps. TDD, on the other hand, seems to only be working only for writing from scratch. Talking about these large existing ap...
TITLE: TDD: possible to bootstrap when enhancing existing large app? QUESTION: Chapter about TDD from Martin's "Clean Code" caught my imagination. However. These days I am mostly expanding or fixing large existing apps. TDD, on the other hand, seems to only be working only for writing from scratch. Talking about these...
[ "tdd", "coding-style" ]
4
3
139
3
0
2011-06-07T10:37:32.280000
2011-06-07T11:29:48.043000
6,264,012
6,264,308
How to delete HTML tags, not the contents in Vim
I have the following piece of code in a file that I opened in Vim: Hello stackoverflow! How can I delete and tags but keep the contents between them? That is, what should I press to end with: Hello stackoverflow! I know pressing d i t will do opposite. I'm using Janus.
With the surround.vim plugin installed, press d s t to d elete s urrounding t ag. Similar shortcuts: d s ( - delete surrounding parentheses () d s " - delete surrounding double quotes "" d s ' - delete surrounding single quotes '' and so on...
How to delete HTML tags, not the contents in Vim I have the following piece of code in a file that I opened in Vim: Hello stackoverflow! How can I delete and tags but keep the contents between them? That is, what should I press to end with: Hello stackoverflow! I know pressing d i t will do opposite. I'm using Janus.
TITLE: How to delete HTML tags, not the contents in Vim QUESTION: I have the following piece of code in a file that I opened in Vim: Hello stackoverflow! How can I delete and tags but keep the contents between them? That is, what should I press to end with: Hello stackoverflow! I know pressing d i t will do opposite. ...
[ "html", "vim", "keyboard-shortcuts", "janus" ]
72
108
11,666
5
0
2011-06-07T10:38:38.703000
2011-06-07T11:09:13.680000
6,264,017
6,265,059
which .NET framework does VS developer server run?
When a site is running in IIS it is possible to choose.NET version in application pool settings. How do I know which version of.NET is developer server running when I start my site from Visual Studio(2010)? Thanks
It will use the.NET framework version selected in Target Framework under project properties. You can verify this by double-clicking on the ASP.NET Development Server task bar icon and inspecting the ASP.NET version.
which .NET framework does VS developer server run? When a site is running in IIS it is possible to choose.NET version in application pool settings. How do I know which version of.NET is developer server running when I start my site from Visual Studio(2010)? Thanks
TITLE: which .NET framework does VS developer server run? QUESTION: When a site is running in IIS it is possible to choose.NET version in application pool settings. How do I know which version of.NET is developer server running when I start my site from Visual Studio(2010)? Thanks ANSWER: It will use the.NET framewor...
[ ".net", "visual-studio-2010", "development-environment" ]
1
1
70
1
0
2011-06-07T10:39:27.767000
2011-06-07T12:21:43.373000
6,264,025
6,264,202
How to adapt the Singleton pattern? (Deprecation warning)
Few years ago I found an implementation of the Singleton pattern in Python by Duncan Booth: class Singleton(object): """ Singleton class by Duncan Booth. Multiple object variables refers to the same object. http://web.archive.org/web/20090619190842/http://www.suttoncourtenay.org.uk/duncan/accu/pythonpatterns.html#singl...
You need to drop any additional arguments you are passing when you construct the object. Change the offending line to: cls._instance = object.__new__(cls) or cls._instance = super(Singleton, cls).__new__(cls) though I think you'll be fine with the first (diamond inheritance and singletons sound as though they shouldn't...
How to adapt the Singleton pattern? (Deprecation warning) Few years ago I found an implementation of the Singleton pattern in Python by Duncan Booth: class Singleton(object): """ Singleton class by Duncan Booth. Multiple object variables refers to the same object. http://web.archive.org/web/20090619190842/http://www.su...
TITLE: How to adapt the Singleton pattern? (Deprecation warning) QUESTION: Few years ago I found an implementation of the Singleton pattern in Python by Duncan Booth: class Singleton(object): """ Singleton class by Duncan Booth. Multiple object variables refers to the same object. http://web.archive.org/web/2009061919...
[ "python", "design-patterns", "singleton", "deprecated" ]
15
10
4,319
3
0
2011-06-07T10:40:06.990000
2011-06-07T10:59:34.283000
6,264,031
6,264,507
Why does the compiler try to instantiate a template that I don't actually instantiate anywhere?
Updated below. The following is the entire code I have in my main.cpp: template struct other_traits; template struct some_traits{ typedef decltype(&T::operator()) Fty; typedef typename other_traits::type type; }; int main(){ } But I get the following errors with Visual Studio 2010 while g++ compiles just fine: src\ma...
It seems to be a Bug (if there is not special flag set as mentioned below). Following is an excerpt from Oracle website for C++ templates: 7.2.2 The ISO C++ Standard permits developers to write template classes for which all members may not be legal with a given template argument. As long as the illegal members are not...
Why does the compiler try to instantiate a template that I don't actually instantiate anywhere? Updated below. The following is the entire code I have in my main.cpp: template struct other_traits; template struct some_traits{ typedef decltype(&T::operator()) Fty; typedef typename other_traits::type type; }; int main(...
TITLE: Why does the compiler try to instantiate a template that I don't actually instantiate anywhere? QUESTION: Updated below. The following is the entire code I have in my main.cpp: template struct other_traits; template struct some_traits{ typedef decltype(&T::operator()) Fty; typedef typename other_traits::type t...
[ "c++", "visual-studio-2010", "templates", "c++11", "instantiation" ]
15
2
3,366
4
0
2011-06-07T10:40:45.290000
2011-06-07T11:28:35.220000
6,264,034
6,264,082
how to move images on finger touch in android?
I am developing an small application in a android. Before this i had done surfing on internet but i can't get useful material. In this application i have two tabs I had made the these two tabs but I want after click on first tab i want some images these Images can move on right side when user touch it on right and left...
See this blog post on how to do it. You need to look at SurfaceView and the onTouchListener. Taken from the blog: surf.setOnTouchListener( new SurfaceView.OnTouchListener(){ public boolean onTouch(View v, MotionEvent event) { case MotionEvent.ACTION_MOVE: if( moving ){ final int x_new = (int)event.getX(); final int y_n...
how to move images on finger touch in android? I am developing an small application in a android. Before this i had done surfing on internet but i can't get useful material. In this application i have two tabs I had made the these two tabs but I want after click on first tab i want some images these Images can move on ...
TITLE: how to move images on finger touch in android? QUESTION: I am developing an small application in a android. Before this i had done surfing on internet but i can't get useful material. In this application i have two tabs I had made the these two tabs but I want after click on first tab i want some images these I...
[ "android" ]
1
3
11,293
2
0
2011-06-07T10:41:28.020000
2011-06-07T10:46:28.223000
6,264,044
6,264,087
Find checkbox and textbox placed inside gridview using javascript
I want to get the value of check box placed inside grid view. if check box is checked, it textbox in that row should be enable and if it is again uncheked, the textbox should get clear and disabled. I asked this question few hours back but still didn't get satisfactory answer. I tried like this. //My grid code. Add Dep...
You can use the onclick JavaScript instead of the OncheckedChanged event which is a CheckBox server side event. Edit: var GridView = document.getElementById('<%=DeptGrid.ClientID %>') Edit: Upon your request in comment if (GridView.rows[Row].cell[2].type == "checkbox") { if (GridView.rows[Row].cell[2].childNodes[0].che...
Find checkbox and textbox placed inside gridview using javascript I want to get the value of check box placed inside grid view. if check box is checked, it textbox in that row should be enable and if it is again uncheked, the textbox should get clear and disabled. I asked this question few hours back but still didn't g...
TITLE: Find checkbox and textbox placed inside gridview using javascript QUESTION: I want to get the value of check box placed inside grid view. if check box is checked, it textbox in that row should be enable and if it is again uncheked, the textbox should get clear and disabled. I asked this question few hours back ...
[ "c#", "javascript", "asp.net", "gridview", "checkbox" ]
6
1
57,405
7
0
2011-06-07T10:42:21.977000
2011-06-07T10:47:00.717000
6,264,046
6,264,076
Force close on second start of application
I am developing an Android application, and when I start my application 2nd time I am getting force close error. Following is my logcat: 06-07 16:08:12.763: ERROR/AndroidRuntime(3293): Uncaught handler: thread exiting due to uncaught exception06-07 16:08:12.773: ERROR/AndroidRuntime(3293): java.lang.NullPointerExceptio...
Your logcat capture is telling you that in your source file MobiintheMorningActivity.java, at line 209, you're using an object which is null. Seems pretty straight forward.
Force close on second start of application I am developing an Android application, and when I start my application 2nd time I am getting force close error. Following is my logcat: 06-07 16:08:12.763: ERROR/AndroidRuntime(3293): Uncaught handler: thread exiting due to uncaught exception06-07 16:08:12.773: ERROR/AndroidR...
TITLE: Force close on second start of application QUESTION: I am developing an Android application, and when I start my application 2nd time I am getting force close error. Following is my logcat: 06-07 16:08:12.763: ERROR/AndroidRuntime(3293): Uncaught handler: thread exiting due to uncaught exception06-07 16:08:12.7...
[ "android" ]
0
3
308
3
0
2011-06-07T10:42:28.900000
2011-06-07T10:45:44.250000
6,264,077
6,264,537
dynamic rails host name for routes
I'm doing this in application controller: before_filter:set_app_host def set_app_host Rails.application.routes.default_url_options[:host] = "some url" end This is to have a dynamic host name that can show up in link_to helper method. However this is not working, and the original host name is showing instead. Any ideas...
In application_controller.rb def default_url_options(options = nil) {:host => "example.com" } end From: http://edgeguides.rubyonrails.org/action_controller_overview.html#default_url_options
dynamic rails host name for routes I'm doing this in application controller: before_filter:set_app_host def set_app_host Rails.application.routes.default_url_options[:host] = "some url" end This is to have a dynamic host name that can show up in link_to helper method. However this is not working, and the original host...
TITLE: dynamic rails host name for routes QUESTION: I'm doing this in application controller: before_filter:set_app_host def set_app_host Rails.application.routes.default_url_options[:host] = "some url" end This is to have a dynamic host name that can show up in link_to helper method. However this is not working, and...
[ "ruby-on-rails", "dynamic", "routes", "host" ]
1
2
1,791
1
0
2011-06-07T10:45:48.440000
2011-06-07T11:31:25.780000
6,264,078
6,264,115
Issue while restoring a Database Backup file
I get the below mentioned while restoring a database back-up file to my system. Actually the back-up has been taken in other system and I'm trying to restore that file to my systems' sql server. Could anybody assist me in explaining what the error is and how to rectify? Please... Error: "System.Data.SqlClient.SqlError:...
You SQL Server where you want to restore the database is older then the origin. So to restore this database, you have to use a newer version. Go to downloads.microsoft.com and get the SQL Express version of the latest, install it on any machine and restore. You can even install on the same machine. If you cant udpate y...
Issue while restoring a Database Backup file I get the below mentioned while restoring a database back-up file to my system. Actually the back-up has been taken in other system and I'm trying to restore that file to my systems' sql server. Could anybody assist me in explaining what the error is and how to rectify? Plea...
TITLE: Issue while restoring a Database Backup file QUESTION: I get the below mentioned while restoring a database back-up file to my system. Actually the back-up has been taken in other system and I'm trying to restore that file to my systems' sql server. Could anybody assist me in explaining what the error is and ho...
[ "sql", "database-backups" ]
0
1
1,396
1
0
2011-06-07T10:45:57.360000
2011-06-07T10:49:37.627000
6,264,084
6,264,148
CSS cascading priority
I've got this HTML that I'm trying to style: Foobar Can anyone explain why this CSS... #menubar menu { width: auto; }...takes priority over... #menubarTransportControls { width: 100%; } I'm using IE7 with the HTML5 shiv javascript. Thanks
#menubar menu has higher specificity than #menubarTransportControls. To understand specificity: The specs: http://www.w3.org/TR/CSS21/cascade.html#specificity If you like Star Wars: http://www.stuffandnonsense.co.uk/archives/css_specificity_wars.html Otherwise: http://css-tricks.com/specifics-on-css-specificity/ You ca...
CSS cascading priority I've got this HTML that I'm trying to style: Foobar Can anyone explain why this CSS... #menubar menu { width: auto; }...takes priority over... #menubarTransportControls { width: 100%; } I'm using IE7 with the HTML5 shiv javascript. Thanks
TITLE: CSS cascading priority QUESTION: I've got this HTML that I'm trying to style: Foobar Can anyone explain why this CSS... #menubar menu { width: auto; }...takes priority over... #menubarTransportControls { width: 100%; } I'm using IE7 with the HTML5 shiv javascript. Thanks ANSWER: #menubar menu has higher specif...
[ "css", "html", "class" ]
2
6
758
4
0
2011-06-07T10:46:37.450000
2011-06-07T10:52:55.263000
6,264,089
6,264,678
Select a ListViewItem by clicking on the controls in its DataTemplate
I've written a custom DataTemplate for items in a ListView, something like this:......... and I've obtain my pretty style. Now, if I want to select the item, I must click on the white space between the template controls. If I click on the textbox in the ListViewItem, it won't select like an item. So, is there a way to ...
Its possible to add a trigger on the ListViewItem which selects the item always then the keyboardfocus is inside of the item. As you do that on the ListViewItem you have the same behavior for all the controls inside the DataTemplate, which should be your solution... example: first second third i hope its clear...
Select a ListViewItem by clicking on the controls in its DataTemplate I've written a custom DataTemplate for items in a ListView, something like this:......... and I've obtain my pretty style. Now, if I want to select the item, I must click on the white space between the template controls. If I click on the textbox in ...
TITLE: Select a ListViewItem by clicking on the controls in its DataTemplate QUESTION: I've written a custom DataTemplate for items in a ListView, something like this:......... and I've obtain my pretty style. Now, if I want to select the item, I must click on the white space between the template controls. If I click ...
[ "c#", ".net", "wpf", "wpf-controls", "datatemplate" ]
4
7
2,926
1
0
2011-06-07T10:47:04.303000
2011-06-07T11:44:18.550000
6,264,098
6,264,211
How to increment the filename if file already exists
In my vb.net winform application, I am moving the file (ex: sample.xls from one folder to another. If file already exists with the same name, the new file name should be incremented (ex:sample(1).xls). How can i acheive this?
Hi here's a pretty "procedural" answer: Dim counter As Integer = 0 Dim newFileName As String = orginialFileName While File.Exists(newFileName) counter = counter + 1 newFileName = String.Format("{0}({1}", orginialFileName, counter.ToString()) End While you will need an imports statement for System.IO
How to increment the filename if file already exists In my vb.net winform application, I am moving the file (ex: sample.xls from one folder to another. If file already exists with the same name, the new file name should be incremented (ex:sample(1).xls). How can i acheive this?
TITLE: How to increment the filename if file already exists QUESTION: In my vb.net winform application, I am moving the file (ex: sample.xls from one folder to another. If file already exists with the same name, the new file name should be incremented (ex:sample(1).xls). How can i acheive this? ANSWER: Hi here's a pr...
[ ".net", "vb.net" ]
4
8
13,414
2
0
2011-06-07T10:47:48.877000
2011-06-07T11:00:41.613000
6,264,107
6,264,142
How can I call a new page and add in the value of a form variable
I would like to link to a new page in the format: /topic/create&qty=4 Right now I have the value (which is the number 4) stored in an field in a form. I tried to put everything in the form with a post but then realized this isn't what I want to do. I just need clicking on a button to go to link to a new page and send t...
you can not use POST to send data via url, but you can use GET like this: /topic/create?qty=4 EDIT: Clarification Writing red in the text field and pressing submit on this form... will produce identical results on the server side to clicking this link rum
How can I call a new page and add in the value of a form variable I would like to link to a new page in the format: /topic/create&qty=4 Right now I have the value (which is the number 4) stored in an field in a form. I tried to put everything in the form with a post but then realized this isn't what I want to do. I jus...
TITLE: How can I call a new page and add in the value of a form variable QUESTION: I would like to link to a new page in the format: /topic/create&qty=4 Right now I have the value (which is the number 4) stored in an field in a form. I tried to put everything in the form with a post but then realized this isn't what I...
[ "javascript", "html", "css" ]
2
0
246
2
0
2011-06-07T10:48:37.703000
2011-06-07T10:52:19.533000
6,264,127
6,264,494
How to add Toolbar search for tree grid in jqgrid
I am facing an issue in jqgrid's treegrid. For local data the tool barserch is not working and if add change the treegrid as false in colModel its works fine in the sense it is acting as a ordinary grid. i have pasted my code below for your reference $(document).ready (function () { var mydata = [ { id:"AA", name:"0123...
There are probably a misunderstanding with my previous answer on the trirand forum. Tree Grid feature of jqGrid work almost only with remote data received from the server per ajax. With respect of some tricks which you use it is do possible to display the local data in the tree grid. Nevertheless you still has very res...
How to add Toolbar search for tree grid in jqgrid I am facing an issue in jqgrid's treegrid. For local data the tool barserch is not working and if add change the treegrid as false in colModel its works fine in the sense it is acting as a ordinary grid. i have pasted my code below for your reference $(document).ready (...
TITLE: How to add Toolbar search for tree grid in jqgrid QUESTION: I am facing an issue in jqgrid's treegrid. For local data the tool barserch is not working and if add change the treegrid as false in colModel its works fine in the sense it is acting as a ordinary grid. i have pasted my code below for your reference $...
[ "jquery-plugins", "jqgrid", "treegrid" ]
0
0
2,091
1
0
2011-06-07T10:50:44.723000
2011-06-07T11:27:12.537000
6,264,132
6,283,261
post dynamically generated textbox using foreach loop
i want to post dynamically generated multiple text box using php by foreach loop. for instance i m working on question bank and for post multiple answer from php. here is my code that dynamically generated textbox but now i donot know how to post value of generated textbox thru foreach loop. $("#questionbank").live('cl...
Consider the following HTML Start I guess you want to post data from each value of the textbox/textarea by $.post() or $.ajax() var i=1; $('#start').one('click',function(){ j=i++; $('#container').append(' Add '); $('#container').after(' Submit Add '); $(this).next().next().after(''); $(this).remove(); }); $('#submit')...
post dynamically generated textbox using foreach loop i want to post dynamically generated multiple text box using php by foreach loop. for instance i m working on question bank and for post multiple answer from php. here is my code that dynamically generated textbox but now i donot know how to post value of generated ...
TITLE: post dynamically generated textbox using foreach loop QUESTION: i want to post dynamically generated multiple text box using php by foreach loop. for instance i m working on question bank and for post multiple answer from php. here is my code that dynamically generated textbox but now i donot know how to post v...
[ "php", "jquery", "mysql" ]
0
1
1,814
2
0
2011-06-07T10:51:04.660000
2011-06-08T18:10:37.783000
6,264,134
6,271,189
What thread calls the completed event handler on silverlight WCF calls?
Assume that I have Silverlight app doing a call to a WCF service: void DoStuff() { MyProxy proxy = new MyProxy(); proxy.DoStuffCompleted += DoStuffCompleted; proxy.DoStuffAsync(); } void DoStuffCompleted(object sender, DoStuffCompletedEventArgs e) { // Handle the result. } DoStuff is called by the UI thread. What thre...
The callback will be invoked on the main thread. Multiple responses will not occur simultaneously. The order of the response events could be unexpected. You may want to use the overload of proxy.DoStuffAsync that accepts "user state" object: proxy.DoStuffAsync(object userState) This will allow you to send something uni...
What thread calls the completed event handler on silverlight WCF calls? Assume that I have Silverlight app doing a call to a WCF service: void DoStuff() { MyProxy proxy = new MyProxy(); proxy.DoStuffCompleted += DoStuffCompleted; proxy.DoStuffAsync(); } void DoStuffCompleted(object sender, DoStuffCompletedEventArgs e)...
TITLE: What thread calls the completed event handler on silverlight WCF calls? QUESTION: Assume that I have Silverlight app doing a call to a WCF service: void DoStuff() { MyProxy proxy = new MyProxy(); proxy.DoStuffCompleted += DoStuffCompleted; proxy.DoStuffAsync(); } void DoStuffCompleted(object sender, DoStuffCom...
[ "c#", ".net", "multithreading", "silverlight", "wcf" ]
5
4
2,479
3
0
2011-06-07T10:51:19.857000
2011-06-07T20:24:45.563000
6,264,135
6,264,691
Activity result not being remembered?
I have the following scenario (note that activity A has launchMode="singleTop" ): Activity A calls startActivityForResult() on activity B; Activity B calls startActivity() on C, after which setResult(RESULT_OK) and finish(); at this point, onActivityResult() in A is NOT called. Activity C calls startActivity() on A usi...
Read this doc: http://developer.android.com/reference/android/content/Intent.html#FLAG_ACTIVITY_CLEAR_TOP If set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent wil...
Activity result not being remembered? I have the following scenario (note that activity A has launchMode="singleTop" ): Activity A calls startActivityForResult() on activity B; Activity B calls startActivity() on C, after which setResult(RESULT_OK) and finish(); at this point, onActivityResult() in A is NOT called. Act...
TITLE: Activity result not being remembered? QUESTION: I have the following scenario (note that activity A has launchMode="singleTop" ): Activity A calls startActivityForResult() on activity B; Activity B calls startActivity() on C, after which setResult(RESULT_OK) and finish(); at this point, onActivityResult() in A ...
[ "android" ]
2
1
383
1
0
2011-06-07T10:51:26.123000
2011-06-07T11:45:52.457000
6,264,137
6,264,527
std::cin.putback() and "wake up" it
I have threads in my program and I want to put character into stream and read it in another thread, but after std::cin.putback() I need to write something from keyboard to "wake up" std::cin in function main. Can I do something to read automatically?
That's not how streams work. The std::cin reads data that come from outside your program to standard input and the putback only allows keeping a character that you actually just read back to the buffer for re-parsing next time you invoke operator>> (or get or getline or other read method). If you want to communicate be...
std::cin.putback() and "wake up" it I have threads in my program and I want to put character into stream and read it in another thread, but after std::cin.putback() I need to write something from keyboard to "wake up" std::cin in function main. Can I do something to read automatically?
TITLE: std::cin.putback() and "wake up" it QUESTION: I have threads in my program and I want to put character into stream and read it in another thread, but after std::cin.putback() I need to write something from keyboard to "wake up" std::cin in function main. Can I do something to read automatically? ANSWER: That's...
[ "c++", "multithreading", "io" ]
3
4
617
1
0
2011-06-07T10:51:52.590000
2011-06-07T11:30:27.870000
6,264,138
6,264,168
How to assign the values for the parameters
How to assign the values for the parameters. Rs232MsgRawEncoded(const int nMsgId,const INT8U* pSrc=NULL,unsigned int nSize=0); I have declared the above cpp method declaration in Objective C as the following -(id)initWithRS232MsgRawEncoded:(const int)nMsgId withpSrc:(const uint8_t*)pSrc withSize:(unsigned int)nSize; In...
Objective-c (as well as c) does not support default parameters for functions. So you can either use the function you have and pass all parameters to it every time. If you don't - create new functions with some parameters omitted and call your 'main' function with default parameters inside, e.g.: -(id)initWithRS232MsgRa...
How to assign the values for the parameters How to assign the values for the parameters. Rs232MsgRawEncoded(const int nMsgId,const INT8U* pSrc=NULL,unsigned int nSize=0); I have declared the above cpp method declaration in Objective C as the following -(id)initWithRS232MsgRawEncoded:(const int)nMsgId withpSrc:(const ui...
TITLE: How to assign the values for the parameters QUESTION: How to assign the values for the parameters. Rs232MsgRawEncoded(const int nMsgId,const INT8U* pSrc=NULL,unsigned int nSize=0); I have declared the above cpp method declaration in Objective C as the following -(id)initWithRS232MsgRawEncoded:(const int)nMsgId ...
[ "objective-c" ]
0
0
86
1
0
2011-06-07T10:52:00.590000
2011-06-07T10:55:50.770000
6,264,139
6,264,194
How to write a logger
So, I'd like to write a logger in c# for an app I'm working on. However, since I love efficiency, I don't want to be opening and closing a log file over and over again during execution. I think I'd like to write all events to RAM and then write to the log file once when the app exits. Would this be a good practice? If ...
However, since I love efficiency, I don't want to be opening and closing a log file over and over again during execution No. It's since you love premature optimizations. I think I'd like to write all events to RAM and then write to the log file once when the app exits. Would this be a good practice? If so, how should I...
How to write a logger So, I'd like to write a logger in c# for an app I'm working on. However, since I love efficiency, I don't want to be opening and closing a log file over and over again during execution. I think I'd like to write all events to RAM and then write to the log file once when the app exits. Would this b...
TITLE: How to write a logger QUESTION: So, I'd like to write a logger in c# for an app I'm working on. However, since I love efficiency, I don't want to be opening and closing a log file over and over again during execution. I think I'd like to write all events to RAM and then write to the log file once when the app e...
[ "c#", "logging" ]
4
6
1,967
3
0
2011-06-07T10:52:15.863000
2011-06-07T10:58:20.290000
6,264,147
6,276,234
jQuery localScroll
I am trying to use jQuery.localScroll, and the onBefore and onAfter events are being triggered but it is not scrolling. Below is the html followed by the javascript. Home Who We Are What We Do Who For Blue Lounge Bits n Bobs Connect Who We Are Duis vitae urna dui. Nullam vel lobortis erat. Cras suscipit lorem vel nulla...
The following CSS seemed to be causing the issue html, body { height: 100%; overflow: auto; } Removing it seemed to solve the problem.
jQuery localScroll I am trying to use jQuery.localScroll, and the onBefore and onAfter events are being triggered but it is not scrolling. Below is the html followed by the javascript. Home Who We Are What We Do Who For Blue Lounge Bits n Bobs Connect Who We Are Duis vitae urna dui. Nullam vel lobortis erat. Cras susci...
TITLE: jQuery localScroll QUESTION: I am trying to use jQuery.localScroll, and the onBefore and onAfter events are being triggered but it is not scrolling. Below is the html followed by the javascript. Home Who We Are What We Do Who For Blue Lounge Bits n Bobs Connect Who We Are Duis vitae urna dui. Nullam vel loborti...
[ "javascript", "jquery" ]
0
0
1,063
1
0
2011-06-07T10:52:40.400000
2011-06-08T08:40:37.443000
6,264,149
6,264,161
Using an HTML select list as link list
I have seen some solutions on how to use a dropdown list in HTML as a combo link list with JS. Is there possibly a way to do it without JS directly with HTML? Maybe sth with method="link"?
Without JS? Yes, do it server side (issuing an HTTP redirect in response to a form submission) Directly with HTML? No. It isn't a nice UI design though. Having links people can see without clicking, and can activate with a single click is much nicer.
Using an HTML select list as link list I have seen some solutions on how to use a dropdown list in HTML as a combo link list with JS. Is there possibly a way to do it without JS directly with HTML? Maybe sth with method="link"?
TITLE: Using an HTML select list as link list QUESTION: I have seen some solutions on how to use a dropdown list in HTML as a combo link list with JS. Is there possibly a way to do it without JS directly with HTML? Maybe sth with method="link"? ANSWER: Without JS? Yes, do it server side (issuing an HTTP redirect in r...
[ "html", "list", "drop-down-menu" ]
0
1
597
1
0
2011-06-07T10:53:01.747000
2011-06-07T10:54:52.923000
6,264,150
6,264,209
Is method overloading not possible
Possible Duplicate: Method overloading in Objective-C? Is method overloading not possible. I have two functions with the same name. When declared like the below i'm etting errors. -(RS232Msg*)CreateMessage:(REMOTE_MESSAGE_ID) nMessageNumber; -(RS232Msg*)CreateMessage:(const uint8_t*) szMessageName; when declared -(RS23...
No, method overloading is not possible in C, and therefore not possible in Objective-C (since Objective-C is a superset of C). If you'd like to use those two methods, you'll have to change their names. I would suggest the following: - (RS232Msg *)createMessageWithMessageID:(REMOTE_MESSAGE_ID)nMessageNumber; - (RS232Msg...
Is method overloading not possible Possible Duplicate: Method overloading in Objective-C? Is method overloading not possible. I have two functions with the same name. When declared like the below i'm etting errors. -(RS232Msg*)CreateMessage:(REMOTE_MESSAGE_ID) nMessageNumber; -(RS232Msg*)CreateMessage:(const uint8_t*) ...
TITLE: Is method overloading not possible QUESTION: Possible Duplicate: Method overloading in Objective-C? Is method overloading not possible. I have two functions with the same name. When declared like the below i'm etting errors. -(RS232Msg*)CreateMessage:(REMOTE_MESSAGE_ID) nMessageNumber; -(RS232Msg*)CreateMessage...
[ "objective-c" ]
0
3
1,640
1
0
2011-06-07T10:53:04.957000
2011-06-07T11:00:26.110000
6,264,155
6,265,846
How to update the quantity of all items in the cart with one update button
I have the following action method, when I press the update button on my cart and post to this method I need it bind all productId and partquantity values into the respective parameters/arrays (int[] ProductId, int[] partquantity) and it does this. I am presuming when form data, that is keys and values are posted they ...
Your Cart object should be enough as parameter for this scenario, you can have something like this. The general idea would be to use an index so you get your Cart object with your Lines as you passed them to the view originally but with updated Quantity values. Your model as I understand it: public class Cart {... publ...
How to update the quantity of all items in the cart with one update button I have the following action method, when I press the update button on my cart and post to this method I need it bind all productId and partquantity values into the respective parameters/arrays (int[] ProductId, int[] partquantity) and it does th...
TITLE: How to update the quantity of all items in the cart with one update button QUESTION: I have the following action method, when I press the update button on my cart and post to this method I need it bind all productId and partquantity values into the respective parameters/arrays (int[] ProductId, int[] partquanti...
[ "c#", "asp.net", "asp.net-mvc", "asp.net-mvc-2", "c#-4.0" ]
0
0
3,774
2
0
2011-06-07T10:54:17.140000
2011-06-07T13:23:09.923000
6,264,158
6,264,176
Override css rendered by an advertising javascript
I have a javascript code which loads some advertising code: In my browser here is how my code renders: The anchor The anchor How can I override the css rules rendered by the javascrip. I need to put my own text site, line height, etc. Is it possible? Thank you very much!
You would need to use!important to override the inline styles. #title0 { font-size: 13px!important; } jsFiddle. Or alternatively, modify them with JavaScript.
Override css rendered by an advertising javascript I have a javascript code which loads some advertising code: In my browser here is how my code renders: The anchor The anchor How can I override the css rules rendered by the javascrip. I need to put my own text site, line height, etc. Is it possible? Thank you very muc...
TITLE: Override css rendered by an advertising javascript QUESTION: I have a javascript code which loads some advertising code: In my browser here is how my code renders: The anchor The anchor How can I override the css rules rendered by the javascrip. I need to put my own text site, line height, etc. Is it possible? ...
[ "javascript", "css" ]
0
2
147
2
0
2011-06-07T10:54:26.130000
2011-06-07T10:56:39.307000
6,264,159
6,264,253
How to intiliaze QTime in QT?
I have this in my header file: explicit AccessSchedule(QWidget *parent = 0,QString item = "",QTime timefrom ) How should timefrom be initialized? Thanks.
If you want a default time, you can write: explicit AccessSchedule(QWidget *parent = 0,QString item = "", QTime timefrom = QTime(11, 45)); timefrom will represent 11:45. If you just put:..., QTime timefrom = QTime()); timefrom will be a "null" time object, i.e. it's isNull() method will return true and isValid() will r...
How to intiliaze QTime in QT? I have this in my header file: explicit AccessSchedule(QWidget *parent = 0,QString item = "",QTime timefrom ) How should timefrom be initialized? Thanks.
TITLE: How to intiliaze QTime in QT? QUESTION: I have this in my header file: explicit AccessSchedule(QWidget *parent = 0,QString item = "",QTime timefrom ) How should timefrom be initialized? Thanks. ANSWER: If you want a default time, you can write: explicit AccessSchedule(QWidget *parent = 0,QString item = "", QTi...
[ "qt" ]
1
1
1,593
3
0
2011-06-07T10:54:32.010000
2011-06-07T11:04:47.290000
6,264,165
6,264,399
Problems with a widget in Android
At the moment, my android widget runs a PendingIntent when you click it. The problem is that if the activity is already running in the background, the widget runs it a second time. Is there any way to make the widget open the currently running version as opposed to a completely new one?
You can mark your Activity as having a launchMode of singleTop or singleTask which should let you use the onNewIntent callback to receive the intent. See http://developer.android.com/guide/topics/manifest/activity-element.html#lmode for more detail.
Problems with a widget in Android At the moment, my android widget runs a PendingIntent when you click it. The problem is that if the activity is already running in the background, the widget runs it a second time. Is there any way to make the widget open the currently running version as opposed to a completely new one...
TITLE: Problems with a widget in Android QUESTION: At the moment, my android widget runs a PendingIntent when you click it. The problem is that if the activity is already running in the background, the widget runs it a second time. Is there any way to make the widget open the currently running version as opposed to a ...
[ "android", "widget", "android-pendingintent" ]
0
1
99
1
0
2011-06-07T10:55:22.737000
2011-06-07T11:18:16.193000
6,264,170
6,265,610
Partition Key Question
Let's I define my entity like this: public class User: TableServiceEntity { /// Unique Id (Row Key) public string Id { get { return RowKey; } set { RowKey = value; } } /// Gets or sets the username (Partition Key) public string Username { get { return PartitionKey; } set { PartitionKey = value; } } } will the followin...
Pretty sure it will not. You can verify this with Fiddler however. If you do not see a $filter on the wire with PartitionKey and RowKey in it, then you are not querying by them (which is probably bad). I believe what you will have on the wire is an entity that has 4 properties (PK, RK, Id, and Username) and the propert...
Partition Key Question Let's I define my entity like this: public class User: TableServiceEntity { /// Unique Id (Row Key) public string Id { get { return RowKey; } set { RowKey = value; } } /// Gets or sets the username (Partition Key) public string Username { get { return PartitionKey; } set { PartitionKey = value; ...
TITLE: Partition Key Question QUESTION: Let's I define my entity like this: public class User: TableServiceEntity { /// Unique Id (Row Key) public string Id { get { return RowKey; } set { RowKey = value; } } /// Gets or sets the username (Partition Key) public string Username { get { return PartitionKey; } set { Part...
[ "linq", "azure", "azure-table-storage" ]
2
1
243
1
0
2011-06-07T10:56:07.763000
2011-06-07T13:05:55.940000
6,264,173
6,264,212
How I can sort a each number in a given number?
I know i can make use of sort() function in Groovy to sort List. For example I can do this: def numbers = [1,4,3] as List print numbers.sort() // outputs: [1,3,4] Now i want to know whether there is a function in Groovy, which does something like this: def number = 143 // any method there to apply on number, so that i ...
This should work: def number = 143 def sorted = "$number".collect { it as int }.sort().join() as int That: Converts the number to a String "$number" collect s each char as an int (so you get a List of int) calls sort() on this array calls join() to stick all the ints back together as a String then calls as int to conve...
How I can sort a each number in a given number? I know i can make use of sort() function in Groovy to sort List. For example I can do this: def numbers = [1,4,3] as List print numbers.sort() // outputs: [1,3,4] Now i want to know whether there is a function in Groovy, which does something like this: def number = 143 //...
TITLE: How I can sort a each number in a given number? QUESTION: I know i can make use of sort() function in Groovy to sort List. For example I can do this: def numbers = [1,4,3] as List print numbers.sort() // outputs: [1,3,4] Now i want to know whether there is a function in Groovy, which does something like this: d...
[ "groovy" ]
0
3
2,284
2
0
2011-06-07T10:56:18.930000
2011-06-07T11:00:42.330000
6,264,180
6,264,367
How to use REPLACE in Select Query? (SQL SERVER)
Can I use REPLACE function conditionally? e.g. I have a query: SELECT diag_type FROM DIAGNOSIS It returns AXIS, AXISI, AXISII, AXIS-C, etc. I want if it returns a result that has AXIS, it makes it AXISIII. Can it be possible? Thanks in advance.
;with DIAGNOSIS(diag_type) as ( select 'AXIS' union all select 'AXISI' union all select 'AXISII' union all select 'AXIS-C' ) select case diag_type when 'AXIS' then 'AXISIII' else diag_type end as diag_type from DIAGNOSIS Result: diag_type --------- AXISIII AXISI AXISII AXIS-C
How to use REPLACE in Select Query? (SQL SERVER) Can I use REPLACE function conditionally? e.g. I have a query: SELECT diag_type FROM DIAGNOSIS It returns AXIS, AXISI, AXISII, AXIS-C, etc. I want if it returns a result that has AXIS, it makes it AXISIII. Can it be possible? Thanks in advance.
TITLE: How to use REPLACE in Select Query? (SQL SERVER) QUESTION: Can I use REPLACE function conditionally? e.g. I have a query: SELECT diag_type FROM DIAGNOSIS It returns AXIS, AXISI, AXISII, AXIS-C, etc. I want if it returns a result that has AXIS, it makes it AXISIII. Can it be possible? Thanks in advance. ANSWER:...
[ "sql-server-2008", "select", "replace" ]
1
3
5,163
2
0
2011-06-07T10:57:07.047000
2011-06-07T11:14:51.023000
6,264,185
6,264,483
image button is not displayed in linear layout
In my app there is a list view with following controls (imageview, textviews, image buttons) nested: all they are displayed except the "Buy" image button How to show the "Buy" image button in the list view? I also could not write an action for play and detail image buttons in the list view. Please help me. my xml is as...
Try out with this and see. I have modified your xml. Drawables please change. I have used the default icon.png as of now. Then as per your any further requirement change the file. RelativeLayout is the easiest way for us to place widgets. So try using that.
image button is not displayed in linear layout In my app there is a list view with following controls (imageview, textviews, image buttons) nested: all they are displayed except the "Buy" image button How to show the "Buy" image button in the list view? I also could not write an action for play and detail image buttons...
TITLE: image button is not displayed in linear layout QUESTION: In my app there is a list view with following controls (imageview, textviews, image buttons) nested: all they are displayed except the "Buy" image button How to show the "Buy" image button in the list view? I also could not write an action for play and de...
[ "android", "android-layout" ]
0
0
2,382
1
0
2011-06-07T10:57:48.913000
2011-06-07T11:26:07.093000
6,264,193
6,264,447
Best way to update MySQL table with random values from another table
For this (pseudo code) example I have two tables in MySQL: member { id, name } names { name } There are 100 members in member and 10 names. I want to use a random name from names to update the member table. So far I've got this, but, not sure if there is a better method to achieve it. UPDATE member SET name = (SELECT n...
You could avoid ordering by rand() by adding id column to your names table and using: UPDATE member SET name = (SELECT name FROM names WHERE id=floor(1 + rand()*10 ) ); With only 10 names the result won't be much faster, but you would see the difference if you wanted to choose from a bigger set of names as sorting by r...
Best way to update MySQL table with random values from another table For this (pseudo code) example I have two tables in MySQL: member { id, name } names { name } There are 100 members in member and 10 names. I want to use a random name from names to update the member table. So far I've got this, but, not sure if there...
TITLE: Best way to update MySQL table with random values from another table QUESTION: For this (pseudo code) example I have two tables in MySQL: member { id, name } names { name } There are 100 members in member and 10 names. I want to use a random name from names to update the member table. So far I've got this, but,...
[ "mysql" ]
6
6
8,246
2
0
2011-06-07T10:58:14.160000
2011-06-07T11:22:46.700000
6,264,196
6,264,797
Parse Weather Forecast Data (from the NDFD) in c#
I am using > http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl webservice to get the weather detials by calling GmlTimeSeries webmethod. Now I just want to read temparature, weather icon link details from the xml. The xml has huge data. Can anybody give an idea to fetch the required data from the xml? NDFD...
I think you will find your answer here Edit: you need to use namespace, for example: XNamespace app = "http://www.weather.gov/forecasts/xml/OGC_services"; var result = from i in doc.Descendants(app+"Forecast_Gml2Point") select new { temperature = i.Element(app + "temperature"), icon = i.Element(app+"weatherIcon") }; Ed...
Parse Weather Forecast Data (from the NDFD) in c# I am using > http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl webservice to get the weather detials by calling GmlTimeSeries webmethod. Now I just want to read temparature, weather icon link details from the xml. The xml has huge data. Can anybody give an ...
TITLE: Parse Weather Forecast Data (from the NDFD) in c# QUESTION: I am using > http://www.weather.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML.wsdl webservice to get the weather detials by calling GmlTimeSeries webmethod. Now I just want to read temparature, weather icon link details from the xml. The xml has huge data. Ca...
[ "c#", "xml", "weather-api" ]
1
3
2,861
2
0
2011-06-07T10:58:39.303000
2011-06-07T11:55:15.893000
6,264,199
6,264,285
jquery .html function remove part of a text within a div
in my question one suggested to do: $(".entry").html(function(i, htm){ return htm.split("-")[0]; }); To remove Approuved - Expire May 18 th 2012 but this remove Source: SuperSite also and i would like to keep the source Published May 18th 2011 - Approuved - Expire May 18 th 2012 Source: SuperSite I would like to remove...
$(".entry").html(function(i, htm){ var retStr = htm.split("-")[0] return retStr+htm.split(" ")[1]; }); You return only what is placed before the first '-'. You have to add what it's placed after the tag. Code snippet is only for give you an idea. It's a little bit dirty but you can start from it.
jquery .html function remove part of a text within a div in my question one suggested to do: $(".entry").html(function(i, htm){ return htm.split("-")[0]; }); To remove Approuved - Expire May 18 th 2012 but this remove Source: SuperSite also and i would like to keep the source Published May 18th 2011 - Approuved - Expir...
TITLE: jquery .html function remove part of a text within a div QUESTION: in my question one suggested to do: $(".entry").html(function(i, htm){ return htm.split("-")[0]; }); To remove Approuved - Expire May 18 th 2012 but this remove Source: SuperSite also and i would like to keep the source Published May 18th 2011 -...
[ "jquery" ]
1
0
1,015
2
0
2011-06-07T10:59:20.350000
2011-06-07T11:07:13.600000
6,264,203
6,265,099
rails create error
I have a threaded Post using Ancestry. When replying to a Post from another user I get: on the line: @post = current_user.posts.new(params[:post]) Started POST "/posts.js" for 127.0.0.1 at Tue Jun 07 13:50:19 +0300 2011 Processing by PostsController#create as JS Parameters: {"commit"=>"Post", "post"=>{"body"=>" a ", "p...
My first pass would be to open rails console (at the prompt type 'rails console') and then try the following: >> x = Post.find(5) If you find it check the user_id on that record. Does it actually exist? If so, that's good to know. Next I would take the SQL in your output above and run it manually in whatever db you use...
rails create error I have a threaded Post using Ancestry. When replying to a Post from another user I get: on the line: @post = current_user.posts.new(params[:post]) Started POST "/posts.js" for 127.0.0.1 at Tue Jun 07 13:50:19 +0300 2011 Processing by PostsController#create as JS Parameters: {"commit"=>"Post", "post"=...
TITLE: rails create error QUESTION: I have a threaded Post using Ancestry. When replying to a Post from another user I get: on the line: @post = current_user.posts.new(params[:post]) Started POST "/posts.js" for 127.0.0.1 at Tue Jun 07 13:50:19 +0300 2011 Processing by PostsController#create as JS Parameters: {"commit...
[ "ruby-on-rails", "activerecord" ]
0
0
272
1
0
2011-06-07T10:59:35.893000
2011-06-07T12:24:33.390000
6,264,205
6,265,199
R readLines read only last line of a file
Possible Duplicate: Reading the last n lines from a huge text file I have created a connection to a file using con=file(path_of_myfile) Now I want to read only the last line without loading everything (it is a HUGE file). I am trying to use?readLines with no success. Any idea?
Since you are on Windows, download and install Duncan's Rtools which you would need anyways if you wanted to build R packages yourself. (If you were on Linux then the only difference is that you would not need to download anything since gawk is already there.) Then issue this R command: system("gawk 'END {print}' myfil...
R readLines read only last line of a file Possible Duplicate: Reading the last n lines from a huge text file I have created a connection to a file using con=file(path_of_myfile) Now I want to read only the last line without loading everything (it is a HUGE file). I am trying to use?readLines with no success. Any idea?
TITLE: R readLines read only last line of a file QUESTION: Possible Duplicate: Reading the last n lines from a huge text file I have created a connection to a file using con=file(path_of_myfile) Now I want to read only the last line without loading everything (it is a HUGE file). I am trying to use?readLines with no s...
[ "r" ]
2
8
7,036
2
0
2011-06-07T10:59:39.867000
2011-06-07T12:34:26.383000
6,264,237
6,268,385
Solr commit taking too long
My commit seems to be taking too much time, if you notice from the Dataimport status given below to commit 1000 docs its taking longer than 24 minutes busy A command is still running... 0:24:43.156 1001 1658 0 2011-06-07 09:15:17 Indexing completed. Added/Updated: 1000 documents. Deleted 0 documents. What can be causin...
I don't know if you use solrj public abstract class SolrServer but if you do, you really need to index by chuncks/collections: public UpdateResponse add(Collection docs ) and not one by one
Solr commit taking too long My commit seems to be taking too much time, if you notice from the Dataimport status given below to commit 1000 docs its taking longer than 24 minutes busy A command is still running... 0:24:43.156 1001 1658 0 2011-06-07 09:15:17 Indexing completed. Added/Updated: 1000 documents. Deleted 0 d...
TITLE: Solr commit taking too long QUESTION: My commit seems to be taking too much time, if you notice from the Dataimport status given below to commit 1000 docs its taking longer than 24 minutes busy A command is still running... 0:24:43.156 1001 1658 0 2011-06-07 09:15:17 Indexing completed. Added/Updated: 1000 docu...
[ "lucene", "solr" ]
1
1
1,999
2
0
2011-06-07T11:04:00.710000
2011-06-07T16:18:03.990000
6,264,243
6,264,305
How to retain field values on error in a dynamic gridview?
I have a page which has a GridView on it, which is populated from a database. Some of the columns in the GridView have text boxes, as well as Checkboxes. When the user saves the page, the page may error if they have not entered their data correctly. At this point, I need to re-display what they have entered already so ...
e.Cancel = true; will do the trick protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e) { e.Cancel = true; //Display Message here }
How to retain field values on error in a dynamic gridview? I have a page which has a GridView on it, which is populated from a database. Some of the columns in the GridView have text boxes, as well as Checkboxes. When the user saves the page, the page may error if they have not entered their data correctly. At this poi...
TITLE: How to retain field values on error in a dynamic gridview? QUESTION: I have a page which has a GridView on it, which is populated from a database. Some of the columns in the GridView have text boxes, as well as Checkboxes. When the user saves the page, the page may error if they have not entered their data corr...
[ "asp.net", "vb.net", "gridview" ]
1
0
136
1
0
2011-06-07T11:04:26.627000
2011-06-07T11:08:45.340000
6,264,249
6,264,256
How does the compilation/linking process work?
How does the compilation and linking process work? (Note: This is meant to be an entry to Stack Overflow's C++ FAQ. If you want to critique the idea of providing an FAQ in this form, then the posting on meta that started all this would be the place to do that. Answers to that question are monitored in the C++ chatroom,...
The compilation of a C++ program involves three steps: Preprocessing: the preprocessor takes a C++ source code file and deals with the #include s, #define s and other preprocessor directives. The output of this step is a "pure" C++ file without pre-processor directives. Compilation: the compiler takes the pre-processor...
How does the compilation/linking process work? How does the compilation and linking process work? (Note: This is meant to be an entry to Stack Overflow's C++ FAQ. If you want to critique the idea of providing an FAQ in this form, then the posting on meta that started all this would be the place to do that. Answers to t...
TITLE: How does the compilation/linking process work? QUESTION: How does the compilation and linking process work? (Note: This is meant to be an entry to Stack Overflow's C++ FAQ. If you want to critique the idea of providing an FAQ in this form, then the posting on meta that started all this would be the place to do ...
[ "c++", "compiler-construction", "linker", "c++-faq" ]
521
696
296,496
5
0
2011-06-07T11:04:33.047000
2011-06-07T11:05:06.887000
6,264,250
6,264,398
Converting Python regex to VisualBasic
I'm converting a python application to VB.net and I need help with this regular expression: a = 'abcdef' b = re.compile('[' + a + ']{3,}$', re.I) Is it possible to convert it to Visual Basic, if so, can you provide any code?
Dim b As New Regex("[" + a + "]{3,}$", RegexOptions.IgnoreCase) I fail to see the problem, though.
Converting Python regex to VisualBasic I'm converting a python application to VB.net and I need help with this regular expression: a = 'abcdef' b = re.compile('[' + a + ']{3,}$', re.I) Is it possible to convert it to Visual Basic, if so, can you provide any code?
TITLE: Converting Python regex to VisualBasic QUESTION: I'm converting a python application to VB.net and I need help with this regular expression: a = 'abcdef' b = re.compile('[' + a + ']{3,}$', re.I) Is it possible to convert it to Visual Basic, if so, can you provide any code? ANSWER: Dim b As New Regex("[" + a + ...
[ "python", "regex", "vb.net" ]
2
4
170
1
0
2011-06-07T11:04:35.090000
2011-06-07T11:18:15.297000
6,264,263
6,264,575
Performing multiple regex matches to same index with pymongo
I need to translate some MySQL to mongodb. I have a MySQL query with multiple regular expression matches on one column. Is it possible to do the same thing with mongodb? SELECT * FROM table WHERE column1 REGEXP r1 AND column1 REGEXP r2 AND colum1 REGEXP r3; With pymongo I can perform regex searches with single regex li...
db.collection.find({"column1": {"$all": [re.compile("r1"), re.compile("r2")]}}) Also take a look at future $and operator. BTW unless your regexp is prefix-like ( /^text/ ) the index won't be used.
Performing multiple regex matches to same index with pymongo I need to translate some MySQL to mongodb. I have a MySQL query with multiple regular expression matches on one column. Is it possible to do the same thing with mongodb? SELECT * FROM table WHERE column1 REGEXP r1 AND column1 REGEXP r2 AND colum1 REGEXP r3; W...
TITLE: Performing multiple regex matches to same index with pymongo QUESTION: I need to translate some MySQL to mongodb. I have a MySQL query with multiple regular expression matches on one column. Is it possible to do the same thing with mongodb? SELECT * FROM table WHERE column1 REGEXP r1 AND column1 REGEXP r2 AND c...
[ "python", "mysql", "mongodb", "pymongo" ]
1
6
1,160
1
0
2011-06-07T11:05:27.077000
2011-06-07T11:35:06.360000
6,264,264
6,265,715
Question About The C++ Programming Language
In Chapter 24.3.4 of the book The C++ Programming Language it said that class Cfield: public Field{ /*...*/ } This expresses the notion that a Cfield really is a kind of Field, allows notational convenience when writing a Cfield function that uses a member of the Field part of the Cfield, and - most importantly - allow...
Let's give a concrete example: struct Field { Field(char const* s): string(s) {} char const* string; }; struct CField: Field { CField(char const* s): Field(s), length(s?::strlen(s): 0) {} std::size_t length; }; This is a very basic kind of string, that does not allow modification of the string it refers too. CField au...
Question About The C++ Programming Language In Chapter 24.3.4 of the book The C++ Programming Language it said that class Cfield: public Field{ /*...*/ } This expresses the notion that a Cfield really is a kind of Field, allows notational convenience when writing a Cfield function that uses a member of the Field part o...
TITLE: Question About The C++ Programming Language QUESTION: In Chapter 24.3.4 of the book The C++ Programming Language it said that class Cfield: public Field{ /*...*/ } This expresses the notion that a Cfield really is a kind of Field, allows notational convenience when writing a Cfield function that uses a member o...
[ "c++", "inheritance" ]
4
1
300
3
0
2011-06-07T11:05:27.797000
2011-06-07T13:12:54.133000
6,264,274
6,264,569
Tristate values -- is there a convention?
I've been thrown a bit of a poser, and I'm not sure what the answer is. Basically - is there a convention for what values to use in tristate data-types? Doing some googling around, it doesn't look like there is: I've seen: -1 = False, 0 = Not known/undefined, +1 = True 0 = False, +1 = True, +2 = Not known/undefined -1 ...
To my knowledge, there is no convention for that. There isn't even a single convention for a boolean value, the most common are: 0 = False, -1 = True 0 = False, 1 = True Another common (but not universal) convention that would be relevant is the usage of -1 for undefined values. If you choose to use -1 for undefined, y...
Tristate values -- is there a convention? I've been thrown a bit of a poser, and I'm not sure what the answer is. Basically - is there a convention for what values to use in tristate data-types? Doing some googling around, it doesn't look like there is: I've seen: -1 = False, 0 = Not known/undefined, +1 = True 0 = Fals...
TITLE: Tristate values -- is there a convention? QUESTION: I've been thrown a bit of a poser, and I'm not sure what the answer is. Basically - is there a convention for what values to use in tristate data-types? Doing some googling around, it doesn't look like there is: I've seen: -1 = False, 0 = Not known/undefined, ...
[ "language-agnostic", "tri-state-logic" ]
8
4
3,260
4
0
2011-06-07T11:06:23.780000
2011-06-07T11:34:25.530000
6,264,288
6,264,359
GWT checking if textbox is empty
Im working on a school project and i'm trying to check in GWT if a textbox i create is empty or not. I have done the exact same thing on another project and there it worked fine. i have searched for the answer here and on google but couldn't find any answer. voornaamTB = new TextBox(); voornaamTB.setText(null); ok.add...
Something like: if(!voornaamTB.getText().isEmpty()) {... will work. You're currently testing to see whether the TextBox itself is null, which it isn't as you initialized it on the first line. You probably don't need the setText(null) after immediately creating it.
GWT checking if textbox is empty Im working on a school project and i'm trying to check in GWT if a textbox i create is empty or not. I have done the exact same thing on another project and there it worked fine. i have searched for the answer here and on google but couldn't find any answer. voornaamTB = new TextBox(); ...
TITLE: GWT checking if textbox is empty QUESTION: Im working on a school project and i'm trying to check in GWT if a textbox i create is empty or not. I have done the exact same thing on another project and there it worked fine. i have searched for the answer here and on google but couldn't find any answer. voornaamTB...
[ "gwt", "textbox" ]
0
2
5,029
2
0
2011-06-07T11:07:26.500000
2011-06-07T11:13:44.760000
6,264,309
6,264,342
Simultaneously run java programs run on same JVM?
Suppose I run two java programs simultaneously on the same machine. Will the programs run in a single instance of JVM or will they run in two different instances of JVM?
If you start each one with the java command (from the command line) they will run as totally separate JVMs. "Programs" may be started as separate Threads running inside the one JVM.
Simultaneously run java programs run on same JVM? Suppose I run two java programs simultaneously on the same machine. Will the programs run in a single instance of JVM or will they run in two different instances of JVM?
TITLE: Simultaneously run java programs run on same JVM? QUESTION: Suppose I run two java programs simultaneously on the same machine. Will the programs run in a single instance of JVM or will they run in two different instances of JVM? ANSWER: If you start each one with the java command (from the command line) they ...
[ "java", "jvm" ]
26
24
15,578
6
0
2011-06-07T11:09:19.987000
2011-06-07T11:12:13.040000
6,264,310
6,264,395
Android context menu on async filled listview
I have a listview which is filled by AsyncTask and I am trying to create a context menu.... @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; int posi...
Try overriding onPrepareContextMenu, this method is called every time the context menu is opening. Hope this helps.
Android context menu on async filled listview I have a listview which is filled by AsyncTask and I am trying to create a context menu.... @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterContextMenuInfo info...
TITLE: Android context menu on async filled listview QUESTION: I have a listview which is filled by AsyncTask and I am trying to create a context menu.... @Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); AdapterCo...
[ "android", "listview", "contextmenu", "android-asynctask" ]
0
0
375
1
0
2011-06-07T11:09:25.887000
2011-06-07T11:17:39.250000
6,264,313
6,264,542
How to get ARP bindings from the file into array
I am trying to get the ARP table in Linux to an array with code posted below. I always get the addresses in the variables ip and mac, but when assigning to the array, it just shows some crazy numbers. Am I doing sth wrong? (I am not really skilled in programming) struct ARP_entry { char IPaddr; char MACaddr; char ARPst...
You need to fix your structure and make the char variables into char arrays: struct ARP_entry { char IPaddr[16]; char MACaddr[18]; char ARPstatus; int timec; }; Then you need to do proper copies of the data so you can preserve them: if ( ARP_table_vel > i) { snprintf(ARP_table[i].IPaddr, 16, "%s", ip); snprintf(ARP_tab...
How to get ARP bindings from the file into array I am trying to get the ARP table in Linux to an array with code posted below. I always get the addresses in the variables ip and mac, but when assigning to the array, it just shows some crazy numbers. Am I doing sth wrong? (I am not really skilled in programming) struct ...
TITLE: How to get ARP bindings from the file into array QUESTION: I am trying to get the ARP table in Linux to an array with code posted below. I always get the addresses in the variables ip and mac, but when assigning to the array, it just shows some crazy numbers. Am I doing sth wrong? (I am not really skilled in pr...
[ "c", "arp" ]
0
0
1,661
1
0
2011-06-07T11:09:39.113000
2011-06-07T11:31:40.943000
6,264,325
6,264,817
CakePHP - Only display a link if user (ARO) has permission for page?
I'm using CakePHP's ACL component to manage permissions for my app. I have about three different "Roles", with different access levels. I am using the HTML helper throughout, to create links to different pages. I would like links to only display if the user has permission to access the page. The obvious but cumbersome ...
I wouldn't recommend to use a helper which has this sort of functionality. This is because this helper would have to do the checking on every link you use on that page. This would slow down your application. So I think the best approach is your approach. Set the permission on login and display your links accordingly. W...
CakePHP - Only display a link if user (ARO) has permission for page? I'm using CakePHP's ACL component to manage permissions for my app. I have about three different "Roles", with different access levels. I am using the HTML helper throughout, to create links to different pages. I would like links to only display if th...
TITLE: CakePHP - Only display a link if user (ARO) has permission for page? QUESTION: I'm using CakePHP's ACL component to manage permissions for my app. I have about three different "Roles", with different access levels. I am using the HTML helper throughout, to create links to different pages. I would like links to ...
[ "cakephp", "cakephp-1.3", "access-control" ]
0
1
434
1
0
2011-06-07T11:10:56.733000
2011-06-07T11:57:09.963000
6,264,328
6,264,818
Inferring generic types of nested static generic functions
Is the Java compiler able to infer the type of a generic static function from its context as the argument to another generic static function? For example, I have a simple Pair class: public class Pair { private final F mFirst; private final S mSecond; public Pair(F first, S second) { mFirst = checkNotNull(first); mS...
Type inference is nasty and complicated. They have to stop somewhere. Consider static T foo(); String s = foo(); print( foo() ) In the assignment context, the intention of the programmer is clear, T should be String In the next line, not so much. The print method is not a very fair example, it is heavily overloaded. ...
Inferring generic types of nested static generic functions Is the Java compiler able to infer the type of a generic static function from its context as the argument to another generic static function? For example, I have a simple Pair class: public class Pair { private final F mFirst; private final S mSecond; public...
TITLE: Inferring generic types of nested static generic functions QUESTION: Is the Java compiler able to infer the type of a generic static function from its context as the argument to another generic static function? For example, I have a simple Pair class: public class Pair { private final F mFirst; private final ...
[ "java", "generics", "guava", "type-inference" ]
12
4
2,038
3
0
2011-06-07T11:11:07.490000
2011-06-07T11:57:12.820000
6,264,349
6,264,414
Why "this" is pointing to something else in Javascript recursive function?
Consider the following JavaScript code which has a recursive boom function function foo() { this.arr = [1, 2, 3, 4, 5]; this.output = ""; this.get_something = function(n, callback) { this.output += "(" + n + ")"; $.get("...", function(result) { // do something with 'result' callback(); }); }; this.boom = function() {...
The problem is in Ajax requests and function call context The problem you're having is function call context when boom gets called after you've received data from the server. Change your code to this and things should start working: this.get_something = function(n, callback) { var context = this; this.output += "(" + n...
Why "this" is pointing to something else in Javascript recursive function? Consider the following JavaScript code which has a recursive boom function function foo() { this.arr = [1, 2, 3, 4, 5]; this.output = ""; this.get_something = function(n, callback) { this.output += "(" + n + ")"; $.get("...", function(result) {...
TITLE: Why "this" is pointing to something else in Javascript recursive function? QUESTION: Consider the following JavaScript code which has a recursive boom function function foo() { this.arr = [1, 2, 3, 4, 5]; this.output = ""; this.get_something = function(n, callback) { this.output += "(" + n + ")"; $.get("...", ...
[ "javascript", "jquery" ]
2
1
165
2
0
2011-06-07T11:12:47.130000
2011-06-07T11:19:21.267000
6,264,356
6,264,994
IE not populating select through ajax request
Hi I have two dropdowns and I am populating second one on the basis of first one. My first select is ABC DEF And I populate second select box on the basis of first one which is Here is my populate_users method function populate_users(project_id) { var url=' url(array(),'admin/clientproject1'));?>'; url2=url+'project_id...
You should return a json string of values and create the option elements in javascript. Then inject those option elements into your select. A bit more coding, but it's better.
IE not populating select through ajax request Hi I have two dropdowns and I am populating second one on the basis of first one. My first select is ABC DEF And I populate second select box on the basis of first one which is Here is my populate_users method function populate_users(project_id) { var url=' url(array(),'adm...
TITLE: IE not populating select through ajax request QUESTION: Hi I have two dropdowns and I am populating second one on the basis of first one. My first select is ABC DEF And I populate second select box on the basis of first one which is Here is my populate_users method function populate_users(project_id) { var url=...
[ "php", "javascript", "jquery" ]
0
1
470
3
0
2011-06-07T11:13:22.670000
2011-06-07T12:16:00.403000
6,264,361
6,264,475
How to add or remove a many-to-many relationship in Entity Framework?
There's a many-to-many UserFeed table that stands between User and Feed and denotes a twitter-like follow relationship. It only has two fields, which form a composite key: UserID and FeedID. I need to write a method that will subscribe or unsubscribe a user from a feed based on a boolean flag. public void SetSubscripti...
You can use dummy objects - it definitely works for insert and I hope it can be used for delete as well: Create new relation: var user = new User() { Id = userId }; context.Users.Attach(user); var store = new Store() { Id = storeId }; context.Stores.Attach(store); // Now context trackes both entities as "existing" // ...
How to add or remove a many-to-many relationship in Entity Framework? There's a many-to-many UserFeed table that stands between User and Feed and denotes a twitter-like follow relationship. It only has two fields, which form a composite key: UserID and FeedID. I need to write a method that will subscribe or unsubscribe...
TITLE: How to add or remove a many-to-many relationship in Entity Framework? QUESTION: There's a many-to-many UserFeed table that stands between User and Feed and denotes a twitter-like follow relationship. It only has two fields, which form a composite key: UserID and FeedID. I need to write a method that will subscr...
[ "c#", "entity-framework", "entity-framework-4", "linq-to-entities", "many-to-many" ]
2
7
5,598
1
0
2011-06-07T11:14:04.313000
2011-06-07T11:24:39.130000
6,264,363
6,264,655
Cannot download patch from Embarcadero web site
I have a possible Delphi bug (oh, damn it, I used again the word 'bug') and I think this QC might help me: ID: 28269, IDE hangs when following "uses" links When I want to download it it says that: To download this, you must have registered: Your existing free membership And I have one (I am a Delphi Pro edition custome...
There is no patch there. Looks like the author Micha Kleidt made a mistake by posting the above information to cc (code central) instead of qc (quality central).
Cannot download patch from Embarcadero web site I have a possible Delphi bug (oh, damn it, I used again the word 'bug') and I think this QC might help me: ID: 28269, IDE hangs when following "uses" links When I want to download it it says that: To download this, you must have registered: Your existing free membership A...
TITLE: Cannot download patch from Embarcadero web site QUESTION: I have a possible Delphi bug (oh, damn it, I used again the word 'bug') and I think this QC might help me: ID: 28269, IDE hangs when following "uses" links When I want to download it it says that: To download this, you must have registered: Your existing...
[ "delphi", "delphi-xe" ]
0
4
205
1
0
2011-06-07T11:14:13.287000
2011-06-07T11:42:12.457000
6,264,368
6,268,346
escaped Ambersand in JSF i18n Resource Bundle
i have something like where the value of myText in the messages.properties is myText=My News The first line of the example works fine and replaces the text to "My News", but the second that uses a value from the resource bundle escapes the ambersand, too "My&#160;News". I tried also to use unicode escape sequences for ...
EDIT - Answer to clarified question The first is obviously inline, so interpreter knows that this is safe. The second one comes from external source (you are using Expression Language) and as such is not safe and need to be escaped. The result of escaping would be as you wrote, basically it will show you the exact valu...
escaped Ambersand in JSF i18n Resource Bundle i have something like where the value of myText in the messages.properties is myText=My News The first line of the example works fine and replaces the text to "My News", but the second that uses a value from the resource bundle escapes the ambersand, too "My&#160;News". I t...
TITLE: escaped Ambersand in JSF i18n Resource Bundle QUESTION: i have something like where the value of myText in the messages.properties is myText=My News The first line of the example works fine and replaces the text to "My News", but the second that uses a value from the resource bundle escapes the ambersand, too "...
[ "jsf", "internationalization" ]
0
1
1,052
1
0
2011-06-07T11:14:51.247000
2011-06-07T16:15:33.960000
6,264,372
6,264,416
Allowing only localhost to access a folder where all inclusive php files exist
We all have php files like 'connect_db.php' for include purposes only. Suppose I have all those inclusive.php files in "www/html/INC" And I have index.php I want index.php accessible from browser to everyone, but I want to prevent users' direct access to "www/html/INC" folder. (e.g. when type in the browser 'www.domain...
How do I achieve this? Don't. As per my previous answer, it's much more secure to put connect_db.php in /www/, not in /www/html/INC/. If you are going to do so, then you'd use /www/html/.htaccess: order allow,deny deny from all
Allowing only localhost to access a folder where all inclusive php files exist We all have php files like 'connect_db.php' for include purposes only. Suppose I have all those inclusive.php files in "www/html/INC" And I have index.php I want index.php accessible from browser to everyone, but I want to prevent users' dir...
TITLE: Allowing only localhost to access a folder where all inclusive php files exist QUESTION: We all have php files like 'connect_db.php' for include purposes only. Suppose I have all those inclusive.php files in "www/html/INC" And I have index.php I want index.php accessible from browser to everyone, but I want to ...
[ "php", ".htaccess" ]
9
6
51,289
5
0
2011-06-07T11:15:01.847000
2011-06-07T11:19:27.663000
6,264,373
6,264,413
when i upload a file it showing error like c:\inetpub\vhosts
I have develop a small web application in asp.net (c#) for uploading files into data base it is working fine in my local machine.But when i tested in the server it showing error like C:\inetpub\vhosts\crosstouch.com\httpdocs\Images\100898.jpeg' is denied what can i do to resolve this problem please help me....
By default the you wont have write access to this directory. See this note for IIS6 or search MSDN for whatever version you're using. http://support.microsoft.com/kb/816117
when i upload a file it showing error like c:\inetpub\vhosts I have develop a small web application in asp.net (c#) for uploading files into data base it is working fine in my local machine.But when i tested in the server it showing error like C:\inetpub\vhosts\crosstouch.com\httpdocs\Images\100898.jpeg' is denied what...
TITLE: when i upload a file it showing error like c:\inetpub\vhosts QUESTION: I have develop a small web application in asp.net (c#) for uploading files into data base it is working fine in my local machine.But when i tested in the server it showing error like C:\inetpub\vhosts\crosstouch.com\httpdocs\Images\100898.jp...
[ "c#", "asp.net" ]
0
2
838
3
0
2011-06-07T11:15:13.247000
2011-06-07T11:19:20.757000
6,264,380
6,264,436
Android: Virtual Keyboard: the use has no idea what EditText he is filling in
I have a few forms that the user has to fill in and I use EditText to enter the information. the problem is, when the user uses the virtual keyboard there no information about which field he is filling in. so its fine when there is only one field but when he has 4 or more he fills in the first one, presses next and he ...
You can add a hint, which pre-fills the EditText with a useful reminder (in a faded-out colour). This disappears when the user starts typing. android:hint="Type your name here"
Android: Virtual Keyboard: the use has no idea what EditText he is filling in I have a few forms that the user has to fill in and I use EditText to enter the information. the problem is, when the user uses the virtual keyboard there no information about which field he is filling in. so its fine when there is only one f...
TITLE: Android: Virtual Keyboard: the use has no idea what EditText he is filling in QUESTION: I have a few forms that the user has to fill in and I use EditText to enter the information. the problem is, when the user uses the virtual keyboard there no information about which field he is filling in. so its fine when t...
[ "android", "layout", "keyboard", "android-edittext" ]
0
2
294
2
0
2011-06-07T11:15:54.597000
2011-06-07T11:21:16.237000
6,264,396
6,264,435
excel vba subroutine call fails
I have the following problem. I want to call a soubroutine for changing the background color for a cell range. The cell range is calculated with cells(1,1) and then the address is calculated to receive A1. Before the subroutine is called I get the addresses for my cells like this: Range1 = cells(4, 4).Address(RowAbsolu...
You do not need quotes around RangeArea. RangeArea = Range1 & ":" & Range2 But then, why would you want to pass ranges around as strings and then convert them back to ranges? Pass the range objects all the time. Sub SetBGLightGrey(byval cells as range) With cells.Interior.Pattern = xlSolid.PatternColorIndex = xlAutomat...
excel vba subroutine call fails I have the following problem. I want to call a soubroutine for changing the background color for a cell range. The cell range is calculated with cells(1,1) and then the address is calculated to receive A1. Before the subroutine is called I get the addresses for my cells like this: Range1...
TITLE: excel vba subroutine call fails QUESTION: I have the following problem. I want to call a soubroutine for changing the background color for a cell range. The cell range is calculated with cells(1,1) and then the address is calculated to receive A1. Before the subroutine is called I get the addresses for my cells...
[ "excel", "vba", "subroutine" ]
0
2
593
1
0
2011-06-07T11:17:52.963000
2011-06-07T11:21:15.100000
6,264,438
6,264,492
How do I create a SQL Server function to return an int?
I'm trying to create a SQL Function that tests whether a parameter starts with a certain term or contains the term, but doesn't start with it. Basically, if the parameter starts with the term, the function returns a 0. Otherwise it returns a 1. This is the bones of the function that I have, which I'm trying to adapt fr...
You don't provide a variable name for the return value, just its type, and the parens are not needed; CREATE FUNCTION [dbo].[fnGetRelevance] ( @fieldName nvarchar(50), @searchTerm nvarchar(50) ) RETURNS int AS.... Also; select Data from @fieldName Will not work, you would need dynamic SQL to select from an object the ...
How do I create a SQL Server function to return an int? I'm trying to create a SQL Function that tests whether a parameter starts with a certain term or contains the term, but doesn't start with it. Basically, if the parameter starts with the term, the function returns a 0. Otherwise it returns a 1. This is the bones o...
TITLE: How do I create a SQL Server function to return an int? QUESTION: I'm trying to create a SQL Function that tests whether a parameter starts with a certain term or contains the term, but doesn't start with it. Basically, if the parameter starts with the term, the function returns a 0. Otherwise it returns a 1. T...
[ "sql", "sql-server", "t-sql", "sql-function" ]
11
13
94,041
4
0
2011-06-07T11:21:20.520000
2011-06-07T11:26:47.747000
6,264,439
6,265,078
java.lang.IllegalArgumentException: View not attached to window manager
I am using the following code. When i change orientation from portrait to landscape, and then again to portrait. it gives Exception "view not attached to window manager". how to solve this problem. thank you. public class Search_List_Activity extends Activity{ public static String keyword=null, category_get_id; public ...
This has been answered several time before... This is because when you change your orientation the Activity is getting created again. To handle this use th following code in your Activity in your manifest file. android:configChanges="keyboardHidden|orientation"
java.lang.IllegalArgumentException: View not attached to window manager I am using the following code. When i change orientation from portrait to landscape, and then again to portrait. it gives Exception "view not attached to window manager". how to solve this problem. thank you. public class Search_List_Activity exten...
TITLE: java.lang.IllegalArgumentException: View not attached to window manager QUESTION: I am using the following code. When i change orientation from portrait to landscape, and then again to portrait. it gives Exception "view not attached to window manager". how to solve this problem. thank you. public class Search_L...
[ "android", "exception", "orientation" ]
3
5
8,212
1
0
2011-06-07T11:21:40.777000
2011-06-07T12:22:55.397000
6,264,440
6,264,480
predefined function for minimum
Possible Duplicate: Is there a convenient function in objective-c / coca-touch to find a lowest number? #import int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int a=10,b=5,c; c=min(a,b); NSLog(@"min:%d",c); [pool drain]; return 0; } I have to calculate the mini...
There was already a discussion about this here. Objective-C includes a MIN(a,b) macro, which should suit your needs.
predefined function for minimum Possible Duplicate: Is there a convenient function in objective-c / coca-touch to find a lowest number? #import int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int a=10,b=5,c; c=min(a,b); NSLog(@"min:%d",c); [pool drain]; return 0...
TITLE: predefined function for minimum QUESTION: Possible Duplicate: Is there a convenient function in objective-c / coca-touch to find a lowest number? #import int main (int argc, const char * argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int a=10,b=5,c; c=min(a,b); NSLog(@"min:%d",c); [poo...
[ "objective-c" ]
10
22
19,516
1
0
2011-06-07T11:22:04.913000
2011-06-07T11:25:40.627000