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,250,691
6,252,311
Setting a label to a file with AppleScript
I'm trying to put a colored label on a file with AppleScript using the following code: set theFile to "HDD:Path:to:the:file.ext" tell application "Finder" set label of file theFile to 3 end tell but when I run it in a terminal with osascript theScript.scpt I get the following error: theScript.scpt:144:178: execution e...
It should be coded as a label index not a label and it needs to be an alias: set theFile to "HDD:Path:to:the:file.ext" as alias tell application "Finder" to set label index of theFile to 3
Setting a label to a file with AppleScript I'm trying to put a colored label on a file with AppleScript using the following code: set theFile to "HDD:Path:to:the:file.ext" tell application "Finder" set label of file theFile to 3 end tell but when I run it in a terminal with osascript theScript.scpt I get the following...
TITLE: Setting a label to a file with AppleScript QUESTION: I'm trying to put a colored label on a file with AppleScript using the following code: set theFile to "HDD:Path:to:the:file.ext" tell application "Finder" set label of file theFile to 3 end tell but when I run it in a terminal with osascript theScript.scpt I...
[ "macos", "terminal", "applescript", "label" ]
3
7
5,986
1
0
2011-06-06T10:27:53.910000
2011-06-06T12:54:03.960000
6,250,701
6,261,876
Box2d - Changing contact filter on the fly
Im using cocos2d (iOS) and box2d to create a game. I have come to the point where I need to change the contact filter mid simulation and wondering how to go about this. I need to use maskbits and categorybits, which is fine, im just unsure how to apply them to a b2body mid game. I'm thinking I may need to retrieve the ...
b2Filter filter; for ( b2Fixture* f = body->GetFixtureList(); f; f = f->GetNext() ) { f->GetFilterData( &filter ); filter.categoryBits =...; filter.maskBits =...; filter.groupIndex =...; f->SetFilterData( &filter ); } Obviously this would change the filter settings for all fixtures on a body - if you want to be more s...
Box2d - Changing contact filter on the fly Im using cocos2d (iOS) and box2d to create a game. I have come to the point where I need to change the contact filter mid simulation and wondering how to go about this. I need to use maskbits and categorybits, which is fine, im just unsure how to apply them to a b2body mid gam...
TITLE: Box2d - Changing contact filter on the fly QUESTION: Im using cocos2d (iOS) and box2d to create a game. I have come to the point where I need to change the contact filter mid simulation and wondering how to go about this. I need to use maskbits and categorybits, which is fine, im just unsure how to apply them t...
[ "objective-c", "cocos2d-iphone", "box2d", "objective-c++" ]
3
9
3,078
3
0
2011-06-06T10:28:48.897000
2011-06-07T07:25:11.140000
6,250,704
6,250,906
View image selected from file-system on client-side before upload?
I have an input tag on a form for selecting images to upload. I've attempted to change the a thumbnail displayed on the form next to the input to affirm to the user that their selection was the intended with the following jquery code: $('#FileToUpload').change(function () { $('#lowresDemo img').attr('src', $(this).val(...
It's possible with the File API (IE does not support the File API) Working example: http://jsfiddle.net/ugPDx/
View image selected from file-system on client-side before upload? I have an input tag on a form for selecting images to upload. I've attempted to change the a thumbnail displayed on the form next to the input to affirm to the user that their selection was the intended with the following jquery code: $('#FileToUpload')...
TITLE: View image selected from file-system on client-side before upload? QUESTION: I have an input tag on a form for selecting images to upload. I've attempted to change the a thumbnail displayed on the form next to the input to affirm to the user that their selection was the intended with the following jquery code: ...
[ "javascript", "jquery", "html", "forms" ]
14
42
21,840
2
0
2011-06-06T10:28:55.050000
2011-06-06T10:47:05.813000
6,250,706
6,250,932
Override Dictionary.Add
I need to know how to override the Add-method of a certain Dictionary in a certain static class. Any suggestions? If it matters, the dictionary looks like this: public static Dictionary Any suggestions?
You can't override the Add method of Dictionary<,> since it's non virtual. You can hide it by adding a method with the same name/signature in the derived class, but hiding isn't the same as overriding. If somebody casts to the base class he will still call the wrong Add. The correct way to do this is to create your own...
Override Dictionary.Add I need to know how to override the Add-method of a certain Dictionary in a certain static class. Any suggestions? If it matters, the dictionary looks like this: public static Dictionary Any suggestions?
TITLE: Override Dictionary.Add QUESTION: I need to know how to override the Add-method of a certain Dictionary in a certain static class. Any suggestions? If it matters, the dictionary looks like this: public static Dictionary Any suggestions? ANSWER: You can't override the Add method of Dictionary<,> since it's non ...
[ "c#", ".net", "windows-phone-7", "dictionary", "overriding" ]
24
42
25,550
5
0
2011-06-06T10:29:06.860000
2011-06-06T10:49:52.707000
6,250,719
6,250,759
How to fetch pdf file in Controller file in iphone
I have to read pdf file from my controller. How to load it? Thanks
You could use UIWebView to view the pdf file. Check the below SO post. Display pdf from the weburl iphone sdk Tutorial link1 From apple Using UIWebView to display select document types
How to fetch pdf file in Controller file in iphone I have to read pdf file from my controller. How to load it? Thanks
TITLE: How to fetch pdf file in Controller file in iphone QUESTION: I have to read pdf file from my controller. How to load it? Thanks ANSWER: You could use UIWebView to view the pdf file. Check the below SO post. Display pdf from the weburl iphone sdk Tutorial link1 From apple Using UIWebView to display select docum...
[ "iphone" ]
0
1
190
2
0
2011-06-06T10:30:19.307000
2011-06-06T10:33:47.280000
6,250,721
6,250,862
ASP.NET MVC cancel, not delete
I have two questions, both related to the same view: so there is view called ProductDetails which shows the details of a product. Each product can have the status: Available - in this case, two button are available "edit" and "remove"(which will change the status of the product to "Not available" but will not remove it...
This is more an issue of displaying the elements so I have added the CSS tag to your question as some alternative answers may rely on this. Personally I think trying to make a button look like a text link would be quite awkward, even once you turn off the border and background you have issues with lining up the text et...
ASP.NET MVC cancel, not delete I have two questions, both related to the same view: so there is view called ProductDetails which shows the details of a product. Each product can have the status: Available - in this case, two button are available "edit" and "remove"(which will change the status of the product to "Not av...
TITLE: ASP.NET MVC cancel, not delete QUESTION: I have two questions, both related to the same view: so there is view called ProductDetails which shows the details of a product. Each product can have the status: Available - in this case, two button are available "edit" and "remove"(which will change the status of the ...
[ "css", "asp.net-mvc-2" ]
0
0
163
2
0
2011-06-06T10:30:25.923000
2011-06-06T10:43:24.407000
6,250,725
6,250,772
How to refresh Datagridview in vb.net
In my VB.net win form application, when I clicked Load button I am displaying a filename from a folder onto a Datagridview. Then after I click on Process button the file will be moved to another folder. After file has been moved, Grid has to be refreshed. Here is the code i have written. I can able to move the file but...
The Refresh() method only redraws the existing grid to the screen again. You will need to reload the grid's data by performing a "click". This can be done by calling the event directly or by using the PerformClick() method. Private Sub Process_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Pr...
How to refresh Datagridview in vb.net In my VB.net win form application, when I clicked Load button I am displaying a filename from a folder onto a Datagridview. Then after I click on Process button the file will be moved to another folder. After file has been moved, Grid has to be refreshed. Here is the code i have wr...
TITLE: How to refresh Datagridview in vb.net QUESTION: In my VB.net win form application, when I clicked Load button I am displaying a filename from a folder onto a Datagridview. Then after I click on Process button the file will be moved to another folder. After file has been moved, Grid has to be refreshed. Here is ...
[ ".net", "vb.net" ]
3
3
21,778
4
0
2011-06-06T10:30:45.853000
2011-06-06T10:34:58.950000
6,250,726
6,251,503
Trying to parse XML in Perl, but long data string gets cutoff
I've tried to parse an XML file with XML::Simple and XML::Twig with the same result. The other fields in the file works just fine. The file in question can be retrieved here: curl -s "http://apps.nlm.nih.gov/medlineplus/services/mpconnect_service.cfm?mainSearchCriteria.v.cs=2.16.840.1.113883.6.103&mainSearchCriteria.v....
I do get some weird results when parsing the curl as a pipe (using XML::Twig->new->parse( curl -s "http://..." | ): the content appears truncated, changes from call to call... Things look better if I parse a file created from the curl result, or XML::Twig's native parseurl method, then the result is constant, and what ...
Trying to parse XML in Perl, but long data string gets cutoff I've tried to parse an XML file with XML::Simple and XML::Twig with the same result. The other fields in the file works just fine. The file in question can be retrieved here: curl -s "http://apps.nlm.nih.gov/medlineplus/services/mpconnect_service.cfm?mainSea...
TITLE: Trying to parse XML in Perl, but long data string gets cutoff QUESTION: I've tried to parse an XML file with XML::Simple and XML::Twig with the same result. The other fields in the file works just fine. The file in question can be retrieved here: curl -s "http://apps.nlm.nih.gov/medlineplus/services/mpconnect_s...
[ "xml", "perl", "parsing" ]
2
2
1,108
1
0
2011-06-06T10:30:50.337000
2011-06-06T11:42:10.547000
6,250,733
6,252,251
Linq lambda join error
I have been following the book Pro ASP.net MVC 2 Framework, which I have found to be quite brilliant. But it's a real learning curve and now I'm stuck. In the book you build something like the below, which allows for paging. public ViewResult List([DefaultValue(0)] string cityzip, [DefaultValue(1)] int page) { var roo...
Here's my suggestion based on the OP's further description: 1) Create an aggregate class that holds both Room and RoomCoordinates info: public class RoomWithCoordinates { public Room Room { get; set; } public RoomCoordinates Coordinates { get; set; } } 2) Modify your controller action as follows: public ViewResult List...
Linq lambda join error I have been following the book Pro ASP.net MVC 2 Framework, which I have found to be quite brilliant. But it's a real learning curve and now I'm stuck. In the book you build something like the below, which allows for paging. public ViewResult List([DefaultValue(0)] string cityzip, [DefaultValue(1...
TITLE: Linq lambda join error QUESTION: I have been following the book Pro ASP.net MVC 2 Framework, which I have found to be quite brilliant. But it's a real learning curve and now I'm stuck. In the book you build something like the below, which allows for paging. public ViewResult List([DefaultValue(0)] string cityzi...
[ "c#", "lambda", "linq-to-entities" ]
3
1
1,074
2
0
2011-06-06T10:31:24.363000
2011-06-06T12:49:17.580000
6,250,735
6,251,082
Send/Receive Text and Data to bluetooth (Com Port) using C#
I am creating a program which can send test or data to Bluetooth devices. For this purpose I want to use the virtual serial ports supplied by Bluetooth software. Q. Is there is any way to send network stream to virtual serial port like socket programming in LAN? Q. How do I receive data form Bluetooth? Does it is in th...
1) Not certain about Bluetooth virtual ports, but I suspect that you can just use readFile/writeFile, (or the 'Ex' asynchronous versions), to the handle returned by CreateFile(), just like a 'normal' serial port. If so, you can handle the handle, (sorry!), just like the socket handle raised in a client socket connect()...
Send/Receive Text and Data to bluetooth (Com Port) using C# I am creating a program which can send test or data to Bluetooth devices. For this purpose I want to use the virtual serial ports supplied by Bluetooth software. Q. Is there is any way to send network stream to virtual serial port like socket programming in LA...
TITLE: Send/Receive Text and Data to bluetooth (Com Port) using C# QUESTION: I am creating a program which can send test or data to Bluetooth devices. For this purpose I want to use the virtual serial ports supplied by Bluetooth software. Q. Is there is any way to send network stream to virtual serial port like socket...
[ "c#", "bluetooth" ]
3
1
3,068
2
0
2011-06-06T10:31:31.853000
2011-06-06T11:04:30.143000
6,250,743
6,250,775
What to use in 'SmtpMail.SmtpServer = "???", in Microsoft Exchange Server
I am trying to write code to send a simple mail from asp.net page. Confusion is over what to write under "smtp server", when I want to send mail using Microsoft Outlook 2007. Two sets of code I'm trying:- 1.) MailMessage objMail = new MailMessage(); objMail.From = "angenlina.jolie@compnayabc.com"; objMail.To = "brad.pi...
Now my problem is what server name should I use for Micrsoft outlook 2007(MS exchange server)? Are you sending email via MAPI (using their "Outlook profile") or via SMTP through an Exchange Server? They're not the same. If you are sending through Exchange then the server will need to be configured to relay mail via SMT...
What to use in 'SmtpMail.SmtpServer = "???", in Microsoft Exchange Server I am trying to write code to send a simple mail from asp.net page. Confusion is over what to write under "smtp server", when I want to send mail using Microsoft Outlook 2007. Two sets of code I'm trying:- 1.) MailMessage objMail = new MailMessage...
TITLE: What to use in 'SmtpMail.SmtpServer = "???", in Microsoft Exchange Server QUESTION: I am trying to write code to send a simple mail from asp.net page. Confusion is over what to write under "smtp server", when I want to send mail using Microsoft Outlook 2007. Two sets of code I'm trying:- 1.) MailMessage objMail...
[ "c#", "outlook" ]
1
2
4,792
2
0
2011-06-06T10:32:06.313000
2011-06-06T10:35:16.827000
6,250,752
6,251,403
My App crashes if image size is larger than heap size
I am coding for audio, video, images streaming using JSON and doing image editing. In image editing there are two options - either use camera or pick image from gallery. The camera works fine. But when I pick image from gallery and when I choose image which is being snapped by camera and been stored in phone gallery, a...
You can not increase the heap on android devices, so you will need to hunt down memory leaks in your app to make sure you got as much heap free as possible.
My App crashes if image size is larger than heap size I am coding for audio, video, images streaming using JSON and doing image editing. In image editing there are two options - either use camera or pick image from gallery. The camera works fine. But when I pick image from gallery and when I choose image which is being...
TITLE: My App crashes if image size is larger than heap size QUESTION: I am coding for audio, video, images streaming using JSON and doing image editing. In image editing there are two options - either use camera or pick image from gallery. The camera works fine. But when I pick image from gallery and when I choose im...
[ "java", "android", "image", "heap-memory" ]
0
1
380
1
0
2011-06-06T10:33:22.710000
2011-06-06T11:32:45.323000
6,250,757
6,250,843
Add image on top of another based on CSS class
I have a bunch of img tags on one of the pages in my site. I want to be able to add a custom image on top of a few of these images based on the css class applied to them So in case of the statements below I want another image added on top of the 2nd image and nothing on the first image. Can I do this using CSS? Thanks....
No, you can't do it in pure CSS with just a single img element.:after is what you would use, but that doesn't work for img elements: Note. This specification does not fully define the interaction of:before and:after with replaced elements (such as IMG in HTML). This will be defined in more detail in a future specificat...
Add image on top of another based on CSS class I have a bunch of img tags on one of the pages in my site. I want to be able to add a custom image on top of a few of these images based on the css class applied to them So in case of the statements below I want another image added on top of the 2nd image and nothing on th...
TITLE: Add image on top of another based on CSS class QUESTION: I have a bunch of img tags on one of the pages in my site. I want to be able to add a custom image on top of a few of these images based on the css class applied to them So in case of the statements below I want another image added on top of the 2nd image...
[ "html", "css", "image" ]
0
1
12,418
2
0
2011-06-06T10:33:44.330000
2011-06-06T10:41:18.027000
6,250,761
6,250,832
A question about a standard way to hide a div in Javascript and jQuery
I'm still relatively new to javascript and jQuery and was just wondering this. Suppose I have this HTML snippet: Disclaimer! I could hide the div in the following ways: $(document).ready(function() { $('#hideButton').click(function() { if ($('#disclaimer').css('display') == 'none') { $('#disclaimer').show(); $('#hideBu...
i'd write that like this $(function() { $('#hideButton').click(function() { $('#disclaimer').toggle(); $(this).val( $('#disclaimer').is(":visible")? 'hide': 'unhide' ); }) }) or even $(function() { $('#hideButton').click(function() { $(this).val( $('#disclaimer').toggle().is(":visible")? 'hide': 'unhide' ) }) }) in res...
A question about a standard way to hide a div in Javascript and jQuery I'm still relatively new to javascript and jQuery and was just wondering this. Suppose I have this HTML snippet: Disclaimer! I could hide the div in the following ways: $(document).ready(function() { $('#hideButton').click(function() { if ($('#discl...
TITLE: A question about a standard way to hide a div in Javascript and jQuery QUESTION: I'm still relatively new to javascript and jQuery and was just wondering this. Suppose I have this HTML snippet: Disclaimer! I could hide the div in the following ways: $(document).ready(function() { $('#hideButton').click(function...
[ "javascript", "jquery" ]
1
6
257
4
0
2011-06-06T10:33:52.197000
2011-06-06T10:39:51.750000
6,250,766
6,252,671
ScrollView as subview does not respect frame boundaries
I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not. The subview is positioned so that it takes up about the bottom half of the screen, with a small - 20 pixels or so - margin at the bottom. Initially it displ...
I'm not 100% sure on this one, but worthy the shot: my guess is you're likely not setting the Bounds property correctly on your table. To solve this issue, the easiest way would be to set myscrollview.clipsToBounds = true.
ScrollView as subview does not respect frame boundaries I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not. The subview is positioned so that it takes up about the bottom half of the screen, with a small - 20...
TITLE: ScrollView as subview does not respect frame boundaries QUESTION: I have a UIScrollView (managed by a view controller) which I am using both full screen and as a subview. The full screen version works fine - the subview does not. The subview is positioned so that it takes up about the bottom half of the screen,...
[ "xamarin.ios", "scrollview" ]
1
3
1,088
2
0
2011-06-06T10:34:14.270000
2011-06-06T13:24:51.273000
6,250,770
6,250,820
Can't close C# application
I'm developing a C# application and when the user clicks on the X, the application gets minimized inside a trayicon. Like so: private void frmChat_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; Hide(); } The application is really simple (only one form). The problem is that I can't manage to prope...
I did something similar a while back. You need to know what is causing the form to close. So when you click on the X, there is a specific reason passed to the FormClosing event. Like so: private void MyForm_FormClosing(object sender, FormClosingEventArgs e) { // don't close just yet if we click on x if (e.CloseReason =...
Can't close C# application I'm developing a C# application and when the user clicks on the X, the application gets minimized inside a trayicon. Like so: private void frmChat_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; Hide(); } The application is really simple (only one form). The problem is t...
TITLE: Can't close C# application QUESTION: I'm developing a C# application and when the user clicks on the X, the application gets minimized inside a trayicon. Like so: private void frmChat_FormClosing(object sender, FormClosingEventArgs e) { e.Cancel = true; Hide(); } The application is really simple (only one form)...
[ "c#" ]
1
5
2,998
8
0
2011-06-06T10:34:38.563000
2011-06-06T10:39:01.463000
6,250,784
6,255,283
Hadoop 'grep' example
In Hadoop 'grep' example (that comes with the Hadoop package) what is the group parameter.Can you give me an example for that.
Disclaimer: I haven't run this example and am pulling answering after just looking at http://wiki.apache.org/hadoop/Grep The CLI call is: bin/hadoop org.apache.hadoop.examples.Grep [ ] and you want to know about. I suspect this is grouping in regex. (random link - http://www.exampledepot.com/egs/java.util.regex/Group.h...
Hadoop 'grep' example In Hadoop 'grep' example (that comes with the Hadoop package) what is the group parameter.Can you give me an example for that.
TITLE: Hadoop 'grep' example QUESTION: In Hadoop 'grep' example (that comes with the Hadoop package) what is the group parameter.Can you give me an example for that. ANSWER: Disclaimer: I haven't run this example and am pulling answering after just looking at http://wiki.apache.org/hadoop/Grep The CLI call is: bin/ha...
[ "hadoop", "mapreduce" ]
0
2
6,447
1
0
2011-06-06T10:36:18.157000
2011-06-06T16:45:10.367000
6,250,785
6,251,752
Taking Snapshot of a PDF using Python
Possible Duplicate: Converting a PDF to a series of images with Python I know the code to open a PDF file using Python: import os os.startfile('C:\file_name.pdf') My query is that whether it is possible for me to save a particular page of the pdf file as an image file (jpeg, png)?
It's look helpful for you: Converting a PDF to a series of images with Python
Taking Snapshot of a PDF using Python Possible Duplicate: Converting a PDF to a series of images with Python I know the code to open a PDF file using Python: import os os.startfile('C:\file_name.pdf') My query is that whether it is possible for me to save a particular page of the pdf file as an image file (jpeg, png)?
TITLE: Taking Snapshot of a PDF using Python QUESTION: Possible Duplicate: Converting a PDF to a series of images with Python I know the code to open a PDF file using Python: import os os.startfile('C:\file_name.pdf') My query is that whether it is possible for me to save a particular page of the pdf file as an image ...
[ "python", "image", "pdf", "png" ]
0
1
9,993
1
0
2011-06-06T10:36:19.767000
2011-06-06T12:06:32.077000
6,250,787
6,250,822
When does the while loop check for its condition
Hi I have something like: Version 1: bool noErrors = true; while(noErrors) { noErrors = ValidateControl(txtName); // other code } Version 2: bool noErrors = true; while(noErrors) { if(!ValidateControl(txtName)) break; // other code } I use this code to validate a form and if the validation returns false, I want to br...
Version 2 will break before running the //other code. Version 1 will not check until the start of the next iteration. bool noErrors = true; while(noErrors) { noErrors = ValidateControl(txtName); // other code } Checks before each iteration. bool noErrors = true; do { noErrors = ValidateControl(txtName); // other code }...
When does the while loop check for its condition Hi I have something like: Version 1: bool noErrors = true; while(noErrors) { noErrors = ValidateControl(txtName); // other code } Version 2: bool noErrors = true; while(noErrors) { if(!ValidateControl(txtName)) break; // other code } I use this code to validate a form ...
TITLE: When does the while loop check for its condition QUESTION: Hi I have something like: Version 1: bool noErrors = true; while(noErrors) { noErrors = ValidateControl(txtName); // other code } Version 2: bool noErrors = true; while(noErrors) { if(!ValidateControl(txtName)) break; // other code } I use this code t...
[ "c#", "while-loop" ]
3
4
18,242
8
0
2011-06-06T10:36:39.277000
2011-06-06T10:39:11.100000
6,250,791
6,250,968
Defining primary key as virtual in Entity Framework
What's the benefit of defining the primary key attribute as virtual in entity Framework? AFAIK, virtual is used for lazy loading in navigation properties and for change tracking in other properties. But we don't need any of the mentioned features in primary keys. So, Is it any use to define primary keys virtual?
Change tracking proxies are created only if all non-navigation mapped properties are virtual. MSDN: Each property that is mapped to a property of an entity type in the data model must have non-sealed (NotOverridable in Visual Basic), public, and virtual (Overridable in Visual Basic) get and set accessors.
Defining primary key as virtual in Entity Framework What's the benefit of defining the primary key attribute as virtual in entity Framework? AFAIK, virtual is used for lazy loading in navigation properties and for change tracking in other properties. But we don't need any of the mentioned features in primary keys. So, ...
TITLE: Defining primary key as virtual in Entity Framework QUESTION: What's the benefit of defining the primary key attribute as virtual in entity Framework? AFAIK, virtual is used for lazy loading in navigation properties and for change tracking in other properties. But we don't need any of the mentioned features in ...
[ "entity-framework", "primary-key", "virtual", "lazy-loading", "change-tracking" ]
0
2
689
1
0
2011-06-06T10:36:51.960000
2011-06-06T10:53:07.840000
6,250,798
6,252,039
How to trigger UI update on Activity when underlying datahandler receives data
I am creating an application which relies on data backend over Internet connection. This data is common between activities. Also, data will be kept refresh e.g. by updating it every two or three minutes. Therefore, I have created a data handler class, which should handle everything related to data downloading, parsing ...
Register your activity as a listener to the DataHandler and when the thread recieves data invoke any listeners. How are you presenting the data? If it's a ListView with an ArrayAdapter, then simply invoke the notifyDataSetChanged() on it as you get an update. You'll have to make sure you update the UI in an appropriate...
How to trigger UI update on Activity when underlying datahandler receives data I am creating an application which relies on data backend over Internet connection. This data is common between activities. Also, data will be kept refresh e.g. by updating it every two or three minutes. Therefore, I have created a data hand...
TITLE: How to trigger UI update on Activity when underlying datahandler receives data QUESTION: I am creating an application which relies on data backend over Internet connection. This data is common between activities. Also, data will be kept refresh e.g. by updating it every two or three minutes. Therefore, I have c...
[ "java", "android", "backend" ]
1
1
2,221
1
0
2011-06-06T10:37:18.310000
2011-06-06T12:31:46.543000
6,250,821
6,250,996
Date Validation using ASP.NET MVC 3.0
I've Date field on my MVC UI named "startDate", the user selects date using jquery date picker. As i wanted to validate that selected date should not be 2 months past and 2 months future. I've wrote the below code for validating the date. public sealed class DateAttribute: DataTypeAttribute { /// /// Initializes a new ...
function IsValid(object) { var theDate = new Date(object); var pointfrom = (theDate.getFullYear() * 100) + (theDate.getMonth()); var today = new Date(); if (pointfrom > (today.getFullYear() * 100) + (today.getMonth()) + 2) return false; if (pointfrom < (today.getFullYear() * 100) + (today.getMonth()) - 2) return false;...
Date Validation using ASP.NET MVC 3.0 I've Date field on my MVC UI named "startDate", the user selects date using jquery date picker. As i wanted to validate that selected date should not be 2 months past and 2 months future. I've wrote the below code for validating the date. public sealed class DateAttribute: DataType...
TITLE: Date Validation using ASP.NET MVC 3.0 QUESTION: I've Date field on my MVC UI named "startDate", the user selects date using jquery date picker. As i wanted to validate that selected date should not be 2 months past and 2 months future. I've wrote the below code for validating the date. public sealed class DateA...
[ "asp.net-mvc", "asp.net-mvc-3" ]
3
0
8,662
3
0
2011-06-06T10:39:10.870000
2011-06-06T10:56:18.260000
6,250,825
6,250,909
Should I begin learning PHP Framework?
I have known PHP basics, functional programming for a long time before. But this year, in my 2nd semester I have learned Object-Oriented Programming with Java. So I want to apply my knowledge of OOP to PHP. But I find it very difficult to think of any decent utilization. It's not like in Java everything is an object. I...
OOP is a methodology used to organise your code into meaningful, reusable entities and it doesn't alone answer to the question of "how to best organize your code to create web applications". Most of the web frameworks use Model-View-Controller architecture (MVC) along with OOP. In order to understand how web frameworks...
Should I begin learning PHP Framework? I have known PHP basics, functional programming for a long time before. But this year, in my 2nd semester I have learned Object-Oriented Programming with Java. So I want to apply my knowledge of OOP to PHP. But I find it very difficult to think of any decent utilization. It's not ...
TITLE: Should I begin learning PHP Framework? QUESTION: I have known PHP basics, functional programming for a long time before. But this year, in my 2nd semester I have learned Object-Oriented Programming with Java. So I want to apply my knowledge of OOP to PHP. But I find it very difficult to think of any decent util...
[ "php", "oop", "frameworks" ]
5
9
3,022
6
0
2011-06-06T10:39:29
2011-06-06T10:47:14.097000
6,250,837
6,251,325
How to Navigate one view to other view
I used button action to to pop sub view sing below code; - (IBAction)pickerUpBtn:(id)sender { PickerPopUpController *screen = [[PickerPopUpController alloc]initWithNibName:@"PickerPopUpController" bundle:Nil]; [self.view addSubview:screen.view]; [self presentModalViewController:screen animated:YES]; } after i need to ...
You need to put only that single code in the Button action..No need of making object of parentViewController. ie, -(IBAction)btnaction:(id)sender{ [self dismissModalViewControllerAnimated:YES]; }
How to Navigate one view to other view I used button action to to pop sub view sing below code; - (IBAction)pickerUpBtn:(id)sender { PickerPopUpController *screen = [[PickerPopUpController alloc]initWithNibName:@"PickerPopUpController" bundle:Nil]; [self.view addSubview:screen.view]; [self presentModalViewController:s...
TITLE: How to Navigate one view to other view QUESTION: I used button action to to pop sub view sing below code; - (IBAction)pickerUpBtn:(id)sender { PickerPopUpController *screen = [[PickerPopUpController alloc]initWithNibName:@"PickerPopUpController" bundle:Nil]; [self.view addSubview:screen.view]; [self presentMod...
[ "iphone", "ios4", "navigation", "uibutton", "subview" ]
0
2
1,777
4
0
2011-06-06T10:40:18.997000
2011-06-06T11:26:33.710000
6,250,851
6,250,901
Changing element places in jQuery
Possible Duplicate: Is there a native jQuery function to switch elements? I have list of items in my HTML, I want to change places of first and last element, but how can I do that with jQuery? I can get first and last elements, but how can I change their places (order) in list? Example HTML: 1 2 3 jQuery: var first = $...
This should be enough: first.appendTo(first.parent()); last.prependTo(last.parent()); Here a jsFiddle
Changing element places in jQuery Possible Duplicate: Is there a native jQuery function to switch elements? I have list of items in my HTML, I want to change places of first and last element, but how can I do that with jQuery? I can get first and last elements, but how can I change their places (order) in list? Example...
TITLE: Changing element places in jQuery QUESTION: Possible Duplicate: Is there a native jQuery function to switch elements? I have list of items in my HTML, I want to change places of first and last element, but how can I do that with jQuery? I can get first and last elements, but how can I change their places (order...
[ "jquery", "html" ]
2
6
10,618
3
0
2011-06-06T10:42:49.997000
2011-06-06T10:46:40.570000
6,250,870
6,257,729
Why does select max(field) from table work so fast as compared to select min(field) from table, Oracle 9i
i ran into the chance of running a select max statement in Oracle 9i and it ran very fast. select max(id) from audit_log; select min(id) from audit_log; However when running a select min, the query seems to hang and never return. This table has audit logs and some several hundred million records. Explain plan for sele...
It could be that your max value is in memory. If it is incrementing quickly it is likely in memory all the time. If no one is accessing the min value it would have to be retrieved. It could be that you are running into locking issues. Try changing the isolation level to see if that makes a difference. It could be that ...
Why does select max(field) from table work so fast as compared to select min(field) from table, Oracle 9i i ran into the chance of running a select max statement in Oracle 9i and it ran very fast. select max(id) from audit_log; select min(id) from audit_log; However when running a select min, the query seems to hang a...
TITLE: Why does select max(field) from table work so fast as compared to select min(field) from table, Oracle 9i QUESTION: i ran into the chance of running a select max statement in Oracle 9i and it ran very fast. select max(id) from audit_log; select min(id) from audit_log; However when running a select min, the que...
[ "oracle", "select", "max", "oracle9i", "min" ]
4
1
428
2
0
2011-06-06T10:44:06.220000
2011-06-06T20:34:00.997000
6,250,882
6,250,990
Detect FF4 using JS objects
I'm currently working on a site that detects the browser version by checking for various JS objects: var is = { ff: window.globalStorage, ie: document.all &&!window.opera, ie6:!window.XMLHttpRequest, ie7: document.all && window.XMLHttpRequest &&!XDomainRequest &&!window.opera, ie8: document.documentMode==8, opera: Bool...
Just check for something that was introduced with Gecko 2.0, such as selection.modify: window.globalStorage && window.getSelection().modify and window.globalStorage won't return all versions of FF, as it requires Gecko 1.8.1 / FF2
Detect FF4 using JS objects I'm currently working on a site that detects the browser version by checking for various JS objects: var is = { ff: window.globalStorage, ie: document.all &&!window.opera, ie6:!window.XMLHttpRequest, ie7: document.all && window.XMLHttpRequest &&!XDomainRequest &&!window.opera, ie8: document....
TITLE: Detect FF4 using JS objects QUESTION: I'm currently working on a site that detects the browser version by checking for various JS objects: var is = { ff: window.globalStorage, ie: document.all &&!window.opera, ie6:!window.XMLHttpRequest, ie7: document.all && window.XMLHttpRequest &&!XDomainRequest &&!window.ope...
[ "javascript", "firefox" ]
1
1
197
3
0
2011-06-06T10:45:10.433000
2011-06-06T10:55:14.890000
6,250,883
6,250,942
Joining a List in a different way
Language: C# 4.0 There is a List with values Value1, Value2, Value3 and so on. I would like to perform a join on the generic List so that the output should be string values = "Value1, Value2 and Value3"; and if there is only one value string values = "Value1"; I am currently replacing LastIndexOf, with and. But did not...
You can use the String.Join(string glue, string[] array); function for this. string values = String.Join(", ", myList.ToArray()); Hope that helps. ( Note: myList is the List you already have in your application somewhere.) Update: Noticed your and requirement a little too late, my appologies, here is a little update: s...
Joining a List in a different way Language: C# 4.0 There is a List with values Value1, Value2, Value3 and so on. I would like to perform a join on the generic List so that the output should be string values = "Value1, Value2 and Value3"; and if there is only one value string values = "Value1"; I am currently replacing ...
TITLE: Joining a List in a different way QUESTION: Language: C# 4.0 There is a List with values Value1, Value2, Value3 and so on. I would like to perform a join on the generic List so that the output should be string values = "Value1, Value2 and Value3"; and if there is only one value string values = "Value1"; I am cu...
[ "c#", "c#-4.0" ]
3
2
368
7
0
2011-06-06T10:45:13.490000
2011-06-06T10:50:50.227000
6,250,884
6,250,965
Is it possible to create a Facebook event via the Graph API on behalf of a page
Creating Facebook event for specific page with FB Graph API There is a thread here that explains how to do this using the PHP SDK. Is it also possible to accomplish this using JS?
for the graph api it does not matter if you called it from php or js. you do the exactly the same as with php-sdk: posting to the graph-url. FB.api('/graph/url', 'post',, );
Is it possible to create a Facebook event via the Graph API on behalf of a page Creating Facebook event for specific page with FB Graph API There is a thread here that explains how to do this using the PHP SDK. Is it also possible to accomplish this using JS?
TITLE: Is it possible to create a Facebook event via the Graph API on behalf of a page QUESTION: Creating Facebook event for specific page with FB Graph API There is a thread here that explains how to do this using the PHP SDK. Is it also possible to accomplish this using JS? ANSWER: for the graph api it does not mat...
[ "javascript", "facebook-graph-api" ]
0
1
365
2
0
2011-06-06T10:45:14.533000
2011-06-06T10:52:38.963000
6,250,890
6,251,014
NSDictionary memory issue
I was created one small business application..Here I got the data from server and Parsed it and then display the data... Here The datas are stored in NSDictionary....For the use of NSDictionary i took Large amount of memory..Any replacement for NSDictionary and it will takes less memory.....
Core Data framework or sqlite3, the former one is Apple's native object graph management framework which provides kinda object-relational mapping features but is not actually an ORM(, though wikipedia does include Core Data in its ORM list).
NSDictionary memory issue I was created one small business application..Here I got the data from server and Parsed it and then display the data... Here The datas are stored in NSDictionary....For the use of NSDictionary i took Large amount of memory..Any replacement for NSDictionary and it will takes less memory.....
TITLE: NSDictionary memory issue QUESTION: I was created one small business application..Here I got the data from server and Parsed it and then display the data... Here The datas are stored in NSDictionary....For the use of NSDictionary i took Large amount of memory..Any replacement for NSDictionary and it will takes ...
[ "objective-c", "nsdictionary" ]
0
0
112
1
0
2011-06-06T10:45:54.440000
2011-06-06T10:58:02.017000
6,250,912
6,254,494
Fade-to certain opacity using dojo
I'm using dojo toolkit. (version 1.6) I'm unable to stop the fading effect at certain opacity (say 0.5) Here is the code I'm using var fadeArgs = {node: "disabled_div", duration: 3000}; dojo.style("disabled_div", "opacity", "0"); dojo.fadeIn(fadeArgs).play(); But the above code is fading the element's opacity from 0 to...
you may try like this: var w = dojo.animateProperty({ node:"disabled_div", duration: 3000, properties: { opacity: 0 }, onAnimate:function(a){ if(a.opacity <=.5) w.stop(); } }) OR dojo.style("disabled_div", "opacity", "1"); var fadeArgs = {node: "disabled_div", duration: 3000,onAnimate:function(o){ if(o.opacity <=.5){...
Fade-to certain opacity using dojo I'm using dojo toolkit. (version 1.6) I'm unable to stop the fading effect at certain opacity (say 0.5) Here is the code I'm using var fadeArgs = {node: "disabled_div", duration: 3000}; dojo.style("disabled_div", "opacity", "0"); dojo.fadeIn(fadeArgs).play(); But the above code is fad...
TITLE: Fade-to certain opacity using dojo QUESTION: I'm using dojo toolkit. (version 1.6) I'm unable to stop the fading effect at certain opacity (say 0.5) Here is the code I'm using var fadeArgs = {node: "disabled_div", duration: 3000}; dojo.style("disabled_div", "opacity", "0"); dojo.fadeIn(fadeArgs).play(); But the...
[ "dojo", "fadein" ]
0
1
800
2
0
2011-06-06T10:47:40.650000
2011-06-06T15:41:03.223000
6,250,914
6,250,979
how to call service from controller in grails
I have a service class and i am trying to call the method of the service in my controller as below. class LogListController { def ListLogDetails = { println "We are inside List log Details-->"+params def logListHelperService logListHelperService.getFilePath(params) }} Exception Message: Cannot invoke method getFilePat...
def logListHelperService must be declared outside of the ListLogDetails definition def logListHelperService def ListLogDetails = { println "We are inside List log Details-->"+params logListHelperService.getFilePath(params) } should work
how to call service from controller in grails I have a service class and i am trying to call the method of the service in my controller as below. class LogListController { def ListLogDetails = { println "We are inside List log Details-->"+params def logListHelperService logListHelperService.getFilePath(params) }} Exce...
TITLE: how to call service from controller in grails QUESTION: I have a service class and i am trying to call the method of the service in my controller as below. class LogListController { def ListLogDetails = { println "We are inside List log Details-->"+params def logListHelperService logListHelperService.getFilePa...
[ "grails", "service", "dependency-injection", "controller" ]
4
11
8,747
1
0
2011-06-06T10:47:58.043000
2011-06-06T10:54:00.943000
6,250,918
6,251,097
ant target vssget is not working
when I run the ant target vssbuild it gives following error. D:\release>ant vssbuild Buildfile: build.xml vssbuild: [vssget] 'ss' is not recognized as an internal or external command, [vssget] operable program or batch file. BUILD FAILED D:\release\build.xml:141: Failed executi ng: ss Get $(project) -GLD:\release\$(l...
If you get a CreateProcesss IOError=2 when running these, it means that ss.exe was not found. Check to see if you can run it from the command line -you may need to alter your path, or set the ssdir property. It may not be the same error but it shows what needs to be done so that ant can find ss.exe. I'd try setting the...
ant target vssget is not working when I run the ant target vssbuild it gives following error. D:\release>ant vssbuild Buildfile: build.xml vssbuild: [vssget] 'ss' is not recognized as an internal or external command, [vssget] operable program or batch file. BUILD FAILED D:\release\build.xml:141: Failed executi ng: ss...
TITLE: ant target vssget is not working QUESTION: when I run the ant target vssbuild it gives following error. D:\release>ant vssbuild Buildfile: build.xml vssbuild: [vssget] 'ss' is not recognized as an internal or external command, [vssget] operable program or batch file. BUILD FAILED D:\release\build.xml:141: Fai...
[ "java", "ant", "visual-sourcesafe" ]
0
1
433
1
0
2011-06-06T10:48:38.673000
2011-06-06T11:06:21.970000
6,250,923
6,251,008
XSL namespaces and nested xsl:for-each
I have below XML and would like to iterate through the element as such the i could display it in some format like: PIN 1 XYZ HELLO PIN 2 ABC HI XML: PIN 1 XYZ HELLO PIN 2 ABC HI I Can't seem to find a solution. Any suggestion?
I would recommend following the W3C schools XSLT tutorial, this should give you all you need to solve this relatively simple XSLT problem. You are right that you will have to pay attention to namespaces, although again this is quite straightforward. Simply ensure that your XSLT defines the namespaces required, and that...
XSL namespaces and nested xsl:for-each I have below XML and would like to iterate through the element as such the i could display it in some format like: PIN 1 XYZ HELLO PIN 2 ABC HI XML: PIN 1 XYZ HELLO PIN 2 ABC HI I Can't seem to find a solution. Any suggestion?
TITLE: XSL namespaces and nested xsl:for-each QUESTION: I have below XML and would like to iterate through the element as such the i could display it in some format like: PIN 1 XYZ HELLO PIN 2 ABC HI XML: PIN 1 XYZ HELLO PIN 2 ABC HI I Can't seem to find a solution. Any suggestion? ANSWER: I would recommend following...
[ "xslt" ]
0
1
596
2
0
2011-06-06T10:49:11.490000
2011-06-06T10:57:16.060000
6,250,931
6,251,199
Getting generic arguments from a class in the stack
I have a generic class called Repository. This class has a function that "calls itself" by initializing a new instance of the Repository class with a different generic argument. This "recursion" can go on - so to avoid StackOverflowException, i need to check if there is in the stack, a method called from the Repository...
Don't think that this is possible, because you only get the GenericType, but not the real GenericArguments of the class. If you look at the return of frame.GetMethod().DeclaringType you'll notice, that only the GenericType, but not the real GenericArguments are within the debugging result.
Getting generic arguments from a class in the stack I have a generic class called Repository. This class has a function that "calls itself" by initializing a new instance of the Repository class with a different generic argument. This "recursion" can go on - so to avoid StackOverflowException, i need to check if there ...
TITLE: Getting generic arguments from a class in the stack QUESTION: I have a generic class called Repository. This class has a function that "calls itself" by initializing a new instance of the Repository class with a different generic argument. This "recursion" can go on - so to avoid StackOverflowException, i need ...
[ "c#", "generics", "reflection", "stack-trace" ]
4
0
702
3
0
2011-06-06T10:49:52.880000
2011-06-06T11:15:37.947000
6,250,955
6,259,897
Can you use the same String as the Key id for multiple models?
If I have three model classes - Taxpayer, Criminal and Patient - can I use socialSecurityNumber as the Key ID for all three or do I need to make it unique even across model classes. In other words, should it be like this: String socialSecurityNumber = "123-45-6789"; Long now = new Long(System.currentTimeMillis()); // u...
Yes. The key name forms only part of the key, along with the app ID, entity kind, and any ancestor keys, so it's fine to use the same key name in different models. Be aware, however, that a social security number makes a poor primary key for several reasons: You probably shouldn't be collecting it from your users in th...
Can you use the same String as the Key id for multiple models? If I have three model classes - Taxpayer, Criminal and Patient - can I use socialSecurityNumber as the Key ID for all three or do I need to make it unique even across model classes. In other words, should it be like this: String socialSecurityNumber = "123-...
TITLE: Can you use the same String as the Key id for multiple models? QUESTION: If I have three model classes - Taxpayer, Criminal and Patient - can I use socialSecurityNumber as the Key ID for all three or do I need to make it unique even across model classes. In other words, should it be like this: String socialSecu...
[ "java", "google-app-engine" ]
1
1
70
2
0
2011-06-06T10:51:41.740000
2011-06-07T01:54:45.540000
6,250,960
6,250,992
fadeIn, fadeOut not working (or I don't know how to make it work)
I have a div with the following class: #instrucPanel { background-color:black; opacity:0; position: absolute; left: 180px; top: 71px; height: 226px } At page load is hidden. I want to display it when user click on a button. And make it hidden if the user click on the same button. To do that I'm using the following Java...
First, you must use display:none; as opposed to opacity:0. Then you can make use of the.fadeToggle() method, like this: function ShowHideInstruc() { var show = $.viacognitaspace.instShown =!$.viacognitaspace.instShown; $('#instrucPanel').fadeToggle((show)? 'fast': 'slow'); } Note how this approach is a whole lot DRYer.
fadeIn, fadeOut not working (or I don't know how to make it work) I have a div with the following class: #instrucPanel { background-color:black; opacity:0; position: absolute; left: 180px; top: 71px; height: 226px } At page load is hidden. I want to display it when user click on a button. And make it hidden if the user...
TITLE: fadeIn, fadeOut not working (or I don't know how to make it work) QUESTION: I have a div with the following class: #instrucPanel { background-color:black; opacity:0; position: absolute; left: 180px; top: 71px; height: 226px } At page load is hidden. I want to display it when user click on a button. And make it ...
[ "jquery", "fadein", "fadeout" ]
0
3
389
3
0
2011-06-06T10:52:00.117000
2011-06-06T10:55:29.967000
6,250,970
6,251,049
Run custom admin command from view
I have a custom admin command that emails out reports. It normally runs from a cron job. What I would like to do is add a button to my web app that when clicked will cause the the admin command to run there and then rather than wait for the cron job to call it. How do I do this? Do I have to call out to a command line ...
You can use call_command: from django.core.management import call_command call_command('myadmincmd')
Run custom admin command from view I have a custom admin command that emails out reports. It normally runs from a cron job. What I would like to do is add a button to my web app that when clicked will cause the the admin command to run there and then rather than wait for the cron job to call it. How do I do this? Do I ...
TITLE: Run custom admin command from view QUESTION: I have a custom admin command that emails out reports. It normally runs from a cron job. What I would like to do is add a button to my web app that when clicked will cause the the admin command to run there and then rather than wait for the cron job to call it. How d...
[ "django" ]
50
85
23,613
1
0
2011-06-06T10:53:12.863000
2011-06-06T11:01:39.057000
6,250,972
6,264,108
JSON Multi dimensional Array to Java Multi-Dimensional Array
I am trying to convert a JSONArray whose String format is multi-dimensional to a Java multi-dimensional array. I have tried a lot of ways by myself and am getting lost in my task. Hopefully someone here can bring some clarity. Converting to a normal array is fine. But when I try to extend myself to a multi-dimensional ...
Turns out my problem was pretty trivial. I was concerned that I was not able to do this with say 1 or 2 lines of code and I pretty much had to fill the array with data manually. Here's how I did it anyway. JSONArray myArray = (JSONArray) JSONSerializer.toJSON(stationData); //Slightly hard coded here. String[][] test = ...
JSON Multi dimensional Array to Java Multi-Dimensional Array I am trying to convert a JSONArray whose String format is multi-dimensional to a Java multi-dimensional array. I have tried a lot of ways by myself and am getting lost in my task. Hopefully someone here can bring some clarity. Converting to a normal array is ...
TITLE: JSON Multi dimensional Array to Java Multi-Dimensional Array QUESTION: I am trying to convert a JSONArray whose String format is multi-dimensional to a Java multi-dimensional array. I have tried a lot of ways by myself and am getting lost in my task. Hopefully someone here can bring some clarity. Converting to ...
[ "java", "arrays", "json", "multidimensional-array" ]
0
1
5,167
2
0
2011-06-06T10:53:24.413000
2011-06-07T10:48:41.060000
6,250,973
6,251,028
Dynamic sort order with XSL
I want to be able to sort elements based on an attribute in my XML. Unfortunately I cannot seem to get it to work, here is my code so far. Currently no errors are produced but the sort doesn't seem to ever be applied descending. descending ascending XML:
Test case for your sample: XSL descending ascending Output for me:
Dynamic sort order with XSL I want to be able to sort elements based on an attribute in my XML. Unfortunately I cannot seem to get it to work, here is my code so far. Currently no errors are produced but the sort doesn't seem to ever be applied descending. descending ascending XML:
TITLE: Dynamic sort order with XSL QUESTION: I want to be able to sort elements based on an attribute in my XML. Unfortunately I cannot seem to get it to work, here is my code so far. Currently no errors are produced but the sort doesn't seem to ever be applied descending. descending ascending XML: ANSWER: Test case ...
[ "xml", "xslt", "sorting" ]
0
1
1,915
1
0
2011-06-06T10:53:30.947000
2011-06-06T10:59:27.060000
6,250,977
6,251,138
Help on a tricky MySQL query
I'd appreciate your help on this please: I've got a table which logs when an user (id_user) where at an event (meeting, concert..) (id_event) and his score for this event (long story). Here is my table: CREATE TABLE `Leaderboards` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `id_event` mediumint(8) NOT NULL, `user_id` ...
I think I might have an answer for you SELECT leader1.user_id, leader2.user_id, COUNT(leader1.id) AS num FROM Leaderboards AS leader1 INNER JOIN Leaderboards AS leader2 ON ( leader1.id_event = leader2.id_event AND leader1.user_id!= leader2.user_id ) GROUP BY leader1.user_id, leader2.user_id ORDER BY num DESC This will ...
Help on a tricky MySQL query I'd appreciate your help on this please: I've got a table which logs when an user (id_user) where at an event (meeting, concert..) (id_event) and his score for this event (long story). Here is my table: CREATE TABLE `Leaderboards` ( `id` mediumint(9) NOT NULL AUTO_INCREMENT, `id_event` medi...
TITLE: Help on a tricky MySQL query QUESTION: I'd appreciate your help on this please: I've got a table which logs when an user (id_user) where at an event (meeting, concert..) (id_event) and his score for this event (long story). Here is my table: CREATE TABLE `Leaderboards` ( `id` mediumint(9) NOT NULL AUTO_INCREMEN...
[ "php", "mysql" ]
1
3
121
4
0
2011-06-06T10:53:45.520000
2011-06-06T11:10:22.923000
6,250,986
6,253,084
Javascript Problem on expand images
I have a problem with my TreeView here. My TreeView is in a UserControl. On the first page, the UserControl is placed directly on the content page. Everything works finde. example (working): On the second page, the UserControl is placed in a TabContainer (TabPanel). The javascript for expanding does not work. What i fo...
Ok i found out what the problem was here: In this scenario, it is not possible to store the TreeNodeCollection (or the rootNode) in the Cache. I thought, it was a clever idea to cache the whole collection to save the time for building the hierachy. But if i try to place the UserControl in another page (in another conta...
Javascript Problem on expand images I have a problem with my TreeView here. My TreeView is in a UserControl. On the first page, the UserControl is placed directly on the content page. Everything works finde. example (working): On the second page, the UserControl is placed in a TabContainer (TabPanel). The javascript fo...
TITLE: Javascript Problem on expand images QUESTION: I have a problem with my TreeView here. My TreeView is in a UserControl. On the first page, the UserControl is placed directly on the content page. Everything works finde. example (working): On the second page, the UserControl is placed in a TabContainer (TabPanel)....
[ "javascript", "asp.net", "treeview", "toggle" ]
1
1
658
1
0
2011-06-06T10:55:06.030000
2011-06-06T13:55:06.590000
6,250,987
6,251,035
Fetch top N rows of the table in Entity Framework
I'm kind of stuck with a problem that I'm having. Among others, I have this tables in my DB: Product (int productId,...otherProductInfo) Customer (int customerId,...otherCustomerInfo) SoldToData ( int productId, int customerId) I want to get top ten selling products using Entity Framework in MVC2. How can I do that? //...
If you have an IQueryable to query the datasource you could use orderby etc for ordering followed by Take(10)?
Fetch top N rows of the table in Entity Framework I'm kind of stuck with a problem that I'm having. Among others, I have this tables in my DB: Product (int productId,...otherProductInfo) Customer (int customerId,...otherCustomerInfo) SoldToData ( int productId, int customerId) I want to get top ten selling products usi...
TITLE: Fetch top N rows of the table in Entity Framework QUESTION: I'm kind of stuck with a problem that I'm having. Among others, I have this tables in my DB: Product (int productId,...otherProductInfo) Customer (int customerId,...otherCustomerInfo) SoldToData ( int productId, int customerId) I want to get top ten se...
[ "c#", "entity-framework", "asp.net-mvc-2" ]
1
4
7,503
2
0
2011-06-06T10:55:06.857000
2011-06-06T11:00:30.927000
6,250,998
6,251,217
c# Ordering Variable data using a drop down list
I am currently stuck on a small problem. I have a List View which displays products and I am looking to include a drop down list, with a filter button which when pressed will order the products by high-low price or low-high. Here is my code. protected void LB_Filter_Click(object sender, EventArgs e) { using (DataClasse...
You need to execute the results by converting it to list to get the expected output, like this: List products = new List (); if (DDL_Order.SelectedIndex == 0) { products = product.OrderByDescending(v => v.Sale_Price).ToList(); } else if (DDL_Order.SelectedIndex == 1) { products = product.OrderBy(v => v.Sale_Price).ToLi...
c# Ordering Variable data using a drop down list I am currently stuck on a small problem. I have a List View which displays products and I am looking to include a drop down list, with a filter button which when pressed will order the products by high-low price or low-high. Here is my code. protected void LB_Filter_Clic...
TITLE: c# Ordering Variable data using a drop down list QUESTION: I am currently stuck on a small problem. I have a List View which displays products and I am looking to include a drop down list, with a filter button which when pressed will order the products by high-low price or low-high. Here is my code. protected v...
[ "c#", "listview", "drop-down-menu" ]
0
1
296
2
0
2011-06-06T10:56:35.263000
2011-06-06T11:16:59.553000
6,251,009
6,252,367
OpenRasta Json returning nested classes
Is it possible to return nested classes in json with OpenRasta? I'm using EF4.1 with code first (which in theory shouldn't make a difference, as they are just POCO classes). Here is an example: public class AppUser { [Key] public int AppUserId { get; set; } public string WinLogin { get; set; } public string ScreenName ...
That's a data contract issue, not an openrast one. The DataContract serialzier is seeing a dynamic proxy probably generated by EF code first, and when seeing that cannot render the object. I'd recommend either swapping for another serialziation codec, or disabling transparent lazy loading, or alternatively marking your...
OpenRasta Json returning nested classes Is it possible to return nested classes in json with OpenRasta? I'm using EF4.1 with code first (which in theory shouldn't make a difference, as they are just POCO classes). Here is an example: public class AppUser { [Key] public int AppUserId { get; set; } public string WinLogin...
TITLE: OpenRasta Json returning nested classes QUESTION: Is it possible to return nested classes in json with OpenRasta? I'm using EF4.1 with code first (which in theory shouldn't make a difference, as they are just POCO classes). Here is an example: public class AppUser { [Key] public int AppUserId { get; set; } publ...
[ "json", "openrasta" ]
1
3
332
1
0
2011-06-06T10:57:16.530000
2011-06-06T12:58:09.623000
6,251,018
6,251,134
Vertical Progress Scrollbar
I am trying to make the following example of a progress scrollbar vertical: http://flowplayer.org/tools/demos/rangeinput/scrollbar.html I have tried for ages now and cant seem to find a way. I'm new to jquery so any help would be much appreciated.
Updated version from comments: http://jsfiddle.net/SKfGQ/5/ It works, but it's massively fudged. It's as simple as inverting all the width and height related properties. So, in the JavaScript, change left to top. In the CSS, where there is a horizontal property and a vertical property, switch them. I took the code from...
Vertical Progress Scrollbar I am trying to make the following example of a progress scrollbar vertical: http://flowplayer.org/tools/demos/rangeinput/scrollbar.html I have tried for ages now and cant seem to find a way. I'm new to jquery so any help would be much appreciated.
TITLE: Vertical Progress Scrollbar QUESTION: I am trying to make the following example of a progress scrollbar vertical: http://flowplayer.org/tools/demos/rangeinput/scrollbar.html I have tried for ages now and cant seem to find a way. I'm new to jquery so any help would be much appreciated. ANSWER: Updated version f...
[ "jquery", "html", "css", "progress-bar", "scrollbar" ]
1
0
1,968
3
0
2011-06-06T10:58:07.527000
2011-06-06T11:10:03.720000
6,251,019
6,251,110
Listing only regular files, problem with stat
I want to list regular files in a directory. However, stat fails for every file. DIR* dp = NULL; struct dirent* entry = NULL; dp = opendir(directory); if (!dp) { log_err("Could not open directory"); return -1; } while (entry = readdir(dp)) { struct stat s; char path[1024]; path[0] = 0; strcat(path, directory); strcat...
stat and many other system calls return 0 on success and -1 on failure. You are incorrectly testing the return value of stat. Your code should be: if (!stat(path, &s)) { if (S_ISREG(s.st_mode)) { printf("%s\n", entry->d_name); } } else { fprintf(stderr, "Can't stat: %s\n", strerror(errno)); }
Listing only regular files, problem with stat I want to list regular files in a directory. However, stat fails for every file. DIR* dp = NULL; struct dirent* entry = NULL; dp = opendir(directory); if (!dp) { log_err("Could not open directory"); return -1; } while (entry = readdir(dp)) { struct stat s; char path[1024]...
TITLE: Listing only regular files, problem with stat QUESTION: I want to list regular files in a directory. However, stat fails for every file. DIR* dp = NULL; struct dirent* entry = NULL; dp = opendir(directory); if (!dp) { log_err("Could not open directory"); return -1; } while (entry = readdir(dp)) { struct stat ...
[ "c", "posix" ]
1
3
2,078
2
0
2011-06-06T10:58:24.280000
2011-06-06T11:07:16.527000
6,251,021
6,251,212
ActionScript: Adding multiple instances of the same swf file to the stage
I'm creating a game in ActionScript 3.0 using the FlashPunk game engine and the FlashDevelop SDK. I've created my own MovieClip class that takes a preloaded movie clip file. public function MyMovieClip(file:MovieClip, posX:int, posY:int, frameRate:int) { movieClip = file; movieClip.x = posX; movieClip.y = posY; movieCl...
You can create a new instance of the same loaded swf by doing this: // re-use a loaded swf var bytes:ByteArray = existingLoader.content.loaderInfo.bytes; var loader:Loader = new Loader(); loader.loadBytes(bytes); where existingLoader is the Loader that you used to load the swf in the first place. The Loader used with l...
ActionScript: Adding multiple instances of the same swf file to the stage I'm creating a game in ActionScript 3.0 using the FlashPunk game engine and the FlashDevelop SDK. I've created my own MovieClip class that takes a preloaded movie clip file. public function MyMovieClip(file:MovieClip, posX:int, posY:int, frameRat...
TITLE: ActionScript: Adding multiple instances of the same swf file to the stage QUESTION: I'm creating a game in ActionScript 3.0 using the FlashPunk game engine and the FlashDevelop SDK. I've created my own MovieClip class that takes a preloaded movie clip file. public function MyMovieClip(file:MovieClip, posX:int, ...
[ "actionscript-3", "flash", "movieclip", "flashdevelop" ]
1
2
1,182
2
0
2011-06-06T10:58:40.307000
2011-06-06T11:16:40.043000
6,251,029
6,251,286
How do I insert a new node into a series of xml docs (varchar column type) in sql server
I've got a few thousand rows stored as xml in a varchar column, and I need to add a new node to each of them. I've read that there is no update mechanism and pretty much the only way I can do this is to read out the rows, update them locally, then write them back in. If this were a small number of rows I'd do it manual...
My suggestion would be: add a new column of type XML to your table ALTER TABLE dbo.YourTable ADD XmlColumn XML fill that column with the values from that other column UPDATE dbo.YourTable SET XmlColumn = CAST(YourVarcharColumn AS XML) in your XML column, add that tag you need UPDATE dbo.YourTable SET XmlColumn.modify(....
How do I insert a new node into a series of xml docs (varchar column type) in sql server I've got a few thousand rows stored as xml in a varchar column, and I need to add a new node to each of them. I've read that there is no update mechanism and pretty much the only way I can do this is to read out the rows, update th...
TITLE: How do I insert a new node into a series of xml docs (varchar column type) in sql server QUESTION: I've got a few thousand rows stored as xml in a varchar column, and I need to add a new node to each of them. I've read that there is no update mechanism and pretty much the only way I can do this is to read out t...
[ "xml", "sql-server-2008" ]
0
1
83
1
0
2011-06-06T10:59:29.317000
2011-06-06T11:23:16.870000
6,251,043
6,251,129
Can't access .NET control from AsyncFIleUpload.OnUploadCompleted code behind
I am using an AJAX Toolkit AsyncFileUpload as follows... I am trying to access the btnImport control to make it visible on success of upload, but accessing it from the uploadComplete procedure in the code behind does nothing.... protected void uploadComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)...
Actually you can access that button but your changes don't applied as the uploadComplete method executed asynchronously. in my opinion its better to hide the btnImport using style="display: none;", handle client-side OnClientUploadComplete event of the AsyncFileUpload and show button after file was uploaded successfull...
Can't access .NET control from AsyncFIleUpload.OnUploadCompleted code behind I am using an AJAX Toolkit AsyncFileUpload as follows... I am trying to access the btnImport control to make it visible on success of upload, but accessing it from the uploadComplete procedure in the code behind does nothing.... protected void...
TITLE: Can't access .NET control from AsyncFIleUpload.OnUploadCompleted code behind QUESTION: I am using an AJAX Toolkit AsyncFileUpload as follows... I am trying to access the btnImport control to make it visible on success of upload, but accessing it from the uploadComplete procedure in the code behind does nothing....
[ ".net", "asyncfileupload" ]
0
0
672
1
0
2011-06-06T11:01:03.080000
2011-06-06T11:09:44.343000
6,251,047
6,251,084
database column check PK and overwrite another column
I have a sql server 2008 database, the code (now corrected) has accidently overwrite one column with wrong data about 50,000 rows The rows might have changed since the backup, but the primary key is intact now I have two database one with correct data in one column and one with incorrect data. Can anyone help with a sc...
You could use an update statement to copy data from the restored database: update wrong set WrongColumn = [right].WrongColumn from ProductionDb.dbo.Table1 as wrong join RestoredDb.dbo.Table1 as [right] on [right].PrimaryKeyCol = wrong.PrimaryKeyCol
database column check PK and overwrite another column I have a sql server 2008 database, the code (now corrected) has accidently overwrite one column with wrong data about 50,000 rows The rows might have changed since the backup, but the primary key is intact now I have two database one with correct data in one column ...
TITLE: database column check PK and overwrite another column QUESTION: I have a sql server 2008 database, the code (now corrected) has accidently overwrite one column with wrong data about 50,000 rows The rows might have changed since the backup, but the primary key is intact now I have two database one with correct d...
[ "sql-server" ]
0
2
159
2
0
2011-06-06T11:01:33.380000
2011-06-06T11:04:45.477000
6,251,051
6,251,116
Subsets of a given Set of Integers whose sum is a Constant N : Java
Given a set of integers, how to find a subset that sums to a given value...the subset problem? Example: S = {1,2,4,3,2,5} and n= 7 Finding the possible subsets whose sum is n. I tried to google out found many links,but were not clear. How can we solve this in java and what is the data structure to be used and its compl...
I wont give you any code, but explain how it works. Run a loop from 0 to (2^k-1) For each value in 1, a 1 in its binary representation indicates that this value is chosen and 0 otherwise. Test to see if the sum of chosen numbers is equal to n. The above method will evaluate each possible subset of the given set. If the...
Subsets of a given Set of Integers whose sum is a Constant N : Java Given a set of integers, how to find a subset that sums to a given value...the subset problem? Example: S = {1,2,4,3,2,5} and n= 7 Finding the possible subsets whose sum is n. I tried to google out found many links,but were not clear. How can we solve ...
TITLE: Subsets of a given Set of Integers whose sum is a Constant N : Java QUESTION: Given a set of integers, how to find a subset that sums to a given value...the subset problem? Example: S = {1,2,4,3,2,5} and n= 7 Finding the possible subsets whose sum is n. I tried to google out found many links,but were not clear....
[ "java", "math", "data-structures", "integer", "subset-sum" ]
0
1
2,838
2
0
2011-06-06T11:01:51.507000
2011-06-06T11:08:23.610000
6,251,067
6,252,672
Is uNhAddIns active enough?
I'm going to use uNhAddins as my base structure for NHibernate session management. But I need to be sure that it is not an a stale project and is to be continued actively. Any idea?
There's a google group where almost no thread goes unnoticed -> +1 Quite a few people "use this" on ohloh -> +1 Lots of committers and contributors -> +1 Recent activity is a bit sparse but I wouldn't say dead All in all, I think it's pretty safe to use.
Is uNhAddIns active enough? I'm going to use uNhAddins as my base structure for NHibernate session management. But I need to be sure that it is not an a stale project and is to be continued actively. Any idea?
TITLE: Is uNhAddIns active enough? QUESTION: I'm going to use uNhAddins as my base structure for NHibernate session management. But I need to be sure that it is not an a stale project and is to be continued actively. Any idea? ANSWER: There's a google group where almost no thread goes unnoticed -> +1 Quite a few peop...
[ "nhibernate" ]
0
1
284
1
0
2011-06-06T11:02:52.490000
2011-06-06T13:24:52.063000
6,251,068
6,292,014
Google Analytics One Page Order Form
Having looked through the questions already on SO, I can't seem to find the answer on how to track a form that has multiple steps on one page. I saw an example that Google gives but could not really understand the way they were presenting it. What we have is a one page order form and need to track the users that come f...
Just call the JS function _gaq.push([trackPageview,'/form/stepXX']); each time the process reaches a new step. You can pass any text string you want as a parameter. Then you can configure a Goal and a funnel in GA with all the major steps of process You can also track Events in case of errors for example. (this uses th...
Google Analytics One Page Order Form Having looked through the questions already on SO, I can't seem to find the answer on how to track a form that has multiple steps on one page. I saw an example that Google gives but could not really understand the way they were presenting it. What we have is a one page order form an...
TITLE: Google Analytics One Page Order Form QUESTION: Having looked through the questions already on SO, I can't seem to find the answer on how to track a form that has multiple steps on one page. I saw an example that Google gives but could not really understand the way they were presenting it. What we have is a one ...
[ "google-analytics" ]
0
0
151
1
0
2011-06-06T11:02:52.803000
2011-06-09T11:24:12.987000
6,251,072
6,251,367
Proper release of UIImagePickerController
I'm a bit confused with this as I've seen way too many different variants and not sure which one is the correct way. Currently I have: - (IBAction)pickImageFromLibrary:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self; picker.sourceType = UIImagePickerControl...
No, because it's retained when presented modally, via presentModelViewController. This is the common pattern you'll find when presenting new view controllers, whether modally, custom view controllers or not. This is fine: - (IBAction)pickImageFromLibrary:(id)sender { UIImagePickerController *picker = [[UIImagePickerCon...
Proper release of UIImagePickerController I'm a bit confused with this as I've seen way too many different variants and not sure which one is the correct way. Currently I have: - (IBAction)pickImageFromLibrary:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; picker.delegate = self...
TITLE: Proper release of UIImagePickerController QUESTION: I'm a bit confused with this as I've seen way too many different variants and not sure which one is the correct way. Currently I have: - (IBAction)pickImageFromLibrary:(id)sender { UIImagePickerController *picker = [[UIImagePickerController alloc] init]; pick...
[ "ios4", "uiimageview", "uiimage", "uiimagepickercontroller" ]
2
6
1,342
1
0
2011-06-06T11:03:14.003000
2011-06-06T11:29:37.107000
6,251,076
6,251,465
How to select elements in namespace scope and get rid of empty default namespace in the output
I need to transform the following input file http://worksite.imanage.com/SearchDocumentsResponse urn:uuid:b9b79a0f-b4de-4686-9c54-51c5a7f99331 urn:uuid:8e88f531-8369-4557-80bf-e8a9835d8eb3 http://schemas.xmlsoap.org/ws/2004/08/addressing/role/anonymous 2011-06-01T07:09:20Z 2011-06-01T07:14:20Z!nrtdms:0:!session:PTHT096...
Simplify XPath I suggest you to include in your transform a declaration with prefix for the default namespaces. For example for you can add w prefix in the stylesheet element: This will make easier for you select elements in the namespace, thus making possible to avoid XPath match against namespace-uri() and simplifyin...
How to select elements in namespace scope and get rid of empty default namespace in the output I need to transform the following input file http://worksite.imanage.com/SearchDocumentsResponse urn:uuid:b9b79a0f-b4de-4686-9c54-51c5a7f99331 urn:uuid:8e88f531-8369-4557-80bf-e8a9835d8eb3 http://schemas.xmlsoap.org/ws/2004/0...
TITLE: How to select elements in namespace scope and get rid of empty default namespace in the output QUESTION: I need to transform the following input file http://worksite.imanage.com/SearchDocumentsResponse urn:uuid:b9b79a0f-b4de-4686-9c54-51c5a7f99331 urn:uuid:8e88f531-8369-4557-80bf-e8a9835d8eb3 http://schemas.xml...
[ "xslt", "xpath" ]
3
3
699
2
0
2011-06-06T11:03:38.130000
2011-06-06T11:38:32.170000
6,251,083
6,251,121
A tool resembling spring's NamedParameterUtils for regular strings processing?
I would like to replace named parameters in a string with values, like when using Python's % operator. Spring supports something very similar to the functionality I need with NamedParameterUtils, but for some reason it's tightly coupled to Jdbc and replacing those named-parameters with question marks. So, if I want to ...
It should take about 50 lines of code to write what you want. Here's an excerpt from a "TrivialTemplate" I wrote a while back, which does something very similar: private final Pattern var = Pattern.compile("\\{\\s*([\\w\\[\\]\\(\\)\\.]+)\\s*\\}"); private final PropertyUtilsBean bean = new PropertyUtilsBean(); private ...
A tool resembling spring's NamedParameterUtils for regular strings processing? I would like to replace named parameters in a string with values, like when using Python's % operator. Spring supports something very similar to the functionality I need with NamedParameterUtils, but for some reason it's tightly coupled to J...
TITLE: A tool resembling spring's NamedParameterUtils for regular strings processing? QUESTION: I would like to replace named parameters in a string with values, like when using Python's % operator. Spring supports something very similar to the functionality I need with NamedParameterUtils, but for some reason it's ti...
[ "java", "spring", "string", "velocity" ]
1
1
252
1
0
2011-06-06T11:04:36.763000
2011-06-06T11:08:46.107000
6,251,093
6,251,942
Inserting values to SQLite table in Android
I am new in android app developement. I tried to insert values to SQLite database through the below code; public class cashbook extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SQLiteDatabase db; db = openOrCreateDatabas...
okk this is fully working code edit it as per your requirement public class TestProjectActivity extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); SQLiteDatabase db; db = openOrCreateDatabase( "Temp.db", SQLiteDatabase.CREATE...
Inserting values to SQLite table in Android I am new in android app developement. I tried to insert values to SQLite database through the below code; public class cashbook extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); ...
TITLE: Inserting values to SQLite table in Android QUESTION: I am new in android app developement. I tried to insert values to SQLite database through the below code; public class cashbook extends Activity { @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentVie...
[ "android", "sqlite" ]
21
18
136,908
8
0
2011-06-06T11:06:01.250000
2011-06-06T12:24:46.130000
6,251,096
6,251,119
How to limit number of posts in index.php
I have an index.php with loop // render post here Now I want to limit number of post by N on the page and create a link to next/previous N posts. A small code snippet is very appreciated. UPDATE What about the URL string? I want to make functionality similar to SO where query is determined by URL for example get next t...
You can achieve that in this way: query_posts( 'posts_per_page=5' ); References: http://codex.wordpress.org/Function_Reference/query_posts http://codex.wordpress.org/Class_Reference/WP_Query
How to limit number of posts in index.php I have an index.php with loop // render post here Now I want to limit number of post by N on the page and create a link to next/previous N posts. A small code snippet is very appreciated. UPDATE What about the URL string? I want to make functionality similar to SO where query i...
TITLE: How to limit number of posts in index.php QUESTION: I have an index.php with loop // render post here Now I want to limit number of post by N on the page and create a link to next/previous N posts. A small code snippet is very appreciated. UPDATE What about the URL string? I want to make functionality similar t...
[ "php", "wordpress" ]
0
2
3,463
1
0
2011-06-06T11:06:20.850000
2011-06-06T11:08:39.723000
6,251,099
6,264,422
Build a solution folder with MSBuild
We have a solution file that contains some solution folders: libraries, unit-tests, applications, etc. With Visual Studio 2010 we can build only the projects of a given folder by right-clicking on it and using "build" or "rebuild". This is perfect on the developers' workstations, and we'd like to do the same on the con...
The short answer is: Yes, if you want to build specific set of projects (grouped together in a VS solution) with plain MSBuild you will have to create a dedicated MSBuild.proj for each specific set of projects you want to build. You will not have to create (and maintain) Visual Studio solutions to support your build, b...
Build a solution folder with MSBuild We have a solution file that contains some solution folders: libraries, unit-tests, applications, etc. With Visual Studio 2010 we can build only the projects of a given folder by right-clicking on it and using "build" or "rebuild". This is perfect on the developers' workstations, an...
TITLE: Build a solution folder with MSBuild QUESTION: We have a solution file that contains some solution folders: libraries, unit-tests, applications, etc. With Visual Studio 2010 we can build only the projects of a given folder by right-clicking on it and using "build" or "rebuild". This is perfect on the developers...
[ "visual-studio", "visual-studio-2010", "msbuild", "continuous-integration", "solution" ]
9
2
8,027
2
0
2011-06-06T11:06:28.367000
2011-06-07T11:20:08.557000
6,251,101
6,251,140
Join two tables in MySQL with random rows from the second
I have two tables The first with only 5 rows The second with 800 rows I'm using this query: SELECT * FROM table1 t1 JOIN (SELECT * FROM table2 ORDER BY RAND() LIMIT 5) t2 But I'm getting 5 rows from the first table for each result of the second table. I don't need a condition when joining, I just want 5 random results ...
Do you mean UNION? SELECT * FROM table1 UNION SELECT * FROM table2 ORDER BY RAND() LIMIT 5; Update: revised answer after modification of your question: SELECT field1 FROM table1 UNION SELECT field2 FROM table2 ORDER BY RAND() LIMIT 5; To my understanding, you just need one field from each table. If you need several one...
Join two tables in MySQL with random rows from the second I have two tables The first with only 5 rows The second with 800 rows I'm using this query: SELECT * FROM table1 t1 JOIN (SELECT * FROM table2 ORDER BY RAND() LIMIT 5) t2 But I'm getting 5 rows from the first table for each result of the second table. I don't ne...
TITLE: Join two tables in MySQL with random rows from the second QUESTION: I have two tables The first with only 5 rows The second with 800 rows I'm using this query: SELECT * FROM table1 t1 JOIN (SELECT * FROM table2 ORDER BY RAND() LIMIT 5) t2 But I'm getting 5 rows from the first table for each result of the second...
[ "mysql", "join", "random" ]
2
2
5,565
2
0
2011-06-06T11:06:42.677000
2011-06-06T11:10:25.817000
6,251,109
6,251,362
How do I set an empty ListView's background image?
How yo set listview background like this. I want to appear when the number of record 0
There is special method in ListView - setEmptyView(). You can find examples of using it here or here. Upd: second link is unavailable now. Here is quote from article: When you set a ListView’s “empty view” programmatically, you can end up scratching your head as to why your empty view actually doesn’t appear when the l...
How do I set an empty ListView's background image? How yo set listview background like this. I want to appear when the number of record 0
TITLE: How do I set an empty ListView's background image? QUESTION: How yo set listview background like this. I want to appear when the number of record 0 ANSWER: There is special method in ListView - setEmptyView(). You can find examples of using it here or here. Upd: second link is unavailable now. Here is quote fr...
[ "android", "image", "listview", "background" ]
6
14
9,723
5
0
2011-06-06T11:07:14.343000
2011-06-06T11:29:20.643000
6,251,115
6,251,869
How to prevent escaping on Zend Form Select : Zend Framework
how to prevent escaping html on zend form elemnt? My code is not work at all $this->addElement('Select', 'forum_icon', array( 'label' => 'Forum Icon', 'value' => $this->_forum->FORUM_ICON, 'escape' => false, 'multiOptions' => $icons )); i try another method but it still not work $this->forum_icon->setAttrib('escape', f...
You can implement your decorator for Select element that generates HTML for select with unescaped value. For example: class My_Select_Decorator extends Zend_Form_Decorator_Abstract { public function render($content) { $element = $this->getElement(); // Generate HTML markup return $markup; } } Refer to these articles fo...
How to prevent escaping on Zend Form Select : Zend Framework how to prevent escaping html on zend form elemnt? My code is not work at all $this->addElement('Select', 'forum_icon', array( 'label' => 'Forum Icon', 'value' => $this->_forum->FORUM_ICON, 'escape' => false, 'multiOptions' => $icons )); i try another method b...
TITLE: How to prevent escaping on Zend Form Select : Zend Framework QUESTION: how to prevent escaping html on zend form elemnt? My code is not work at all $this->addElement('Select', 'forum_icon', array( 'label' => 'Forum Icon', 'value' => $this->_forum->FORUM_ICON, 'escape' => false, 'multiOptions' => $icons )); i tr...
[ "php", "zend-framework", "escaping", "zend-form" ]
0
2
1,580
1
0
2011-06-06T11:08:19.240000
2011-06-06T12:17:38.687000
6,251,130
6,251,861
Construct a List of Maps
First of all I'm a Clojure beginner and sry for my bad English. Lets say you have a function that is suppossed to return a List of Maps containing various Information (in this example Systeminformation). I've come up with the following example but it just seems wrong and overcomplicated to me. My Problem is that 'for [...
You can also use the little list* helper. It creates a list from the given elements. The last of which is taken as a tail list. So the "merging" happens implicitly. (defn get-sysinfo [] (list* {:name "Processor Count:":value (.availableProcessors (Runtime/getRuntime))} {:name "OS Name:",:value (System/getProperty "os.n...
Construct a List of Maps First of all I'm a Clojure beginner and sry for my bad English. Lets say you have a function that is suppossed to return a List of Maps containing various Information (in this example Systeminformation). I've come up with the following example but it just seems wrong and overcomplicated to me. ...
TITLE: Construct a List of Maps QUESTION: First of all I'm a Clojure beginner and sry for my bad English. Lets say you have a function that is suppossed to return a List of Maps containing various Information (in this example Systeminformation). I've come up with the following example but it just seems wrong and overc...
[ "clojure" ]
1
1
258
2
0
2011-06-06T11:09:49.260000
2011-06-06T12:17:20.403000
6,251,136
6,251,323
Improve Asp.net Shop Listview Performance
we have an online shop with about 8000 products. Now its time to improve the performance of product listing / filtering. Currently we store the results of previous searches / listings temporary in the database. The performance of this solution is good enough, but its a pain to extend if we add new search options / filt...
You don't have to worry about memory in asp.net caching. If your app is running out of memory asp.net caching releases some things from caching memory. I would go with that solution as I don't think Lucene will be a big help.
Improve Asp.net Shop Listview Performance we have an online shop with about 8000 products. Now its time to improve the performance of product listing / filtering. Currently we store the results of previous searches / listings temporary in the database. The performance of this solution is good enough, but its a pain to ...
TITLE: Improve Asp.net Shop Listview Performance QUESTION: we have an online shop with about 8000 products. Now its time to improve the performance of product listing / filtering. Currently we store the results of previous searches / listings temporary in the database. The performance of this solution is good enough, ...
[ "asp.net", "performance" ]
1
0
321
2
0
2011-06-06T11:10:11.753000
2011-06-06T11:26:24.390000
6,251,151
6,251,178
Jquery: exclude element
I have a following code: $(document).ready(function() { $('a[rel]').each(function() { $(this).qtip( { content: { text: ' Loading...', ajax: { url: $(this).attr('rel') }, title: { text: $(this).text(), button: true } } }).click(function() { return false; }); }); }); This code make all rel's on pages to work with tipsy j...
You could use not() to exclude elements: $('a[rel]').not('#IdOfElement').each(function()
Jquery: exclude element I have a following code: $(document).ready(function() { $('a[rel]').each(function() { $(this).qtip( { content: { text: ' Loading...', ajax: { url: $(this).attr('rel') }, title: { text: $(this).text(), button: true } } }).click(function() { return false; }); }); }); This code make all rel's on pa...
TITLE: Jquery: exclude element QUESTION: I have a following code: $(document).ready(function() { $('a[rel]').each(function() { $(this).qtip( { content: { text: ' Loading...', ajax: { url: $(this).attr('rel') }, title: { text: $(this).text(), button: true } } }).click(function() { return false; }); }); }); This code ma...
[ "javascript", "jquery", "ajax" ]
7
10
8,824
3
0
2011-06-06T11:11:42.703000
2011-06-06T11:14:09.187000
6,251,160
6,251,190
What is the meaning of double curly braces initializing a C-struct?
I'm currently working with legacy C++ code, successfully compiled with gcc 2.9.X. I've been asked to port this legacy code to gcc 3.4.X. Most of the errors were easily corrected, but this particular one puzzles me. The context: struct TMessage { THeader header; TData data; }; struct THeader { TEnum myEnum; TBool valid...
It initialises all fields of the POD structure to 0. Rationale: const SomeStruct init = {Value}; Initialises the first field of SomeStruct to Value, the rest of the structure to zero (I forget the section in the standard, but it's there somewhere) Thus: const SomeOtherStruct init = {{Value}}; Initialises the first fiel...
What is the meaning of double curly braces initializing a C-struct? I'm currently working with legacy C++ code, successfully compiled with gcc 2.9.X. I've been asked to port this legacy code to gcc 3.4.X. Most of the errors were easily corrected, but this particular one puzzles me. The context: struct TMessage { THeade...
TITLE: What is the meaning of double curly braces initializing a C-struct? QUESTION: I'm currently working with legacy C++ code, successfully compiled with gcc 2.9.X. I've been asked to port this legacy code to gcc 3.4.X. Most of the errors were easily corrected, but this particular one puzzles me. The context: struct...
[ "c++", "c", "struct" ]
22
25
13,698
3
0
2011-06-06T11:12:20.503000
2011-06-06T11:14:54.613000
6,251,163
6,251,238
is it true that one computer will only have one java version?
is it true that the java -version command returns the java version for the java that I use to browse the web, but the java version that I use in netbeans / eclipse can be a totally different version? In fact can the version of java i use in netbeans and eclipse be different? Or is it that a system only has 1 version of...
The version of Java that is used in the browser is defined in the control panel. This defaults to the version that is returned by java -version. IE uses a JRE. When NetBeans is installed, it asks which version of Java to use, so this is not necessarily the same as IE, alkthough it may default to the same version JDK. N...
is it true that one computer will only have one java version? is it true that the java -version command returns the java version for the java that I use to browse the web, but the java version that I use in netbeans / eclipse can be a totally different version? In fact can the version of java i use in netbeans and ecli...
TITLE: is it true that one computer will only have one java version? QUESTION: is it true that the java -version command returns the java version for the java that I use to browse the web, but the java version that I use in netbeans / eclipse can be a totally different version? In fact can the version of java i use in...
[ "java", "java-me", "jakarta-ee", "versioning" ]
0
2
215
4
0
2011-06-06T11:13:03.477000
2011-06-06T11:17:57.197000
6,251,167
6,251,561
How to embed a javascript/jquery file in ExpressionEngine?
I need to embed jquery files in ExpressionEngine. I have created the template js under the main site template group. I know that the css is embedding with the following tag: for css its {stylesheet=template_group/template} I want to know what is the tag for embedding js files
Just make sure that your template containing your javascript is of the "JavaScript" type, and link it using the standard path syntax:
How to embed a javascript/jquery file in ExpressionEngine? I need to embed jquery files in ExpressionEngine. I have created the template js under the main site template group. I know that the css is embedding with the following tag: for css its {stylesheet=template_group/template} I want to know what is the tag for emb...
TITLE: How to embed a javascript/jquery file in ExpressionEngine? QUESTION: I need to embed jquery files in ExpressionEngine. I have created the template js under the main site template group. I know that the css is embedding with the following tag: for css its {stylesheet=template_group/template} I want to know what ...
[ "expressionengine" ]
4
8
6,911
1
0
2011-06-06T11:13:10.347000
2011-06-06T11:48:11.937000
6,251,171
6,251,786
Architecturally what is the difference between a shared object (SO) and a dynamic link library (DLL)?
The question is pretty much in the title: in terms of OS-level implementation, how are shared objects and dlls different? The reason I ask this is because I recently read this page on extending Python, which states: Unix and Windows use completely different paradigms for run-time loading of code. Before you try to buil...
A Dll is pretty much the same mechanism as used by.so or.dylib (MacOS) files, so it is very hard to explain exactly what the differences are. The core difference is in what is visible by default from each type of file..so files export the language (gcc) level linkage - which means that (by default) all C & c++ symbols ...
Architecturally what is the difference between a shared object (SO) and a dynamic link library (DLL)? The question is pretty much in the title: in terms of OS-level implementation, how are shared objects and dlls different? The reason I ask this is because I recently read this page on extending Python, which states: Un...
TITLE: Architecturally what is the difference between a shared object (SO) and a dynamic link library (DLL)? QUESTION: The question is pretty much in the title: in terms of OS-level implementation, how are shared objects and dlls different? The reason I ask this is because I recently read this page on extending Python...
[ "windows", "linux", "dll", "operating-system", "shared-libraries" ]
19
17
7,303
1
0
2011-06-06T11:13:41.177000
2011-06-06T12:10:17.347000
6,251,174
6,251,292
(PHP) Reject descriptions that don't include the required tags
This is how my script currently sends errors when the description is too short: if(strlen($linkres->content) = minStoryLength ) { // if description is too short $main_smarty->assign('submit_error', 'incomplete'); $main_smarty->display($the_template. '/submit_errors.tpl'); $error = true; } I want to send the same error ...
$tags = array('img','youtube','googlevideo','xoinks','break','vimeo','revver','myspace','veoh','wmv','dailymotion','ifilm','metacafe','tubeley','guba'); $contains = false; foreach($tags as $check) { if(preg_match("/<".$check.">/", $linkres->content)) { $contains = true; } } if(!$contains) { // here goes your error } ...
(PHP) Reject descriptions that don't include the required tags This is how my script currently sends errors when the description is too short: if(strlen($linkres->content) = minStoryLength ) { // if description is too short $main_smarty->assign('submit_error', 'incomplete'); $main_smarty->display($the_template. '/submi...
TITLE: (PHP) Reject descriptions that don't include the required tags QUESTION: This is how my script currently sends errors when the description is too short: if(strlen($linkres->content) = minStoryLength ) { // if description is too short $main_smarty->assign('submit_error', 'incomplete'); $main_smarty->display($the...
[ "php" ]
0
0
78
3
0
2011-06-06T11:13:46.060000
2011-06-06T11:23:58.443000
6,251,179
6,251,271
How to make IE 8 not to show anything to an iFrame before onload element is finished?
I want to hide elements of an website loaded in an iFrame. The script and the site can take a while so it is requested that the iFrame content is only shown after it has been modified. I use an onload event to execute the script which hides the elements. I have access to the iFrame content (it's on the same domain, but...
You could have the hidden on your parent page load and on the onload event of the iframe set this one to visible: function frameLoaded() { sleep(3000); //simulating the time the script needs var leftDiv = window.frames.testFrame.document.getElementById("leftcol"); leftDiv.style.display = "none"; document.getElementById...
How to make IE 8 not to show anything to an iFrame before onload element is finished? I want to hide elements of an website loaded in an iFrame. The script and the site can take a while so it is requested that the iFrame content is only shown after it has been modified. I use an onload event to execute the script which...
TITLE: How to make IE 8 not to show anything to an iFrame before onload element is finished? QUESTION: I want to hide elements of an website loaded in an iFrame. The script and the site can take a while so it is requested that the iFrame content is only shown after it has been modified. I use an onload event to execut...
[ "javascript", "iframe", "internet-explorer-8", "coding-style", "onload" ]
0
1
293
1
0
2011-06-06T11:14:15.827000
2011-06-06T11:21:49.073000
6,251,180
6,251,216
Un-rarring with java?
In a piece of my code, I want to download a.rar (archive) file in a certain folder and unrar it, rather than download all the files one by one. However, I couldn't find a way to do this.
You can either execute external unrar utility using Runtime.getRuntime().exec() or use Java library like JUnrar.
Un-rarring with java? In a piece of my code, I want to download a.rar (archive) file in a certain folder and unrar it, rather than download all the files one by one. However, I couldn't find a way to do this.
TITLE: Un-rarring with java? QUESTION: In a piece of my code, I want to download a.rar (archive) file in a certain folder and unrar it, rather than download all the files one by one. However, I couldn't find a way to do this. ANSWER: You can either execute external unrar utility using Runtime.getRuntime().exec() or u...
[ "java", "rar" ]
2
3
2,842
2
0
2011-06-06T11:14:18.780000
2011-06-06T11:16:58.887000
6,251,184
6,251,612
frameset issue in iPad Safari
First of all, while I do understand that frameset is kind of very old and should be avoided. But in my case, i have recently started working on a client project and have limited rights to make major changes, like converting frameset to iframe code... Having said that, here is the issue; I have a frameset with 3 rows de...
you should create 2 stylesheets, 1 for each mode: http://matthewjamestaylor.com/blog/ipad-layout-with-landscape-portrait-modes or http://www.cloudfour.com/ipad-css/
frameset issue in iPad Safari First of all, while I do understand that frameset is kind of very old and should be avoided. But in my case, i have recently started working on a client project and have limited rights to make major changes, like converting frameset to iframe code... Having said that, here is the issue; I ...
TITLE: frameset issue in iPad Safari QUESTION: First of all, while I do understand that frameset is kind of very old and should be avoided. But in my case, i have recently started working on a client project and have limited rights to make major changes, like converting frameset to iframe code... Having said that, her...
[ "javascript", "html", "ipad", "safari", "frames" ]
0
0
3,169
3
0
2011-06-06T11:14:23.283000
2011-06-06T11:53:27.473000
6,251,188
6,251,581
Perl DBI begin_work and nested transactions interacting with SQL server 2008
I have a scenario like below. Where the main method needs to call multiple methods, 1 method for 1 table, and each method runs a set of statements which has to be atomic. So they are enclosed within a begin_work,commit,rollback block. Also call_method_for_table1,call_method_for_table2,call_method_for_table3 should all ...
I think it's impossible without modifying the call_method_for_tableX. Suppose call_method_for_table1 succeeds, then the commit is done and you can't rollback after call_method_for_table2 eventually failed.
Perl DBI begin_work and nested transactions interacting with SQL server 2008 I have a scenario like below. Where the main method needs to call multiple methods, 1 method for 1 table, and each method runs a set of statements which has to be atomic. So they are enclosed within a begin_work,commit,rollback block. Also cal...
TITLE: Perl DBI begin_work and nested transactions interacting with SQL server 2008 QUESTION: I have a scenario like below. Where the main method needs to call multiple methods, 1 method for 1 table, and each method runs a set of statements which has to be atomic. So they are enclosed within a begin_work,commit,rollba...
[ "perl", "sql-server-2008", "transactions", "nested", "dbi" ]
3
1
2,895
1
0
2011-06-06T11:14:44.967000
2011-06-06T11:50:59.347000
6,251,191
6,251,729
SQL query - strange behaviour
DECLARE @OrdersTemp TABLE ( OrderId UNIQUEIDENTIFIER ) INSERT INTO @OrdersTemp SELECT ord.Id FROM Orders --all rows count SELECT @RowsCount = COUNT(DISTINCT ord.Id) FROM Orders --@RowsCount = 5. It's right! --second table with paging DECLARE @OrdersTempWithPaging TABLE ( OrderId UNIQUEIDENTIFIER ) INSERT INTO @Ord...
Try this (reversing the DISTINCT use): INSERT INTO @OrdersTempWithPaging SELECT DISTINCT OrderId FROM (SELECT OrderId, ROW_NUMBER() OVER (ORDER BY OrderId) AS RowNum FROM @OrdersTemp) AS alias WHERE RowNum BETWEEN (@PageIndex - 1) * @PageSize + 1 AND @PageIndex * @PageSize If you need only distinct order-ids, you could...
SQL query - strange behaviour DECLARE @OrdersTemp TABLE ( OrderId UNIQUEIDENTIFIER ) INSERT INTO @OrdersTemp SELECT ord.Id FROM Orders --all rows count SELECT @RowsCount = COUNT(DISTINCT ord.Id) FROM Orders --@RowsCount = 5. It's right! --second table with paging DECLARE @OrdersTempWithPaging TABLE ( OrderId UNIQUE...
TITLE: SQL query - strange behaviour QUESTION: DECLARE @OrdersTemp TABLE ( OrderId UNIQUEIDENTIFIER ) INSERT INTO @OrdersTemp SELECT ord.Id FROM Orders --all rows count SELECT @RowsCount = COUNT(DISTINCT ord.Id) FROM Orders --@RowsCount = 5. It's right! --second table with paging DECLARE @OrdersTempWithPaging TABL...
[ "sql", "sql-server-2008-r2" ]
1
2
407
3
0
2011-06-06T11:15:02.767000
2011-06-06T12:04:41.263000
6,251,195
6,251,375
jQuery: draggable bars - remember position with cookie?
hey guys, I can't seem to get it working. I have draggable black bars that act as navigation on top of the content. I simply want to browser to remember the position of the bars with a cookie. Whenever a user drags the bars and clicks something else (the page refreshes) the bars should stay at the last position. I can'...
You got your condition wrong way around: if ($.cookie('position'+ $(this).index('li').toString()) ) { // random distribution of elements } else { // if a cookie exists (the bars have already been dragged) // remember the position } Swap it around, so that if a cookie exists, it won't randomly distribute them. if (!...
jQuery: draggable bars - remember position with cookie? hey guys, I can't seem to get it working. I have draggable black bars that act as navigation on top of the content. I simply want to browser to remember the position of the bars with a cookie. Whenever a user drags the bars and clicks something else (the page refr...
TITLE: jQuery: draggable bars - remember position with cookie? QUESTION: hey guys, I can't seem to get it working. I have draggable black bars that act as navigation on top of the content. I simply want to browser to remember the position of the bars with a cookie. Whenever a user drags the bars and clicks something e...
[ "jquery", "jquery-ui", "cookies", "drag-and-drop", "draggable" ]
2
0
1,384
1
0
2011-06-06T11:15:16.823000
2011-06-06T11:30:31.720000
6,251,198
6,251,393
Hibernate configuration files in an Ant-built WAR file
I have a web app in Eclipse that is working fine. I have built a war file using the ant script below, it works until the program attempts to access Hibernate: The problem I am having is the positioning of the Hibernate config files. In my application they are in: audiClave\src but in the deployed app the xml files are ...
Ask Ant to the files into /WEB-INF/classes. You are correct - that's where they belong. Be sure to create the directory path.
Hibernate configuration files in an Ant-built WAR file I have a web app in Eclipse that is working fine. I have built a war file using the ant script below, it works until the program attempts to access Hibernate: The problem I am having is the positioning of the Hibernate config files. In my application they are in: a...
TITLE: Hibernate configuration files in an Ant-built WAR file QUESTION: I have a web app in Eclipse that is working fine. I have built a war file using the ant script below, it works until the program attempts to access Hibernate: The problem I am having is the positioning of the Hibernate config files. In my applicat...
[ "java", "hibernate", "tomcat", "ant" ]
2
3
2,561
1
0
2011-06-06T11:15:35.883000
2011-06-06T11:32:17.713000
6,251,202
6,251,593
NSCondition ->Objective C
I am a newbie to Objective-C. I'm currently working on threads. I have to make a synchronous execution of threads. I'm using NSInvocationOperaion to spawn a thread. I have two threads. I need to wait for the 1st thread to signal a event or the timeout. Signalling a event can be done by NSConditionLock. How to signal a ...
You mean NSCondition? You can use waitUntilDate: as relative time. [condition lock]; // wait 5 seconds. [condition waitUntilDate:[NSDate dateWithTimeIntervalSinceNow:5]]; [condition unlock]; EDITED: My PseudoSerialQueue class requires to be called from a class that is derived from NSObject like the following. @interfac...
NSCondition ->Objective C I am a newbie to Objective-C. I'm currently working on threads. I have to make a synchronous execution of threads. I'm using NSInvocationOperaion to spawn a thread. I have two threads. I need to wait for the 1st thread to signal a event or the timeout. Signalling a event can be done by NSCondi...
TITLE: NSCondition ->Objective C QUESTION: I am a newbie to Objective-C. I'm currently working on threads. I have to make a synchronous execution of threads. I'm using NSInvocationOperaion to spawn a thread. I have two threads. I need to wait for the 1st thread to signal a event or the timeout. Signalling a event can ...
[ "objective-c" ]
3
2
5,208
2
0
2011-06-06T11:15:58.763000
2011-06-06T11:52:00.707000
6,251,205
6,251,345
Singleton is Violated or Not?
While we are creating a class using Singleton Pattern I am able to clone in the same class. It means the Singleton Pattern rule was violated. Can any one please clarify my doubt. My Code is: class SingletonObject implements Cloneable { private SingletonObject() { // no code req'd } public static SingletonObject getSin...
Good observation. Your code is a good example of why many Java developers consider clone() to be problematic: It is a mechanism which circumvents many restrictions that you can place on the creation of objects. It can thus be used to duplicate singletons. This is (arguably) a design flaw of Java. The only solution is t...
Singleton is Violated or Not? While we are creating a class using Singleton Pattern I am able to clone in the same class. It means the Singleton Pattern rule was violated. Can any one please clarify my doubt. My Code is: class SingletonObject implements Cloneable { private SingletonObject() { // no code req'd } public...
TITLE: Singleton is Violated or Not? QUESTION: While we are creating a class using Singleton Pattern I am able to clone in the same class. It means the Singleton Pattern rule was violated. Can any one please clarify my doubt. My Code is: class SingletonObject implements Cloneable { private SingletonObject() { // no co...
[ "java", "design-patterns" ]
0
0
1,394
6
0
2011-06-06T11:16:12.953000
2011-06-06T11:27:42.127000
6,251,214
6,289,350
Download in Background for iPad Application
Is it possible to continue download when we close application. Suppose we have download button in the app and we press it. Download start but if we want to navigate to another application so that we close application, after we come back to that application then the download should complete or in progress. Thanks in adv...
More info can be found on Apple developer documentation on Completing a Finite-Length Task in the Background section
Download in Background for iPad Application Is it possible to continue download when we close application. Suppose we have download button in the app and we press it. Download start but if we want to navigate to another application so that we close application, after we come back to that application then the download s...
TITLE: Download in Background for iPad Application QUESTION: Is it possible to continue download when we close application. Suppose we have download button in the app and we press it. Download start but if we want to navigate to another application so that we close application, after we come back to that application t...
[ "iphone", "ipad", "download" ]
0
0
1,393
1
0
2011-06-06T11:16:44.657000
2011-06-09T07:16:45.537000
6,251,219
6,251,357
Get Asp.net/iis to set Cache-control:max-age for static files
We have a Webforms project with url routing. I have defined exception routes for images and css-files as routes.Add("IgnoreImages", new Route("img/{*pathInfo}", new StopRoutingHandler())); routes.Add("IgnoreCss", new Route("css/{*pathInfo}", new StopRoutingHandler())); so static files should be served by IIS directly a...
The solution is using the system.webserver section in the web.config file to configure server caching (and compression). Here is a starting point: http://www.iis.net/ConfigReference/system.webServer/staticContent/clientCache Example:
Get Asp.net/iis to set Cache-control:max-age for static files We have a Webforms project with url routing. I have defined exception routes for images and css-files as routes.Add("IgnoreImages", new Route("img/{*pathInfo}", new StopRoutingHandler())); routes.Add("IgnoreCss", new Route("css/{*pathInfo}", new StopRoutingH...
TITLE: Get Asp.net/iis to set Cache-control:max-age for static files QUESTION: We have a Webforms project with url routing. I have defined exception routes for images and css-files as routes.Add("IgnoreImages", new Route("img/{*pathInfo}", new StopRoutingHandler())); routes.Add("IgnoreCss", new Route("css/{*pathInfo}"...
[ "asp.net", "image", "caching", "cache-control" ]
20
30
23,075
2
0
2011-06-06T11:17:02.237000
2011-06-06T11:28:49.880000
6,251,223
6,251,253
htaccess+modrewrite issue 2
I want that every user has a profile-url like this: www.example.com/username But my php page need the id of the user ( not username ). for example I want that this url: www.example.com/profile.php?id=13 become: www.example.com/john what I have to write in the htaccess?
There is no magic answer to this question. You obviously need to have a PHP script that is able to take a username as a query parameter: www.example.com/profile.php?username=john Then you can use mod_rewrite: RewriteEngine On RewriteBase / RewriteRule ^([^\.]+)$ profile.php?username=$1 The above rewrite rule will match...
htaccess+modrewrite issue 2 I want that every user has a profile-url like this: www.example.com/username But my php page need the id of the user ( not username ). for example I want that this url: www.example.com/profile.php?id=13 become: www.example.com/john what I have to write in the htaccess?
TITLE: htaccess+modrewrite issue 2 QUESTION: I want that every user has a profile-url like this: www.example.com/username But my php page need the id of the user ( not username ). for example I want that this url: www.example.com/profile.php?id=13 become: www.example.com/john what I have to write in the htaccess? ANS...
[ "php", ".htaccess" ]
0
2
37
2
0
2011-06-06T11:17:09.803000
2011-06-06T11:19:43.490000
6,251,228
6,251,288
load() sequentially, instead of at the same time with jQuery
I'm developing a site where I want to get all the links from a navigation bar, and load a div from the linked pages into a big container. What I have so far is the following: $('nav a').each(function(index){ var to_load = $(this).attr('href') + '#slides section'; $(' ').load(to_load, function(){ $('#slides').append($(t...
I'd try with async: false mentioned jQuery.ajax documentation. Don't know if it works with load but I'd bet it does. Also, for performance reason, don't use: $(this).attr('href') + '#slides section' but this.href + '#slides section' To avoid converting this into a jQuery element (you only need it to get the href attrib...
load() sequentially, instead of at the same time with jQuery I'm developing a site where I want to get all the links from a navigation bar, and load a div from the linked pages into a big container. What I have so far is the following: $('nav a').each(function(index){ var to_load = $(this).attr('href') + '#slides secti...
TITLE: load() sequentially, instead of at the same time with jQuery QUESTION: I'm developing a site where I want to get all the links from a navigation bar, and load a div from the linked pages into a big container. What I have so far is the following: $('nav a').each(function(index){ var to_load = $(this).attr('href'...
[ "javascript", "jquery", "dom" ]
3
2
771
4
0
2011-06-06T11:17:29.210000
2011-06-06T11:23:28.930000
6,251,229
6,251,285
Why is this object a potential leak?
how can i solve this potential leak? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; Chapter *chapter =[Chapter alloc]; switch (indexPath.section) { case 0: chapter = [einfuerung objectAtIndex:row]; break; case 1: chapter = [vertiefung ob...
You should not alloc the chapter in below statement. Chapter *chapter =[Chapter alloc]; Use below instead. Chapter *chapter = nil; I have modified your code NSUInteger row = [indexPath row]; Chapter *chapter = nil; switch (indexPath.section) { case 0: chapter = [[einfuerung objectAtIndex:row] retain]; break; case 1: c...
Why is this object a potential leak? how can i solve this potential leak? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; Chapter *chapter =[Chapter alloc]; switch (indexPath.section) { case 0: chapter = [einfuerung objectAtIndex:row]; br...
TITLE: Why is this object a potential leak? QUESTION: how can i solve this potential leak? - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSUInteger row = [indexPath row]; Chapter *chapter =[Chapter alloc]; switch (indexPath.section) { case 0: chapter = [einfuerung obje...
[ "iphone", "xcode", "memory-leaks", "autorelease" ]
0
4
566
3
0
2011-06-06T11:17:34.057000
2011-06-06T11:22:59.147000
6,251,237
6,251,673
Are methods in the pimpl inlined?
Considering next simple example: The header: // a.hpp #ifndef A_HPP #define A_HPP #include class A { public: A(); int foo(); private: struct Imp; std::auto_ptr< Imp > pimpl; }; #endif // A_HPP The implementation: // a.cpp #include "a.hpp" struct A::Imp { int foo() { // do something and return the result } }; A::A(...
Herb Sutter once made a great article about inlining. The first question to ask is: when can inlining happen? In C++: it may happen at the compilation stage it may happen at the link stage (LTO: Link Time Optimization) Both times, the mechanism is similar: if the compiler/linker knows about the implementation of the me...
Are methods in the pimpl inlined? Considering next simple example: The header: // a.hpp #ifndef A_HPP #define A_HPP #include class A { public: A(); int foo(); private: struct Imp; std::auto_ptr< Imp > pimpl; }; #endif // A_HPP The implementation: // a.cpp #include "a.hpp" struct A::Imp { int foo() { // do something...
TITLE: Are methods in the pimpl inlined? QUESTION: Considering next simple example: The header: // a.hpp #ifndef A_HPP #define A_HPP #include class A { public: A(); int foo(); private: struct Imp; std::auto_ptr< Imp > pimpl; }; #endif // A_HPP The implementation: // a.cpp #include "a.hpp" struct A::Imp { int foo()...
[ "c++", "inline", "pimpl-idiom" ]
4
10
1,466
2
0
2011-06-06T11:17:52.237000
2011-06-06T11:59:24.997000
6,251,242
6,253,216
Take webpage screenshot after a certain interval of time
I have written a chrome extension which could take the visible tab's screenshot. Now, I want the extension to take pictures automatically after a certain interval of time without pressing the button. How could that be done?
It should be pretty simple, just use the standard methods in Javascript setTimeout and setInterval. var seconds = 10 * 1000; var windowId = some window id; setTimeout(function() { chrome.tabs.captureVisibleTab( some window id, {}, function () {... do something with the screen shot;} ) }, seconds); This will take a scre...
Take webpage screenshot after a certain interval of time I have written a chrome extension which could take the visible tab's screenshot. Now, I want the extension to take pictures automatically after a certain interval of time without pressing the button. How could that be done?
TITLE: Take webpage screenshot after a certain interval of time QUESTION: I have written a chrome extension which could take the visible tab's screenshot. Now, I want the extension to take pictures automatically after a certain interval of time without pressing the button. How could that be done? ANSWER: It should be...
[ "google-chrome", "google-chrome-extension", "webpage-screenshot" ]
1
1
2,863
1
0
2011-06-06T11:18:21.817000
2011-06-06T14:04:15.880000
6,251,244
6,253,115
online "diary" - existing script / mysql / fwrite()?
i am looking for a PHP web script that could suit my needs. i am ready to write it but i suppose it has already been done, so i thought i'd ask here first. what i want is to have a web page that i can edit in real time (just like etherpad), but that basically is never finished. in etherpad people export their work when...
What you intend to do sounds an awful lot like a wiki... If you want to checkout a lightweight PHP wiki, then have a look at DokuWiki. It doesn't even require a DB (uses plain textfiles) and changes can be tracked.
online "diary" - existing script / mysql / fwrite()? i am looking for a PHP web script that could suit my needs. i am ready to write it but i suppose it has already been done, so i thought i'd ask here first. what i want is to have a web page that i can edit in real time (just like etherpad), but that basically is neve...
TITLE: online "diary" - existing script / mysql / fwrite()? QUESTION: i am looking for a PHP web script that could suit my needs. i am ready to write it but i suppose it has already been done, so i thought i'd ask here first. what i want is to have a web page that i can edit in real time (just like etherpad), but that...
[ "php", "mysql", "editing", "etherpad" ]
0
1
987
2
0
2011-06-06T11:18:25.403000
2011-06-06T13:57:05.863000
6,251,256
6,251,300
single file generator in visual studio 2010
i took the XmlClassGenerator sample of the visual studio 2010 sdk. in the visual studio 2010 experimental instance it's working and generating c# file from xml file. but in the normal visual studio 2010 this cutom tool does not work.i get a warning "Cannot find custom tool 'XmlClassGenerator' on this system". why?
In the experimental instance, your Extension is automatically registered with Visual Studio. In order to use it in the standard installation, you have to register it yourself. See this topic on msdn for more info.
single file generator in visual studio 2010 i took the XmlClassGenerator sample of the visual studio 2010 sdk. in the visual studio 2010 experimental instance it's working and generating c# file from xml file. but in the normal visual studio 2010 this cutom tool does not work.i get a warning "Cannot find custom tool 'X...
TITLE: single file generator in visual studio 2010 QUESTION: i took the XmlClassGenerator sample of the visual studio 2010 sdk. in the visual studio 2010 experimental instance it's working and generating c# file from xml file. but in the normal visual studio 2010 this cutom tool does not work.i get a warning "Cannot f...
[ "visual-studio-2010" ]
2
2
550
1
0
2011-06-06T11:19:51.687000
2011-06-06T11:24:27.813000
6,251,266
6,251,307
How to show/hide another application's window(s)?
I want to create a button that can hide an exe application. As example: this application will start spider.exe when page loads. I need a button that can hide & show the spider.exe. How can I do it with VB.NET, C#, or Java? I tried to use myProcess.StartInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Normal myP...
I think you should use PInvoke and call API ShowWindow passing the other app window handle and proper parameters to show or hide.
How to show/hide another application's window(s)? I want to create a button that can hide an exe application. As example: this application will start spider.exe when page loads. I need a button that can hide & show the spider.exe. How can I do it with VB.NET, C#, or Java? I tried to use myProcess.StartInfo.WindowStyle ...
TITLE: How to show/hide another application's window(s)? QUESTION: I want to create a button that can hide an exe application. As example: this application will start spider.exe when page loads. I need a button that can hide & show the spider.exe. How can I do it with VB.NET, C#, or Java? I tried to use myProcess.Star...
[ "c#", "java", "vb.net" ]
2
2
6,572
1
0
2011-06-06T11:21:10.053000
2011-06-06T11:24:46.603000
6,251,294
6,251,370
Get related Jquery submenu to stay open on new page load?
I need help with following menu. How would I get a particular submenu to stay open when a submenu item is clicked and another page is loaded. Code on jsfiddle
If you reload the entire page, you have to submit some information to the new page. To achieve this, you have to modify the links of your sub menu items, or set a cookie. On page load you have to parse these information (url or cookie), and apply this to your menu. You could also use some server side code to have a pre...
Get related Jquery submenu to stay open on new page load? I need help with following menu. How would I get a particular submenu to stay open when a submenu item is clicked and another page is loaded. Code on jsfiddle
TITLE: Get related Jquery submenu to stay open on new page load? QUESTION: I need help with following menu. How would I get a particular submenu to stay open when a submenu item is clicked and another page is loaded. Code on jsfiddle ANSWER: If you reload the entire page, you have to submit some information to the ne...
[ "javascript", "jquery", "menu" ]
1
5
2,430
3
0
2011-06-06T11:24:11.377000
2011-06-06T11:30:07.743000
6,251,303
6,251,427
valgrind - invalid write size
we have couple of C applications which talk using the shared memory. first application adds the message and the second one always reads from the shared memory. struct messagestruct { unsigned int sessionid; uint8_t message[16]; //unsigned 8bit int }__attribute__ ((__packed__)); we need to have 3 sessions (for 3 users)....
memcpy(shmaddr, currentsessionsstruct, SHARED_SIZE); You are copying 3 * sizeof(messagestruct) + sizeof(int). I believe you want to copy only sizeof(currentsessionstruct).
valgrind - invalid write size we have couple of C applications which talk using the shared memory. first application adds the message and the second one always reads from the shared memory. struct messagestruct { unsigned int sessionid; uint8_t message[16]; //unsigned 8bit int }__attribute__ ((__packed__)); we need to ...
TITLE: valgrind - invalid write size QUESTION: we have couple of C applications which talk using the shared memory. first application adds the message and the second one always reads from the shared memory. struct messagestruct { unsigned int sessionid; uint8_t message[16]; //unsigned 8bit int }__attribute__ ((__packe...
[ "size", "valgrind", "memcpy" ]
2
3
3,686
1
0
2011-06-06T11:24:29.180000
2011-06-06T11:34:44.590000
6,251,308
6,251,334
Java: Connect to MS-Access Database (mdb or mde)
I am trying to connect to MS-Access using JDBC:ODBC: public boolean connectToAccess(String accessFilePath) { //Get connection to database try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); myConnection = DriverManager.getConnection("jdbc: odbc: driver={Microsoft Access Driver (*.mdb)};DBQ=" + accessFilePath); } catch...
Take those spaces out of the connection string and see if that helps. I'd also recommend printing the stack trace. public boolean connectToAccess(String accessFilePath) { //Get connection to database try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); myConnection = DriverManager.getConnection("jdbc:odbc:driver={Micro...
Java: Connect to MS-Access Database (mdb or mde) I am trying to connect to MS-Access using JDBC:ODBC: public boolean connectToAccess(String accessFilePath) { //Get connection to database try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); myConnection = DriverManager.getConnection("jdbc: odbc: driver={Microsoft Access...
TITLE: Java: Connect to MS-Access Database (mdb or mde) QUESTION: I am trying to connect to MS-Access using JDBC:ODBC: public boolean connectToAccess(String accessFilePath) { //Get connection to database try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); myConnection = DriverManager.getConnection("jdbc: odbc: driver...
[ "java", "database", "ms-access", "jdbc", "odbc" ]
2
3
14,525
3
0
2011-06-06T11:24:51.860000
2011-06-06T11:27:17.260000
6,251,326
6,251,467
Border radius in thead and tfoot with background image
I have a table, inside thead, tbody and tfoot. Thead and tfoot have a background image. I try to apply rounded corners, and everything looks good until I apply any background (color or image). Screen below: Thead and tfoot have also border, so when I hide background, it's rounded like I want... The problem appears in a...
You can set the background as an image with z-index: 1 and set the content as z-index: 2, then round the image's corners using CSS.
Border radius in thead and tfoot with background image I have a table, inside thead, tbody and tfoot. Thead and tfoot have a background image. I try to apply rounded corners, and everything looks good until I apply any background (color or image). Screen below: Thead and tfoot have also border, so when I hide backgroun...
TITLE: Border radius in thead and tfoot with background image QUESTION: I have a table, inside thead, tbody and tfoot. Thead and tfoot have a background image. I try to apply rounded corners, and everything looks good until I apply any background (color or image). Screen below: Thead and tfoot have also border, so whe...
[ "html", "css", "background", "border" ]
1
1
1,556
1
0
2011-06-06T11:26:34.863000
2011-06-06T11:38:36.023000
6,251,328
6,258,949
Add new shape on paper(Raphael JS)
i need to add new shape to papaer object using button. my html: Calculator Width: my calc.js is: window.onload = function() { } function testResults (form){ var paper = new Raphael(document.getElementById('canvas_container'), 500, 500); var small = paper.path("M10 270 L 60 270 M10 265 L 10 275 M60 265 L60 275"); var ...
ok. i will try to give an answer. i hope this solution is correct: my html: Calculator Width: Go gate and my calc.js: window.onload = function () { var paper = Raphael("canvas", 500, 500), btn = document.getElementById("run"), gate = document.getElementById("gate"), width = document.getElementById("width"), gatechk = d...
Add new shape on paper(Raphael JS) i need to add new shape to papaer object using button. my html: Calculator Width: my calc.js is: window.onload = function() { } function testResults (form){ var paper = new Raphael(document.getElementById('canvas_container'), 500, 500); var small = paper.path("M10 270 L 60 270 M10 2...
TITLE: Add new shape on paper(Raphael JS) QUESTION: i need to add new shape to papaer object using button. my html: Calculator Width: my calc.js is: window.onload = function() { } function testResults (form){ var paper = new Raphael(document.getElementById('canvas_container'), 500, 500); var small = paper.path("M10 ...
[ "javascript", "raphael" ]
1
1
2,361
1
0
2011-06-06T11:26:41.583000
2011-06-06T22:57:35.520000
6,251,331
6,251,383
Get key of the last element in an array
Hay, i have an array which contains a set of arrays, here's an example. array( [0]=>array('name'=>'bob'), [2]=>array('name'=>'tom'), [3]=array('name'=>'mark') ) How would i get the last item in the array, and returns it's key. So in the above example it would return 3.
end($array); echo key($array) This should return the key of the last element.
Get key of the last element in an array Hay, i have an array which contains a set of arrays, here's an example. array( [0]=>array('name'=>'bob'), [2]=>array('name'=>'tom'), [3]=array('name'=>'mark') ) How would i get the last item in the array, and returns it's key. So in the above example it would return 3.
TITLE: Get key of the last element in an array QUESTION: Hay, i have an array which contains a set of arrays, here's an example. array( [0]=>array('name'=>'bob'), [2]=>array('name'=>'tom'), [3]=array('name'=>'mark') ) How would i get the last item in the array, and returns it's key. So in the above example it would re...
[ "php", "arrays", "indexing" ]
15
33
28,308
5
0
2011-06-06T11:27:05.737000
2011-06-06T11:31:28.133000
6,251,348
6,251,421
How to add a shortcut in a VS2010 setup project which does not reevaluate installed files
The situation: I've got a Windows Desktop application that connects to various services (one at a time) to perform various calls. My application works the same way no matter which service it connects to. Which service it should connect to at any time is defined in an application.config file. In order to switch between ...
Your deployment project has what is known as an "advertised shortcut". There are several ways to disable those, see the following link: http://social.msdn.microsoft.com/Forums/en/vssetup/thread/b57f1d84-9b0c-4c29-b140-0555f92ffed8
How to add a shortcut in a VS2010 setup project which does not reevaluate installed files The situation: I've got a Windows Desktop application that connects to various services (one at a time) to perform various calls. My application works the same way no matter which service it connects to. Which service it should co...
TITLE: How to add a shortcut in a VS2010 setup project which does not reevaluate installed files QUESTION: The situation: I've got a Windows Desktop application that connects to various services (one at a time) to perform various calls. My application works the same way no matter which service it connects to. Which se...
[ ".net", "visual-studio-2010", "deployment", "deployment-project" ]
3
2
3,035
2
0
2011-06-06T11:28:04.187000
2011-06-06T11:34:24.153000
6,251,350
6,251,893
Grouping Unix Timestamp by Day Producing Unevenly Spaced Groups
I'm using a MySQL query to pull a range of datetimes as a Unix Timestamp (because I'll be converting them to Javascript time). I'm grouping by 'FROM_UNIXTIME' as below: SELECT UNIX_TIMESTAMP(DateAndTime) as x, Sum(If(Pass='Pass',1,0)) AS y, Sum(If(Pass='Fail',1,0)) AS z, Sum(If(Pass='Fail',1,0))/(Sum(If(Pass='Pass',1,0...
Question is very confused. Your SQL statement makes no sense - you are grouping by entities not found in the select statement. And a bar chart plots an ordered set of values - so if there's something funny with the spacing then its not really a bar chart. But I think the answer you are looking for is: SELECT DATE_FORMA...
Grouping Unix Timestamp by Day Producing Unevenly Spaced Groups I'm using a MySQL query to pull a range of datetimes as a Unix Timestamp (because I'll be converting them to Javascript time). I'm grouping by 'FROM_UNIXTIME' as below: SELECT UNIX_TIMESTAMP(DateAndTime) as x, Sum(If(Pass='Pass',1,0)) AS y, Sum(If(Pass='Fa...
TITLE: Grouping Unix Timestamp by Day Producing Unevenly Spaced Groups QUESTION: I'm using a MySQL query to pull a range of datetimes as a Unix Timestamp (because I'll be converting them to Javascript time). I'm grouping by 'FROM_UNIXTIME' as below: SELECT UNIX_TIMESTAMP(DateAndTime) as x, Sum(If(Pass='Pass',1,0)) AS ...
[ "mysql", "sql", "datetime", "group-by", "timestamp" ]
0
1
1,532
1
0
2011-06-06T11:28:19.043000
2011-06-06T12:20:16.597000
6,251,361
6,251,408
PHP: escape non-alphanumeric characters
I'm trying to port a script that I wrote in bash some time ago into PHP. One particular line is about escaping all non-alphanumeric characters. In bash, I was able to do it as a one-liner as follows: echo "aaa bbb::" | sed 's/\([^a-zA-Z0-9]\)/\\\1/g' # => aaa\ bbb\:\: The closest I got in PHP was with this: echo preg_r...
echo preg_replace('/([^a-zA-Z0-9])/',"\\\\$1",'aaa bbb::'); //output => aaa\ bbb\:\:
PHP: escape non-alphanumeric characters I'm trying to port a script that I wrote in bash some time ago into PHP. One particular line is about escaping all non-alphanumeric characters. In bash, I was able to do it as a one-liner as follows: echo "aaa bbb::" | sed 's/\([^a-zA-Z0-9]\)/\\\1/g' # => aaa\ bbb\:\: The closest...
TITLE: PHP: escape non-alphanumeric characters QUESTION: I'm trying to port a script that I wrote in bash some time ago into PHP. One particular line is about escaping all non-alphanumeric characters. In bash, I was able to do it as a one-liner as follows: echo "aaa bbb::" | sed 's/\([^a-zA-Z0-9]\)/\\\1/g' # => aaa\ b...
[ "php", "regex", "escaping", "alphanumeric" ]
2
3
2,163
3
0
2011-06-06T11:29:19.413000
2011-06-06T11:33:36.867000
6,251,373
6,251,395
hash_map value deletion
My question concern memory management. I got this container: typedef hash_map PowerdomainHashMap; now I add one element in it PowerdomainHashMap powerdomainMap; Powerdomain* pd1=new Powerdomain("Powerdomain1"); powerdomainMap.insert(Powerdomain_pair(pd1->getName(),pd1)); After that my program does a first step. Now tha...
Is a powerdomainMap.clear() sufficient? No. You have manually acquired memory (using new ), you need to manually release it (using delete ). Better to use smart pointers instead of raw pointers though (preferably std::shared_ptr ).
hash_map value deletion My question concern memory management. I got this container: typedef hash_map PowerdomainHashMap; now I add one element in it PowerdomainHashMap powerdomainMap; Powerdomain* pd1=new Powerdomain("Powerdomain1"); powerdomainMap.insert(Powerdomain_pair(pd1->getName(),pd1)); After that my program do...
TITLE: hash_map value deletion QUESTION: My question concern memory management. I got this container: typedef hash_map PowerdomainHashMap; now I add one element in it PowerdomainHashMap powerdomainMap; Powerdomain* pd1=new Powerdomain("Powerdomain1"); powerdomainMap.insert(Powerdomain_pair(pd1->getName(),pd1)); After ...
[ "c++", "hashmap" ]
1
3
1,569
2
0
2011-06-06T11:30:16.750000
2011-06-06T11:32:23.443000