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
145,402
145,417
Can you recommend Performance Analysis tools for PHP?
Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there, but I'm wondering what people recommend as being the most useful and w...
Try webgrind. It gives you the profiling of CacheGrinder in an easy to read, browser based format. I'm on a Mac and it has made profiling a breeze.
Can you recommend Performance Analysis tools for PHP? Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there, but I'm wonderin...
TITLE: Can you recommend Performance Analysis tools for PHP? QUESTION: Can anyone recommend some useful performance analysis tools for PHP scripts? Anything that could help me find problematic or unusually slow blocks of code, details about execution time, etc. would be really helpful. I know there are tools out there...
[ "php", "performance", "testing" ]
11
11
10,191
5
0
2008-09-28T07:09:00.713000
2008-09-28T07:24:40.427000
145,426
145,432
How to test web-apps on mobile for free without wlan?
I tried GNUBOX which use bluetooth to connect to my computer then to the internet. It's very painful to set up (under windows more than under linux, but it's still painful, it works 1 time on 3). I own a Nokia 6630 so there is no WLAN support. Is there any emulator? I'd need to know something like max width, max height...
This may sound silly but you could consider getting a mobile tariff with unlimited data. In most European countries these are now available and are not too expensive. I don't believe you would get a solid experience from any emulator.
How to test web-apps on mobile for free without wlan? I tried GNUBOX which use bluetooth to connect to my computer then to the internet. It's very painful to set up (under windows more than under linux, but it's still painful, it works 1 time on 3). I own a Nokia 6630 so there is no WLAN support. Is there any emulator?...
TITLE: How to test web-apps on mobile for free without wlan? QUESTION: I tried GNUBOX which use bluetooth to connect to my computer then to the internet. It's very painful to set up (under windows more than under linux, but it's still painful, it works 1 time on 3). I own a Nokia 6630 so there is no WLAN support. Is t...
[ "testing", "web-applications", "mobile", "usability", "emulation" ]
0
1
377
4
0
2008-09-28T07:36:41.067000
2008-09-28T07:48:04.673000
145,440
145,979
Deploy a Desktop Shortcut to a Device running Windows CE 4.2 (VS2005)
I have an application written using VS2005 in C# targeting the Compact Framework 2.0 SP2. As part of the solution, I have CAB deploy project which deploys to the device without a problem. What I can't do is create a shortcut to my application on the devices desktop. I have spent several hours reading various bits of do...
A Windows CE shortcut (CE of any version or flavor, including WinMo) uses a ASCII-text based file. They are in the form: {XX}#{PATH} Where: XX = the number of the characters in the path, to include the number a # sign PATH = fully qualified path to the file to run For example: 20#\Windows\calc.exe The other option is t...
Deploy a Desktop Shortcut to a Device running Windows CE 4.2 (VS2005) I have an application written using VS2005 in C# targeting the Compact Framework 2.0 SP2. As part of the solution, I have CAB deploy project which deploys to the device without a problem. What I can't do is create a shortcut to my application on the ...
TITLE: Deploy a Desktop Shortcut to a Device running Windows CE 4.2 (VS2005) QUESTION: I have an application written using VS2005 in C# targeting the Compact Framework 2.0 SP2. As part of the solution, I have CAB deploy project which deploys to the device without a problem. What I can't do is create a shortcut to my a...
[ "deployment", "windows-mobile", "visual-studio-2005", "cab", "shortcut-file" ]
9
7
32,019
9
0
2008-09-28T07:56:21.003000
2008-09-28T14:45:11.427000
145,443
145,463
Multiple repositories, single setup
If I use multiple repositories, all located under a single root folder, how can I set it up so that they will use a single master svnconf / passwd file for setup but still allow me to customize each if the need arises? This is on Windows, but I guess the process would be similar on other systems. Update: I am using svn...
svnserve isn't intended for use in large deployments. If you need more fine-grained permissions, or integration, etc., use a web server (like Apache ).
Multiple repositories, single setup If I use multiple repositories, all located under a single root folder, how can I set it up so that they will use a single master svnconf / passwd file for setup but still allow me to customize each if the need arises? This is on Windows, but I guess the process would be similar on o...
TITLE: Multiple repositories, single setup QUESTION: If I use multiple repositories, all located under a single root folder, how can I set it up so that they will use a single master svnconf / passwd file for setup but still allow me to customize each if the need arises? This is on Windows, but I guess the process wou...
[ "windows", "svn" ]
2
2
1,480
3
0
2008-09-28T07:58:54.897000
2008-09-28T08:10:38.397000
145,449
145,470
Easy way to embed svn revision number in page in PHP?
Notice in the bottom right hand corner of this page it has the SVN revision id? I'm assuming that's dynamic. I'd love to add that to some of my sites, just as a comment in the source to make sure code pushes are going through. NOTE: You can also assume that the working directory of the site in question is an svn checko...
You can use the svnversion CLI utility to get a more specific look at the revision, including the highest number. You could then use regular expressions to parse this. Subversion has no concept of a global revision; rather, you'd have to recursively look through the working copy to find the highest revision number. svn...
Easy way to embed svn revision number in page in PHP? Notice in the bottom right hand corner of this page it has the SVN revision id? I'm assuming that's dynamic. I'd love to add that to some of my sites, just as a comment in the source to make sure code pushes are going through. NOTE: You can also assume that the work...
TITLE: Easy way to embed svn revision number in page in PHP? QUESTION: Notice in the bottom right hand corner of this page it has the SVN revision id? I'm assuming that's dynamic. I'd love to add that to some of my sites, just as a comment in the source to make sure code pushes are going through. NOTE: You can also as...
[ "php", "svn", "versioning", "revision" ]
6
9
7,624
3
0
2008-09-28T08:04:06.757000
2008-09-28T08:18:09.687000
145,480
145,527
Why Stackoverflow binds user actions dynamically with javascript?
Checking the HTML source of a question I see for instance: add comment JavaScript is needed to access comments. And then in the javascript source: // Setup our click events.. $().ready(function() { $("a[id^='comments-link-']").click(function() { comments.show($(this).attr("id").substr("comments-link-".length)); }); });...
You don't have to type the same string over and over again in the HTML (which if nothing else would increase the number of typos to debug) You can hand over the HTML/CSS to a designer who need not have any javascript skills You have programmatic control over what callbacks are called and when It's more elegant because ...
Why Stackoverflow binds user actions dynamically with javascript? Checking the HTML source of a question I see for instance: add comment JavaScript is needed to access comments. And then in the javascript source: // Setup our click events.. $().ready(function() { $("a[id^='comments-link-']").click(function() { comments...
TITLE: Why Stackoverflow binds user actions dynamically with javascript? QUESTION: Checking the HTML source of a question I see for instance: add comment JavaScript is needed to access comments. And then in the javascript source: // Setup our click events.. $().ready(function() { $("a[id^='comments-link-']").click(fun...
[ "javascript", "jquery" ]
6
18
470
5
0
2008-09-28T08:26:35.283000
2008-09-28T09:07:58.523000
145,484
145,487
Looking for up-to-date eclipse plugin for C#
I used to work with eclipse for nearly all the languages I need. I'm asked to work on a tool developed in C# and so, I would like to stay in the same familiar environment. I've found the improve's plugin but its last release is from 2004 and.NET 1.1 which is quite old. Is there a newer plugin to program in C# within ec...
Emonic integrates mono into the eclipse framework, that may be of use.
Looking for up-to-date eclipse plugin for C# I used to work with eclipse for nearly all the languages I need. I'm asked to work on a tool developed in C# and so, I would like to stay in the same familiar environment. I've found the improve's plugin but its last release is from 2004 and.NET 1.1 which is quite old. Is th...
TITLE: Looking for up-to-date eclipse plugin for C# QUESTION: I used to work with eclipse for nearly all the languages I need. I'm asked to work on a tool developed in C# and so, I would like to stay in the same familiar environment. I've found the improve's plugin but its last release is from 2004 and.NET 1.1 which i...
[ "c#", "eclipse", "eclipse-plugin" ]
37
17
30,307
5
0
2008-09-28T08:30:04.637000
2008-09-28T08:33:10.073000
145,494
145,505
Should I stick with the ReportViewer control or buy a third party tool?
we need reports in our web application and there is the free ReportViewer Control from microsoft (normally used, to display reports from the reporting services). I like the fact, that the Report Format (.RDL-Format) from the ReportViewer is a documented XML-Format. But the functionality is somewhat limited, when the Re...
This depend on your requirements. I am not clear what your requirements are. Is your application a web application or a desktop application? If your application is a web application then you can use any other reporting service. I like i-net Clear Reports. There is also a free and fully functional GUI report designer th...
Should I stick with the ReportViewer control or buy a third party tool? we need reports in our web application and there is the free ReportViewer Control from microsoft (normally used, to display reports from the reporting services). I like the fact, that the Report Format (.RDL-Format) from the ReportViewer is a docum...
TITLE: Should I stick with the ReportViewer control or buy a third party tool? QUESTION: we need reports in our web application and there is the free ReportViewer Control from microsoft (normally used, to display reports from the reporting services). I like the fact, that the Report Format (.RDL-Format) from the Repor...
[ "asp.net", "reporting-services", "reportviewer" ]
2
1
1,334
2
0
2008-09-28T08:45:35.550000
2008-09-28T08:56:44.870000
145,499
145,517
Merge several native DLLs into one DLL
I've got a lot of small DLLs which I would like to make into one big(er) DLL (as suggested here ). I can do so by merging my projects but I would like a less intrusive way. Can several DLLs be merged into one unit? A quick search found this thread that claims this is not possible. Does anyone know otherwise? Note that ...
I don't know about merging dlls, but I'm sure you can link the intermediate object files into one dll. This would only require changes in your build script.
Merge several native DLLs into one DLL I've got a lot of small DLLs which I would like to make into one big(er) DLL (as suggested here ). I can do so by merging my projects but I would like a less intrusive way. Can several DLLs be merged into one unit? A quick search found this thread that claims this is not possible....
TITLE: Merge several native DLLs into one DLL QUESTION: I've got a lot of small DLLs which I would like to make into one big(er) DLL (as suggested here ). I can do so by merging my projects but I would like a less intrusive way. Can several DLLs be merged into one unit? A quick search found this thread that claims thi...
[ "dll", "merge", "unmanaged" ]
8
1
15,578
3
0
2008-09-28T08:49:53.857000
2008-09-28T09:04:48.610000
145,508
145,530
Do you think a software company should impose developers a coding-style?
If you think it shouldn't, explain why. If yes, how deep should the guidelines be in your opinion? For example, indentation of code should be included?
I think a team (rather than a company ) need to agree on a set of guidelines for reasonably consistent style. It makes it more straightforward for maintenance. How deep? As shallow as you can agree on. The shorter and clearer it is the more likely it is that all the team members can agree to it and will abide by it.
Do you think a software company should impose developers a coding-style? If you think it shouldn't, explain why. If yes, how deep should the guidelines be in your opinion? For example, indentation of code should be included?
TITLE: Do you think a software company should impose developers a coding-style? QUESTION: If you think it shouldn't, explain why. If yes, how deep should the guidelines be in your opinion? For example, indentation of code should be included? ANSWER: I think a team (rather than a company ) need to agree on a set of gu...
[ "coding-style", "conventions" ]
19
35
2,521
28
0
2008-09-28T08:58:48.763000
2008-09-28T09:10:45.833000
145,509
145,516
Why does "abcd".StartsWith("") return true?
Title is the entire question. Can someone give me a reason why this happens?
Yes - because it does begin with the empty string. Indeed, the empty string logically occurs between every pair of characters. Put it this way: what definition of "starts with" could you give that would preclude this? Here's a simple definition of "starts with" that doesn't: "x starts with y if the first y.Length chara...
Why does "abcd".StartsWith("") return true? Title is the entire question. Can someone give me a reason why this happens?
TITLE: Why does "abcd".StartsWith("") return true? QUESTION: Title is the entire question. Can someone give me a reason why this happens? ANSWER: Yes - because it does begin with the empty string. Indeed, the empty string logically occurs between every pair of characters. Put it this way: what definition of "starts w...
[ "c#", "java", "startswith" ]
89
168
21,362
11
0
2008-09-28T08:59:49.353000
2008-09-28T09:04:31.167000
145,540
145,550
Best way to sandbox Apache on Linux
I have Apache running on a public-facing Debian server, and am a bit worried about the security of the installation. This is a machine that hosts several free-time hobby projects, so none of us who use the machine really have the time to constantly watch for upstream patches, stay aware of security issues, etc. But I w...
Chroot jails can be really insecure when you are running a complete sandbox environment. Attackers have complete access to kernel functionality and for example may mount drives to access the "host" system. I would suggest that you use linux-vserver. You can see linux-vserver as an improved chroot jail with a complete d...
Best way to sandbox Apache on Linux I have Apache running on a public-facing Debian server, and am a bit worried about the security of the installation. This is a machine that hosts several free-time hobby projects, so none of us who use the machine really have the time to constantly watch for upstream patches, stay aw...
TITLE: Best way to sandbox Apache on Linux QUESTION: I have Apache running on a public-facing Debian server, and am a bit worried about the security of the installation. This is a machine that hosts several free-time hobby projects, so none of us who use the machine really have the time to constantly watch for upstrea...
[ "linux", "security", "apache", "debian", "system-administration" ]
18
15
10,379
11
0
2008-09-28T09:16:36.147000
2008-09-28T09:24:33.163000
145,552
145,554
How can I write a shell script to direct grep data into a date-based filename?
I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log...with of course the filename being example.com.2008-09-27-11:21:30.log I'd then put this in crontab to run daily.
The verbose method: grep 'example.com' www_log > `date +example.com.%Y-%m-%d-%H:%M:%S.log` The terse method: grep 'example.com' www_log > `date +example.com.%F-%T.log`
How can I write a shell script to direct grep data into a date-based filename? I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log...with of course the filename being example.com.2008-09-27-11:21:30.log I'd then put this in crontab to run daily.
TITLE: How can I write a shell script to direct grep data into a date-based filename? QUESTION: I basically want to do this: grep 'example.com' www_log > example.com.YYYY-MM-DD-H:i:S.log...with of course the filename being example.com.2008-09-27-11:21:30.log I'd then put this in crontab to run daily. ANSWER: The verb...
[ "shell", "grep", "date", "scripting", "filenames" ]
5
9
1,438
3
0
2008-09-28T09:25:01.713000
2008-09-28T09:27:50.783000
145,563
145,576
Finding Frequency of numbers in a given group of numbers
Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job. example: int a = { 2, 456, 34, 3456, 2, 435, 2, 456, 2} the output is 4 because 2 occurs 4 times. That is the maximum number ...
Sort the array and then do a quick pass to count each number. The algorithm has O(N*logN) complexity. Alternatively, create a hash table, using the number as the key. Store in the hashtable a counter for each element you've keyed. You'll be able to count all elements in one pass; however, the complexity of the algorith...
Finding Frequency of numbers in a given group of numbers Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job. example: int a = { 2, 456, 34, 3456, 2, 435, 2, 456, 2} the output i...
TITLE: Finding Frequency of numbers in a given group of numbers QUESTION: Suppose we have a vector/array in C++ and we wish to count which of these N elements has maximum repetitive occurrences and output the highest count. Which algorithm is best suited for this job. example: int a = { 2, 456, 34, 3456, 2, 435, 2, 45...
[ "c++", "c", "algorithm", "puzzle", "frequency" ]
8
18
7,116
10
0
2008-09-28T09:38:37.093000
2008-09-28T09:44:55.953000
145,565
145,578
Free set of forms, icons, styles, etc for web-based admin interfaces
Is there any free set of forms, icons, styles, images, etc for building web-based admin interfaces? If yes, which is the best?
A particularly common choice is Silk. It's a very comprehensive free set. There's also the Silk Companion 1.
Free set of forms, icons, styles, etc for web-based admin interfaces Is there any free set of forms, icons, styles, images, etc for building web-based admin interfaces? If yes, which is the best?
TITLE: Free set of forms, icons, styles, etc for web-based admin interfaces QUESTION: Is there any free set of forms, icons, styles, images, etc for building web-based admin interfaces? If yes, which is the best? ANSWER: A particularly common choice is Silk. It's a very comprehensive free set. There's also the Silk C...
[ "user-interface" ]
8
11
4,737
4
0
2008-09-28T09:39:22.597000
2008-09-28T09:45:07.827000
145,570
145,604
Existing Standard Style and Coding standard documents
The following have been proposed for an upcoming C++ project. C++ Coding Standards, by Sutter and Alexandrescu JSF Air Vehicle C++ coding standards The Elements of C++ Style Effective C++ 3rd Edition, by Scott Meyers Are there other choices? Or is the list above what be should used on a C++ project? Some related links ...
I really think it does not matter which one you adopt, as long as everyone goes along with it. Sometimes that can be hard as it seems that some styles don't agree with peoples tases. I.e. it comes down to arguing about whether prefixing all member variable with m_ is pretty or not. I have been using and modifying the G...
Existing Standard Style and Coding standard documents The following have been proposed for an upcoming C++ project. C++ Coding Standards, by Sutter and Alexandrescu JSF Air Vehicle C++ coding standards The Elements of C++ Style Effective C++ 3rd Edition, by Scott Meyers Are there other choices? Or is the list above wha...
TITLE: Existing Standard Style and Coding standard documents QUESTION: The following have been proposed for an upcoming C++ project. C++ Coding Standards, by Sutter and Alexandrescu JSF Air Vehicle C++ coding standards The Elements of C++ Style Effective C++ 3rd Edition, by Scott Meyers Are there other choices? Or is ...
[ "c++", "coding-style", "documentation", "standards" ]
15
7
3,805
11
0
2008-09-28T09:41:41.750000
2008-09-28T10:10:01.993000
145,586
145,763
What continuous integration tool is best for a C++ project?
Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows scheduler or cron to schedule builds. Are there better continuous integration systems ...
We have been using CruiseControl for CI on a C++ project. While it is the only thing we use ant for, the ant build script for CruiseControl just starts our normal build script, so it is very simple and we haven't really needed to update it in a long while. Therefore the fact that CrusieControl is Java based has not rea...
What continuous integration tool is best for a C++ project? Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows scheduler or cron to sched...
TITLE: What continuous integration tool is best for a C++ project? QUESTION: Cruisecontrol and Hudson are two popular continuous integration systems. Although both systems are able to do the automated continuous builds nicely, it just seems a lot easier to create a batch or bash build script, then use Windows schedule...
[ "c++", "continuous-integration" ]
19
13
20,943
6
0
2008-09-28T09:55:31.450000
2008-09-28T12:22:26.683000
145,607
146,957
Text difference algorithm
I need an algorithm that can compare two text files and highlight their difference and ( even better!) can compute their difference in a meaningful way (like two similar files should have a similarity score higher than two dissimilar files, with the word "similar" defined in the normal terms). It sounds easy to impleme...
In Python, there is difflib, as also others have suggested. difflib offers the SequenceMatcher class, which can be used to give you a similarity ratio. Example function: def text_compare(text1, text2, isjunk=None): return difflib.SequenceMatcher(isjunk, text1, text2).ratio()
Text difference algorithm I need an algorithm that can compare two text files and highlight their difference and ( even better!) can compute their difference in a meaningful way (like two similar files should have a similarity score higher than two dissimilar files, with the word "similar" defined in the normal terms)....
TITLE: Text difference algorithm QUESTION: I need an algorithm that can compare two text files and highlight their difference and ( even better!) can compute their difference in a meaningful way (like two similar files should have a similarity score higher than two dissimilar files, with the word "similar" defined in ...
[ "c#", "python", "diff" ]
43
27
20,808
11
0
2008-09-28T10:12:25.497000
2008-09-28T23:02:33.917000
145,617
145,625
What is the best practice when having a terminate clause...see explanation :)
The case goes as following: You have a Boolean property called FullScreenEnabled. You enter some method, and the code within this method is executed iff FullScreenEnabled is true. Which of the 2 approaches below do you use in your everyday programming: private bool FullScreenEnabled { get; set; } // Check if FullScreen...
private void MyMethod(bool arg){ if(arg) return; //do stuff }; (for voting)
What is the best practice when having a terminate clause...see explanation :) The case goes as following: You have a Boolean property called FullScreenEnabled. You enter some method, and the code within this method is executed iff FullScreenEnabled is true. Which of the 2 approaches below do you use in your everyday pr...
TITLE: What is the best practice when having a terminate clause...see explanation :) QUESTION: The case goes as following: You have a Boolean property called FullScreenEnabled. You enter some method, and the code within this method is executed iff FullScreenEnabled is true. Which of the 2 approaches below do you use i...
[ "c#" ]
4
11
245
10
0
2008-09-28T10:22:46.503000
2008-09-28T10:29:16.940000
145,621
145,648
What are some recommendations for porting C++ code to the MacOS?
For a upcoming project, there are plans to port the existing C++ code that compiles on Windows and Linux to the MacOS(leopard). The software is command line application, but a GUI front end might be planned. The MacOS uses the g++ compiler. By having the same compiler as Linux, it does not seem like there would be any ...
Does your app have a GUI, and which one (native / Qt / Gtk+)? If not, the issues to watch out for (compared to Linux) are mainly in the dynamic linkage area. OS X uses '-dylib' and '-bundle' and in fact has two kinds of dynamic libraries (runtime loadable and the normal ones). Linux has only one kind (-shared), and is ...
What are some recommendations for porting C++ code to the MacOS? For a upcoming project, there are plans to port the existing C++ code that compiles on Windows and Linux to the MacOS(leopard). The software is command line application, but a GUI front end might be planned. The MacOS uses the g++ compiler. By having the ...
TITLE: What are some recommendations for porting C++ code to the MacOS? QUESTION: For a upcoming project, there are plans to port the existing C++ code that compiles on Windows and Linux to the MacOS(leopard). The software is command line application, but a GUI front end might be planned. The MacOS uses the g++ compil...
[ "c++", "macos", "g++", "portability" ]
4
8
1,628
4
0
2008-09-28T10:25:44.093000
2008-09-28T10:51:23.673000
145,638
145,658
Deploying database for ASP .NET Website
I was just browsing through questions on stack overflow, and i've come up to a post where it suggests of deploying database by simply copying the mdf file in the app_data folder and modifying your connection string. I know that some people do create an mdf file in the app_code during development, but for going live, is...
I personally prefer your method of deploying Databases and I see one big advantage with this: usually the Web and the DBServer should not be one machine (Security, Maintainability,...) and utilizing the app_code folder to hold your Database seems a little credulously.
Deploying database for ASP .NET Website I was just browsing through questions on stack overflow, and i've come up to a post where it suggests of deploying database by simply copying the mdf file in the app_data folder and modifying your connection string. I know that some people do create an mdf file in the app_code du...
TITLE: Deploying database for ASP .NET Website QUESTION: I was just browsing through questions on stack overflow, and i've come up to a post where it suggests of deploying database by simply copying the mdf file in the app_data folder and modifying your connection string. I know that some people do create an mdf file ...
[ "asp.net", "sql-server", "database" ]
1
2
1,568
5
0
2008-09-28T10:37:41.117000
2008-09-28T11:03:33.457000
145,641
156,359
How to properly setup a multi module SpringMVC application created by appfuse in Eclipse?
I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by step guideline showing the ideal way to setup such application in Eclipse?
Have you tried using maven eclipse plugin? You can just go to the project root folder (the one that contains your pom.xml file) and run "mvn eclipse:eclipse" from the command line. This will build project files for each of your modules and also create inter-dependencies. You can just treat your multi-module project lik...
How to properly setup a multi module SpringMVC application created by appfuse in Eclipse? I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by step guideline sho...
TITLE: How to properly setup a multi module SpringMVC application created by appfuse in Eclipse? QUESTION: I am trying to setup a multi module SpringMVC appfuse applicaiton in Eclipse but it seems that I'm facing lots of errors in Eclipse after I import the project in Eclipse. Can anyone please help me with a step by ...
[ "java", "eclipse", "spring", "maven-2", "appfuse" ]
4
4
1,941
4
0
2008-09-28T10:40:30.330000
2008-10-01T05:39:58.857000
145,657
2,271,481
Tool to compare large numbers of PDF files?
I need to compare large count of PDF files for it optical content. Because the PDF files was created on different platforms and with different versions of the software there are structural differences. For example: the chunking of text can be different the write order can be different the position can be differ some pi...
Because there is no such tool available that we have written one. You can download the i-net PDF content comparer and use it. I hope that help other with the same problem. If you have problems with it or you have feedback for us then you can contact our support.
Tool to compare large numbers of PDF files? I need to compare large count of PDF files for it optical content. Because the PDF files was created on different platforms and with different versions of the software there are structural differences. For example: the chunking of text can be different the write order can be ...
TITLE: Tool to compare large numbers of PDF files? QUESTION: I need to compare large count of PDF files for it optical content. Because the PDF files was created on different platforms and with different versions of the software there are structural differences. For example: the chunking of text can be different the w...
[ "testing", "pdf", "compare" ]
84
41
102,099
10
0
2008-09-28T11:02:13.100000
2010-02-16T08:34:47.007000
145,676
145,691
How to approach something complex?
You know that particular part of your code that is essential for the project but will probably take a lot of time to get it done? Do you ever get the feeling that you'd rather work on something else (probably less important) or not code at all instead of working on that part? That beast you try so hard to avoid and use...
I'll tell a story of a case in which this happened to me. I wanted to implement a new frametype decision algorithm for x264 that used forward dynamic programming (the Viterbi algorithm). But it was going to be complicated, messy, ugly, and so forth. And I really didn't want to do it. I tried to pawn off the project ont...
How to approach something complex? You know that particular part of your code that is essential for the project but will probably take a lot of time to get it done? Do you ever get the feeling that you'd rather work on something else (probably less important) or not code at all instead of working on that part? That bea...
TITLE: How to approach something complex? QUESTION: You know that particular part of your code that is essential for the project but will probably take a lot of time to get it done? Do you ever get the feeling that you'd rather work on something else (probably less important) or not code at all instead of working on t...
[ "language-agnostic", "abstraction" ]
7
16
743
9
0
2008-09-28T11:22:07.483000
2008-09-28T11:30:37.540000
145,689
145,714
Relational Database Design Patterns?
Design patterns are usually related to object oriented design. Are there design patterns for creating and programming relational databases? Many problems surely must have reusable solutions. Examples would include patterns for table design, stored procedures, triggers, etc... Is there an online repository of such patte...
There's a book in Martin Fowler's Signature Series called Refactoring Databases. That provides a list of techniques for refactoring databases. I can't say I've heard a list of database patterns so much. I would also highly recommend David C. Hay's Data Model Patterns and the follow up A Metadata Map which builds on the...
Relational Database Design Patterns? Design patterns are usually related to object oriented design. Are there design patterns for creating and programming relational databases? Many problems surely must have reusable solutions. Examples would include patterns for table design, stored procedures, triggers, etc... Is the...
TITLE: Relational Database Design Patterns? QUESTION: Design patterns are usually related to object oriented design. Are there design patterns for creating and programming relational databases? Many problems surely must have reusable solutions. Examples would include patterns for table design, stored procedures, trigg...
[ "design-patterns", "database-design", "rdbms" ]
295
174
131,424
6
0
2008-09-28T11:29:56.980000
2008-09-28T11:44:48.520000
145,699
145,731
Combining Lisp and PHP code in the same application
At the moment I use PHP for almost everything I develop for the Web but its linguistic limitations are starting to annoy me. However, as I developed some practices and maintain some PHP libraries that help me a lot, I don't feel I'd be ready to just switch to LISP throwing away all my PHP output. It could even be impos...
It's not a mutually-exclusive choice, you can run both on one system, in the same way that perl and php (for example) are run side-by-side on many systems. There's a good post here on a similar topic, which suggests using sockets to communicate between both languages - If you want to go the PHP<->Lisp route the easyest...
Combining Lisp and PHP code in the same application At the moment I use PHP for almost everything I develop for the Web but its linguistic limitations are starting to annoy me. However, as I developed some practices and maintain some PHP libraries that help me a lot, I don't feel I'd be ready to just switch to LISP thr...
TITLE: Combining Lisp and PHP code in the same application QUESTION: At the moment I use PHP for almost everything I develop for the Web but its linguistic limitations are starting to annoy me. However, as I developed some practices and maintain some PHP libraries that help me a lot, I don't feel I'd be ready to just ...
[ "php", "web-applications", "interop", "lisp" ]
17
9
3,706
7
0
2008-09-28T11:33:39.703000
2008-09-28T11:55:57.497000
145,720
145,735
What techniques do you use to maximise code reuse?
Some years ago I was told about a study into code reuse. Apparently it was found that, on average, programmers have a 7 minute window when searching for code to reuse. If they don't find code that suits their needs within that window they'll write their own. This was presented in the context of needing to carefully man...
A complex question: Some parts of the code can be generalized as libraries or APIs. We have a common library which is kept up to date with solutions to common problems. Typically: validation, caching, data access classes, logging, etc... Some parts are application specific. They cannot be generalized easily. We convert...
What techniques do you use to maximise code reuse? Some years ago I was told about a study into code reuse. Apparently it was found that, on average, programmers have a 7 minute window when searching for code to reuse. If they don't find code that suits their needs within that window they'll write their own. This was p...
TITLE: What techniques do you use to maximise code reuse? QUESTION: Some years ago I was told about a study into code reuse. Apparently it was found that, on average, programmers have a 7 minute window when searching for code to reuse. If they don't find code that suits their needs within that window they'll write the...
[ "code-reuse" ]
15
10
2,034
7
0
2008-09-28T11:50:28.790000
2008-09-28T11:58:43.963000
145,728
145,736
Best way to validate user input JDBC?
Is there a built-in way to escape user input in java using the JDBC? Something similar to the php version mysql_real_escape() function. What's the best way to validate input?
If you mean how do you make sure user input can't be used in SQL injection attacks, the way to do this (and the way all SQL should be written in JDBC) is using Prepared Statements. JDBC will automatically handle any necessary escaping. http://java.sun.com/docs/books/tutorial/jdbc/basics/prepared.html
Best way to validate user input JDBC? Is there a built-in way to escape user input in java using the JDBC? Something similar to the php version mysql_real_escape() function. What's the best way to validate input?
TITLE: Best way to validate user input JDBC? QUESTION: Is there a built-in way to escape user input in java using the JDBC? Something similar to the php version mysql_real_escape() function. What's the best way to validate input? ANSWER: If you mean how do you make sure user input can't be used in SQL injection attac...
[ "java", "mysql", "validation", "jdbc" ]
2
15
4,314
2
0
2008-09-28T11:55:23.427000
2008-09-28T11:58:44.433000
145,753
145,772
FAT-16 on modern OS
I've got a project that was written in BASIC. I'm not sure of the exact reason, but the app will not function except when being run from a FAT-16 file system. I'd rather try to set up an environment that will support this app in a modern OS (Vista/XP) instead of rewriting it. Does anyone know how to get an app like thi...
You may try running it via a DOSBOX: DOSBox emulates an Intel x86 PC, complete with sound, graphics, mouse, joystick, modem, etc., necessary for running many old MS-DOS applications that simply cannot be run on modern PCs and operating systems, such as Microsoft Windows XP, Windows Vista, Linux and FreeBSD (from their ...
FAT-16 on modern OS I've got a project that was written in BASIC. I'm not sure of the exact reason, but the app will not function except when being run from a FAT-16 file system. I'd rather try to set up an environment that will support this app in a modern OS (Vista/XP) instead of rewriting it. Does anyone know how to...
TITLE: FAT-16 on modern OS QUESTION: I've got a project that was written in BASIC. I'm not sure of the exact reason, but the app will not function except when being run from a FAT-16 file system. I'd rather try to set up an environment that will support this app in a modern OS (Vista/XP) instead of rewriting it. Does ...
[ "windows-vista", "windows-xp", "filesystems", "basic" ]
3
7
637
8
0
2008-09-28T12:16:08.087000
2008-09-28T12:32:43.290000
145,771
145,779
DLL-s using C++ on Linux
I have tried to find how to create DLL-s on linux using google, but got very confusing information. Is it possible to write dynamic link libraries on linux? If not, are there other means by which I can call code in another module from several running programs?
That's because DLL is a Windows term. In Linux they are called shared libraries. http://www.linux.org/docs/ldp/howto/Program-Library-HOWTO/shared-libraries.html
DLL-s using C++ on Linux I have tried to find how to create DLL-s on linux using google, but got very confusing information. Is it possible to write dynamic link libraries on linux? If not, are there other means by which I can call code in another module from several running programs?
TITLE: DLL-s using C++ on Linux QUESTION: I have tried to find how to create DLL-s on linux using google, but got very confusing information. Is it possible to write dynamic link libraries on linux? If not, are there other means by which I can call code in another module from several running programs? ANSWER: That's ...
[ "linux", "gcc", "shared-libraries" ]
2
16
9,020
4
0
2008-09-28T12:32:07.520000
2008-09-28T12:37:30.843000
145,800
145,804
Favorite image file format for 2d sprites
What is your favorite, lossless image format for games (namely 2d games)? And why? Some things to take into consideration are size on disk, overhead for converting to a usable format, and features of the format (ie alpha support). There is no best answer, but be sure to back yours up the best you can!
I'd suggest PNG. Most software supports writing it, most libraries support reading it, it's lossless and supports alpha transparency. And it's a standard format. And, maybe important for hobbyist 2D games, very small images also result in very small files (i.e. a 16x16 icon can be 1KB or less).
Favorite image file format for 2d sprites What is your favorite, lossless image format for games (namely 2d games)? And why? Some things to take into consideration are size on disk, overhead for converting to a usable format, and features of the format (ie alpha support). There is no best answer, but be sure to back yo...
TITLE: Favorite image file format for 2d sprites QUESTION: What is your favorite, lossless image format for games (namely 2d games)? And why? Some things to take into consideration are size on disk, overhead for converting to a usable format, and features of the format (ie alpha support). There is no best answer, but ...
[ "image", "2d", "file-format", "sprite" ]
9
15
22,736
4
0
2008-09-28T13:03:19.473000
2008-09-28T13:07:12.537000
145,802
145,812
.NET: What is the status of the Castle Project?
Clicking through to the download-page if see that the last version of the download is over one year old and it's also "just" a Release Candidate of version 1.0. There are really no news on any development. Yes, you can find newer versions from the nightly builds, but that's not a real serious option. Also, the "getting...
Hamilton Verissimo, the project founder, took up a position with Microsoft in August. What happens to Castle? That was a delicate subject to me, but surprisingly it wasn’t a problem to them. I got a written permission to keep working on Castle as much as I want. So nothing changes… What happens to Castle Stronghold? Al...
.NET: What is the status of the Castle Project? Clicking through to the download-page if see that the last version of the download is over one year old and it's also "just" a Release Candidate of version 1.0. There are really no news on any development. Yes, you can find newer versions from the nightly builds, but that...
TITLE: .NET: What is the status of the Castle Project? QUESTION: Clicking through to the download-page if see that the last version of the download is over one year old and it's also "just" a Release Candidate of version 1.0. There are really no news on any development. Yes, you can find newer versions from the nightl...
[ ".net", "castle" ]
4
2
413
2
0
2008-09-28T13:04:29.673000
2008-09-28T13:12:07.237000
145,803
145,903
Targeting both 32bit and 64bit with Visual Studio in same solution/project
I have a little dilemma on how to set up my visual studio builds for multi-targeting. Background: c#.NET v2.0 with p/invoking into 3rd party 32 bit DLL's, SQL compact v3.5 SP1, with a Setup project. Right now, the platform target is set to x86 so it can be run on Windows x64. The 3rd party company has just released 64 ...
Yes, you can target both x86 and x64 with the same code base in the same project. In general, things will Just Work if you create the right solution configurations in VS.NET (although P/Invoke to entirely unmanaged DLLs will most likely require some conditional code): the items that I found to require special attention...
Targeting both 32bit and 64bit with Visual Studio in same solution/project I have a little dilemma on how to set up my visual studio builds for multi-targeting. Background: c#.NET v2.0 with p/invoking into 3rd party 32 bit DLL's, SQL compact v3.5 SP1, with a Setup project. Right now, the platform target is set to x86 s...
TITLE: Targeting both 32bit and 64bit with Visual Studio in same solution/project QUESTION: I have a little dilemma on how to set up my visual studio builds for multi-targeting. Background: c#.NET v2.0 with p/invoking into 3rd party 32 bit DLL's, SQL compact v3.5 SP1, with a Setup project. Right now, the platform targ...
[ ".net", "visual-studio", "64-bit", "x86-64" ]
113
86
108,054
8
0
2008-09-28T13:05:41.977000
2008-09-28T14:06:00.740000
145,814
145,944
Compile-time type based dispatch
Following techniques from 'Modern C++ Design', I am implementing a persistence library with various compile-time optimisations. I would like the ability to dispatch a function to a templated member variable if that variable derives from a given class: template class Manager = DefaultManager> class Data { private: T *da...
Overloading can be useful to implement compile-time dispatching, as proposed by Alexandrescu in his book "Modern C++ Design". You can use a class like this to transform at compile time a boolean or integer into a type: template struct int2type { enum { value = n}; }; The following source code shows a possible applicati...
Compile-time type based dispatch Following techniques from 'Modern C++ Design', I am implementing a persistence library with various compile-time optimisations. I would like the ability to dispatch a function to a templated member variable if that variable derives from a given class: template class Manager = DefaultMan...
TITLE: Compile-time type based dispatch QUESTION: Following techniques from 'Modern C++ Design', I am implementing a persistence library with various compile-time optimisations. I would like the ability to dispatch a function to a templated member variable if that variable derives from a given class: template class Ma...
[ "c++", "templates" ]
5
3
4,450
5
0
2008-09-28T13:14:57.510000
2008-09-28T14:30:06.113000
145,838
145,841
What are the benefits of inline functions?
What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everything had to fit in 100KB of memory) what adva...
Inline functions are faster because you don't need to push and pop things on/off the stack like parameters and the return address; however, it does make your binary slightly larger. Does it make a significant difference? Not noticeably enough on modern hardware for most. But it can make a difference, which is enough fo...
What are the benefits of inline functions? What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was scarce and everythi...
TITLE: What are the benefits of inline functions? QUESTION: What is the advantages/disadvantages of using inline functions in C++? I see that it only increases performance for the code that the compiler outputs, but with today's optimized compilers, fast CPUs, huge memory etc. (not like in the 1980< where memory was s...
[ "c++", "inline", "inline-functions" ]
276
150
178,051
14
0
2008-09-28T13:35:23.623000
2008-09-28T13:36:29.953000
145,842
146,042
What are the most useful data structures to know inside out?
I'm interested in finding out what people would consider the most useful data structures to know in programming. What data structure do you find yourself using all the time? Answers to this post should help new programmers interested in finding a useful data structure for their problem. Answers should probably include ...
One of the data structures I use the most (beyond vectors, of course) is the Hashtable. Its about the only choise if you need to be able to search large quantities of data in O(1) time, that means the time to search does not grow as the size of the collection grows. The catch is that the insertion and deletion times ar...
What are the most useful data structures to know inside out? I'm interested in finding out what people would consider the most useful data structures to know in programming. What data structure do you find yourself using all the time? Answers to this post should help new programmers interested in finding a useful data ...
TITLE: What are the most useful data structures to know inside out? QUESTION: I'm interested in finding out what people would consider the most useful data structures to know in programming. What data structure do you find yourself using all the time? Answers to this post should help new programmers interested in find...
[ "data-structures" ]
14
24
22,660
15
0
2008-09-28T13:36:41.763000
2008-09-28T15:05:28.460000
145,855
152,198
Unable to access HTTP PUT data in webservice code
All, As part of an application I'm writing I need to have a HTTP PUT webservice which accepts incoming imagedata, which will by analyzed, validated, and added to a local file store. My issue arises after the size validation as the $_SERVER['CONTENT_LENGTH'] has a > 0 value, and this value is identical to the test file ...
My best guess is that you need to alter httpd.conf to not deny PUT requests. Have you checked that?
Unable to access HTTP PUT data in webservice code All, As part of an application I'm writing I need to have a HTTP PUT webservice which accepts incoming imagedata, which will by analyzed, validated, and added to a local file store. My issue arises after the size validation as the $_SERVER['CONTENT_LENGTH'] has a > 0 va...
TITLE: Unable to access HTTP PUT data in webservice code QUESTION: All, As part of an application I'm writing I need to have a HTTP PUT webservice which accepts incoming imagedata, which will by analyzed, validated, and added to a local file store. My issue arises after the size validation as the $_SERVER['CONTENT_LEN...
[ "php", "web-services", "rest" ]
2
1
1,467
4
0
2008-09-28T13:41:25.370000
2008-09-30T08:17:04.963000
145,856
145,864
How can I join int[] to a character-separated string in .NET?
I have an array of integers: int[] number = new int[] { 2,3,6,7 }; What is the easiest way of converting these into a single string where the numbers are separated by a character (like: "2,3,6,7" )? I'm using C# and.NET 3.5.
var ints = new int[] {1, 2, 3, 4, 5}; var result = string.Join(",", ints.Select(x => x.ToString()).ToArray()); Console.WriteLine(result); // prints "1,2,3,4,5" As of (at least).NET 4.5, var result = string.Join(",", ints.Select(x => x.ToString()).ToArray()); is equivalent to: var result = string.Join(",", ints); I see ...
How can I join int[] to a character-separated string in .NET? I have an array of integers: int[] number = new int[] { 2,3,6,7 }; What is the easiest way of converting these into a single string where the numbers are separated by a character (like: "2,3,6,7" )? I'm using C# and.NET 3.5.
TITLE: How can I join int[] to a character-separated string in .NET? QUESTION: I have an array of integers: int[] number = new int[] { 2,3,6,7 }; What is the easiest way of converting these into a single string where the numbers are separated by a character (like: "2,3,6,7" )? I'm using C# and.NET 3.5. ANSWER: var in...
[ "c#", ".net", ".net-3.5" ]
110
173
78,181
11
0
2008-09-28T13:42:28.457000
2008-09-28T13:45:57.403000
145,863
145,891
Best Java/Swing browser component?
What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component?) and able to run on MacOSX and Windows? Things like: FlyingSaucer, JDIC, maybe others?
i belive this could help: http://djproject.sourceforge.net/ns/index.html
Best Java/Swing browser component? What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component?) and able to run on MacOSX and Windows? Things like: FlyingSaucer, JDIC, maybe others?
TITLE: Best Java/Swing browser component? QUESTION: What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component?) and able to run on MacOSX and Windows? Things like: FlyingSaucer, JDIC, maybe others? ANSWER: i belive this could help: http://djpr...
[ "java", "swing", "browser" ]
43
36
75,425
2
0
2008-09-28T13:45:56.920000
2008-09-28T14:01:07.943000
145,880
145,883
How do I get a stack trace in OCaml?
The Objective Caml language will only produce stack traces if you ask for them just right - what are the requirements for both bytecode and native code?
Compile with -g and set environment variable OCAMLRUNPARAM=b
How do I get a stack trace in OCaml? The Objective Caml language will only produce stack traces if you ask for them just right - what are the requirements for both bytecode and native code?
TITLE: How do I get a stack trace in OCaml? QUESTION: The Objective Caml language will only produce stack traces if you ask for them just right - what are the requirements for both bytecode and native code? ANSWER: Compile with -g and set environment variable OCAMLRUNPARAM=b
[ "ocaml", "stack-trace" ]
39
46
12,057
5
0
2008-09-28T13:53:16.077000
2008-09-28T13:56:53.430000
145,887
145,898
Which image format is cost effective in terms of network operation for iPhone?
I want to display a thumbnail image in a cell of tableViewController, this thumbnail image is located at some remote place (URL of address is in XML file) so which format of image is cost effective?
It's mostly the same as on the Web, really. For graphics, PNG is generally more efficient; for photos, you'll want to pick JPEG. I'm not sure whether the iPhone supports JPEG 2000 (OS X does), so that may be a more efficient options for photos. Also consider tools such as optipng and jpegtran to shed some additional ki...
Which image format is cost effective in terms of network operation for iPhone? I want to display a thumbnail image in a cell of tableViewController, this thumbnail image is located at some remote place (URL of address is in XML file) so which format of image is cost effective?
TITLE: Which image format is cost effective in terms of network operation for iPhone? QUESTION: I want to display a thumbnail image in a cell of tableViewController, this thumbnail image is located at some remote place (URL of address is in XML file) so which format of image is cost effective? ANSWER: It's mostly the...
[ "iphone", "image", "format" ]
0
3
369
3
0
2008-09-28T13:58:18.093000
2008-09-28T14:04:35.067000
145,894
145,918
how to set a menubar icon on mac osx using wx
I could not find any pointers on how to create a menubar icon on OSX using wx. I originally thought that the wxTaskBarIcon class would do, but it actually creates an icon on the Dock. On Windows, wxTaskBarIcon creates a Systray icon and associated menu, and I would think that on mac osx it would create a menubar icon, ...
You have to set wxTaskBarIconType to STATUSITEM, not DOCK. The Cocoa APIs for this are NSStatusBar and NSStatusItem; here's the code in wxWidgets that calls to them.
how to set a menubar icon on mac osx using wx I could not find any pointers on how to create a menubar icon on OSX using wx. I originally thought that the wxTaskBarIcon class would do, but it actually creates an icon on the Dock. On Windows, wxTaskBarIcon creates a Systray icon and associated menu, and I would think th...
TITLE: how to set a menubar icon on mac osx using wx QUESTION: I could not find any pointers on how to create a menubar icon on OSX using wx. I originally thought that the wxTaskBarIcon class would do, but it actually creates an icon on the Dock. On Windows, wxTaskBarIcon creates a Systray icon and associated menu, an...
[ "macos", "wxpython", "wxwidgets" ]
6
4
5,348
4
0
2008-09-28T14:02:29.377000
2008-09-28T14:14:00.597000
145,922
145,945
How can I see what is in my heap in Java?
I've managed to get a memory 'leak' in a java application I'm developing. When running my JUnit test suite I randomly get out of memory exceptions (java.lang.OutOfMemoryError). What tools can I use to examine the heap of my java application to see what's using up all my heap so that I can work out what's keeping refere...
VisualVM is included in the most recent releases of Java. You can use this to create a heap dump, and look at the objects in it. Alternatively, you can also create a heapdump commandine using jmap (in your jdk/bin dir): jmap -dump:format=b,file=heap.bin You can even use this to get a quick histogram of all objects jmap...
How can I see what is in my heap in Java? I've managed to get a memory 'leak' in a java application I'm developing. When running my JUnit test suite I randomly get out of memory exceptions (java.lang.OutOfMemoryError). What tools can I use to examine the heap of my java application to see what's using up all my heap so...
TITLE: How can I see what is in my heap in Java? QUESTION: I've managed to get a memory 'leak' in a java application I'm developing. When running my JUnit test suite I randomly get out of memory exceptions (java.lang.OutOfMemoryError). What tools can I use to examine the heap of my java application to see what's using...
[ "java", "out-of-memory" ]
22
30
20,304
8
0
2008-09-28T14:15:21.373000
2008-09-28T14:30:28.827000
145,969
146,001
Sql design problem - items in multiple sections
I've got a sections table, and an items table. The problem is each item may be in one or more sections, so a simple 'section_id' for each item won't work, and sql doesn't have a way to store arrays where I can do say "WHERE 5 in section_ids"... I've considered storing the list of ids as a comma separated string, the pr...
You need an intermediate lookup table: CREATE TABLE item_in_section (item_id int, section_id int) (I'm guessing about your key types, use whatever ones are appropriate). To find items in a section: SELECT item.* from item, item_in_section WHERE item_in_section.item_id = item.item_id AND item_in_section.section_id = X G...
Sql design problem - items in multiple sections I've got a sections table, and an items table. The problem is each item may be in one or more sections, so a simple 'section_id' for each item won't work, and sql doesn't have a way to store arrays where I can do say "WHERE 5 in section_ids"... I've considered storing the...
TITLE: Sql design problem - items in multiple sections QUESTION: I've got a sections table, and an items table. The problem is each item may be in one or more sections, so a simple 'section_id' for each item won't work, and sql doesn't have a way to store arrays where I can do say "WHERE 5 in section_ids"... I've cons...
[ "sql", "database-design" ]
0
3
401
9
0
2008-09-28T14:43:34.677000
2008-09-28T14:49:45.847000
145,972
146,208
How can I setup LookAndFeel Files in Java?
I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar napkinlaf.jar How can I set this up and use it? I would like a GTK look and feel OR Qt look and feel, Are they available?
The class name for Naplin is net.sourceforge.napkinlaf.NapkinLookAndFeel. So to set it as default on the command line, use: java -Dswing.defaultlaf=net.sourceforge.napkinlaf.NapkinLookAndFeel To install it add napkinlaf.jar to the lib/ext direction and the lines: swing.installedlafs=napkin swing.installedlaf.napkin.nam...
How can I setup LookAndFeel Files in Java? I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar napkinlaf.jar How can I set this up and use it? I would like a GTK look and feel OR Qt look and feel, Are they available?
TITLE: How can I setup LookAndFeel Files in Java? QUESTION: I need to setup LookAndFeel Files in JDK 1.6. I have two files: napkinlaf-swingset2.jar napkinlaf.jar How can I set this up and use it? I would like a GTK look and feel OR Qt look and feel, Are they available? ANSWER: The class name for Naplin is net.sourcef...
[ "java", "swing", "qt", "gtk", "look-and-feel" ]
4
4
7,125
3
0
2008-09-28T14:43:52.570000
2008-09-28T16:36:18.167000
146,020
146,086
Making Eclipse behave like Visual Studio
I'm doing some Android development, and I much prefer Visual Studio, but I'll have to use Eclipse for this. Has anyone made a tool which can make Eclipse look and behave more like visual studio? I mainly can't stand its clippyesqe suggestions on how I should program (Yes, I know I have not yet used that private field! ...
There are also other choices for Java IDEs. You've obviously found Eclipse, but you also may want to check out IntelliJ and NetBeans. IntelliJ is not free, but has a 30 day evaluation period and a Visual Studio key map:) Shop around, find one that you like and start to use it heavily. They are all very good IDEs, and I...
Making Eclipse behave like Visual Studio I'm doing some Android development, and I much prefer Visual Studio, but I'll have to use Eclipse for this. Has anyone made a tool which can make Eclipse look and behave more like visual studio? I mainly can't stand its clippyesqe suggestions on how I should program (Yes, I know...
TITLE: Making Eclipse behave like Visual Studio QUESTION: I'm doing some Android development, and I much prefer Visual Studio, but I'll have to use Eclipse for this. Has anyone made a tool which can make Eclipse look and behave more like visual studio? I mainly can't stand its clippyesqe suggestions on how I should pr...
[ "java", "android", "eclipse", "visual-studio", "ide" ]
59
14
21,774
4
0
2008-09-28T14:53:56.990000
2008-09-28T15:27:02.043000
146,025
146,045
Why is half of my compiled (small) objective-C file a large block of zeroes?
I opened up my compiled Hello World Obj-C application in a text editor and, to my surprise, I found about 8 kilobytes of 00 00 00 00 00 00 00 00.... Why are these here? Is there a way to clear out these zeroes (which I doubt have too much function)? Obviously it's not so important in this file, seeing as it's only 16kB...
It's most likely padding between code, data, relocation or other sections of the executable format you use. Linkers like to pad such sections on a 4k or 8k boundary. This improves loading time for the price of a bit of memory-waste. For a simple hello world it's significant, but for a large application the extra memory...
Why is half of my compiled (small) objective-C file a large block of zeroes? I opened up my compiled Hello World Obj-C application in a text editor and, to my surprise, I found about 8 kilobytes of 00 00 00 00 00 00 00 00.... Why are these here? Is there a way to clear out these zeroes (which I doubt have too much func...
TITLE: Why is half of my compiled (small) objective-C file a large block of zeroes? QUESTION: I opened up my compiled Hello World Obj-C application in a text editor and, to my surprise, I found about 8 kilobytes of 00 00 00 00 00 00 00 00.... Why are these here? Is there a way to clear out these zeroes (which I doubt ...
[ "objective-c", "file-format" ]
4
8
311
4
0
2008-09-28T14:55:04.493000
2008-09-28T15:05:38.587000
146,038
147,581
Near Sorting Algorithms - When to use?
From time to time I browse the web and look for interesting algorithms and datastructures to put into my bag of tricks. A year ago I came across the Soft Heap data-structure and learned about near sorting. The idea behind this is that it's possible to break the O(n log n) barrier of compare based sorts if you can live ...
There are a lot of "greedy" heuristics where you periodically select the minimum of a set. The greedy heuristic is not perfect, so even if you pick the minimum you aren't guaranteed to get to the best final answer. In fact, the GRASP meta-heuristic, you intentionally introduce random error so that you get multiple fina...
Near Sorting Algorithms - When to use? From time to time I browse the web and look for interesting algorithms and datastructures to put into my bag of tricks. A year ago I came across the Soft Heap data-structure and learned about near sorting. The idea behind this is that it's possible to break the O(n log n) barrier ...
TITLE: Near Sorting Algorithms - When to use? QUESTION: From time to time I browse the web and look for interesting algorithms and datastructures to put into my bag of tricks. A year ago I came across the Soft Heap data-structure and learned about near sorting. The idea behind this is that it's possible to break the O...
[ "algorithm", "language-agnostic", "sorting" ]
8
5
2,123
6
0
2008-09-28T15:02:52.163000
2008-09-29T05:00:28.890000
146,081
146,191
Emacs: How do you store the last parameter supplied by the user as the default?
I'm writing an interactive function that I'd like to have remember the last argument the user supplied and use it as the default. (defun run-rake (param) (interactive "sTask: ") (shell-command (format "rake %s" task))) The first time the function is invoked I want it to remember the argument the user supplied so that t...
You can see how the compile command does this. Bring up the help text for the compile command with C-h f compile, move the cursor over the name of the file that contains the function, then hit RETURN. This will bring up the source file for compile. Basically, there's a dynamic/global variable compile-command that holds...
Emacs: How do you store the last parameter supplied by the user as the default? I'm writing an interactive function that I'd like to have remember the last argument the user supplied and use it as the default. (defun run-rake (param) (interactive "sTask: ") (shell-command (format "rake %s" task))) The first time the fu...
TITLE: Emacs: How do you store the last parameter supplied by the user as the default? QUESTION: I'm writing an interactive function that I'd like to have remember the last argument the user supplied and use it as the default. (defun run-rake (param) (interactive "sTask: ") (shell-command (format "rake %s" task))) The...
[ "emacs", "lisp", "elisp" ]
8
5
592
3
0
2008-09-28T15:22:46.953000
2008-09-28T16:22:15.717000
146,093
146,098
Storing a complete graph in a RDBMS
I have several types of entities, each with their own fields, which are stored in separate tables. Each record in such a table may be connected to zero or more records in a different table, i.e., linked to records from different entity types. If I go with lookup tables, I get (m(m-1))/2=O(m^2) separate lookup tables th...
This is Object-Relational Mapping, a classically hard problem. You really need a ORM tool to do this properly, or it'll drive you nuts. The connection problem you refer to is one of the pitfalls, and it needs very careful optimisation and query tuning, else it'll kill performance (e.g. the N+1 SELECT problem). I can't ...
Storing a complete graph in a RDBMS I have several types of entities, each with their own fields, which are stored in separate tables. Each record in such a table may be connected to zero or more records in a different table, i.e., linked to records from different entity types. If I go with lookup tables, I get (m(m-1)...
TITLE: Storing a complete graph in a RDBMS QUESTION: I have several types of entities, each with their own fields, which are stored in separate tables. Each record in such a table may be connected to zero or more records in a different table, i.e., linked to records from different entity types. If I go with lookup tab...
[ "database", "graph-theory" ]
1
2
1,287
3
0
2008-09-28T15:30:44.657000
2008-09-28T15:33:02.717000
146,106
146,695
How should I organize the contents of my CSS file(s)?
This question is about organizing the actual CSS directives themselves within a.css file. When developing a new page or set of pages, I usually just add directives by hand to the.css file, trying to refactor when I can. After some time, I have hundreds (or thousands) of lines and it can get difficult to find what I nee...
Have a look at these three slideshare presentations to start: Beautiful Maintainable CSS Maintainable CSS Efficient, maintainable, modular CSS Firstly, and most importantly, document your CSS. Whatever method you use to organize your CSS, be consistent and document it. Describe at the top of each file what is in that f...
How should I organize the contents of my CSS file(s)? This question is about organizing the actual CSS directives themselves within a.css file. When developing a new page or set of pages, I usually just add directives by hand to the.css file, trying to refactor when I can. After some time, I have hundreds (or thousands...
TITLE: How should I organize the contents of my CSS file(s)? QUESTION: This question is about organizing the actual CSS directives themselves within a.css file. When developing a new page or set of pages, I usually just add directives by hand to the.css file, trying to refactor when I can. After some time, I have hund...
[ "css" ]
84
57
47,227
13
0
2008-09-28T15:37:51.677000
2008-09-28T20:39:38.440000
146,124
146,174
What are the limitations of refactoring?
I'm making a study on refactoring limitations on improving existing software architecture and I would be interested to hear your experiences where you have found refactoring to be not enough or still too immature to accomplish your goals.
Refactoring code that doesn't have a corresponding set suite of unit test can be risky. If the project already has an established unit test suite then provided that you maintain a TDD approach there should be little reason for concern.
What are the limitations of refactoring? I'm making a study on refactoring limitations on improving existing software architecture and I would be interested to hear your experiences where you have found refactoring to be not enough or still too immature to accomplish your goals.
TITLE: What are the limitations of refactoring? QUESTION: I'm making a study on refactoring limitations on improving existing software architecture and I would be interested to hear your experiences where you have found refactoring to be not enough or still too immature to accomplish your goals. ANSWER: Refactoring c...
[ "refactoring" ]
0
4
1,373
6
0
2008-09-28T15:46:16.537000
2008-09-28T16:09:22.300000
146,134
146,162
How to remove illegal characters from path and filenames?
I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using System.IO; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { string illegal = "\"M<>\"\\a/r...
Try something like this instead; string illegal = "\"M\"\\a/ry/ h**ad:>> a\\/:*?\"| li*tt|le|| la\"mb.?"; string invalid = new string(Path.GetInvalidFileNameChars()) + new string(Path.GetInvalidPathChars()); foreach (char c in invalid) { illegal = illegal.Replace(c.ToString(), ""); } But I have to agree with the comme...
How to remove illegal characters from path and filenames? I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using System.IO; namespace ConsoleApplication1 { class Program { static...
TITLE: How to remove illegal characters from path and filenames? QUESTION: I need a robust and simple way to remove illegal path and file characters from a simple string. I've used the below code but it doesn't seem to do anything, what am I missing? using System; using System.IO; namespace ConsoleApplication1 { clas...
[ "c#", "string", "path", "directory" ]
601
555
613,625
30
0
2008-09-28T15:52:10.580000
2008-09-28T16:03:37.247000
146,140
146,161
OpenGL: How to do RGBA->RGBA blitting without changing destination alpha
I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the resulting blit causes the destination texture alpha to change, making it slightly transparent for places wh...
You can set the blend-modes for RGB and alpha to different equations: void glBlendFuncSeparate( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); In your case you want to use the following enums: glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_ZERO, GL_ONE); Note that you may have to import ...
OpenGL: How to do RGBA->RGBA blitting without changing destination alpha I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the resulting blit causes the destinat...
TITLE: OpenGL: How to do RGBA->RGBA blitting without changing destination alpha QUESTION: I have an OpenGL RGBA texture and I blit another RGBA texture onto it using a framebuffer object. The problem is that if I use the usual blend functions with glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA), the resulting blit c...
[ "opengl", "alphablending" ]
2
7
4,424
2
0
2008-09-28T15:55:56.997000
2008-09-28T16:03:13.533000
146,146
146,152
Is my form password being passed in clear text?
This is what my browser sent, when logging into some site: POST http://www.some.site/login.php HTTP/1.0 User-Agent: Opera/8.26 (X2000; Linux i686; Z; en) Host: www.some.site Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1 Accept-Language: en-...
Every data sent trought a http connection can be seen by someone in your route to the server (man in the middle attack). type="password" only hides the character on-screen, and even other programs on your computer can read the data. The only way to protect the data is to send it trought SSL (HTTPS instead of HTTP)
Is my form password being passed in clear text? This is what my browser sent, when logging into some site: POST http://www.some.site/login.php HTTP/1.0 User-Agent: Opera/8.26 (X2000; Linux i686; Z; en) Host: www.some.site Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif,...
TITLE: Is my form password being passed in clear text? QUESTION: This is what my browser sent, when logging into some site: POST http://www.some.site/login.php HTTP/1.0 User-Agent: Opera/8.26 (X2000; Linux i686; Z; en) Host: www.some.site Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, imag...
[ "http", "forms" ]
7
17
17,421
5
0
2008-09-28T15:58:40.720000
2008-09-28T16:00:50.450000
146,153
146,711
How to rotate and fade background images in and out with javascript/ASP.NET/CSS
I need to randomly fade my background images in and out. It will be a timed function, like once every 5 seconds. I need to do it with ASP.NET, Javascript, CSS or all three. Please help me out here guys. Thank you.
Cycle, a jQuery plugin is a very flexible image rotating solution: http://malsup.com/jquery/cycle/
How to rotate and fade background images in and out with javascript/ASP.NET/CSS I need to randomly fade my background images in and out. It will be a timed function, like once every 5 seconds. I need to do it with ASP.NET, Javascript, CSS or all three. Please help me out here guys. Thank you.
TITLE: How to rotate and fade background images in and out with javascript/ASP.NET/CSS QUESTION: I need to randomly fade my background images in and out. It will be a timed function, like once every 5 seconds. I need to do it with ASP.NET, Javascript, CSS or all three. Please help me out here guys. Thank you. ANSWER:...
[ "asp.net", "javascript", "css", "image-manipulation" ]
4
5
62,497
3
0
2008-09-28T16:00:56.830000
2008-09-28T20:48:36.983000
146,155
146,167
targeting specific frawework version in csc.exe
How do you specify a target framework version for the csc.exe c# compiler via command-line invocation (e.g., no.csproj file and not going thru the MSBUILD engine)? e.g, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0.net framework?
In the specific case of the C# 3 compiler, there isn't a problem so long as you don't use any assemblies or types which aren't in.NET 2.0 - the IL is the same (as opposed to targeting 1.1, for instance). In addition to this, you can use /noconfig /nostdlib and then explicitly reference the.NET 2.0 assemblies (in c:\Win...
targeting specific frawework version in csc.exe How do you specify a target framework version for the csc.exe c# compiler via command-line invocation (e.g., no.csproj file and not going thru the MSBUILD engine)? e.g, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0.net framework?
TITLE: targeting specific frawework version in csc.exe QUESTION: How do you specify a target framework version for the csc.exe c# compiler via command-line invocation (e.g., no.csproj file and not going thru the MSBUILD engine)? e.g, using the C# 3.0 csc.exe compiler, how do you compile to IL targeting the 2.0.net fra...
[ "c#" ]
13
5
4,235
1
0
2008-09-28T16:01:25.177000
2008-09-28T16:06:21.637000
146,159
146,186
Is Fortran easier to optimize than C for heavy calculations?
From time to time I read that Fortran is or can be faster then C for heavy calculations. Is that really true? I must admit that I hardly know Fortran, but the Fortran code I have seen so far did not show that the language has features that C doesn't have. If it is true, please tell me why. Please don't tell me what lan...
The languages have similar feature-sets. The performance difference comes from the fact that Fortran says aliasing is not allowed, unless an EQUIVALENCE statement is used. Any code that has aliasing is not valid Fortran, but it is up to the programmer and not the compiler to detect these errors. Thus Fortran compilers ...
Is Fortran easier to optimize than C for heavy calculations? From time to time I read that Fortran is or can be faster then C for heavy calculations. Is that really true? I must admit that I hardly know Fortran, but the Fortran code I have seen so far did not show that the language has features that C doesn't have. If ...
TITLE: Is Fortran easier to optimize than C for heavy calculations? QUESTION: From time to time I read that Fortran is or can be faster then C for heavy calculations. Is that really true? I must admit that I hardly know Fortran, but the Fortran code I have seen so far did not show that the language has features that C...
[ "c", "performance", "fortran" ]
474
515
183,528
23
0
2008-09-28T16:02:52.707000
2008-09-28T16:14:48.763000
146,164
147,078
How Can I Get Touch Events in an iPhone App's Hidden Status Bar's Area?
I have an iPhone app that hides the status bar. However, my main view doesn't get any touch events when I tap in the status bar area. Is there something I can do to fix this? Here are a few details of my app's setup (in case it matters): It's an OpenGL-based application. The app launches in landscape mode. However, the...
Found my own answer (of sorts): This behavior only happens in the iPhone Simulator. When I run the application on an actual iPhone, it works fine. I'd still be interested to know if there is a way to make it work on the simulator.
How Can I Get Touch Events in an iPhone App's Hidden Status Bar's Area? I have an iPhone app that hides the status bar. However, my main view doesn't get any touch events when I tap in the status bar area. Is there something I can do to fix this? Here are a few details of my app's setup (in case it matters): It's an Op...
TITLE: How Can I Get Touch Events in an iPhone App's Hidden Status Bar's Area? QUESTION: I have an iPhone app that hides the status bar. However, my main view doesn't get any touch events when I tap in the status bar area. Is there something I can do to fix this? Here are a few details of my app's setup (in case it ma...
[ "iphone" ]
5
5
3,117
3
0
2008-09-28T16:04:06.573000
2008-09-29T00:28:22.337000
146,204
146,227
Duplicate keys in .NET dictionaries?
Are there any dictionary classes in the.NET base class library which allow duplicate keys to be used? The only solution I've found is to create, for example, a class like: Dictionary > But this is quite irritating to actually use. In Java, I believe a MultiMap accomplishes this, but cannot find an analog in.NET.
If you're using.NET 3.5, use the Lookup class. EDIT: You generally create a Lookup using Enumerable.ToLookup. This does assume that you don't need to change it afterwards - but I typically find that's good enough. If that doesn't work for you, I don't think there's anything in the framework which will help - and using ...
Duplicate keys in .NET dictionaries? Are there any dictionary classes in the.NET base class library which allow duplicate keys to be used? The only solution I've found is to create, for example, a class like: Dictionary > But this is quite irritating to actually use. In Java, I believe a MultiMap accomplishes this, but...
TITLE: Duplicate keys in .NET dictionaries? QUESTION: Are there any dictionary classes in the.NET base class library which allow duplicate keys to be used? The only solution I've found is to create, for example, a class like: Dictionary > But this is quite irritating to actually use. In Java, I believe a MultiMap acco...
[ "c#", ".net", "dictionary", "multimap" ]
297
242
294,518
24
0
2008-09-28T16:33:42.383000
2008-09-28T16:46:37.970000
146,212
146,229
Best way to search in a table and get results and number of results (MySQL)
I have a table of "items", and a table of "itemkeywords". When a user searches for a keyword, I want to give him one page of results plus the total number of results. What I'm doing currently is (for a user that searches "a b c": SELECT DISTINCT {fields I want} FROM itemkeywords JOIN items WHERE (keyword = 'a' or keywo...
Add SQL_CALC_FOUND_ROWS after the select in your limited select, then do a "SELECT FOUND_ROWS()" after the first select is finished. Example: mysql> SELECT SQL_CALC_FOUND_ROWS * FROM tbl_name -> WHERE id > 100 LIMIT 10; mysql> SELECT FOUND_ROWS();
Best way to search in a table and get results and number of results (MySQL) I have a table of "items", and a table of "itemkeywords". When a user searches for a keyword, I want to give him one page of results plus the total number of results. What I'm doing currently is (for a user that searches "a b c": SELECT DISTINC...
TITLE: Best way to search in a table and get results and number of results (MySQL) QUESTION: I have a table of "items", and a table of "itemkeywords". When a user searches for a keyword, I want to give him one page of results plus the total number of results. What I'm doing currently is (for a user that searches "a b ...
[ "asp.net", "mysql", "performance", "search" ]
3
5
620
4
0
2008-09-28T16:37:18.070000
2008-09-28T16:47:00.307000
146,230
146,268
nant: Can I extract the last directory in a path?
In Nant, I would like to be able to extract the last name of the directory in a path. For example, we have the path 'c:\my_proj\source\test.my_dll\' I would like to pass in that path and extract 'test.my_dll' Is there a way to easily do this?
See the script task. You can write custom code in C# or whatever, and return a value that you can assign to a property.
nant: Can I extract the last directory in a path? In Nant, I would like to be able to extract the last name of the directory in a path. For example, we have the path 'c:\my_proj\source\test.my_dll\' I would like to pass in that path and extract 'test.my_dll' Is there a way to easily do this?
TITLE: nant: Can I extract the last directory in a path? QUESTION: In Nant, I would like to be able to extract the last name of the directory in a path. For example, we have the path 'c:\my_proj\source\test.my_dll\' I would like to pass in that path and extract 'test.my_dll' Is there a way to easily do this? ANSWER: ...
[ "nant" ]
1
0
1,408
6
0
2008-09-28T16:47:23.817000
2008-09-28T17:10:30.687000
146,250
146,255
Push or Pull? Turning keypresses into velocity for in-game vehicles
Should I push keypresses to vehicles when they're pressed, or should vehicles pull keys pressed from the engine? I have a vehicle object, which has location, velocity and accelleration members (among other things) and an update method, during which it updates its location based on its velocity, and its vevlocity based ...
You should try and follow an Subscribing/Observer pattern. You put all the key capture code into one singleton InputManager and then each object that requires reaction to input registers with the manager. The manager holds the list of subscribed objects and sends events to them when the keys are pressed/depressed. Just...
Push or Pull? Turning keypresses into velocity for in-game vehicles Should I push keypresses to vehicles when they're pressed, or should vehicles pull keys pressed from the engine? I have a vehicle object, which has location, velocity and accelleration members (among other things) and an update method, during which it ...
TITLE: Push or Pull? Turning keypresses into velocity for in-game vehicles QUESTION: Should I push keypresses to vehicles when they're pressed, or should vehicles pull keys pressed from the engine? I have a vehicle object, which has location, velocity and accelleration members (among other things) and an update method...
[ "language-agnostic" ]
4
8
570
5
0
2008-09-28T16:58:25.523000
2008-09-28T17:04:13.963000
146,269
146,423
Change WPF DataTemplate for ListBox item if selected
I need to change the DataTemplate for items in a ListBox depending on whether the item is selected or not (displaying different/more information when selected). I don't get a GotFocus/LostFocus event on the top-most element in the DataTemplate (a StackPanel) when clicking the ListBox item in question (only through tabb...
The easiest way to do this is to supply a template for the "ItemContainerStyle" and NOT the "ItemTemplate" property. In the code below I create 2 data templates: one for the "unselected" and one for the "selected" states. I then create a template for the "ItemContainerStyle" which is the actual "ListBoxItem" that conta...
Change WPF DataTemplate for ListBox item if selected I need to change the DataTemplate for items in a ListBox depending on whether the item is selected or not (displaying different/more information when selected). I don't get a GotFocus/LostFocus event on the top-most element in the DataTemplate (a StackPanel) when cli...
TITLE: Change WPF DataTemplate for ListBox item if selected QUESTION: I need to change the DataTemplate for items in a ListBox depending on whether the item is selected or not (displaying different/more information when selected). I don't get a GotFocus/LostFocus event on the top-most element in the DataTemplate (a St...
[ ".net", "wpf" ]
94
187
91,069
3
0
2008-09-28T17:10:39.207000
2008-09-28T18:25:32.833000
146,271
146,462
Default pass-by-reference semantics in C++
EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it could be done. That's not the way it works right now, that's the way I wish it could be done, a...
I guess you're missing the point of C++, and C++ semantics. You missed the fact C++ is correct in passing (almost) everything by value, because it's the way it's done in C. Always. But not only in C, as I'll show you below... Parameters Semantics on C In C, everything is passed by value. "primitives" and "PODs" are pas...
Default pass-by-reference semantics in C++ EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it could be done. That's not the way it works right now...
TITLE: Default pass-by-reference semantics in C++ QUESTION: EDIT: This question is more about language engineering than C++ itself. I used C++ as an example to show what I wanted, mostly because I use it daily. I didn't want to know how it works on C++ but open a discussion on how it could be done. That's not the way ...
[ "c++", "programming-languages", "syntax", "semantics" ]
7
15
3,441
9
0
2008-09-28T17:13:13.803000
2008-09-28T18:41:07.163000
146,275
146,309
Function pointer to template class member functions
I have a templated class defined (in part) as template MyClass { public: void DoSomething(){} }; If I want to call DoSomething from another class, but be able to do this for multiple 'T' types in the same place, I am stuck for an idea as method functions pointers are uniquely constrained to the class type. Of course, e...
Ok, so the functor solution doesn't work as you need. Perhaps you should have your template class inherit from a common base "Interface" class. And then you use a vector of those. Something like this: class Base { public: virtual ~Base(){} virtual void DoSomething() = 0; } template class MyClass: public Base { public:...
Function pointer to template class member functions I have a templated class defined (in part) as template MyClass { public: void DoSomething(){} }; If I want to call DoSomething from another class, but be able to do this for multiple 'T' types in the same place, I am stuck for an idea as method functions pointers are ...
TITLE: Function pointer to template class member functions QUESTION: I have a templated class defined (in part) as template MyClass { public: void DoSomething(){} }; If I want to call DoSomething from another class, but be able to do this for multiple 'T' types in the same place, I am stuck for an idea as method funct...
[ "c++", "templates", "function", "member" ]
3
13
4,988
2
0
2008-09-28T17:13:37.343000
2008-09-28T17:31:54.957000
146,291
146,352
Manpage scandir() prototype weirdness
I have a problem with scandir(): The manpage contains this as prototype: int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); Therefore I have this: static inline int RubyCompare(const struct dirent **a, const struc...
Actually, there's no such constraint that you can't pass a pointer to an inline function. The inline keyword serves only as a hint to the compiler to inline calls when it can. The problem is that the manpage for scandir() is a little misleading. The prototype in for the 4th parameter is actually int (*cmp)(const void *...
Manpage scandir() prototype weirdness I have a problem with scandir(): The manpage contains this as prototype: int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); Therefore I have this: static inline int RubyCompar...
TITLE: Manpage scandir() prototype weirdness QUESTION: I have a problem with scandir(): The manpage contains this as prototype: int scandir(const char *dir, struct dirent ***namelist, int (*filter)(const struct dirent *), int (*compar)(const struct dirent **, const struct dirent **)); Therefore I have this: static inl...
[ "c", "manpage" ]
6
5
2,054
3
0
2008-09-28T17:22:29.707000
2008-09-28T17:55:23.560000
146,305
146,313
Organizing classes into namespaces
Are there some principles of organizing classes into namespaces? For example is it OK if classes from namespace N depends on classes from N.X? And if classes from N.X depends on classes from N?
In general, that should be fine for your example, if your packages were "N.UI" and "N.Util". I've seen namespaces used in two general fashions: 1) All tiers of a system have a namespace (i.e. database, web, biz, etc.) 2) Each component has a namespace (i.e. Customer, Invoice) and tiered namespaced underneath Either way...
Organizing classes into namespaces Are there some principles of organizing classes into namespaces? For example is it OK if classes from namespace N depends on classes from N.X? And if classes from N.X depends on classes from N?
TITLE: Organizing classes into namespaces QUESTION: Are there some principles of organizing classes into namespaces? For example is it OK if classes from namespace N depends on classes from N.X? And if classes from N.X depends on classes from N? ANSWER: In general, that should be fine for your example, if your packag...
[ "c#", ".net", "principles" ]
5
5
897
2
0
2008-09-28T17:29:52.203000
2008-09-28T17:33:53.410000
146,316
148,481
Ideal number of classes per namespace branch
What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on the maintainable vs. not maintainable number...
"42? No, it doesn't work..." Ok, let's put our programming prowess to work and see what is Microsoft's opinion: # IronPython import System exported_types = [ (t.Namespace, t.Name) for t in System.Int32().GetType().Assembly.GetExportedTypes()] import itertools get_ns = lambda (ns, typename): ns sorted_exported_types = ...
Ideal number of classes per namespace branch What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this point, focused on...
TITLE: Ideal number of classes per namespace branch QUESTION: What number of classes do you think is ideal per one namespace "branch"? At which point would one decide to break one namespace into multiple ones? Let's not discuss the logical grouping of classes (assume they are logically grouped properly), I am, at this...
[ "c#", "namespaces", "grouping" ]
11
28
1,900
7
0
2008-09-28T17:35:12.157000
2008-09-29T12:34:04.400000
146,354
146,446
Setting PHP variables in httpd.conf?
I'd like to automatically change my database connection settings on a per-vhost basis, so that I don't have to edit any PHP code as it moves from staging to live and yet access different databases. This is on a single dedicated server. So I was wondering, can I set a PHP variable or constant in httpd.conf as part of th...
Did you tried to use the.htaccess file? You could override the php.ini values using it. Just put the.htaccess file into your htdocs directory: php_value name value Futher information: https://php.net/manual/en/configuration.changes.php https://php.net/manual/en/ini.php
Setting PHP variables in httpd.conf? I'd like to automatically change my database connection settings on a per-vhost basis, so that I don't have to edit any PHP code as it moves from staging to live and yet access different databases. This is on a single dedicated server. So I was wondering, can I set a PHP variable or...
TITLE: Setting PHP variables in httpd.conf? QUESTION: I'd like to automatically change my database connection settings on a per-vhost basis, so that I don't have to edit any PHP code as it moves from staging to live and yet access different databases. This is on a single dedicated server. So I was wondering, can I set...
[ "php", "apache" ]
26
14
46,576
6
0
2008-09-28T17:56:33.527000
2008-09-28T18:35:19.627000
146,358
147,149
Efficiently merge string arrays in .NET, keeping distinct values
I'm using.NET 3.5. I have two string arrays, which may share one or more values: string[] list1 = new string[] { "apple", "orange", "banana" }; string[] list2 = new string[] { "banana", "pear", "grape" }; I'd like a way to merge them into one array with no duplicate values: { "apple", "orange", "banana", "pear", "grape...
string[] result = list1.Union(list2).ToArray(); from msdn: "This method excludes duplicates from the return set. This is different behavior to the Concat(TSource) method, which returns all the elements in the input sequences including duplicates."
Efficiently merge string arrays in .NET, keeping distinct values I'm using.NET 3.5. I have two string arrays, which may share one or more values: string[] list1 = new string[] { "apple", "orange", "banana" }; string[] list2 = new string[] { "banana", "pear", "grape" }; I'd like a way to merge them into one array with n...
TITLE: Efficiently merge string arrays in .NET, keeping distinct values QUESTION: I'm using.NET 3.5. I have two string arrays, which may share one or more values: string[] list1 = new string[] { "apple", "orange", "banana" }; string[] list2 = new string[] { "banana", "pear", "grape" }; I'd like a way to merge them int...
[ "c#", "linq", "arrays", "merge", "distinct" ]
47
115
58,878
6
0
2008-09-28T17:59:01.087000
2008-09-29T01:04:37.117000
146,359
146,365
Python scope: "UnboundLocalError: local variable 'c' referenced before assignment"
I am trying to figure out this: c = 1 def f(n): print c + n def g(n): c = c + n f(1) # => 2 g(1) # => UnboundLocalError: local variable 'c' referenced before assignment Thanks!
Within a function, variables that are assigned to are treated as local variables by default. To assign to global variables, use the global statement: def g(n): global c c = c + n This is one of the quirky areas of Python that has never really sat well with me.
Python scope: "UnboundLocalError: local variable 'c' referenced before assignment" I am trying to figure out this: c = 1 def f(n): print c + n def g(n): c = c + n f(1) # => 2 g(1) # => UnboundLocalError: local variable 'c' referenced before assignment Thanks!
TITLE: Python scope: "UnboundLocalError: local variable 'c' referenced before assignment" QUESTION: I am trying to figure out this: c = 1 def f(n): print c + n def g(n): c = c + n f(1) # => 2 g(1) # => UnboundLocalError: local variable 'c' referenced before assignment Thanks! ANSWER: Within a function, variables tha...
[ "python", "scope" ]
41
52
19,496
4
0
2008-09-28T17:59:30.663000
2008-09-28T18:02:54.260000
146,361
146,377
What is your smallish web development company setup?
I work for a small web development company (only 2 to 3 developers) that work on a wide range of projects for different customers (everything from CMS's to eCommerce sites). Usually we work on our own projects but occasionally we need to work together on one. We use subversion as our source control software and sites a...
Unit testing IS necassary no matter what. If you write code, you unit test. I work by myself alot too. I still test. I dont know how I ever wrote code before it. Heres the way I look at it. you dont necassarily need the same expensive tools as the big boys, but if you want to be big, you have to think big. Do the same ...
What is your smallish web development company setup? I work for a small web development company (only 2 to 3 developers) that work on a wide range of projects for different customers (everything from CMS's to eCommerce sites). Usually we work on our own projects but occasionally we need to work together on one. We use ...
TITLE: What is your smallish web development company setup? QUESTION: I work for a small web development company (only 2 to 3 developers) that work on a wide range of projects for different customers (everything from CMS's to eCommerce sites). Usually we work on our own projects but occasionally we need to work togeth...
[ ".net", "language-agnostic", "development-environment" ]
2
1
414
4
0
2008-09-28T17:59:50.227000
2008-09-28T18:07:39.770000
146,367
146,404
Asp.Net MVC: How do I get Html.ActionLink to render integer values properly?
I have an asp.net mvc application with a route similar to: routes.MapRoute("Blog", "{controller}/{action}/{year}/{month}/{day}/{friendlyName}", new { controller = "Blog", action = "Index", id = "", friendlyName="" }, new { controller = @"[^\.]*", year = @"\d{4}", month = @"\d{2}", day = @"\d{2}" } ); My controller acti...
I would suggest formatting the Year, Month, and Day as Strings instead. Think about this: Will you be doing any math on these "integers"? Probably not, so there really is no point for making them integers. Once you have them as Strings you can force the leading zero format.
Asp.Net MVC: How do I get Html.ActionLink to render integer values properly? I have an asp.net mvc application with a route similar to: routes.MapRoute("Blog", "{controller}/{action}/{year}/{month}/{day}/{friendlyName}", new { controller = "Blog", action = "Index", id = "", friendlyName="" }, new { controller = @"[^\.]...
TITLE: Asp.Net MVC: How do I get Html.ActionLink to render integer values properly? QUESTION: I have an asp.net mvc application with a route similar to: routes.MapRoute("Blog", "{controller}/{action}/{year}/{month}/{day}/{friendlyName}", new { controller = "Blog", action = "Index", id = "", friendlyName="" }, new { co...
[ "c#", "asp.net-mvc", "routes" ]
5
2
2,894
2
0
2008-09-28T18:03:13.637000
2008-09-28T18:15:23.263000
146,381
146,419
Visual Studio support for new C / C++ standards?
I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio. Will any of the new stuff in the standard ever get added to visual studio, or is Microsoft ...
MS has a series of public replies to this, most of them blaming their users. Like this one: https://devblogs.microsoft.com/cppblog/iso-c-standard-update/ Now, the Visual C++ compiler team receives the occasionally question as to why we haven’t implemented C99. It’s really based on interest from our users. Where we’ve r...
Visual Studio support for new C / C++ standards? I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio. Will any of the new stuff in the standard ...
TITLE: Visual Studio support for new C / C++ standards? QUESTION: I keep reading about C99 and C++11 and all these totally sweet things that are getting added to the language standard that might be nice to use someday. However, we currently languish in the land of writing C++ in Visual Studio. Will any of the new stuf...
[ "c++", "visual-studio", "visual-c++", "c++11", "c99" ]
103
104
65,896
12
0
2008-09-28T18:08:19.067000
2008-09-28T18:24:11.043000
146,385
146,565
Server cert and Client Truststore
I am trying to call a webservice using ssl. How do i get the relevant server cert so that i can import it into my truststore? I know about the use of property com.ibm.ssl.enableSignerExchangePrompt from a main method but i would add the server cert to my truststore manually. I dont want this property set in any of my s...
you can programmatically do this with Java by implementing your own X509TrustManager. public class dummyTrustManager implements X509TrustManager { public void checkClientTrusted(X509Certificate[] chain, String authType) throws CertificateException { //do nothing } public void checkServerTrusted(X509Certificate[] chai...
Server cert and Client Truststore I am trying to call a webservice using ssl. How do i get the relevant server cert so that i can import it into my truststore? I know about the use of property com.ibm.ssl.enableSignerExchangePrompt from a main method but i would add the server cert to my truststore manually. I dont wan...
TITLE: Server cert and Client Truststore QUESTION: I am trying to call a webservice using ssl. How do i get the relevant server cert so that i can import it into my truststore? I know about the use of property com.ibm.ssl.enableSignerExchangePrompt from a main method but i would add the server cert to my truststore ma...
[ "web-services", "ssl" ]
0
2
2,080
2
0
2008-09-28T18:09:47.987000
2008-09-28T19:39:41.750000
146,387
149,814
What is the best way to produce random double on POSIX?
I'd like to get uniform distribution in range [0.0, 1.0) If possible, please let the implementation make use of random bytes from /dev/urandom. It would also be nice if your solution was thread-safe. If you're not sure, please indicate that. See some solution I thought about after reading other answers.
This seems to be pretty good way: unsigned short int r1, r2, r3; // let r1, r2 and r3 hold random values double result = ldexp(r1, -48) + ldexp(r2, -32) + ldexp(r3, -16); This is based on NetBSD's drand48 implementation.
What is the best way to produce random double on POSIX? I'd like to get uniform distribution in range [0.0, 1.0) If possible, please let the implementation make use of random bytes from /dev/urandom. It would also be nice if your solution was thread-safe. If you're not sure, please indicate that. See some solution I th...
TITLE: What is the best way to produce random double on POSIX? QUESTION: I'd like to get uniform distribution in range [0.0, 1.0) If possible, please let the implementation make use of random bytes from /dev/urandom. It would also be nice if your solution was thread-safe. If you're not sure, please indicate that. See ...
[ "c++", "multithreading", "random", "posix" ]
4
4
1,831
6
0
2008-09-28T18:09:49.593000
2008-09-29T17:40:58.843000
146,388
146,645
What is a good search engine for embedding in a web site
I am thinking of changing my web site's homegrown search engine. Before I break out Visual Studio, I wondered if anyone can suggest an alternative that gives me what I need. This being: Works with an ASP.NET site (is a.NET project) Creates a file-based index Fast search across hundreds or thousands of pages Performs wo...
The.NET version of Lucene is what we've been using. It meets all of your criteria.
What is a good search engine for embedding in a web site I am thinking of changing my web site's homegrown search engine. Before I break out Visual Studio, I wondered if anyone can suggest an alternative that gives me what I need. This being: Works with an ASP.NET site (is a.NET project) Creates a file-based index Fast...
TITLE: What is a good search engine for embedding in a web site QUESTION: I am thinking of changing my web site's homegrown search engine. Before I break out Visual Studio, I wondered if anyone can suggest an alternative that gives me what I need. This being: Works with an ASP.NET site (is a.NET project) Creates a fil...
[ "asp.net", "search-engine" ]
8
6
8,412
6
0
2008-09-28T18:09:51.420000
2008-09-28T20:21:42.117000
146,390
146,408
Java printf functionality for collections or arrays
In python you can use a tuple in a formatted print statement and the tuple values are used at the indicated positions in the formatted string. For example: >>> a = (1,"Hello",7.2) >>> print "these are the values %d, %s, %f" % a these are the values 1, Hello, 7.200000 Is there some way to use any array or collection in ...
printf will have a declaration along the lines of: public PrintString printf(String format, Object... args);... means much the same as []. The difference is... allows the caller to omit explicitly creating an array. So consider: out.printf("%s:%s", a, b); That is the equivalent of: out.printf("%s:%s", new Object[] { a,...
Java printf functionality for collections or arrays In python you can use a tuple in a formatted print statement and the tuple values are used at the indicated positions in the formatted string. For example: >>> a = (1,"Hello",7.2) >>> print "these are the values %d, %s, %f" % a these are the values 1, Hello, 7.200000 ...
TITLE: Java printf functionality for collections or arrays QUESTION: In python you can use a tuple in a formatted print statement and the tuple values are used at the indicated positions in the formatted string. For example: >>> a = (1,"Hello",7.2) >>> print "these are the values %d, %s, %f" % a these are the values 1...
[ "java", "collections", "printf" ]
3
12
7,680
2
0
2008-09-28T18:11:18.390000
2008-09-28T18:18:25.313000
146,391
146,422
Annotations on Interfaces?
I can't figure out a use case for being able to annotate interfaces in Java. Maybe someone could give me an example?
I've used it in Spring to annotate interfaces where the annotation should apply to all subclasses. For example, say you have a Service interface and you might have multiple implementations of the interface but you want a security annotation to apply regardless of the annotation. In that case, it makes the most sense to...
Annotations on Interfaces? I can't figure out a use case for being able to annotate interfaces in Java. Maybe someone could give me an example?
TITLE: Annotations on Interfaces? QUESTION: I can't figure out a use case for being able to annotate interfaces in Java. Maybe someone could give me an example? ANSWER: I've used it in Spring to annotate interfaces where the annotation should apply to all subclasses. For example, say you have a Service interface and ...
[ "java", "annotations" ]
22
28
39,806
10
0
2008-09-28T18:11:21.963000
2008-09-28T18:25:12.520000
146,439
146,474
Way to stop a program from starting up using c#?
Here's the idea, I'd like to make a service? that will look for a certain program starting up and dissallow it unless certain conditions are met. Let's say I have a game I want to stop myself from playing during the week. So if I start it up on any day other than Friday/Saturday/Sunday, it will intercept and cancel. Is...
Well, you can definitely determine which programs are running by looking for the process names you want (GetProcessesByName()) and killing them. Process[] processes = Process.GetProcessesByName(processName); foreach(Process process in processes) { process.Kill(); } You could just have a list of them you didn't want to ...
Way to stop a program from starting up using c#? Here's the idea, I'd like to make a service? that will look for a certain program starting up and dissallow it unless certain conditions are met. Let's say I have a game I want to stop myself from playing during the week. So if I start it up on any day other than Friday/...
TITLE: Way to stop a program from starting up using c#? QUESTION: Here's the idea, I'd like to make a service? that will look for a certain program starting up and dissallow it unless certain conditions are met. Let's say I have a game I want to stop myself from playing during the week. So if I start it up on any day ...
[ "c#", "windows", "service" ]
5
6
6,787
8
0
2008-09-28T18:33:03.453000
2008-09-28T18:46:22.703000
146,452
146,454
What are POD types in C++?
I've come across this term POD-type a few times. What does it mean?
POD stands for Plain Old Data - that is, a class (whether defined with the keyword struct or the keyword class ) without constructors, destructors and virtual members functions. Wikipedia's article on POD goes into a bit more detail and defines it as: A Plain Old Data Structure in C++ is an aggregate class that contain...
What are POD types in C++? I've come across this term POD-type a few times. What does it mean?
TITLE: What are POD types in C++? QUESTION: I've come across this term POD-type a few times. What does it mean? ANSWER: POD stands for Plain Old Data - that is, a class (whether defined with the keyword struct or the keyword class ) without constructors, destructors and virtual members functions. Wikipedia's article ...
[ "c++", "types", "c++-faq" ]
1,221
852
448,817
9
0
2008-09-28T18:36:09.563000
2008-09-28T18:37:31.977000
146,466
487,436
Tutorials for Wii programming
I have a Nintendo Wii, and I've got devkitpro working to load some simple programs. The example source code that I've been able to find is very simplistic, such as drawing and rotating a simple shape. I've been looking for more in depth tutorials, and I haven't been able to find much. Most of the applications available...
I'm going to provide you with some nice links: Getting started (dead) Wii Programming (dead) Wii Wiki about Homebrew A Blogger who talks about Wii Programming A big resource on Wii Development (dead) Another very good resource is WiiBrew, here are some development specific links: Tutorials Debugging Development Tools D...
Tutorials for Wii programming I have a Nintendo Wii, and I've got devkitpro working to load some simple programs. The example source code that I've been able to find is very simplistic, such as drawing and rotating a simple shape. I've been looking for more in depth tutorials, and I haven't been able to find much. Most...
TITLE: Tutorials for Wii programming QUESTION: I have a Nintendo Wii, and I've got devkitpro working to load some simple programs. The example source code that I've been able to find is very simplistic, such as drawing and rotating a simple shape. I've been looking for more in depth tutorials, and I haven't been able ...
[ "homebrew", "wii", "devkitpro" ]
72
29
26,316
5
0
2008-09-28T18:42:33.713000
2009-01-28T12:24:20.337000
146,480
146,509
How do I get the resolution of the main monitor in Mac OS X in C++?
I have a graphical app that needs to test the resolution of the display it is starting up on in Mac OS X to ensure it is not larger than the resolution. This is done before the window itself is initialized. If there is more than one display, it needs to be the primary display. This is the display that hardware accelera...
Using CoreGraphics: CGRect mainMonitor = CGDisplayBounds(CGMainDisplayID()); CGFloat monitorHeight = CGRectGetHeight(mainMonitor); CGFloat monitorWidth = CGRectGetWidth(mainMonitor); More information at Apple's Quartz Display Services Reference.
How do I get the resolution of the main monitor in Mac OS X in C++? I have a graphical app that needs to test the resolution of the display it is starting up on in Mac OS X to ensure it is not larger than the resolution. This is done before the window itself is initialized. If there is more than one display, it needs t...
TITLE: How do I get the resolution of the main monitor in Mac OS X in C++? QUESTION: I have a graphical app that needs to test the resolution of the display it is starting up on in Mac OS X to ensure it is not larger than the resolution. This is done before the window itself is initialized. If there is more than one d...
[ "c++", "macos", "graphics", "resolution" ]
4
6
2,502
1
0
2008-09-28T18:49:12.447000
2008-09-28T19:06:56.727000
146,484
146,491
What is the windows API to change Screen refresh rate?
Can some one specify the windows API, one need to use in order to be able to change programmatically the screen refresh rate?
I found this via a google search. Hope it helps some. http://www.codeproject.com/KB/winsdk/changerefresh.aspx http://msdn.microsoft.com/en-us/library/ms533260(VS.85).aspx
What is the windows API to change Screen refresh rate? Can some one specify the windows API, one need to use in order to be able to change programmatically the screen refresh rate?
TITLE: What is the windows API to change Screen refresh rate? QUESTION: Can some one specify the windows API, one need to use in order to be able to change programmatically the screen refresh rate? ANSWER: I found this via a google search. Hope it helps some. http://www.codeproject.com/KB/winsdk/changerefresh.aspx ht...
[ "winapi" ]
3
3
5,013
2
0
2008-09-28T18:51:19.777000
2008-09-28T18:54:43.730000
146,486
159,443
What are the quintessential tools and resources for hosting Rails applications on Amazon's EC2?
I'm looking for: documentation blogs books ready-to-use pre-configured slice images services wrappers libraries tutorials...anything that would make it easier to start using EC2 to host a Rails application.
There is a Rails image for EC2 at http://ec2onrails.rubyforge.org/
What are the quintessential tools and resources for hosting Rails applications on Amazon's EC2? I'm looking for: documentation blogs books ready-to-use pre-configured slice images services wrappers libraries tutorials...anything that would make it easier to start using EC2 to host a Rails application.
TITLE: What are the quintessential tools and resources for hosting Rails applications on Amazon's EC2? QUESTION: I'm looking for: documentation blogs books ready-to-use pre-configured slice images services wrappers libraries tutorials...anything that would make it easier to start using EC2 to host a Rails application....
[ "ruby-on-rails", "amazon-ec2", "system-administration" ]
14
12
1,004
7
0
2008-09-28T18:51:33.770000
2008-10-01T20:00:12.503000
146,498
147,428
JTable column spanning
I am trying to make a JTable that has column spans available. Specifically, I am looking to nest a JTable inside another JTable, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you see in MS Access where you can nest table...
As a pointer in the right direction, try this article at SwingWiki that explains the TableUI method of column spanning quite well. Before this, I also tried some alternatives such as overriding the TableCellRenderer paint methods without much success.
JTable column spanning I am trying to make a JTable that has column spans available. Specifically, I am looking to nest a JTable inside another JTable, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you see in MS Access w...
TITLE: JTable column spanning QUESTION: I am trying to make a JTable that has column spans available. Specifically, I am looking to nest a JTable inside another JTable, and when the user clicks to view the nested table, it should expand to push down the rows below and fill the empty space. This is similar to what you ...
[ "java", "swing", "jtable" ]
6
4
8,897
3
0
2008-09-28T19:00:05.980000
2008-09-29T03:38:05.140000
146,520
146,597
How to programmatically simulate XP's "Windows Security" start menu option on Windows 2000
I'm trying to find a way to invoke the Ctrl+Alt+Delete dialog on a Windows 2000 computer that I'm connected to via Remote Desktop. Windows XP and 2003 include a new start menu command called "Windows Security" that does this, but Windows 2000 has no such option. It appears that Ctrl+Alt+End will do this, but it only go...
My coworker found the way to accomplish this directly: Start | Settings | Windows Security. If it's not present, it may have been disabled via Group Policy ( Technet ).
How to programmatically simulate XP's "Windows Security" start menu option on Windows 2000 I'm trying to find a way to invoke the Ctrl+Alt+Delete dialog on a Windows 2000 computer that I'm connected to via Remote Desktop. Windows XP and 2003 include a new start menu command called "Windows Security" that does this, but...
TITLE: How to programmatically simulate XP's "Windows Security" start menu option on Windows 2000 QUESTION: I'm trying to find a way to invoke the Ctrl+Alt+Delete dialog on a Windows 2000 computer that I'm connected to via Remote Desktop. Windows XP and 2003 include a new start menu command called "Windows Security" t...
[ "windows", "security", "rdp" ]
0
1
751
1
0
2008-09-28T19:14:40.610000
2008-09-28T19:57:52.127000
146,522
146,524
How do I successfully pass a function reference to Django’s reverse() function?
I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string: # urls.py # ------- # coding=utf-8 from django.conf.urls.defaults import * from myapp import views urlpatterns = patterns('', url(r'^myvi...
Got it!! The problem is that some of the imports are of myproject.myapp.views, and some are just of myapp.views. This is confusing the Python module system enough that it no longer detects the functions as the same object. This is because your main settings.py probably has a line like: ROOT_URLCONF = `myproject.urls` T...
How do I successfully pass a function reference to Django’s reverse() function? I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string: # urls.py # ------- # coding=utf-8 from django.conf.urls.de...
TITLE: How do I successfully pass a function reference to Django’s reverse() function? QUESTION: I’ve got a brand new Django project. I’ve added one minimal view function to views.py, and one URL pattern to urls.py, passing the view by function reference instead of a string: # urls.py # ------- # coding=utf-8 from d...
[ "python", "django" ]
13
11
6,671
2
0
2008-09-28T19:15:15.227000
2008-09-28T19:17:44.470000
146,528
146,601
What is the fastest way to get to documentation for Ruby?
Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing Date.methods, but as far as I know this doesn't provide details about argumen...
Bookmark the ruby core docs Use your web browser's find-text command. Unexpected as it may seem, I find this is actually quicker than using ri, which for some reason seems to take ages to start up. It is also much better than ri because the HTML page lists all the documentation for all the methods on a single page. Oft...
What is the fastest way to get to documentation for Ruby? Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing Date.methods, but a...
TITLE: What is the fastest way to get to documentation for Ruby? QUESTION: Say I'm writing some ruby code and I want to use the standard Date type to get the current date. Instead of using a search engine, is there a faster way to find the documentation for this class? I know I can get the methods for Date by typing D...
[ "ruby", "documentation" ]
3
4
346
4
0
2008-09-28T19:20:49.330000
2008-09-28T20:01:22.633000
146,531
146,629
Delete all but the 50 newest rows
I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories?
I ended up using two queries since MySQL5 doesn't yet support LIMIT's in subqueries SELECT unixTime FROM entries ORDER BY unixTime DESC LIMIT 49, 1; DELETE FROM entries WHERE unixTime < $sqlResult;
Delete all but the 50 newest rows I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories?
TITLE: Delete all but the 50 newest rows QUESTION: I have a SQL table with news stories and Unix timestamps. I'd like to only keep the 50 newest stories. How would I write an SQL statement to delete any amount of older stories? ANSWER: I ended up using two queries since MySQL5 doesn't yet support LIMIT's in subquerie...
[ "mysql", "sql" ]
2
6
2,691
7
0
2008-09-28T19:22:00.747000
2008-09-28T20:15:18.730000
146,575
146,964
Crafting .webloc file
I'm writing a program (for Mac OS X, using Objective-C) and I need to create a bunch of.webloc files programmatically. The.webloc file is simply file which is created after you drag-n-drop an URL from Safari's location bar to some folder. Generally speaking, I need an approach to create items in a filesystem which poin...
It is little known - but there is also a simple plist based file format for weblocs. When creating webloc files you DO NOT NEED to save them using the resource method the other three posters describe. You can also write a simple plist: URL http://apple.com The binary resource format is still in active use and if you wa...
Crafting .webloc file I'm writing a program (for Mac OS X, using Objective-C) and I need to create a bunch of.webloc files programmatically. The.webloc file is simply file which is created after you drag-n-drop an URL from Safari's location bar to some folder. Generally speaking, I need an approach to create items in a...
TITLE: Crafting .webloc file QUESTION: I'm writing a program (for Mac OS X, using Objective-C) and I need to create a bunch of.webloc files programmatically. The.webloc file is simply file which is created after you drag-n-drop an URL from Safari's location bar to some folder. Generally speaking, I need an approach to...
[ "objective-c", "cocoa", "macos", "macos-carbon" ]
20
23
7,742
7
0
2008-09-28T19:44:19.820000
2008-09-28T23:04:16.657000
146,576
146,662
Why is the Java main method static?
The method signature of a Java main method is: public static void main(String[] args) {... } Is there a reason why this method must be static?
The method is static because otherwise there would be ambiguity: which constructor should be called? Especially if your class looks like this: public class JavaClass{ protected JavaClass(int x){} public void main(String[] args){ } } Should the JVM call new JavaClass(int)? What should it pass for x? If not, should the J...
Why is the Java main method static? The method signature of a Java main method is: public static void main(String[] args) {... } Is there a reason why this method must be static?
TITLE: Why is the Java main method static? QUESTION: The method signature of a Java main method is: public static void main(String[] args) {... } Is there a reason why this method must be static? ANSWER: The method is static because otherwise there would be ambiguity: which constructor should be called? Especially if...
[ "java", "static", "program-entry-point" ]
542
354
523,081
37
0
2008-09-28T19:45:34.810000
2008-09-28T20:28:34.377000
146,604
146,640
Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically?
I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one for the child, however, the foreign-key on the child that references the parent, is an empty guid. Here is my...
You may need to add NOT-NULL="true" to your mapping class: as well as make sure that you have the reverse of the mapping defined for the child class: I had similar issues with hibernate on my current project with parent-child relationships, and this was a part of the solution.
Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically? I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one for the child, ho...
TITLE: Why isn't my NHibernate bag collection setting the 'parent id' of the children dynamically? QUESTION: I have a new object with a collection of new objects within it on some property as an IList. I see through sql profiler two insert queries being executed.. one for the parent, which has the new guid id, and one...
[ "nhibernate", "mapping", "parent-child" ]
8
9
10,208
2
0
2008-09-28T20:01:44.007000
2008-09-28T20:20:44.037000
146,607
146,671
I'm using Python regexes in a criminally inefficient manner
My goal here is to create a very simple template language. At the moment, I'm working on replacing a variable with a value, like this: This input: The Web Should produce this output: The Web This Is A Test Variable I've got it working. But looking at my code, I'm running multiple identical regexes on the same strings -...
The first thing that may improve things is to move the re.compile outside the function. The compilation is cached, but there is a speed hit in checking this to see if its compiled. Another possibility is to use a single regex as below: MatchedQuotes = re.compile(r"(['\"])(.*)\1", re.LOCALE) item = MatchedQuotes.sub(r'\...
I'm using Python regexes in a criminally inefficient manner My goal here is to create a very simple template language. At the moment, I'm working on replacing a variable with a value, like this: This input: The Web Should produce this output: The Web This Is A Test Variable I've got it working. But looking at my code, ...
TITLE: I'm using Python regexes in a criminally inefficient manner QUESTION: My goal here is to create a very simple template language. At the moment, I'm working on replacing a variable with a value, like this: This input: The Web Should produce this output: The Web This Is A Test Variable I've got it working. But lo...
[ "regex", "algorithm", "optimization", "python" ]
8
12
2,226
10
0
2008-09-28T20:03:14.017000
2008-09-28T20:31:44.120000
146,622
172,611
Sieve of Eratosthenes in Erlang
I'm in the process of learning Erlang. As an exercise I picked up the Sieve of Eratosthenes algorithm of generating prime numbers. Here is my code: -module(seed2). -export([get/1]). get(N) -> WorkList = lists:duplicate(N, empty), get(2, N, WorkList, []). get(thats_the_end, _N, _WorkList, ResultList) -> lists:reverse(...
Here's a simple (but not terribly fast) sieve implementation: -module(primes). -export([sieve/1]). -include_lib("eunit/include/eunit.hrl"). sieve([]) -> []; sieve([H|T]) -> List = lists:filter(fun(N) -> N rem H /= 0 end, T), [H|sieve(List)]; sieve(N) -> sieve(lists:seq(2,N)).
Sieve of Eratosthenes in Erlang I'm in the process of learning Erlang. As an exercise I picked up the Sieve of Eratosthenes algorithm of generating prime numbers. Here is my code: -module(seed2). -export([get/1]). get(N) -> WorkList = lists:duplicate(N, empty), get(2, N, WorkList, []). get(thats_the_end, _N, _WorkLis...
TITLE: Sieve of Eratosthenes in Erlang QUESTION: I'm in the process of learning Erlang. As an exercise I picked up the Sieve of Eratosthenes algorithm of generating prime numbers. Here is my code: -module(seed2). -export([get/1]). get(N) -> WorkList = lists:duplicate(N, empty), get(2, N, WorkList, []). get(thats_the...
[ "erlang", "sieve-of-eratosthenes" ]
17
13
4,095
12
0
2008-09-28T20:08:30.853000
2008-10-05T20:35:09.567000
146,657
146,694
C header file loops
I have a couple of header files, which boil down to: tree.h: #include "element.h" typedef struct tree_ { struct *tree_ first_child; struct *tree_ next_sibling; int tag; element *obj;.... } tree; and element.h: #include "tree.h" typedef struct element_ { tree *tree_parent; char *name;... } element; The problem is that...
I think the problem here is not the missing include guard but the fact that the two structures need each other in their definition. So it's a type define hann and egg problem. The way to solve these in C or C++ is to do forward declarations on the type. If you tell the compiler that element is a structure of some sort,...
C header file loops I have a couple of header files, which boil down to: tree.h: #include "element.h" typedef struct tree_ { struct *tree_ first_child; struct *tree_ next_sibling; int tag; element *obj;.... } tree; and element.h: #include "tree.h" typedef struct element_ { tree *tree_parent; char *name;... } element;...
TITLE: C header file loops QUESTION: I have a couple of header files, which boil down to: tree.h: #include "element.h" typedef struct tree_ { struct *tree_ first_child; struct *tree_ next_sibling; int tag; element *obj;.... } tree; and element.h: #include "tree.h" typedef struct element_ { tree *tree_parent; char *n...
[ "c", "include-guards" ]
12
29
15,497
11
0
2008-09-28T20:26:52.977000
2008-09-28T20:39:24.727000
146,659
147,152
How do I get a floating footer to stick to the bottom of the viewport in IE 6?
I know this would be easy with position:fixed, but unfortanately I'm stuck with supporting IE 6. How can I do this? I would rather use CSS to be clean, but if I have to use Javascript, that's not the end of the world. In my current implementation I have a "floating footer" that floats above the main content area and is...
This may work for you. It works on IE6 and Firefox 2.0.0.17 for me. Give it a shot. I made the footer's height very tall, just for effect. You would obviously change it to what you need. I hope this works for you. Liquid Footer This is to expand the content on the page This is to expand the content on the page This is ...
How do I get a floating footer to stick to the bottom of the viewport in IE 6? I know this would be easy with position:fixed, but unfortanately I'm stuck with supporting IE 6. How can I do this? I would rather use CSS to be clean, but if I have to use Javascript, that's not the end of the world. In my current implement...
TITLE: How do I get a floating footer to stick to the bottom of the viewport in IE 6? QUESTION: I know this would be easy with position:fixed, but unfortanately I'm stuck with supporting IE 6. How can I do this? I would rather use CSS to be clean, but if I have to use Javascript, that's not the end of the world. In my...
[ "javascript", "css", "internet-explorer-6", "sticky-footer" ]
12
19
32,864
6
0
2008-09-28T20:27:55.597000
2008-09-29T01:07:09.340000
146,661
1,308,729
How can I build an Adobe Air project with Maven?
Has anyone successfully built an Adobe Air application with Maven? If so, what are the steps to get it working? I have been trying to use flex-mojos to build an Air applications. When I set the packaging type to "aswf", as suggested in the DashboardSamplePom, Maven complains that aswf is an unknown packaging type. I al...
There is an article called Building an AIR Application on the mojos website wiki. It should be able to help you.
How can I build an Adobe Air project with Maven? Has anyone successfully built an Adobe Air application with Maven? If so, what are the steps to get it working? I have been trying to use flex-mojos to build an Air applications. When I set the packaging type to "aswf", as suggested in the DashboardSamplePom, Maven compl...
TITLE: How can I build an Adobe Air project with Maven? QUESTION: Has anyone successfully built an Adobe Air application with Maven? If so, what are the steps to get it working? I have been trying to use flex-mojos to build an Air applications. When I set the packaging type to "aswf", as suggested in the DashboardSamp...
[ "apache-flex", "maven-2", "air", "adobe" ]
8
2
5,982
5
0
2008-09-28T20:28:33.177000
2009-08-20T20:51:25.977000
146,668
146,679
How do I parse a number from a String that may have a leading zero?
In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer constructor. date =~ /^([\d]{2})([\d]{2})([\d]{4})/ year = Integer($3) month = Integer($2) ...
I'm not familiar with regexes, so forgive me if this answer's off-base. I've been assuming that $3, $2, and $1 are strings. Here's what I did in IRB to replicate the problem: irb(main):003:0> Integer("04") => 4 irb(main):004:0> Integer("09") ArgumentError: invalid value for Integer: "09" from (irb):4:in `Integer' from ...
How do I parse a number from a String that may have a leading zero? In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer constructor. date =~ /^...
TITLE: How do I parse a number from a String that may have a leading zero? QUESTION: In ruby I am parsing a date in the following format: 24092008. I want to convert each section (year, month, date) into a number. I have split them up using a regex which produces three Strings which I am passing into the Integer const...
[ "ruby", "string", "date", "types" ]
9
15
9,242
4
0
2008-09-28T20:30:35.717000
2008-09-28T20:36:02.363000