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
180,858
180,865
Procedural music generation techniques
I've been putting a lot of thought into procedural generation of content for a while and I've never seen much experimentation with procedural music. We have fantastic techniques for generating models, animations, textures, but music is still either completely static or simply layered loops (e.g. Spore). Because of that...
Cellular Automata - read. You can also try it out here. Edit: rakkarage has supplied another resource: http://www.ibm.com/developerworks/java/library/j-camusic/
Procedural music generation techniques I've been putting a lot of thought into procedural generation of content for a while and I've never seen much experimentation with procedural music. We have fantastic techniques for generating models, animations, textures, but music is still either completely static or simply laye...
TITLE: Procedural music generation techniques QUESTION: I've been putting a lot of thought into procedural generation of content for a while and I've never seen much experimentation with procedural music. We have fantastic techniques for generating models, animations, textures, but music is still either completely sta...
[ "procedural", "generative" ]
89
28
38,799
19
0
2008-10-07T23:43:05.940000
2008-10-07T23:45:15.563000
180,860
180,868
CString maximum length
What is the maximum length in characters a CString object can hold?
Up to your available memory or INT_MAX-1 (whichever is less).
CString maximum length What is the maximum length in characters a CString object can hold?
TITLE: CString maximum length QUESTION: What is the maximum length in characters a CString object can hold? ANSWER: Up to your available memory or INT_MAX-1 (whichever is less).
[ "mfc", "cstring" ]
6
12
19,045
3
0
2008-10-07T23:43:44.520000
2008-10-07T23:47:39.833000
180,884
180,941
JQuery selectors not finding class on elements in table created by an Ajax XHR in Ruby on Rails
When using $('.foo').click(function(){ alert("I haz class alertz!"); return false; }); in application.js, and Teh Foobar in any div that initializes with the page, when clicking "Teh Foobar" it alerts and doesn't follow the link. However, when using the same code in application.js, and Teh Foobar is being returned into...
New elements added to the document after you bind your events don't automatically get those event handlers. One way to fix this is - as John Millikin says - re-bind your events after you create new elements. The other standard way is event delegation. Because events go all the way up and down the stack through all thei...
JQuery selectors not finding class on elements in table created by an Ajax XHR in Ruby on Rails When using $('.foo').click(function(){ alert("I haz class alertz!"); return false; }); in application.js, and Teh Foobar in any div that initializes with the page, when clicking "Teh Foobar" it alerts and doesn't follow the ...
TITLE: JQuery selectors not finding class on elements in table created by an Ajax XHR in Ruby on Rails QUESTION: When using $('.foo').click(function(){ alert("I haz class alertz!"); return false; }); in application.js, and Teh Foobar in any div that initializes with the page, when clicking "Teh Foobar" it alerts and d...
[ "javascript", "ruby-on-rails", "ruby", "ajax" ]
4
3
2,654
3
0
2008-10-07T23:55:21.190000
2008-10-08T00:22:40.010000
180,887
180,892
How do I highlight a link based on the current page?
Sorry if this sounds like a really stupid question, but I need to make a link change colour when you are on the page it links to. For example, when you are on the "Questions" page of StackOverflow, the link at the top changes colour. How do you do this?
It's a server-side thing -- when rendering the page, add a class like "current-page" to the link. Then you can style it separately from the other links. For example, StackOverflow renders the links with class="youarehere" when it points to the page you're already on.
How do I highlight a link based on the current page? Sorry if this sounds like a really stupid question, but I need to make a link change colour when you are on the page it links to. For example, when you are on the "Questions" page of StackOverflow, the link at the top changes colour. How do you do this?
TITLE: How do I highlight a link based on the current page? QUESTION: Sorry if this sounds like a really stupid question, but I need to make a link change colour when you are on the page it links to. For example, when you are on the "Questions" page of StackOverflow, the link at the top changes colour. How do you do t...
[ "html", "css", "navigation" ]
11
6
25,732
7
0
2008-10-07T23:56:08.987000
2008-10-07T23:58:18.250000
180,910
180,914
How do I change read/write mode for a file using Emacs?
If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs?
M-x read-only-mode in very old versions of Emacs, the command was: M-x toggle-read-only On my Windows box, that amounts to Alt-x to bring up the meta prompt and typing "read-only-mode" to call the correct elisp function. If you are using the default keyboard bindings, C-x C-q (which you read aloud as "Control-X Control...
How do I change read/write mode for a file using Emacs? If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs?
TITLE: How do I change read/write mode for a file using Emacs? QUESTION: If a file is set to read only mode, how do I change it to write mode and vice versa from within Emacs? ANSWER: M-x read-only-mode in very old versions of Emacs, the command was: M-x toggle-read-only On my Windows box, that amounts to Alt-x to br...
[ "emacs", "file", "file-permissions" ]
131
182
85,193
9
0
2008-10-08T00:08:37.357000
2008-10-08T00:10:47.930000
180,924
181,401
Configuring tomcat security manager in Eclipse
Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?
Go into 'Window' -> 'Preferences' then select 'Java' -> 'Installed JREs', clone the JRE used by Tomcat and add the following to the default VM Arguments -Djava.security.manager -Djava.security.policy="XXXX\conf\catalina.policy" With XXXX replaced by the appropriate path - Mine was C:\Program Files\Apache Software Found...
Configuring tomcat security manager in Eclipse Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)?
TITLE: Configuring tomcat security manager in Eclipse QUESTION: Working in Eclipse on a Dynamic Web Project (using Tomcat (v5.5) as the app server), is there some way I can configure things so Tomcat will start with security turned on (i.e. as if I ran catalina.sh start -security)? ANSWER: Go into 'Window' -> 'Prefer...
[ "java", "eclipse", "tomcat" ]
1
6
9,011
3
0
2008-10-08T00:14:25.473000
2008-10-08T04:55:45.543000
180,929
181,763
How do I create a decimal field in Access with Alter Table?
I want to programmatically create a new column in an MS Access table. I've tried many permutations of ALTER TABLE MyTable Add MyField DECIMAL (9,4) NULL; and got: Syntax Error in Field Definition I can easily create a number field that goes to a Double type, but I want decimal. I would very strongly prefer to do this i...
If you want to create a new column in an acces table, it is easy to use the DAO.tableDef object: Dim my_tableDef As DAO.TableDef Dim my_field As DAO.Field Set my_tableDef = currentDb.TableDefs(my_table) Set my_Field = my_tableDef.CreateField(my_fieldName, dbDecimal, myFieldSize) my_Field.decimalPlaces = myDecimalPlace...
How do I create a decimal field in Access with Alter Table? I want to programmatically create a new column in an MS Access table. I've tried many permutations of ALTER TABLE MyTable Add MyField DECIMAL (9,4) NULL; and got: Syntax Error in Field Definition I can easily create a number field that goes to a Double type, b...
TITLE: How do I create a decimal field in Access with Alter Table? QUESTION: I want to programmatically create a new column in an MS Access table. I've tried many permutations of ALTER TABLE MyTable Add MyField DECIMAL (9,4) NULL; and got: Syntax Error in Field Definition I can easily create a number field that goes t...
[ "sql", "ms-access" ]
7
4
31,693
3
0
2008-10-08T00:18:25.403000
2008-10-08T08:03:30.190000
180,930
182,823
Object Initializer syntax to produce correct Json
I am attempting to use linq to shape list of data into a particular shape to be returned as Json from an ajax call. Given this data: var data = new List (); data.Add("One"); data.Add("Two"); data.Add("Three"); And this code: ** Which is not correct and is what needs to be fixed!! ** var shaped = data.Select(c => new { ...
Solution offered for correctness, not performance. List data = new List () { "One", "Two", "Three" }; string result = "{ " + string.Join(", ", data.Select(c => @"""" + c + @""": """ + c + @"""").ToArray() ) + " }";
Object Initializer syntax to produce correct Json I am attempting to use linq to shape list of data into a particular shape to be returned as Json from an ajax call. Given this data: var data = new List (); data.Add("One"); data.Add("Two"); data.Add("Three"); And this code: ** Which is not correct and is what needs to ...
TITLE: Object Initializer syntax to produce correct Json QUESTION: I am attempting to use linq to shape list of data into a particular shape to be returned as Json from an ajax call. Given this data: var data = new List (); data.Add("One"); data.Add("Two"); data.Add("Three"); And this code: ** Which is not correct and...
[ "c#", "linq", "json" ]
1
1
962
4
0
2008-10-08T00:19:17.147000
2008-10-08T13:44:23.467000
180,935
180,977
Converting a home-brew test application to a standard unit test framework
I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which is that it isn't using a standard testing framework and ends up requiring the person running ...
If you use NUnit (which you should), you'll need to create a new test method for each of your current test methods. NUnit uses reflection to query the test class for methods marked with the [Test] attribute, which is how it builds its list of the tests that show up in the UI, and the test classes use the NUnit Assert m...
Converting a home-brew test application to a standard unit test framework I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which is that it isn't us...
TITLE: Converting a home-brew test application to a standard unit test framework QUESTION: I've got a LOT of tests written for a piece of software (which is a GREAT thing) but it was built essentially as a standalone test in C#. While this works well enough, it suffers from a few shortcomings, not the least of which i...
[ "c#", "unit-testing", "automated-tests", "homebrew" ]
2
4
425
2
0
2008-10-08T00:21:28.530000
2008-10-08T00:44:07.473000
180,937
180,974
Are exceptions really for exceptional errors?
It's my understanding that common wisdom says to only use exceptions for truly exceptional conditions (In fact, I've seen that statement here at SO several times). However, Krzysztof Cwalina says: One of the biggest misconceptions about exceptions is that they are for “exceptional conditions.” The reality is that they ...
This sounds over-simplistic, but I think it makes sense to simply use exceptions where they are appropriate. In languages like Java and Python, exceptions are very common, especially in certain situations. Exceptions are appropriate for the type of error you want to bubble up through a code path and force the developer...
Are exceptions really for exceptional errors? It's my understanding that common wisdom says to only use exceptions for truly exceptional conditions (In fact, I've seen that statement here at SO several times). However, Krzysztof Cwalina says: One of the biggest misconceptions about exceptions is that they are for “exce...
TITLE: Are exceptions really for exceptional errors? QUESTION: It's my understanding that common wisdom says to only use exceptions for truly exceptional conditions (In fact, I've seen that statement here at SO several times). However, Krzysztof Cwalina says: One of the biggest misconceptions about exceptions is that ...
[ "language-agnostic", "exception", "frameworks" ]
36
27
9,521
15
0
2008-10-08T00:22:10.933000
2008-10-08T00:41:59.583000
180,947
180,949
Base64 decode snippet in C++
Is there a freely available Base64 decoding code snippet in C++?
See Encoding and decoding base 64 with C++. Here is the implementation from that page: /* base64.cpp and base64.h Copyright (C) 2004-2008 René Nyffenegger This source code is provided 'as-is', without any express or implied warranty. In no event will the author be held liable for any damages arising from the use of t...
Base64 decode snippet in C++ Is there a freely available Base64 decoding code snippet in C++?
TITLE: Base64 decode snippet in C++ QUESTION: Is there a freely available Base64 decoding code snippet in C++? ANSWER: See Encoding and decoding base 64 with C++. Here is the implementation from that page: /* base64.cpp and base64.h Copyright (C) 2004-2008 René Nyffenegger This source code is provided 'as-is', with...
[ "c++", "base64" ]
96
107
243,816
14
0
2008-10-08T00:25:26.463000
2008-10-08T00:28:35.443000
180,963
181,192
how do you package up silverlight dlls into a xap file?
Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.
Hey Brian, you can get chiron from http://www.codeplex.com/sdlsdk -- it was decided to be removed from the SL SDK core tools, but is still a part of the DLR SDK which is available.
how do you package up silverlight dlls into a xap file? Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron.
TITLE: how do you package up silverlight dlls into a xap file? QUESTION: Just updated build server with rc0 and surprise no chiron. Wondering how you package up a xap file without chiron. ANSWER: Hey Brian, you can get chiron from http://www.codeplex.com/sdlsdk -- it was decided to be removed from the SL SDK core too...
[ "silverlight", "silverlight-2-rc0" ]
1
1
1,070
2
0
2008-10-08T00:36:48.610000
2008-10-08T03:10:52.637000
180,967
181,026
Add new field to multiple table at once?
I want to add same field to multiple tables. Can I do this with single query in MySql?
I don't think you can do this with a single query, as it requires the ALTER TABLE syntax which only supports one table per query (although you could add/modify multiple columns in the same table). You have to do one ALTER TABLE query per table to be modified.
Add new field to multiple table at once? I want to add same field to multiple tables. Can I do this with single query in MySql?
TITLE: Add new field to multiple table at once? QUESTION: I want to add same field to multiple tables. Can I do this with single query in MySql? ANSWER: I don't think you can do this with a single query, as it requires the ALTER TABLE syntax which only supports one table per query (although you could add/modify multi...
[ "mysql", "sql" ]
1
4
823
1
0
2008-10-08T00:38:50.290000
2008-10-08T01:06:14.633000
180,978
180,996
Java EE Programming Skills
I have many years of experience in Java including Swing, Servlet and JDBC, but have never programmed for a Java EE server. Many job advertisements from large companies are specifically asking for Java EE experience. Are there specific skills or development environments that I should learn to qualify for these kinds of ...
Download JBoss and get to work on the sample applications in the documentation. If you've done java, you're 95% there. Java EE adds the container and naming aspect to the java you already know and love. With the advent of EJB3, beans got a lot simpler as you only need a couple of annotations to get rolling with EJB. Ja...
Java EE Programming Skills I have many years of experience in Java including Swing, Servlet and JDBC, but have never programmed for a Java EE server. Many job advertisements from large companies are specifically asking for Java EE experience. Are there specific skills or development environments that I should learn to ...
TITLE: Java EE Programming Skills QUESTION: I have many years of experience in Java including Swing, Servlet and JDBC, but have never programmed for a Java EE server. Many job advertisements from large companies are specifically asking for Java EE experience. Are there specific skills or development environments that ...
[ "java", "jakarta-ee" ]
12
11
4,279
6
0
2008-10-08T00:45:05.893000
2008-10-08T00:54:11.383000
180,979
180,990
Using Collections API to Shuffle
I am getting very frustrated because I cannot seem to figure out why Collections shuffling is not working properly. Lets say that I am trying to shuffle the randomizer array. int[] randomizer = new int[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(randomizer)); For some reason the elements stay sorted e...
Arrays.asList cannot be used with arrays of primitives. Use this instead: Integer[] randomizer = new Integer[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(randomizer)); The same rule applies to most classes in the collections framework, in that you can't use primitive types. The original code (with int[...
Using Collections API to Shuffle I am getting very frustrated because I cannot seem to figure out why Collections shuffling is not working properly. Lets say that I am trying to shuffle the randomizer array. int[] randomizer = new int[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(randomizer)); For some ...
TITLE: Using Collections API to Shuffle QUESTION: I am getting very frustrated because I cannot seem to figure out why Collections shuffling is not working properly. Lets say that I am trying to shuffle the randomizer array. int[] randomizer = new int[] {200,300,212,111,6,2332}; Collections.shuffle(Arrays.asList(rando...
[ "java", "collections", "shuffle" ]
6
18
2,849
2
0
2008-10-08T00:45:15.207000
2008-10-08T00:52:52.603000
180,985
181,025
What is tempuri.org?
Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique from any other on the web?
Webservices require unique namespaces so they don't confuse each others schemas and whatever with each other. A URL (domain, subdomain, subsubdomain, etc) is a clever identifier as it's "guaranteed" to be unique, and in most circumstances you've already got one.
What is tempuri.org? Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique from any other on the web?
TITLE: What is tempuri.org? QUESTION: Why does tempuri.org exist? Why does each XML Webservice require its own namespace, unique from any other on the web? ANSWER: Webservices require unique namespaces so they don't confuse each others schemas and whatever with each other. A URL (domain, subdomain, subsubdomain, etc)...
[ "web-services", "namespaces" ]
101
47
167,942
5
0
2008-10-08T00:50:36.740000
2008-10-08T01:05:26.913000
180,986
180,993
What is the difference between re.search and re.match?
What is the difference between the search() and match() functions in the Python re module? I've read the Python 2 documentation ( Python 3 documentation ), but I never seem to remember it.
re.match is anchored at the beginning of the string. That has nothing to do with newlines, so it is not the same as using ^ in the pattern. As the re.match documentation says: If zero or more characters at the beginning of string match the regular expression pattern, return a corresponding MatchObject instance. Return ...
What is the difference between re.search and re.match? What is the difference between the search() and match() functions in the Python re module? I've read the Python 2 documentation ( Python 3 documentation ), but I never seem to remember it.
TITLE: What is the difference between re.search and re.match? QUESTION: What is the difference between the search() and match() functions in the Python re module? I've read the Python 2 documentation ( Python 3 documentation ), but I never seem to remember it. ANSWER: re.match is anchored at the beginning of the stri...
[ "python", "regex", "search", "match", "string-matching" ]
687
663
418,731
10
0
2008-10-08T00:51:36.257000
2008-10-08T00:53:12.117000
180,987
384,982
Attaching to a remote process for debugging
Using Xcode 3.1 on OSX 10.5; is it possible to attach (the debugger) to a running remote process? I know that it's possible to start and debug a remote process (as explained here ), but it would be great if I could find a way to attach to an already running remote process... edit to add: Thanks. I've submitted a bug re...
There is no nice gui for it in XCode but you can do it this way: start a second instance of the program from XCode with remote debugging, use the GDB attach command from the console Step by step instructions: Follow Apple's instructions to set up remote debuging: Find out the process-id of the running instance of your ...
Attaching to a remote process for debugging Using Xcode 3.1 on OSX 10.5; is it possible to attach (the debugger) to a running remote process? I know that it's possible to start and debug a remote process (as explained here ), but it would be great if I could find a way to attach to an already running remote process... ...
TITLE: Attaching to a remote process for debugging QUESTION: Using Xcode 3.1 on OSX 10.5; is it possible to attach (the debugger) to a running remote process? I know that it's possible to start and debug a remote process (as explained here ), but it would be great if I could find a way to attach to an already running ...
[ "xcode", "macos", "debugging", "gdb", "xcode3.1" ]
6
8
17,328
1
0
2008-10-08T00:52:17.690000
2008-12-21T21:32:29.697000
181,003
181,021
Tool or IDE to debug VB Script code
I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion).
Sadly not free.... How to debug Windows Script Host, VBScript, and JScript files
Tool or IDE to debug VB Script code I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion).
TITLE: Tool or IDE to debug VB Script code QUESTION: I need any tool or IDE environment to debug and test the vb scripts code. Please suggest any free ones. My vb scripts are standalone (vbs extenstion). ANSWER: Sadly not free.... How to debug Windows Script Host, VBScript, and JScript files
[ "asp.net", "debugging", "vbscript" ]
3
1
5,435
4
0
2008-10-08T00:56:57.947000
2008-10-08T01:04:45.027000
181,015
181,024
.NET // vs /// Comments convention
I am just checking out F#, so apologies if this is a silly question, but in the VS2008 F# CTP 1.9.6.2 'Tutorial' project, both // and /// are used for commenting code. Is there a functional difference between the two slash vs three slash commenting, or is it convention (as it appears in the tutorial code) to comment a ...
Using three slashes (///) is a C# convention for XML Documentation Comments that is adopted by F# as well.
.NET // vs /// Comments convention I am just checking out F#, so apologies if this is a silly question, but in the VS2008 F# CTP 1.9.6.2 'Tutorial' project, both // and /// are used for commenting code. Is there a functional difference between the two slash vs three slash commenting, or is it convention (as it appears ...
TITLE: .NET // vs /// Comments convention QUESTION: I am just checking out F#, so apologies if this is a silly question, but in the VS2008 F# CTP 1.9.6.2 'Tutorial' project, both // and /// are used for commenting code. Is there a functional difference between the two slash vs three slash commenting, or is it conventi...
[ "c#", "f#", "comments" ]
26
46
20,638
4
0
2008-10-08T01:02:12.600000
2008-10-08T01:05:23.717000
181,029
432,734
Implementing jQuery's jgGrid with ASP.Net and JSON formatting
Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to implement the JSON paging, and I feel like I'm getting close, but that I am also being swamped by inconsequential details. If anyone could post some sample code, I would greatly appreciate it.
Found your post while I was trying to do this for my project. I got it working. For anyone who needs it in the future, jqGrid won't work out of the box with JSON and ASP.NET. You need to make a couple of small modifications to grid.base.js. Around line 829, replace the json case section with the following: case "json":...
Implementing jQuery's jgGrid with ASP.Net and JSON formatting Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to implement the JSON paging, and I feel like I'm getting close, but that I am also being swamped by inconsequential details. If anyone could post some sample code, I would greatly ...
TITLE: Implementing jQuery's jgGrid with ASP.Net and JSON formatting QUESTION: Has anyone been able to implement the JQuery grid plugin, jqGrid? I'm trying to implement the JSON paging, and I feel like I'm getting close, but that I am also being swamped by inconsequential details. If anyone could post some sample code...
[ "asp.net", "jquery", "ajax", "jqgrid" ]
10
9
9,304
8
0
2008-10-08T01:07:37.220000
2009-01-11T10:45:51.750000
181,036
181,065
Run a program in a ForEach loop
I'm trying to get this simple PowerShell script working, but I think something is fundamentally wrong.;-) ls | ForEach { "C:\Working\tools\custom-tool.exe" $_ } I basically want to get files in a directory, and pass them one by one as arguments to the custom tool.
ls | %{C:\Working\tools\custom-tool.exe $_} As each object comes down the pipeline the tool will be run against it. Putting quotes around the command string causes it to be... a string! The local variable "$_" it then likely doesn't know what to do with so pukes with an error.
Run a program in a ForEach loop I'm trying to get this simple PowerShell script working, but I think something is fundamentally wrong.;-) ls | ForEach { "C:\Working\tools\custom-tool.exe" $_ } I basically want to get files in a directory, and pass them one by one as arguments to the custom tool.
TITLE: Run a program in a ForEach loop QUESTION: I'm trying to get this simple PowerShell script working, but I think something is fundamentally wrong.;-) ls | ForEach { "C:\Working\tools\custom-tool.exe" $_ } I basically want to get files in a directory, and pass them one by one as arguments to the custom tool. ANSW...
[ "powershell", "foreach", "pipeline" ]
30
37
33,331
4
0
2008-10-08T01:12:34.450000
2008-10-08T01:26:05.657000
181,037
191,269
Case-insensitive UTF-8 string collation for SQLite (C/C++)
I am looking for a method to compare and sort UTF-8 strings in C++ in a case-insensitive manner to use it in a custom collation function in SQLite. The method should ideally be locale-independent. However I won't be holding my breath, as far as I know, collation is very language-dependent, so anything that works on lan...
What you really want is logically impossible. There is no locale-independent, case-insensitive way of sorting strings. The simple counter-example is "i" <> "I"? The naive answer is no, but in Turkish these strings are unequal. "i" is uppercased to "İ" (U+130 Latin Capital I with dot above) UTF-8 strings add extra compl...
Case-insensitive UTF-8 string collation for SQLite (C/C++) I am looking for a method to compare and sort UTF-8 strings in C++ in a case-insensitive manner to use it in a custom collation function in SQLite. The method should ideally be locale-independent. However I won't be holding my breath, as far as I know, collatio...
TITLE: Case-insensitive UTF-8 string collation for SQLite (C/C++) QUESTION: I am looking for a method to compare and sort UTF-8 strings in C++ in a case-insensitive manner to use it in a custom collation function in SQLite. The method should ideally be locale-independent. However I won't be holding my breath, as far a...
[ "c++", "sqlite", "unicode", "utf-8", "internationalization" ]
7
7
10,476
6
0
2008-10-08T01:12:53.327000
2008-10-10T13:28:08.273000
181,038
181,071
Cannot use gem and ruby command after install on Vista
I installed Ruby and Ruby on Rails yesterday on Vista 32bit using the directions on this site: http://rubyonrails.org/down So I downloaded the installer, then Gems, then I downloaded rails with Gems. Now I can't use the Gem or Ruby commands in the command line... so I assume there's something wrong with the environment...
To set up the environment variables, do this Fire up the start menu Right-Click on Computer and select Properties Click Advanced system settings in the left-hand bar, and confirm the UAC prompt Select the Advanced tab (it's 3rd) Click Environment Variables... (at the bottom) In the top box ( User variables for XXX ) ei...
Cannot use gem and ruby command after install on Vista I installed Ruby and Ruby on Rails yesterday on Vista 32bit using the directions on this site: http://rubyonrails.org/down So I downloaded the installer, then Gems, then I downloaded rails with Gems. Now I can't use the Gem or Ruby commands in the command line... s...
TITLE: Cannot use gem and ruby command after install on Vista QUESTION: I installed Ruby and Ruby on Rails yesterday on Vista 32bit using the directions on this site: http://rubyonrails.org/down So I downloaded the installer, then Gems, then I downloaded rails with Gems. Now I can't use the Gem or Ruby commands in the...
[ "ruby-on-rails", "ruby", "windows-vista", "rubygems" ]
6
12
1,683
3
0
2008-10-08T01:13:20.453000
2008-10-08T01:29:14.667000
181,046
181,429
What is the single best resource for learning the visual studio tools?
I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information? I see this: https://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-features But it seems more related to tips and advanced features. All three versions ( 2003, 20...
Microsoft has quite a few videos demonstrating various techniques in Visual Studio: http://msdn.microsoft.com/en-us/vs2008/bb964532.aspx Personally I'm not a fan of training videos as I find I get impatient with them (too linear, too slow, no interaction), but maybe they'll work well for others.
What is the single best resource for learning the visual studio tools? I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information? I see this: https://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-features But it seems mo...
TITLE: What is the single best resource for learning the visual studio tools? QUESTION: I am trying to learn some of the basic and advanced features of visual studio, Anyone find sites that have this type of information? I see this: https://stackoverflow.com/questions/86355/best-way-to-learn-visual-studio-power-featur...
[ "visual-studio" ]
1
1
160
3
0
2008-10-08T01:15:51.200000
2008-10-08T05:08:05.583000
181,050
181,058
Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++?
With very large amounts of ram these days I was wondering, it is possible to allocate a single chunk of memory that is larger than 4GB? Or would I need to allocate a bunch of smaller chunks and handle switching between them? Why??? I'm working on processing some openstreetmap xml data and these files are huge. I'm curr...
Short answer: Not likely In order for this to work, you absolutely would have to use a 64-bit processor. Secondly, it would depend on the Operating System support for allocating more than 4G of RAM to a single process. In theory, it would be possible, but you would have to read the documentation for the memory allocato...
Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++? With very large amounts of ram these days I was wondering, it is possible to allocate a single chunk of memory that is larger than 4GB? Or would I need to allocate a bunch of smaller chunks and handle switching between them? Why??? I'm working ...
TITLE: Can you allocate a very large single chunk of memory ( > 4GB ) in c or c++? QUESTION: With very large amounts of ram these days I was wondering, it is possible to allocate a single chunk of memory that is larger than 4GB? Or would I need to allocate a bunch of smaller chunks and handle switching between them? W...
[ "c++", "c", "memory", "malloc" ]
43
27
27,233
10
0
2008-10-08T01:18:48.463000
2008-10-08T01:22:16.007000
181,056
181,073
What is the most stable modal dialog implementation across browsers to use from javascript for a web app?
I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set. IE 7+ FF 2+ Chrome and Safari I've tried a couple of jQuery plugins but there always seems to be artifacts in one o...
I used jqModal few times and I'm very satisfied. It is pretty configurable yet very light weight.
What is the most stable modal dialog implementation across browsers to use from javascript for a web app? I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following browser set. IE 7+ FF ...
TITLE: What is the most stable modal dialog implementation across browsers to use from javascript for a web app? QUESTION: I'm using a lot of JQuery in a web application that I am building for a client and I want to find an javascript implementation of a modal dialog that is reasonably stable across the following brow...
[ "javascript", "jquery", "modal-dialog", "cross-browser", "jqmodal" ]
6
3
2,278
4
0
2008-10-08T01:21:48.863000
2008-10-08T01:30:50.373000
181,060
181,389
Best way to add full web search to my site?
I need to add full web search to my site. I need something like Google Custom Search but with no ads and it has to be free. Any recommendation of a web service or open source project that can index my site and allow me to search it will be helpful. My site is made in ruby on rails, if that helps. I'll make this questio...
Depends what you mean by full web search really. If you want to search the whole web then the answers above wont help you much as they are really for indexing and searching the content of your site. I would suggest using the Google ajax search (just a 'powered by google' needed, no ads) or Boss from yahoo (might requir...
Best way to add full web search to my site? I need to add full web search to my site. I need something like Google Custom Search but with no ads and it has to be free. Any recommendation of a web service or open source project that can index my site and allow me to search it will be helpful. My site is made in ruby on ...
TITLE: Best way to add full web search to my site? QUESTION: I need to add full web search to my site. I need something like Google Custom Search but with no ads and it has to be free. Any recommendation of a web service or open source project that can index my site and allow me to search it will be helpful. My site i...
[ "ruby-on-rails", "ruby", "search" ]
8
5
787
6
0
2008-10-08T01:22:51.403000
2008-10-08T04:47:19.463000
181,064
202,877
EnumDisplayDevices vs WMI Win32_DesktopMonitor, how to detect active monitors?
For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers. Research has pointed to 2 options Use WMI and query the Win32_DesktopMonitor for all active monitors. Use the PNPDeviceID for unique identification of monitors. Use the EnumDisplayD...
This is my current work-in-progress code for detecting the monitor device id, reliably. CString DeviceID; DISPLAY_DEVICE dd; dd.cb = sizeof(dd); DWORD dev = 0; // device index int id = 1; // monitor number, as used by Display Properties > Settings while (EnumDisplayDevices(0, dev, ⅆ, 0)) { DISPLAY_DEVICE ddMon; ZeroMe...
EnumDisplayDevices vs WMI Win32_DesktopMonitor, how to detect active monitors? For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers. Research has pointed to 2 options Use WMI and query the Win32_DesktopMonitor for all active monitors. ...
TITLE: EnumDisplayDevices vs WMI Win32_DesktopMonitor, how to detect active monitors? QUESTION: For my current C++ project I need to detect a unique string for every monitor that is connected and active on a large number of computers. Research has pointed to 2 options Use WMI and query the Win32_DesktopMonitor for all...
[ "c++", "windows", "winapi", "wmi" ]
9
10
20,946
5
0
2008-10-08T01:25:32.817000
2008-10-14T21:13:30.393000
181,082
181,555
How do I install cURL on Windows?
I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get the PHP5 packages and get the CURL packages. I run the apache and run a PHP script. no problem. but when I run the php script with curl, it fails. It returns: **Call to un...
You're probably mistaking what PHP.ini you need to edit. first, add a PHPinfo(); to a info.php, and run it from your browser. Write down the PHP ini directory path you see in the variables list now! You will probably notice that it's different from your PHP-CLI ini file. Enable the extension You're done:-)
How do I install cURL on Windows? I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get the PHP5 packages and get the CURL packages. I run the apache and run a PHP script. no problem. but when I run the php script with curl, ...
TITLE: How do I install cURL on Windows? QUESTION: I have followed all the instructions here: http://www.tonyspencer.com/2003/10/22/curl-with-php-and-apache-on-windows/ to install & config apache get the PHP5 packages and get the CURL packages. I run the apache and run a PHP script. no problem. but when I run the php ...
[ "php", "windows", "curl", "windows-xp", "installation" ]
59
22
245,023
13
0
2008-10-08T01:33:49.463000
2008-10-08T06:32:40.297000
181,090
181,502
How can I cache a calculated column in rails?
I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many:sub_parts,:class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation } else sleep(1) return rand(10000) end end end It is ...
You can stuff the actually cached values in the Rails cache (use memcached if you require that it be distributed). The tough bit is cache expiry, but cache expiry is uncommon, right? In that case, we can just loop over each of the parent objects in turn and zap its cache, too. I added some ActiveRecord magic to your cl...
How can I cache a calculated column in rails? I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many:sub_parts,:class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_calculation } else s...
TITLE: How can I cache a calculated column in rails? QUESTION: I have a tree of active record objects, something like: class Part < ActiveRecord::Base has_many:sub_parts,:class_name => "Part" def complicated_calculation if sub_parts.size > 0 return self.sub_parts.inject(0){ |sum, current| sum + current.complicated_ca...
[ "ruby-on-rails", "ruby", "calculated-columns", "caching" ]
16
8
10,311
5
0
2008-10-08T01:39:11.543000
2008-10-08T06:01:48.563000
181,091
181,096
How do I get the unique elements from an array of hashes in Ruby?
I have an array of hashes, and I want the unique values out of it. Calling Array.uniq doesn't give me what I expect. a = [{:a => 1},{:a => 2}, {:a => 1}] a.uniq # => [{:a => 1}, {:a => 2}, {:a => 1}] Where I expected: [{:a => 1}, {:a => 2}] In searching around on the net, I didn't come up with a solution that I was hap...
I can get what I want by calling inject a = [{:a => 1},{:a => 2}, {:a => 1}] a.inject([]) { |result,h| result << h unless result.include?(h); result } This will return: [{:a=>1}, {:a=>2}]
How do I get the unique elements from an array of hashes in Ruby? I have an array of hashes, and I want the unique values out of it. Calling Array.uniq doesn't give me what I expect. a = [{:a => 1},{:a => 2}, {:a => 1}] a.uniq # => [{:a => 1}, {:a => 2}, {:a => 1}] Where I expected: [{:a => 1}, {:a => 2}] In searching ...
TITLE: How do I get the unique elements from an array of hashes in Ruby? QUESTION: I have an array of hashes, and I want the unique values out of it. Calling Array.uniq doesn't give me what I expect. a = [{:a => 1},{:a => 2}, {:a => 1}] a.uniq # => [{:a => 1}, {:a => 2}, {:a => 1}] Where I expected: [{:a => 1}, {:a =>...
[ "ruby", "arrays", "hash", "unique" ]
25
27
26,500
8
0
2008-10-08T01:40:53.957000
2008-10-08T01:44:15.353000
181,095
181,116
regular expression to extract text from HTML
I would like to extract from a general HTML page, all the text (displayed or not). I would like to remove any HTML tags Any javascript Any CSS styles Is there a regular expression (one or more) that will achieve that?
You can't really parse HTML with regular expressions. It's too complex. RE's won't handle </code> sections correctly at all. Further, some kinds of common HTML things like <code>&lt;text></code> will work in a browser as proper text, but might baffle a naive RE.</p> <p>You'll be happier and more successful with a prop...
regular expression to extract text from HTML I would like to extract from a general HTML page, all the text (displayed or not). I would like to remove any HTML tags Any javascript Any CSS styles Is there a regular expression (one or more) that will achieve that?
TITLE: regular expression to extract text from HTML QUESTION: I would like to extract from a general HTML page, all the text (displayed or not). I would like to remove any HTML tags Any javascript Any CSS styles Is there a regular expression (one or more) that will achieve that? ANSWER: You can't really parse HTML wi...
[ "html", "regex", "html-content-extraction", "text-extraction" ]
22
14
63,456
11
0
2008-10-08T01:43:39.270000
2008-10-08T02:01:41.077000
181,097
181,103
Is there a way to add an onclick event to an ASP.NET Label server control?
I wanted to do something like this: My Label I know that in Javascript I can do: My Label So I'm wondering why I can't do that with a Label object.
You can use Attributes to add onclick client side callback. I didn't know you can do this on span tags, but if it works you can add 'onclick' by lblMyLabel.Attributes.Add("onclick", "foo();"); But foo(); would need to be a client side javascript function. System.Web.UI.WebControls.Label does NOT have OnClick server eve...
Is there a way to add an onclick event to an ASP.NET Label server control? I wanted to do something like this: My Label I know that in Javascript I can do: My Label So I'm wondering why I can't do that with a Label object.
TITLE: Is there a way to add an onclick event to an ASP.NET Label server control? QUESTION: I wanted to do something like this: My Label I know that in Javascript I can do: My Label So I'm wondering why I can't do that with a Label object. ANSWER: You can use Attributes to add onclick client side callback. I didn't k...
[ "asp.net", "controls" ]
34
46
107,723
10
0
2008-10-08T01:45:21.497000
2008-10-08T01:53:02.467000
181,106
181,178
JUnit TestCase object instantiation
Is a new (or different) instance of TestCase object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests? public class MyTest extends TestCase { public void testSomething() {... } public void testSomethingElse() {... } } While running this test, how many instances of MyTest ...
I couldn't find a clear answer in the JUnit docs about your question, but the intent, as anjanb wrote, is that each test is independent of the others, so a new TestCase instance could be created for each test to be run. If you have expensive test setup (" fixtures ") that you want to be shared across all test cases in ...
JUnit TestCase object instantiation Is a new (or different) instance of TestCase object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests? public class MyTest extends TestCase { public void testSomething() {... } public void testSomethingElse() {... } } While running this...
TITLE: JUnit TestCase object instantiation QUESTION: Is a new (or different) instance of TestCase object is used to run each test method in a JUnit test case? Or one instance is reused for all the tests? public class MyTest extends TestCase { public void testSomething() {... } public void testSomethingElse() {... } } ...
[ "java", "junit", "instantiation", "testcase" ]
9
4
6,031
5
0
2008-10-08T01:53:58.097000
2008-10-08T02:58:50.367000
181,130
181,142
Encrypted database query
I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time. I'm not much given into cryptography but if I'm not clear enough I'll try...
You can do it the way you describe - effectively querying the hash, say, but there's not many systems with that requirement, because at that point the security requirements are interfering with other requirements for the system to be usable - i.e. no partial matches, since the encryption rules that out. It's the same p...
Encrypted database query I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time. I'm not much given into cryptography but if I'm ...
TITLE: Encrypted database query QUESTION: I've just found out about Stack Overflow and I'm just checking if there are ideas for a constraint I'm having with some friends in a project, though this is more of a theoretical question to which I've been trying to find an answer for some time. I'm not much given into crypto...
[ "sql", "database", "encryption", "theory" ]
3
5
7,464
5
0
2008-10-08T02:17:34.787000
2008-10-08T02:30:02.517000
181,132
196,643
Reloading a page via AJAX when window.location=self.location doesn't work
On my homepage I got: log-in | sign-up Via MooTools, I get these anchor elements by id so that once they're clicked, a flashy div will popup below them that contains the login or signup form (with methods to stop the propagation of events of course) and upon filling-up the fields the AJAX call kicks in - that's suppose...
window.location = self.location; This JavaScript is executing. When it executes, the browser is being told to replace the value of window.location with a new value. Not all browsers will react the same way here. Some will probably work as you expect, but others will get smart about it and compare the two values. The br...
Reloading a page via AJAX when window.location=self.location doesn't work On my homepage I got: log-in | sign-up Via MooTools, I get these anchor elements by id so that once they're clicked, a flashy div will popup below them that contains the login or signup form (with methods to stop the propagation of events of cour...
TITLE: Reloading a page via AJAX when window.location=self.location doesn't work QUESTION: On my homepage I got: log-in | sign-up Via MooTools, I get these anchor elements by id so that once they're clicked, a flashy div will popup below them that contains the login or signup form (with methods to stop the propagation...
[ "javascript", "browser", "caching", "reload" ]
9
20
25,113
3
0
2008-10-08T02:21:14.810000
2008-10-13T03:32:19.817000
181,147
183,614
WinForms: Load localized help (chm) files
What is the best way to load a locale-specific (i.e. translated) compiled help file (.chm)? Our install will deploy them alongside the satellite assemblies containing resources. I'd like to re-use the same probing rules the.NET framework uses to load the satellite assemblies, and I'd definitely like to avoid writing my...
Off hand, I would suggest that instead of deploying your CHM file side by side with the satellite assembly, that you actually include the CHM as an embedded resource in the satellite assembly itself. Remember that an assembly can actually be contained across multiple files. What makes an assembly and assembly is the ma...
WinForms: Load localized help (chm) files What is the best way to load a locale-specific (i.e. translated) compiled help file (.chm)? Our install will deploy them alongside the satellite assemblies containing resources. I'd like to re-use the same probing rules the.NET framework uses to load the satellite assemblies, a...
TITLE: WinForms: Load localized help (chm) files QUESTION: What is the best way to load a locale-specific (i.e. translated) compiled help file (.chm)? Our install will deploy them alongside the satellite assemblies containing resources. I'd like to re-use the same probing rules the.NET framework uses to load the satel...
[ "winforms", "localization", "chm" ]
4
3
1,311
1
0
2008-10-08T02:32:38.970000
2008-10-08T16:19:09.457000
181,158
181,168
How to programmatically insert a row in a GridView?
i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al. I am researching this for a client and for an article, and i think my google-fu is not strong tonight. Any suggestions? ED...
I think I figured it out. Here is a solution that seems to work. It could be improved using user controls but this is the gist of it: protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow && (e.Row.RowState & DataControlRowState.Selected) > 0) { T...
How to programmatically insert a row in a GridView? i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al. I am researching this for a client and for an article, and i think my ...
TITLE: How to programmatically insert a row in a GridView? QUESTION: i have a databound GridView in asp.net 2.0 with a row-selection link. When a row is selected, I want to programmatically add a table row below the selected row, in order to nest another grid et al. I am researching this for a client and for an articl...
[ "asp.net", "gridview", "databound" ]
5
8
28,343
2
0
2008-10-08T02:42:33.707000
2008-10-08T02:52:08.337000
181,159
181,163
Generating a unique ID in PHP
I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID: $id = tempnam (".", ""); unlink($id); $id = substr($id, 2); This code is hideous: it creates a temporary file on the FS...
string uniqid ([ string $prefix [, bool $more_entropy ]] ) Gets a prefixed unique identifier based on the current time in microseconds. USAGE: $id = uniqid(rand(), true);
Generating a unique ID in PHP I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID: $id = tempnam (".", ""); unlink($id); $id = substr($id, 2); This code is hideous: it crea...
TITLE: Generating a unique ID in PHP QUESTION: I'm trying to generate a unique ID in php in order to store user-uploaded content on a FS without conflicts. I'm using php, and at the moment this little snippet is responsible for generating the UID: $id = tempnam (".", ""); unlink($id); $id = substr($id, 2); This code i...
[ "php", "guid", "unique", "uuid", "identifier" ]
15
19
16,774
3
0
2008-10-08T02:43:00.383000
2008-10-08T02:45:25.417000
181,166
290,202
What might this gdb output mean?
Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb: =shlibs-removed,shlib-info=[num="54",name="AudioIPCPlugIn",kind="B",dyld-addr="0x2c2000",reason="dyld",requested-state="E",state="E",path="/System/Library/Extensions/AudioIPCDriver.kext/Con...
Those are informational messages from the system which let you know when a dynamic library gets unloaded from your executable. I presume that they occur in this case because you are perhaps doing a bit too much destructing (ie, unloading bundles, etc.) when you try to shut down your app's connection to CoreAudio.
What might this gdb output mean? Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb: =shlibs-removed,shlib-info=[num="54",name="AudioIPCPlugIn",kind="B",dyld-addr="0x2c2000",reason="dyld",requested-state="E",state="E",path="/System/Library/E...
TITLE: What might this gdb output mean? QUESTION: Trying to create my first iPhone app that would play back audio. When I try to set up playback, messages like these appear in gdb: =shlibs-removed,shlib-info=[num="54",name="AudioIPCPlugIn",kind="B",dyld-addr="0x2c2000",reason="dyld",requested-state="E",state="E",path=...
[ "iphone", "gdb" ]
0
1
543
2
0
2008-10-08T02:49:08.077000
2008-11-14T14:19:43.503000
181,191
181,208
Regex Partial String CSV Matching
Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this: Two words,Word,Word,Word,"Number, number" What I need to do is format ...
s/,([^ ])/","$1/ will match a ", " followed by a "not-a-space", capturing the not-a-space, then replacing the whole thing with the captured part. Depending on which regex engine you're using, you might be writing \1 or other things instead of $1. If you're using Perl or otherwise have access to a regex engine with nega...
Regex Partial String CSV Matching Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this: Two words,Word,Word,Word,"Number, nu...
TITLE: Regex Partial String CSV Matching QUESTION: Let me preface this by saying I'm a complete amateur when it comes to RegEx and only started a few days ago. I'm trying to solve a problem formatting a file and have hit a hitch with a particular type of data. The input file is structured like this: Two words,Word,Wor...
[ "regex", "csv" ]
0
1
2,507
4
0
2008-10-08T03:09:41.063000
2008-10-08T03:18:42.403000
181,209
181,223
PHP5: Specifying a datatype in method parameters
I have a function that looks like this class NSNode { function insertAfter(NSNode $node) {... } } I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after nothing. The way I think about that is that null means "nothing", so I'd write my function call like ...
sure, just set a default "null" function(NSNode $node = null) { // stuff.... } result being: $obj->insertAfter(); // no error $obj->insertAfter(new NSNode); // no error $obj->insertAfter($somevar); // error expected NSNode
PHP5: Specifying a datatype in method parameters I have a function that looks like this class NSNode { function insertAfter(NSNode $node) {... } } I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after nothing. The way I think about that is that null mea...
TITLE: PHP5: Specifying a datatype in method parameters QUESTION: I have a function that looks like this class NSNode { function insertAfter(NSNode $node) {... } } I'd like to be able to use that function to indicate that the node is being inserted at the start, therefore it is after nothing. The way I think about tha...
[ "php", "parameters" ]
4
8
913
3
0
2008-10-08T03:20:38.747000
2008-10-08T03:25:50.920000
181,210
181,310
Update the database maintaining the Null status
I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status). Typically, I would create multiple functions, each with a different signature to handle this. However, I ...
Nullable Types are meant for the same purpose. They represent value types with the possibility of having no data in them. Presence of value can be checked using HasValue property of these types. Pseudo code to read the fields: decimal? dValue; // default value is null if(decimalValueExists) { dValue = } When you say mu...
Update the database maintaining the Null status I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status). Typically, I would create multiple functions, each with a...
TITLE: Update the database maintaining the Null status QUESTION: I have an asp.net text form that contains numerous decimal fields that are optional. I want to selectively update the database but not inserting a "0" for fields that do not have data (maintaining the null status). Typically, I would create multiple func...
[ "c#", "asp.net", "sql-server", "web-services" ]
0
2
966
3
0
2008-10-08T03:20:40.353000
2008-10-08T04:10:54.153000
181,212
181,250
Exceptions causing junk data in string (C#)
Ok, this is a weird one. The junk data isn't random either, it appears to be substrings of the executable itself. private void Form1_Load(object sender, EventArgs e) { string s = GetValue(); // at this point, s == "400". Why isn't really relevant (dumbed down a test) if (s!= "18446744073709551615") throw new Exception(...
"And I'm checking it in the "Locals" window in VS" That explains it. Contrary to popular belief, C# is allowed to do some amount of optimization. If you don't add a "KeepAlive" at the end of your function, the value doesn't really have to be stored.
Exceptions causing junk data in string (C#) Ok, this is a weird one. The junk data isn't random either, it appears to be substrings of the executable itself. private void Form1_Load(object sender, EventArgs e) { string s = GetValue(); // at this point, s == "400". Why isn't really relevant (dumbed down a test) if (s!= ...
TITLE: Exceptions causing junk data in string (C#) QUESTION: Ok, this is a weird one. The junk data isn't random either, it appears to be substrings of the executable itself. private void Form1_Load(object sender, EventArgs e) { string s = GetValue(); // at this point, s == "400". Why isn't really relevant (dumbed dow...
[ "c#", "exception" ]
1
2
220
2
0
2008-10-08T03:20:58.357000
2008-10-08T03:40:25.587000
181,213
181,224
How to build a solution to target 64 bit environment?
Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated. cheers, RWendi
This page on 2003's lack of 64-bit targeting seems to address your issue: http://www.toymaker.info/Games/html/64_bit.html. The first step was to set up my development environment for 64 bit development. I use Visual Studio 2003 which has little built in support for 64 bit development. In order to create 64 bit applicat...
How to build a solution to target 64 bit environment? Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated. cheers, RWendi
TITLE: How to build a solution to target 64 bit environment? QUESTION: Is there anyway to build a solution to target 64 bit environment in vs2003? My solution is native c++ not visual c++. Any help would be greatly appreciated. cheers, RWendi ANSWER: This page on 2003's lack of 64-bit targeting seems to address your ...
[ "c++", "64-bit", "visual-studio-2003" ]
5
4
3,479
3
0
2008-10-08T03:22:20.757000
2008-10-08T03:26:23.743000
181,226
181,796
Return to referring page
I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring controller but that becomes p...
In case you're using FormsAuthentication, when ASP.NET redirects a user to the login page, the URL looks something like this: http://www.mysite.com/Login?ReturnUrl=/Something The login form's action attribute should have the same ReturnUrl parameter (either as hidden input or as part of Url) so that FormsAuthentication...
Return to referring page I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action and referring cont...
TITLE: Return to referring page QUESTION: I am using an authentication attribute on some of my actions in an asp.net mvc page to refer people to a login screen if they have not authenticated. My problem is returning them to the referring page after they have logged in. I was just keeping track of the referring action ...
[ "asp.net-mvc", "authentication" ]
7
3
1,635
3
0
2008-10-08T03:26:53.807000
2008-10-08T08:16:29.493000
181,254
181,269
Is there a way to reference an existing CSS style from another CSS style using CSS or javascript?
If I have a style defined.style1 { width: 140px; } can I reference it from a second style?.style2 { ref:.style1; } Or is there a way via javascript/jQuery? --- Edit To clarify the problem, I am trying to apply whatever style is defined for a #x and #c to.x and.c without altering the CSS as the CSS is going to have upda...
There's no way to do it with CSS -- it's an oft-requested feature, but not included in the spec yet. You also can't do it directly with JS, but there's sort of a hacky workaround: $('.style2').addClass ('style1');
Is there a way to reference an existing CSS style from another CSS style using CSS or javascript? If I have a style defined.style1 { width: 140px; } can I reference it from a second style?.style2 { ref:.style1; } Or is there a way via javascript/jQuery? --- Edit To clarify the problem, I am trying to apply whatever sty...
TITLE: Is there a way to reference an existing CSS style from another CSS style using CSS or javascript? QUESTION: If I have a style defined.style1 { width: 140px; } can I reference it from a second style?.style2 { ref:.style1; } Or is there a way via javascript/jQuery? --- Edit To clarify the problem, I am trying to ...
[ "javascript", "jquery", "dynamic-css" ]
19
14
15,996
7
0
2008-10-08T03:43:18.780000
2008-10-08T03:50:41.010000
181,258
181,299
Linq to SQL Class Regeneration
I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regenerating the data layer?
I've run into this same problem and using sqlmetal is definitely a good way to solve it. One approach is to create a batch file that executes your sqlmetal command and that way you can just run the batch anytime you need update your Linq to SQL classes, but what is even slicker solution is to use Visual Studio's Tools-...
Linq to SQL Class Regeneration I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some shortcut to regeneratin...
TITLE: Linq to SQL Class Regeneration QUESTION: I've been using this nifty LINQ to SQL tool for a data access layer in an asp.net project. I keep making changes to the underlying tables and in order for the data classes to recognize the change I have to delete and readd the table which has changed. Is there some short...
[ "linq", "linq-to-sql" ]
8
5
1,895
5
0
2008-10-08T03:46:12.563000
2008-10-08T04:04:26.380000
181,268
181,327
How can I add an additional "view" to my iphone app?
I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest way to do this? Cheers!
Dunno if this will help I'm a bit new to objective-c and iPhone api. Maybe u can do something like this: Use the interface builder: just type "Interface Builder" on the Spotlight (top right corner) to generate like "myOptions.xib" And then just implement it: like @implementation myOptions -(void)awakeFromNib {... You ...
How can I add an additional "view" to my iphone app? I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest way to do this? C...
TITLE: How can I add an additional "view" to my iphone app? QUESTION: I have a simple iphone app that's based on the CrashLanding sample app. So basically you tap the title screen and do some stuff... all on the same "view". I want to add an "options" screen/page/view whatever with a few UISwitches. What's the easiest...
[ "iphone", "objective-c", "cocoa-touch" ]
2
1
7,769
4
0
2008-10-08T03:50:32.417000
2008-10-08T04:18:53.483000
181,272
181,286
What does "select count(1) from table_name" on any database tables mean?
When we execute select count(*) from table_name it returns the number of rows. What does count(1) do? What does 1 signify here? Is this the same as count(*) (as it gives the same result on execution)?
The parameter to the COUNT function is an expression that is to be evaluated for each row. The COUNT function returns the number of rows for which the expression evaluates to a non-null value. ( * is a special expression that is not evaluated, it simply returns the number of rows.) There are two additional modifiers fo...
What does "select count(1) from table_name" on any database tables mean? When we execute select count(*) from table_name it returns the number of rows. What does count(1) do? What does 1 signify here? Is this the same as count(*) (as it gives the same result on execution)?
TITLE: What does "select count(1) from table_name" on any database tables mean? QUESTION: When we execute select count(*) from table_name it returns the number of rows. What does count(1) do? What does 1 signify here? Is this the same as count(*) (as it gives the same result on execution)? ANSWER: The parameter to th...
[ "sql", "database", "oracle" ]
126
140
235,007
9
0
2008-10-08T03:52:13.583000
2008-10-08T04:00:28.060000
181,279
181,314
How does TCP/IP report errors?
How does TCP/IP report errors when packet delivery fails permanently? All Socket.write() APIs I've seen simply pass bytes to the underlying TCP/IP output buffer and transfer the data asynchronously. How then is TCP/IP supposed to notify the developer if packet delivery fails permanently (i.e. the destination host is no...
TCP/IP is a reliable byte stream protocol. All your bytes will get to the receiver or you'll get an error indication. The error indication will come in the form of a closed socket. Regardless of what the communication pattern (who does the sending), if the bytes can't be delivered, the socket will close. So the questio...
How does TCP/IP report errors? How does TCP/IP report errors when packet delivery fails permanently? All Socket.write() APIs I've seen simply pass bytes to the underlying TCP/IP output buffer and transfer the data asynchronously. How then is TCP/IP supposed to notify the developer if packet delivery fails permanently (...
TITLE: How does TCP/IP report errors? QUESTION: How does TCP/IP report errors when packet delivery fails permanently? All Socket.write() APIs I've seen simply pass bytes to the underlying TCP/IP output buffer and transfer the data asynchronously. How then is TCP/IP supposed to notify the developer if packet delivery f...
[ "tcp" ]
1
5
8,711
5
0
2008-10-08T03:55:49.753000
2008-10-08T04:14:28.483000
181,284
181,292
Functional programming and multicore architecture
I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture?
Functional programming minimizes or eliminates side effects and thus is better suited to distributed programming. i.e. multicore processing. In other words, lots of pieces of the puzzle can be solved independently on separate cores simultaneously without having to worry about one operation affecting another nearly as m...
Functional programming and multicore architecture I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture?
TITLE: Functional programming and multicore architecture QUESTION: I've read somewhere that functional programming is suitable to take advantage of multi-core trend in computing. I didn't really get the idea. Is it related to the lambda calculus and von neumann architecture? ANSWER: Functional programming minimizes o...
[ "f#", "functional-programming", "multicore" ]
18
13
5,509
9
0
2008-10-08T03:59:05.300000
2008-10-08T04:02:39.460000
181,285
181,290
Does using global create any overhead?
Is it a problem if you use the global keyword on variables you don't end up using? Compare: function foo() { global $fu; global $bah; if (something()) { $fu->doSomething(); } else { $bah->doSomething(); } } function bar() { if (something()) { global $fu; $fu->doSomething(); } else { global $bah; $bah->doSomething(); }...
If there is, it won't be (humanly) measurable, unless you are literally calling this function millions of times. And even if it was a recursive function with that property, I still wouldn't use your second method for the maintainability aspects you already brought up. Edit: For arguments sake, I actually went and bench...
Does using global create any overhead? Is it a problem if you use the global keyword on variables you don't end up using? Compare: function foo() { global $fu; global $bah; if (something()) { $fu->doSomething(); } else { $bah->doSomething(); } } function bar() { if (something()) { global $fu; $fu->doSomething(); } els...
TITLE: Does using global create any overhead? QUESTION: Is it a problem if you use the global keyword on variables you don't end up using? Compare: function foo() { global $fu; global $bah; if (something()) { $fu->doSomething(); } else { $bah->doSomething(); } } function bar() { if (something()) { global $fu; $fu->do...
[ "php", "optimization" ]
2
8
431
4
0
2008-10-08T03:59:17.657000
2008-10-08T04:01:58.523000
181,309
181,312
How to override global stylesheet
In a nutshell, there's a global stylesheet: a { font-family: Arial; } I want to use a different font family for a particular link:... or... but nothing works. Is there an easy way to do this? P.S. I'm dynamically (via PHP) assign different fonts to different links, so creating a special class is not an option.
Unless you have a specific font named Helvetica, you should realise that on some platforms (such as Windows, via FontSubstitutes ), Helvetica is aliased to Arial. That might be the source of the problem. Try another font and see.
How to override global stylesheet In a nutshell, there's a global stylesheet: a { font-family: Arial; } I want to use a different font family for a particular link:... or... but nothing works. Is there an easy way to do this? P.S. I'm dynamically (via PHP) assign different fonts to different links, so creating a specia...
TITLE: How to override global stylesheet QUESTION: In a nutshell, there's a global stylesheet: a { font-family: Arial; } I want to use a different font family for a particular link:... or... but nothing works. Is there an easy way to do this? P.S. I'm dynamically (via PHP) assign different fonts to different links, so...
[ "html", "css", "stylesheet" ]
2
12
16,271
4
0
2008-10-08T04:10:42.423000
2008-10-08T04:13:12.277000
181,316
181,325
Best practices for catching exceptions from SQL in C#
What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a particular state int value, I have used a stored procedure returning int v...
i always do two things: use raiseerror, which manifests on the code side as an exception, and return an error code this lets me catch errors both in C# code and also when one stored procedure calls another [sql server now supports a try-catch block, but i haven't used it yet]
Best practices for catching exceptions from SQL in C# What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a particular state int...
TITLE: Best practices for catching exceptions from SQL in C# QUESTION: What are some good ways to catch business logic exceptions or return values from SQL in C#? For instance, upon creating a new user, if the user already exists, the system and the user must be notified. I have used the raise_error() method with a pa...
[ "c#", "sql", "exception" ]
3
1
919
1
0
2008-10-08T04:14:47.797000
2008-10-08T04:17:24.733000
181,321
181,326
What is the default URL for APEX for an Oracle XE installation?
I've installed Oracle XE with APEX, but forgot to write down the URL to access it. How may I determine the URL?
The default is http://127.0.0.1:8080/apex If you happen to be on Windows, there will also be an entry in the Start menu (Programs > Oracle XE > Database homepage )
What is the default URL for APEX for an Oracle XE installation? I've installed Oracle XE with APEX, but forgot to write down the URL to access it. How may I determine the URL?
TITLE: What is the default URL for APEX for an Oracle XE installation? QUESTION: I've installed Oracle XE with APEX, but forgot to write down the URL to access it. How may I determine the URL? ANSWER: The default is http://127.0.0.1:8080/apex If you happen to be on Windows, there will also be an entry in the Start me...
[ "oracle-apex" ]
3
12
33,975
2
0
2008-10-08T04:16:27.620000
2008-10-08T04:18:18.333000
181,341
185,365
Tunnel over HTTPS
At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic as IM and redirect it through another...
Find out why the company has such a restrictive policy. It might be for a good reason. If you still find that you want to bypass the policy, you could write a small proxy that will listen on your server on port 443 and then, depending on the request, will forward the traffic either to your web server or to the SSH daem...
Tunnel over HTTPS At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic as IM and redirect ...
TITLE: Tunnel over HTTPS QUESTION: At my workplace, the traffic blocker/firewall has been getting progressively worse. I can't connect to my home machine on port 22, and lack of ssh access makes me sad. I was previously able to use SSH by moving it to port 5050, but I think some recent filters now treat this traffic a...
[ "apache", "proxy", "https", "ssh", "tunnel" ]
27
9
43,570
13
0
2008-10-08T04:29:43.633000
2008-10-08T23:35:58.530000
181,342
181,434
Automated MSI installation
What is the best way to automatically install an MSI file or installer.exe? We want to do some automated testing from our build system on the installed copy of the product. Our installer has the usual license acceptance screen, install location, etc. As FryHard pointed out there are two options in particular that seem ...
To automate the installation of an MSI package, you can use the /I option, like this: msiexec.exe /qn /i mypackage.msi Keep in mind that you need to specify the properties the MSI package expect the user to specify through the UI, and for which it does not have a default value. You can use the Orca tool to see the list...
Automated MSI installation What is the best way to automatically install an MSI file or installer.exe? We want to do some automated testing from our build system on the installed copy of the product. Our installer has the usual license acceptance screen, install location, etc. As FryHard pointed out there are two optio...
TITLE: Automated MSI installation QUESTION: What is the best way to automatically install an MSI file or installer.exe? We want to do some automated testing from our build system on the installed copy of the product. Our installer has the usual license acceptance screen, install location, etc. As FryHard pointed out t...
[ "windows-installer", "automated-tests", "automated-deploy" ]
17
25
30,076
3
0
2008-10-08T04:29:53.413000
2008-10-08T05:09:20.963000
181,348
217,042
Instantiating a JavaScript object by calling prototype.constructor.apply
Let me start with a specific example of what I'm trying to do. I have an array of year, month, day, hour, minute, second and millisecond components in the form [ 2008, 10, 8, 00, 16, 34, 254 ]. I'd like to instantiate a Date object using the following standard constructor: new Date(year, month, date [, hour, minute, se...
I've done more investigation of my own and came up with the conclusion that this is an impossible feat, due to how the Date class is implemented. I've inspected the SpiderMonkey source code to see how Date was implemented. I think it all boils down to the following few lines: static JSBool Date(JSContext *cx, JSObject ...
Instantiating a JavaScript object by calling prototype.constructor.apply Let me start with a specific example of what I'm trying to do. I have an array of year, month, day, hour, minute, second and millisecond components in the form [ 2008, 10, 8, 00, 16, 34, 254 ]. I'd like to instantiate a Date object using the follo...
TITLE: Instantiating a JavaScript object by calling prototype.constructor.apply QUESTION: Let me start with a specific example of what I'm trying to do. I have an array of year, month, day, hour, minute, second and millisecond components in the form [ 2008, 10, 8, 00, 16, 34, 254 ]. I'd like to instantiate a Date obje...
[ "javascript", "reflection" ]
54
64
24,451
13
0
2008-10-08T04:32:36.183000
2008-10-19T21:58:38.630000
181,353
181,458
How do I use the Rails helper link_to RESTfully in this situation?
I basically want to use link_to to link to the index method of a controller. I tried: <%= link_to 'Recipes', Recipe %> but that outputs: Recipes Which is clearly not right, if it left off that last bit it would do exactly what I want it to. I thought that with RESTful stuff I somehow would start to leave out the action...
With the restful routes, the majority of the time you're expected to call a helper method to generate the route. eg: link_to 'Recipes', recipes_path There is an optimization where you can just pass in a recipe object, and it will call the helper method for you behind the scenes: eg: link_to 'Recipe X', @recipe is the s...
How do I use the Rails helper link_to RESTfully in this situation? I basically want to use link_to to link to the index method of a controller. I tried: <%= link_to 'Recipes', Recipe %> but that outputs: Recipes Which is clearly not right, if it left off that last bit it would do exactly what I want it to. I thought th...
TITLE: How do I use the Rails helper link_to RESTfully in this situation? QUESTION: I basically want to use link_to to link to the index method of a controller. I tried: <%= link_to 'Recipes', Recipe %> but that outputs: Recipes Which is clearly not right, if it left off that last bit it would do exactly what I want i...
[ "ruby-on-rails", "rest" ]
3
6
8,437
1
0
2008-10-08T04:34:33.950000
2008-10-08T05:25:40.617000
181,354
181,404
obtain command line arguments in unit test
In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. How do you get the arguments from MSTest?
VS 2008 test are compiled into DLLs which can't directly receive command line arguments as far as I know. You could add a configuration file 'app.config' for the dll and use that instead. Just beware, mstest only copies.config files for the test container being run at the time. if you have the following... mytest.dll m...
obtain command line arguments in unit test In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. How do you get the arg...
TITLE: obtain command line arguments in unit test QUESTION: In a Test project in Visual Studio 2008 (Pro), I created a Test project, and I want to configure the project properties to give a command line argument to the tests. I set the properties, but then realized I have no idea how to actually use the argument. How ...
[ "c#", ".net", "unit-testing", "visual-studio-2008", "mstest" ]
2
1
2,675
2
0
2008-10-08T04:35:18.893000
2008-10-08T04:56:58.023000
181,363
181,381
Convert SQL Server Database from 2005 to 2000
We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so this should not make the conversion problematic. ...
Generate a full script for your database in SQL2005, and change the "Script for Server Version" option to SQL Server 2000. You can now recreate your database on the SQL 2000 server. After this is complete, use the export data feature to export from SQL 2005 to SQL 2000.
Convert SQL Server Database from 2005 to 2000 We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in the database so thi...
TITLE: Convert SQL Server Database from 2005 to 2000 QUESTION: We have a Microsoft SQL Server 2005 database that needs to be converted back to SQL Server 2000. Does anybody have any suggestions on the approach or tools I should use to perform this conversion? We don't utilise any SQL Server 2005 specific features in t...
[ "sql-server-2005", "sql-server-2000" ]
2
5
8,583
4
0
2008-10-08T04:37:39.187000
2008-10-08T04:44:44.303000
181,377
195,211
Update a list element with Lotus Formula
I am trying to update an element in a list with Lotus Formula. I thought you would do it like this: x:= "0":"0":"0"; x[1]:= "1"; But when I try to save I get the following error::= must be immediately preceded by a field or variable name
From the Lotus Domino Designer 7 Help: The subscript operator cannot be used on the left side of an assignment statement. That is, you cannot assign a value to a subscripted element. You must build the complete list and then assign it. For example, if Categories is a 3-element list and you want to assign a new value to...
Update a list element with Lotus Formula I am trying to update an element in a list with Lotus Formula. I thought you would do it like this: x:= "0":"0":"0"; x[1]:= "1"; But when I try to save I get the following error::= must be immediately preceded by a field or variable name
TITLE: Update a list element with Lotus Formula QUESTION: I am trying to update an element in a list with Lotus Formula. I thought you would do it like this: x:= "0":"0":"0"; x[1]:= "1"; But when I try to save I get the following error::= must be immediately preceded by a field or variable name ANSWER: From the Lotus...
[ "lotus-notes", "lotus-formula" ]
0
3
5,390
1
0
2008-10-08T04:43:06.583000
2008-10-12T07:50:20.343000
181,380
185,113
Delphi Project Needing runtime Packages, even with runtime Packages off
My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl I have Build with runtime packages unticked, so shouldn't they be complied into the exe? Edit: the Project uses Jedi Packages (TJvPlugin) and running the program with out any plugin installed w...
Your project may use DLLs or COM objects that have been built with Delphi packages.
Delphi Project Needing runtime Packages, even with runtime Packages off My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl I have Build with runtime packages unticked, so shouldn't they be complied into the exe? Edit: the Project uses Jedi Pack...
TITLE: Delphi Project Needing runtime Packages, even with runtime Packages off QUESTION: My Delphi7 project will not run on my clients computer if i don't have a few of the runtime packages in the path. eg rtl70.bpl I have Build with runtime packages unticked, so shouldn't they be complied into the exe? Edit: the Proj...
[ "delphi", "package", "bpl" ]
6
2
3,857
5
0
2008-10-08T04:44:05.663000
2008-10-08T22:08:54.353000
181,388
181,402
Refactoring from ActiveRecord to DataMapper
Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.
I really do like the ActiveRecord pattern for its simplicity. However, I have been moving away from it for larger web apps. I find that as an ActiveRecord based project becomes more complex the ActiveRecord objects become large and laden with too much code. By introducing a Repository pattern (essentially a Data Mapper...
Refactoring from ActiveRecord to DataMapper Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment.
TITLE: Refactoring from ActiveRecord to DataMapper QUESTION: Have you refactored from an ActiveRecord to a DataMapper pattern? What conditions prompted the switch? I'm primarily interested in web based applications, but would like to know the challenges that accompany such a move in any environment. ANSWER: I really ...
[ "design-patterns", "activerecord", "refactoring", "datamapper" ]
5
7
2,346
3
0
2008-10-08T04:46:47.247000
2008-10-08T04:56:13.953000
181,398
181,884
Configuring Tomcat 6 to support Russian cp1251 encoding
I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM argument -DFile.encoding=cp1251, the system doesnt accept input (I an any t...
You can use a servlet filter which sets the response encoding to workaround the problem. Check http://snippets.dzone.com/posts/show/5948. There is a sample code for the filter. You need to replace the: response.setCharacterEncoding("UTF-8"); and request.setCharacterEncoding("UTF-8"); with the required encoding. Also yo...
Configuring Tomcat 6 to support Russian cp1251 encoding I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM argument -DFile.enc...
TITLE: Configuring Tomcat 6 to support Russian cp1251 encoding QUESTION: I am migrating a struts application from Websphere to Tomcat 6 and my application has support for Russian language. In Websphere we use to pass the JVM param -Dclinet.encoding.override=cp1251 but when I tried this with tomcat by passing the JVM a...
[ "java", "tomcat", "encoding", "cp1251" ]
3
4
2,402
1
0
2008-10-08T04:53:24.473000
2008-10-08T08:57:37.647000
181,406
181,445
Ruby Memory Management
I have been using Ruby for a while now and I find, for bigger projects, it can take up a fair amount of memory. What are some best practices for reducing memory usage in Ruby? Please, let each answer have one "best practice" and let the community vote it up.
Don't do this: def method(x) x.split( doesn't matter what the args are ) end or this: def method(x) x.gsub( doesn't matter what the args are ) end Both will permanently leak memory in ruby 1.8.5 and 1.8.6. (not sure about 1.8.7 as I haven't tried it, but I really hope it's fixed.) The workaround is stupid and involves ...
Ruby Memory Management I have been using Ruby for a while now and I find, for bigger projects, it can take up a fair amount of memory. What are some best practices for reducing memory usage in Ruby? Please, let each answer have one "best practice" and let the community vote it up.
TITLE: Ruby Memory Management QUESTION: I have been using Ruby for a while now and I find, for bigger projects, it can take up a fair amount of memory. What are some best practices for reducing memory usage in Ruby? Please, let each answer have one "best practice" and let the community vote it up. ANSWER: Don't do th...
[ "ruby", "memory", "memory-management", "coding-style" ]
24
15
14,534
5
0
2008-10-08T04:59:05.227000
2008-10-08T05:18:09.150000
181,408
185,076
Best Way to Write Bytes in the Middle of a File in Java
What is the best way to write bytes in the middle of a file using Java?
Reading and Writing in the middle of a file is as simple as using a RandomAccessFile in Java. RandomAccessFile, despite its name, is more like an InputStream and OutputStream and less like a File. It allows you to read or seek through bytes in a file and then begin writing over whichever bytes you care to stop at. Once...
Best Way to Write Bytes in the Middle of a File in Java What is the best way to write bytes in the middle of a file using Java?
TITLE: Best Way to Write Bytes in the Middle of a File in Java QUESTION: What is the best way to write bytes in the middle of a file using Java? ANSWER: Reading and Writing in the middle of a file is as simple as using a RandomAccessFile in Java. RandomAccessFile, despite its name, is more like an InputStream and Out...
[ "java", "file", "java-io" ]
18
25
16,288
4
0
2008-10-08T05:00:13.523000
2008-10-08T21:54:27.860000
181,426
181,430
How do I add a Line break in a SQL Server Stored Procedure?
I'm making a Stored Procedure that basically concatenates a long string with data from many records. I want to do: set @output = @output + 'aaa' + LINEBREAK How do I specify that line break?
DECLARE @LINEBREAK AS varchar(2) SET @LINEBREAK = CHAR(13) + CHAR(10)
How do I add a Line break in a SQL Server Stored Procedure? I'm making a Stored Procedure that basically concatenates a long string with data from many records. I want to do: set @output = @output + 'aaa' + LINEBREAK How do I specify that line break?
TITLE: How do I add a Line break in a SQL Server Stored Procedure? QUESTION: I'm making a Stored Procedure that basically concatenates a long string with data from many records. I want to do: set @output = @output + 'aaa' + LINEBREAK How do I specify that line break? ANSWER: DECLARE @LINEBREAK AS varchar(2) SET @LINE...
[ "sql-server", "t-sql", "stored-procedures" ]
13
23
28,463
2
0
2008-10-08T05:06:51.730000
2008-10-08T05:08:36.813000
181,427
181,462
C# event handling (compared to Java)
I am currently having a hardtime understanding and implementing events in C# using delagates. I am used to the Java way of doing things: Define an interface for a listener type which would contain a number of method definitions Define adapter class for that interface to make things easier if I'm not interested in all t...
You'd create four events, and methods to raise them, along with a new EventArgs-based class to indicate the error: public class ExceptionEventArgs: EventArgs { private readonly Exception error; public ExceptionEventArgs(Exception error) { this.error = error; } public Error { get { return error; } } } public class Co...
C# event handling (compared to Java) I am currently having a hardtime understanding and implementing events in C# using delagates. I am used to the Java way of doing things: Define an interface for a listener type which would contain a number of method definitions Define adapter class for that interface to make things ...
TITLE: C# event handling (compared to Java) QUESTION: I am currently having a hardtime understanding and implementing events in C# using delagates. I am used to the Java way of doing things: Define an interface for a listener type which would contain a number of method definitions Define adapter class for that interfa...
[ "c#", "event-handling", "delegates" ]
13
17
7,238
9
0
2008-10-08T05:06:57.737000
2008-10-08T05:29:53.963000
181,432
184,463
How to create the "indexes" required for NSIndexPath:indexPathWithIndexes:length:
The class method to create an index path with one or more nodes is: + (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length How do we create the "indexes" required in the first parameter? The documentation listed it as Array of indexes to make up the index path but it is expecting a (NSUinteger *). T...
You are correct. You might use it like this: NSUInteger indexArr[] = {1,2,3,4}; NSIndexPath *indexPath = [NSIndexPath indexPathWithIndexes:indexArr length:4];
How to create the "indexes" required for NSIndexPath:indexPathWithIndexes:length: The class method to create an index path with one or more nodes is: + (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length How do we create the "indexes" required in the first parameter? The documentation listed it as ...
TITLE: How to create the "indexes" required for NSIndexPath:indexPathWithIndexes:length: QUESTION: The class method to create an index path with one or more nodes is: + (id)indexPathWithIndexes:(NSUInteger *)indexes length:(NSUInteger)length How do we create the "indexes" required in the first parameter? The documenta...
[ "objective-c", "cocoa" ]
42
61
43,972
4
0
2008-10-08T05:09:09.277000
2008-10-08T19:32:12.827000
181,442
183,750
Can any of the iPhone collection objects hold an image?
Actually, I wanted a custom cell which contains 2 image objects and 1 text object, and I decided to make a container for those objects. So is it possible to hold a image in object and insert that object in any of the collection objects, and later use that object to display inside cell?
NSArray and NSDictionary both hold objects. These are most likely the collections you'll use with a table view. The best way to implement what you are trying to do is to use the UIImage class. UIImages wrap a CGImage and do all the memory management for you (if your app is running low on memory, the image data is purge...
Can any of the iPhone collection objects hold an image? Actually, I wanted a custom cell which contains 2 image objects and 1 text object, and I decided to make a container for those objects. So is it possible to hold a image in object and insert that object in any of the collection objects, and later use that object t...
TITLE: Can any of the iPhone collection objects hold an image? QUESTION: Actually, I wanted a custom cell which contains 2 image objects and 1 text object, and I decided to make a container for those objects. So is it possible to hold a image in object and insert that object in any of the collection objects, and later...
[ "iphone", "cocoa-touch" ]
0
2
897
2
0
2008-10-08T05:15:18.220000
2008-10-08T16:49:18.367000
181,447
181,450
I'm getting a NULL output in a SQL Function when concatting fields
I have the following function: CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS varchar(8000) AS BEGIN declare StatusChanges cursor for select NewStatusID, FirstName + ' ' + LastName AS UserName, Stamp, CAST(Notes AS varchar(8000)) AS Notes from TransactionStatusChanges tsc left join Users us ON...
One of these is NULL set @output = @output + RTRIM(CAST(@Stamp AS varchar(30))) + ': ' + @NewStatusID + ' by ' + @UserName + CHAR(13) + CHAR(10) Also, you can make your code simpler by using ISNULL or COALESCE to handle columns which contain NULLs CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS ...
I'm getting a NULL output in a SQL Function when concatting fields I have the following function: CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS varchar(8000) AS BEGIN declare StatusChanges cursor for select NewStatusID, FirstName + ' ' + LastName AS UserName, Stamp, CAST(Notes AS varchar(8000...
TITLE: I'm getting a NULL output in a SQL Function when concatting fields QUESTION: I have the following function: CREATE FUNCTION fGetTransactionStatusLog ( @TransactionID int ) RETURNS varchar(8000) AS BEGIN declare StatusChanges cursor for select NewStatusID, FirstName + ' ' + LastName AS UserName, Stamp, CAST(Not...
[ "sql-server", "t-sql", "null" ]
1
4
517
1
0
2008-10-08T05:18:13.533000
2008-10-08T05:20:13.373000
181,453
181,534
Good Examples of .NET Desktop Applications
I would like to evaluate.NET as a development platform for a desktop application. I am looking for good examples of.NET desktop applications used in the mainstream. The only ones I know of are: Visual Studio (The copy website form is one example.) Team Explorer UI Paint.NET Reflector Gnome Do (An app launcher for Gnome...
SharpDevelop is an open source Development IDE for.NET very much like VS.NET written in.NET (iirc it still has some pinvokes, but it is all managed code) and is quite large and feature complete. You can even get the source code for it to look at.
Good Examples of .NET Desktop Applications I would like to evaluate.NET as a development platform for a desktop application. I am looking for good examples of.NET desktop applications used in the mainstream. The only ones I know of are: Visual Studio (The copy website form is one example.) Team Explorer UI Paint.NET Re...
TITLE: Good Examples of .NET Desktop Applications QUESTION: I would like to evaluate.NET as a development platform for a desktop application. I am looking for good examples of.NET desktop applications used in the mainstream. The only ones I know of are: Visual Studio (The copy website form is one example.) Team Explor...
[ ".net", "winforms", "desktop" ]
11
11
20,892
12
0
2008-10-08T05:23:30.090000
2008-10-08T06:20:34.483000
181,459
181,495
Is there a better way to find midnight tomorrow?
Is there a better way to do this? -(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorrow yearOfCommonEra] month:[tomorrow monthOfYear] day:[tomorrow dayO...
From the documentation: Use of NSCalendarDate strongly discouraged. It is not deprecated yet, however it may be in the next major OS release after Mac OS X v10.5. For calendrical calculations, you should use suitable combinations of NSCalendar, NSDate, and NSDateComponents, as described in Calendars in Dates and Times ...
Is there a better way to find midnight tomorrow? Is there a better way to do this? -(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorrow yearOfCommonEra...
TITLE: Is there a better way to find midnight tomorrow? QUESTION: Is there a better way to do this? -(NSDate *)getMidnightTommorow { NSCalendarDate *now = [NSCalendarDate date]; NSCalendarDate *tomorrow = [now dateByAddingYears:0 months:0 days:1 hours:0 minutes:0 seconds:0]; return [NSCalendarDate dateWithYear:[tomorr...
[ "cocoa", "date", "performance" ]
12
25
7,129
6
0
2008-10-08T05:26:10.820000
2008-10-08T05:56:35.640000
181,471
181,494
VS2008 Keyboard shortcut Ctrl + . stopped working
The new awesome Ctrl +. keyboard shortcut to show smart tags has suddenly stopped working, a week or so after I discovered it:( I am missing it badly, having had to revert back to Ctrl + Alt + F10, which really just isn't the same. I recently installed F# CTP 1.9.6.2 Has anyone else installed this CTP and still has Ctr...
I have just discovered this blog entry that references the problem. I have just tested it and it works! Cheers John Sheehan for at least getting me to a step that gave me some googleable terms, I have given you an upmod as a thanks
VS2008 Keyboard shortcut Ctrl + . stopped working The new awesome Ctrl +. keyboard shortcut to show smart tags has suddenly stopped working, a week or so after I discovered it:( I am missing it badly, having had to revert back to Ctrl + Alt + F10, which really just isn't the same. I recently installed F# CTP 1.9.6.2 Ha...
TITLE: VS2008 Keyboard shortcut Ctrl + . stopped working QUESTION: The new awesome Ctrl +. keyboard shortcut to show smart tags has suddenly stopped working, a week or so after I discovered it:( I am missing it badly, having had to revert back to Ctrl + Alt + F10, which really just isn't the same. I recently installed...
[ "visual-studio-2008", "keyboard-shortcuts" ]
0
2
1,311
2
0
2008-10-08T05:35:31.940000
2008-10-08T05:54:09.750000
181,485
181,529
Determining when an EDGE connection comes back after a dropout on an iPhone
I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification implementation because it seemed easier to have the reachablity updated in ...
Reachability notificataions didn't seem to be reliable for me either, for detecting Wi-Fi. So I just use polling instead. Checking every 5 seconds seems to do no harm. - (void) checkReachability { BOOL connected = ([[Reachability sharedReachability] localWiFiConnectionStatus] == ReachableViaWiFiNetwork); // Do somethi...
Determining when an EDGE connection comes back after a dropout on an iPhone I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the status notification...
TITLE: Determining when an EDGE connection comes back after a dropout on an iPhone QUESTION: I've incorporated Apple's Reachability sample into my own project so I know whether or not I have a network connection - if I don't have a network connection, I don't bother sending out and requests. I decided to go with the s...
[ "iphone", "cocoa-touch", "networking", "connection" ]
10
14
3,407
2
0
2008-10-08T05:44:44.197000
2008-10-08T06:18:50.620000
181,498
181,673
lists:usort for nth element in tuple
I need to sort tuples according to the second element of each tuple but apparently usort/1 only works with the first element. So I have to swap the elements, usort them and swap back.Is there an easier way?Also is there a way to sort in descending order (I know sorting and reversing can be done, but just want to know).
Have you tried keysort/2 function (or its counterpart ukeysort/2 )? > lists:reverse(lists:keysort(2, [{a,2}, {b,1}, {c, 3}])). [{c,3},{a,2},{b,1}] If you don't sort very big lists this is probably the most readable solution you can get.
lists:usort for nth element in tuple I need to sort tuples according to the second element of each tuple but apparently usort/1 only works with the first element. So I have to swap the elements, usort them and swap back.Is there an easier way?Also is there a way to sort in descending order (I know sorting and reversing...
TITLE: lists:usort for nth element in tuple QUESTION: I need to sort tuples according to the second element of each tuple but apparently usort/1 only works with the first element. So I have to swap the elements, usort them and swap back.Is there an easier way?Also is there a way to sort in descending order (I know sor...
[ "erlang", "sorting" ]
2
4
2,358
4
0
2008-10-08T05:59:01.610000
2008-10-08T07:27:57.127000
181,530
181,557
Styling multi-line conditions in 'if' statements?
Sometimes I break long conditions in if s onto several lines. The most obvious way to do this is: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Isn't very very appealing visually, because the action blends with the conditions. However, it is the natural way using correct...
You don't need to use 4 spaces on your second conditional line. Maybe use: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Also, don't forget the whitespace is more flexible than you might think: if ( cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'va...
Styling multi-line conditions in 'if' statements? Sometimes I break long conditions in if s onto several lines. The most obvious way to do this is: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Isn't very very appealing visually, because the action blends with the condit...
TITLE: Styling multi-line conditions in 'if' statements? QUESTION: Sometimes I break long conditions in if s onto several lines. The most obvious way to do this is: if (cond1 == 'val1' and cond2 == 'val2' and cond3 == 'val3' and cond4 == 'val4'): do_something Isn't very very appealing visually, because the action blen...
[ "python", "if-statement" ]
880
990
1,619,766
30
0
2008-10-08T06:19:07.670000
2008-10-08T06:34:25.267000
181,539
181,541
Summing Split ranges in a SQL query
I have a table which contains my server status create table ServerStatus ( ServerId int, StartTime datetime, Seconds int, [State] char(8) ) I would like a query that given a start and end date will summarize the time the server spends in each state during that time. I would also like the query to return the amount of t...
This is the best I have come up with so far: declare @start datetime declare @fin datetime select @start = dateadd(second, 60, '2008-01-01'), @fin = dateadd(second, 60, '2008-01-04') select ServerId, State, Total = sum( case when StartTime > @start and DateAdd(second, Seconds, StartTime) <= @fin then Seconds when Sta...
Summing Split ranges in a SQL query I have a table which contains my server status create table ServerStatus ( ServerId int, StartTime datetime, Seconds int, [State] char(8) ) I would like a query that given a start and end date will summarize the time the server spends in each state during that time. I would also like...
TITLE: Summing Split ranges in a SQL query QUESTION: I have a table which contains my server status create table ServerStatus ( ServerId int, StartTime datetime, Seconds int, [State] char(8) ) I would like a query that given a start and end date will summarize the time the server spends in each state during that time....
[ "sql-server", "t-sql", "range", "aggregate" ]
2
3
981
1
0
2008-10-08T06:25:12.557000
2008-10-08T06:25:56.237000
181,543
181,706
What is the problem with reduce()?
There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contempt was simply subjective, I cannot i...
As Guido says in his The fate of reduce() in Python 3000 post: So now reduce(). This is actually the one I've always hated most, because, apart from a few examples involving + or *, almost every time I see a reduce() call with a non-trivial function argument, I need to grab pen and paper to diagram what's actually bein...
What is the problem with reduce()? There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cases. If the contemp...
TITLE: What is the problem with reduce()? QUESTION: There seems to be a lot of heated discussion on the net about the changes to the reduce() function in python 3.0 and how it should be removed. I am having a little difficulty understanding why this is the case; I find it quite reasonable to use it in a variety of cas...
[ "python", "python-3.x" ]
81
81
24,240
5
0
2008-10-08T06:27:12.350000
2008-10-08T07:42:12.293000
181,551
189,463
How to check in Java using JIntegra if COM object implements an interface?
I'm working with JIntegra java com bridge. I have an object of type Object which true coclass is unknown. I need to check if that object can be casted to specific COM interface (which has a proxy class generated by JIntegra).
Call queryInterface() on the proxy. It should throw an exception if the underlying COM object does not implement the proxy interface.
How to check in Java using JIntegra if COM object implements an interface? I'm working with JIntegra java com bridge. I have an object of type Object which true coclass is unknown. I need to check if that object can be casted to specific COM interface (which has a proxy class generated by JIntegra).
TITLE: How to check in Java using JIntegra if COM object implements an interface? QUESTION: I'm working with JIntegra java com bridge. I have an object of type Object which true coclass is unknown. I need to check if that object can be casted to specific COM interface (which has a proxy class generated by JIntegra). ...
[ "java", "casting" ]
2
1
935
2
0
2008-10-08T06:31:28.613000
2008-10-09T22:36:37.713000
181,556
181,583
py2exe including MSVC DLLs in the .exe
When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the.exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll The former can be included in the.exe using this tip. However, the latter is just placed in the...
Wouldn't it fail to launch, then? You want msvcr71.dll in the same directory as the exe, so that the library loader will be able to find and link it into the application's memory map. It's needed for basic operation, so you can't just let py2exe unpack it with the rest of the DLLs.
py2exe including MSVC DLLs in the .exe When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the.exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll The former can be included in the.exe using this tip. Ho...
TITLE: py2exe including MSVC DLLs in the .exe QUESTION: When using py2exe to distribute Python applications with wxPython, some MSVC DLLs are usually needed to make the.exe work on freshly installed machines. In particular, the two most common DLLs are msvcp71.dll and msvcr71.dll The former can be included in the.exe ...
[ "python", "dll", "py2exe" ]
5
7
5,414
3
0
2008-10-08T06:34:21.103000
2008-10-08T06:46:57.740000
181,568
181,590
Which Java Profiling tool do you use and which tool you think is the best?
Want to know what the stackoverflow community feels about the various free and non-free Java Profilers and profiling tools available.
JProfiler works very well for us. http://www.ej-technologies.com/products/jprofiler/overview.html
Which Java Profiling tool do you use and which tool you think is the best? Want to know what the stackoverflow community feels about the various free and non-free Java Profilers and profiling tools available.
TITLE: Which Java Profiling tool do you use and which tool you think is the best? QUESTION: Want to know what the stackoverflow community feels about the various free and non-free Java Profilers and profiling tools available. ANSWER: JProfiler works very well for us. http://www.ej-technologies.com/products/jprofiler/...
[ "java", "profiler", "profiling" ]
20
10
17,449
3
0
2008-10-08T06:39:50.110000
2008-10-08T06:51:26.873000
181,573
181,626
wxPython: displaying multiple widgets in same frame
I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow ) to display the text box below the Notebook in the same frame? import wx import wx.lib.sheet as ...
Making two widgets appear on the same frame is easy, actually. You should use sizers to accomplish this. In your example, you can change your Notebook class implementation to something like this: class Notebook(wx.Frame): def __init__(self, parent, id, title): wx.Frame.__init__(self, parent, id, title, size=(600, 600))...
wxPython: displaying multiple widgets in same frame I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow ) to display the text box below the Notebook ...
TITLE: wxPython: displaying multiple widgets in same frame QUESTION: I would like to be able to display Notebook and a TxtCtrl wx widgets in a single frame. Below is an example adapted from the wxpython wiki; is it possible to change their layout (maybe with something like wx.SplitterWindow ) to display the text box b...
[ "python", "user-interface", "layout", "wxpython", "wxwidgets" ]
4
9
3,253
2
0
2008-10-08T06:41:18.967000
2008-10-08T07:11:08.050000
181,579
187,158
List Comprehension in an Open Office Spreadsheet
List Comprehension is a very useful code mechanism that is found in several languages, such as Haskell, Python, and Ruby (just to name a few off the top of my head). I'm familiar with the construct. I find myself working on an Open Office Spreadsheet and I need to do something fairly common: I want to count all of the ...
CountIf can count values equal to one chosen. Unfortunately it seems that there is no good candidate for such function. Alternatively you can use additional column with If to display 1 or 0 if the value fits in range or not accordingly: =If(AND({list_cell}>=MinVal; {list_cell}<=MaxVal); 1; 0) Then only thing left is to...
List Comprehension in an Open Office Spreadsheet List Comprehension is a very useful code mechanism that is found in several languages, such as Haskell, Python, and Ruby (just to name a few off the top of my head). I'm familiar with the construct. I find myself working on an Open Office Spreadsheet and I need to do som...
TITLE: List Comprehension in an Open Office Spreadsheet QUESTION: List Comprehension is a very useful code mechanism that is found in several languages, such as Haskell, Python, and Ruby (just to name a few off the top of my head). I'm familiar with the construct. I find myself working on an Open Office Spreadsheet an...
[ "openoffice.org", "list-comprehension" ]
3
1
366
2
0
2008-10-08T06:44:53.967000
2008-10-09T13:04:34.403000
181,581
181,599
Generate X.509 certificate key pair and signing request (CSR) in C#
How do you generate a X.509 public and private key pair and a signing request (CSR file) to be sent to a CA for signing in C#?
Generating a RSA key-pair is easy: // Generate a 2048 bit RSA keypair RSA keypair = new RSACryptoServiceProvider(2048); Unfortunately.NET has no support for generating certificate-requests. Your best bet is probably to interface with the COM-component CEnroll. You should use the CreatePKCS10 -method.
Generate X.509 certificate key pair and signing request (CSR) in C# How do you generate a X.509 public and private key pair and a signing request (CSR file) to be sent to a CA for signing in C#?
TITLE: Generate X.509 certificate key pair and signing request (CSR) in C# QUESTION: How do you generate a X.509 public and private key pair and a signing request (CSR file) to be sent to a CA for signing in C#? ANSWER: Generating a RSA key-pair is easy: // Generate a 2048 bit RSA keypair RSA keypair = new RSACryptoS...
[ "c#", "x509", "csr" ]
1
1
13,018
2
0
2008-10-08T06:45:40.393000
2008-10-08T06:58:48.667000
181,585
217,082
RPC_E_SERVERCALL_RETRYLATER during powershell automation
I'm using PowersHell to automate iTunes but find the error handling / waiting for com objects handling to be less than optimal. Example code #Cause an RPC error $iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource # Get "playlist" objects for main sections foreach ($PList in $Librar...
Here's a function to retry operations, pausing in between failures: function retry( [scriptblock]$action, [int]$wait=2, [int]$maxRetries=100 ) { $results = $null $currentRetry = 0 $success = $false while( -not $success ) { trap { # Set status variables at function scope. Set-Variable -scope 1 success $false Set-Variab...
RPC_E_SERVERCALL_RETRYLATER during powershell automation I'm using PowersHell to automate iTunes but find the error handling / waiting for com objects handling to be less than optimal. Example code #Cause an RPC error $iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibrarySource # Get "playl...
TITLE: RPC_E_SERVERCALL_RETRYLATER during powershell automation QUESTION: I'm using PowersHell to automate iTunes but find the error handling / waiting for com objects handling to be less than optimal. Example code #Cause an RPC error $iTunes = New-Object -ComObject iTunes.Application $LibrarySource = $iTunes.LibraryS...
[ "powershell", "itunes" ]
1
1
2,640
3
0
2008-10-08T06:48:03.087000
2008-10-19T22:39:51.323000
181,595
208,702
TraceSource in TestDriven.NET AppDomain
I'm running tests using the TestDriven.NET VS add-in, and the class library I'm testing is instrumented using TraceSource. How can I get the output of that TraceSource to show up in the Output window in Visual Studio? The DefaultTraceListener doesn't appear to be working quite right. Do I need to manually add a Console...
The MSDN documentation states: A DefaultTraceListener emits Write and WriteLine messages to the OutputDebugString and to the Debugger.Log method. In Visual Studio, this causes the debugging messages to appear in the Output window. Fail and failed Assert messages also emit to the OutputDebugString Windows API and the De...
TraceSource in TestDriven.NET AppDomain I'm running tests using the TestDriven.NET VS add-in, and the class library I'm testing is instrumented using TraceSource. How can I get the output of that TraceSource to show up in the Output window in Visual Studio? The DefaultTraceListener doesn't appear to be working quite ri...
TITLE: TraceSource in TestDriven.NET AppDomain QUESTION: I'm running tests using the TestDriven.NET VS add-in, and the class library I'm testing is instrumented using TraceSource. How can I get the output of that TraceSource to show up in the Output window in Visual Studio? The DefaultTraceListener doesn't appear to b...
[ "c#", ".net", "unit-testing", "testdriven.net" ]
1
3
764
1
0
2008-10-08T06:54:59.593000
2008-10-16T14:05:34.250000
181,596
182,924
How to convert a column number (e.g. 127) into an Excel column (e.g. AA)
How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel. Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. The resulting values should be in the form of excel column names, e.g. A, AA, AAA etc.
Here's how I do it: private string GetExcelColumnName(int columnNumber) { string columnName = ""; while (columnNumber > 0) { int modulo = (columnNumber - 1) % 26; columnName = Convert.ToChar('A' + modulo) + columnName; columnNumber = (columnNumber - modulo) / 26; } return columnName; }
How to convert a column number (e.g. 127) into an Excel column (e.g. AA) How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel. Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. The resulting value...
TITLE: How to convert a column number (e.g. 127) into an Excel column (e.g. AA) QUESTION: How do you convert a numerical number to an Excel column name in C# without using automation getting the value directly from Excel. Excel 2007 has a possible range of 1 to 16384, which is the number of columns that it supports. T...
[ "c#", "excel" ]
563
1,060
299,202
60
0
2008-10-08T06:55:01.780000
2008-10-08T14:01:28.423000
181,597
911,194
What are the naming guidelines for ASP.NET controls?
We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc. We came up with the following three possibilities that we voted on: (Exampl...
The reason Visual Studio adds "TextBox1" when you add it to the page is because Microsoft has no way of knowing how you intend to use it. Naming it "Control1" would be too confusing because it could be any number of controls. Microsoft provides guidance in general for OO naming conventions, but not specifically for nam...
What are the naming guidelines for ASP.NET controls? We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc. We came up with the fo...
TITLE: What are the naming guidelines for ASP.NET controls? QUESTION: We are in the process of nutting out the design guidelines we would like to use in our development team and got into a discussion today around how ASP.NET controls should be named. I am talking about our good friends Label, TextBox, Button etc. We c...
[ "asp.net", "naming-conventions", "coding-style" ]
21
33
40,378
18
0
2008-10-08T06:55:58.173000
2009-05-26T15:08:52.243000
181,605
181,619
How to refactor function that takes lots of arguments?
I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call. I was just wondering if anyone could think of a better way to do the following code. Public Function OpenTable(ByVal TablePath As String, Optiona...
In this case it seems many of the parameters are just 'configuration values' (which end up being strings), you could modify it to accept a single class for all the configuration that you prepare before the call and that will return you the string accordingly. Something like class COMConfiguration { private bool Hide = ...
How to refactor function that takes lots of arguments? I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call. I was just wondering if anyone could think of a better way to do the following code. Publi...
TITLE: How to refactor function that takes lots of arguments? QUESTION: I wrote a wrapper for a COM object that only excepted strings as input, so in good OOP practice I wrapped the string up in a function so that it was easier to build and call. I was just wondering if anyone could think of a better way to do the fol...
[ "vb.net", "refactoring", "wrapper", "comobject" ]
1
4
522
4
0
2008-10-08T07:00:56.697000
2008-10-08T07:09:11.517000
181,615
181,971
Java threads: Is it possible view/pause/kill a particular thread from a different java program running on the same JVM?
I have a program 'foo' running different threads, fooT1, fooT2,.. fooTn. Now if I want write another program 'bar', which could kill the thread fooTr, is that possible? Reason: One of the thread fooTr tracks product license. If this thread is killed; one may run this product indefinitely. And killing 'foo' itself is to...
To my knowledge it is not possible to do this directly. What you could consider however is to create some kind of service on your 'foo' that can be called from 'bar' to kill the thread. There are, of course, hundreds of ways to implement this. My first thought would be to do this using RMI.
Java threads: Is it possible view/pause/kill a particular thread from a different java program running on the same JVM? I have a program 'foo' running different threads, fooT1, fooT2,.. fooTn. Now if I want write another program 'bar', which could kill the thread fooTr, is that possible? Reason: One of the thread fooTr...
TITLE: Java threads: Is it possible view/pause/kill a particular thread from a different java program running on the same JVM? QUESTION: I have a program 'foo' running different threads, fooT1, fooT2,.. fooTn. Now if I want write another program 'bar', which could kill the thread fooTr, is that possible? Reason: One o...
[ "java", "multithreading", "jvm" ]
7
4
19,495
4
0
2008-10-08T07:08:04.107000
2008-10-08T09:51:26.853000
181,622
181,686
Screencapture from the browser using Javascript?
I guess this is an odd one, and the answer is most likely it is not possible since it would represent a security breach; but I am looking for a way - if any - to get a screendump of content inside the browser. I don't need the entire window, but actually just need to dump the rendered state of an tag. It need to be cro...
It cannot be done (yet) in pure JavaScript. As a side-note, if your goal is to make rendering tests, you could try instantiating the target browsers within a hosted environment (i.e. host Internet Explorer in a WinForms application and get a screenshot of the rendered content) - this will show the Silverlight plug-in a...
Screencapture from the browser using Javascript? I guess this is an odd one, and the answer is most likely it is not possible since it would represent a security breach; but I am looking for a way - if any - to get a screendump of content inside the browser. I don't need the entire window, but actually just need to dum...
TITLE: Screencapture from the browser using Javascript? QUESTION: I guess this is an odd one, and the answer is most likely it is not possible since it would represent a security breach; but I am looking for a way - if any - to get a screendump of content inside the browser. I don't need the entire window, but actuall...
[ "javascript" ]
3
1
6,024
2
0
2008-10-08T07:10:09.300000
2008-10-08T07:32:07.023000
181,624
186,026
C++: what regex library should I use?
I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.) QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick search has brought the following to my attention:...
Thanks for all the suggestions. I tried out a few things today, and with the stuff we're trying to do, I opted for the simplest solution where I don't have to download any other 3rd-party library. In the end, I #include and used the standard C POSIX calls regcomp() and regexec(). Not C++, but in a pinch this proved to ...
C++: what regex library should I use? I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.) QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A quick search has ...
TITLE: C++: what regex library should I use? QUESTION: I'm working on a commercial (not open source) C++ project that runs on a linux-based system. I need to do some regex within the C++ code. (I know: I now have 2 problems.) QUESTION: What libraries do people who regularly do regex from C/C++ recommend I look into? A...
[ "c++", "regex", "linux" ]
111
24
115,604
10
0
2008-10-08T07:10:52.043000
2008-10-09T05:36:36.053000
181,627
181,723
Why is my K2 process not appearing in the reports?
I use K2 as my workflow engine. For some reason my processes are not available in any of the reporting views (on the workspace). Do I have to do something special when deploying to get them there?
Your k2 process should appear in the reports automatically. If it does not, maybe it has never been started? Look at the _ProcInst table in the K2Server database to see if it's there.
Why is my K2 process not appearing in the reports? I use K2 as my workflow engine. For some reason my processes are not available in any of the reporting views (on the workspace). Do I have to do something special when deploying to get them there?
TITLE: Why is my K2 process not appearing in the reports? QUESTION: I use K2 as my workflow engine. For some reason my processes are not available in any of the reporting views (on the workspace). Do I have to do something special when deploying to get them there? ANSWER: Your k2 process should appear in the reports ...
[ "k2" ]
1
3
1,165
3
0
2008-10-08T07:11:15.367000
2008-10-08T07:48:52.513000
181,629
181,666
How can I set the /baseaddress to a "good" value?
We have a project with many dll files which get loaded when the application starts. The baseaddresses of the dll files do overlap so that the memory image gets relocated. Is there a possibility to assign the baseaddresses automatically or a way to calculate a "good" baseaddress for each dll file?
You can use the REBASE utility which ships with the platform SDK and with Visual studio I think to set the base addresses of a whole bunch of DLLS loaded by the appliction You supply REBASE with a list of the DLLS that make up your program, not including system Dlls, it then performs a dummy load of all the DLLs and as...
How can I set the /baseaddress to a "good" value? We have a project with many dll files which get loaded when the application starts. The baseaddresses of the dll files do overlap so that the memory image gets relocated. Is there a possibility to assign the baseaddresses automatically or a way to calculate a "good" bas...
TITLE: How can I set the /baseaddress to a "good" value? QUESTION: We have a project with many dll files which get loaded when the application starts. The baseaddresses of the dll files do overlap so that the memory image gets relocated. Is there a possibility to assign the baseaddresses automatically or a way to calc...
[ "c++", "dll", "native" ]
9
7
653
2
0
2008-10-08T07:12:49.060000
2008-10-08T07:25:37.270000
181,630
181,802
What's a good and stable C++ tree implementation?
I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that is stl compatible if at all possible. For the record, I've written tree algorithms many times before, and I know it can be fun, but I want to be pragmatic and lazy if at all possible. So an actual link to a working solution is the ...
I don't know about your requirements, but wouldn't you be better off with a graph (implementations for example in Boost Graph ) if you're interested mostly in the structure and not so much in tree-specific benefits like speed through balancing? You can 'emulate' a tree through a graph, and maybe it'll be (conceptually)...
What's a good and stable C++ tree implementation? I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that is stl compatible if at all possible. For the record, I've written tree algorithms many times before, and I know it can be fun, but I want to be pragmatic and lazy if at all possibl...
TITLE: What's a good and stable C++ tree implementation? QUESTION: I'm wondering if anyone can recommend a good C++ tree implementation, hopefully one that is stl compatible if at all possible. For the record, I've written tree algorithms many times before, and I know it can be fun, but I want to be pragmatic and lazy...
[ "c++", "tree", "graph-theory" ]
49
26
82,576
6
0
2008-10-08T07:13:49.167000
2008-10-08T08:18:55.837000
181,643
181,663
Wait window in a windows application
I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below Form2 f = new Form2(); f.Show(); Thread.Sleep(2000); f...
That's because you probably do some lengthy operation in the same thread (UI thread). You should execute your code in a new thread (see Thread class) or at least call Application.DoEvents periodically from inside your lengthy operation to update the UI.
Wait window in a windows application I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below Form2 f = new For...
TITLE: Wait window in a windows application QUESTION: I basically need to show a wait window to the user. For this i have put two seperate window forms in the application. the first form is the main form with a button. The second one is a empty one with just a label text. On click of the button in Form1 i do the below...
[ "c#", ".net", ".net-2.0" ]
1
3
12,968
6
0
2008-10-08T07:20:09.043000
2008-10-08T07:24:53.967000