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
149,585
399,710
BeautifulSoup's Python 3 compatibility
Does BeautifulSoup work with Python 3? If not, how soon will there be a port? Will there be a port at all? Google doesn't turn up anything to me (Maybe it's 'coz I'm looking for the wrong thing?)
About two months after I asked this question, a port has been released: http://groups.google.com/group/beautifulsoup/browse_thread/thread/f24882cc17a0625e It'll bet BS working, but that's about it. Not yet tried it though.
BeautifulSoup's Python 3 compatibility Does BeautifulSoup work with Python 3? If not, how soon will there be a port? Will there be a port at all? Google doesn't turn up anything to me (Maybe it's 'coz I'm looking for the wrong thing?)
TITLE: BeautifulSoup's Python 3 compatibility QUESTION: Does BeautifulSoup work with Python 3? If not, how soon will there be a port? Will there be a port at all? Google doesn't turn up anything to me (Maybe it's 'coz I'm looking for the wrong thing?) ANSWER: About two months after I asked this question, a port has b...
[ "python", "python-3.x", "beautifulsoup", "porting" ]
20
6
9,517
6
0
2008-09-29T16:49:50.667000
2008-12-30T07:19:47.197000
149,593
150,156
How do you define a type in a Linq 2 SQL mapping?
I'm trying to do my linq 2 sql objects manually, so I have the following code: var mapping = XmlMappingSource.FromXml(xml); using (DataContext ctx = new DataContext(conn_string, mapping)) { list = ctx.GetTable ().ToList(); } and the XML looks like this: this returns the following error: System.InvalidOperationExceptio...
I suspect the issue is here: Member="AchievementTypeId" For an association, you should be linking a typed member - for example you might have a property called "AchievementType" (of type AchievementType), and have Member="AchievementType". For example, in Northwind, linking Customer and Order shows (for Order): The Sql...
How do you define a type in a Linq 2 SQL mapping? I'm trying to do my linq 2 sql objects manually, so I have the following code: var mapping = XmlMappingSource.FromXml(xml); using (DataContext ctx = new DataContext(conn_string, mapping)) { list = ctx.GetTable ().ToList(); } and the XML looks like this: this returns th...
TITLE: How do you define a type in a Linq 2 SQL mapping? QUESTION: I'm trying to do my linq 2 sql objects manually, so I have the following code: var mapping = XmlMappingSource.FromXml(xml); using (DataContext ctx = new DataContext(conn_string, mapping)) { list = ctx.GetTable ().ToList(); } and the XML looks like thi...
[ "c#", "linq-to-sql", ".net-3.5" ]
0
1
1,221
1
0
2008-09-29T16:52:09.273000
2008-09-29T19:04:24.307000
149,596
149,759
Multiple platform development
I was currently developing a desktop application in C# using mono and testing in SuSE and Windows. The concept doesn't matter much, but it is a "web lint" program that will scan a web site and return possible issues with security and/or cross browser compatibility. However, I want to be able to offer binaries for multi...
C# and Mono is probably cross-platform enough for most desktop environments. The trick will be the "mobile platform" requirement. Mobile operating systems are wildly diverse and there's not a lot you can do to generalize. Some have Java, like the Blackberry. C# may get you onto Windows Mobile-based platforms. iPhones d...
Multiple platform development I was currently developing a desktop application in C# using mono and testing in SuSE and Windows. The concept doesn't matter much, but it is a "web lint" program that will scan a web site and return possible issues with security and/or cross browser compatibility. However, I want to be ab...
TITLE: Multiple platform development QUESTION: I was currently developing a desktop application in C# using mono and testing in SuSE and Windows. The concept doesn't matter much, but it is a "web lint" program that will scan a web site and return possible issues with security and/or cross browser compatibility. Howeve...
[ "cross-platform" ]
2
2
620
7
0
2008-09-29T16:52:41.283000
2008-09-29T17:27:52.743000
149,600
150,028
Php code formatter / beautifier and php beautification in general
Do you know any good tools for nicely formatting messy php code? Preferably a script for Aptana/Eclipse, but a standalone tool will do too.
PHP Code Beautifier is a useful free tool that should do what you're after, although their download page does require an account to be created. The tool has been declined into 3 versions: A GUI version which allow to process file visually. A command line version which allow to be batched or integrated with other tools ...
Php code formatter / beautifier and php beautification in general Do you know any good tools for nicely formatting messy php code? Preferably a script for Aptana/Eclipse, but a standalone tool will do too.
TITLE: Php code formatter / beautifier and php beautification in general QUESTION: Do you know any good tools for nicely formatting messy php code? Preferably a script for Aptana/Eclipse, but a standalone tool will do too. ANSWER: PHP Code Beautifier is a useful free tool that should do what you're after, although th...
[ "php", "editor" ]
36
13
41,500
14
0
2008-09-29T16:53:53.607000
2008-09-29T18:36:01.800000
149,609
149,629
C# "Using" Syntax
Does the using catch the exception or throw it? i.e. using (StreamReader rdr = File.OpenText("file.txt")) { //do stuff } If the streamreader throws an exception is it caught by using or thrown so the calling function can handle it?
using statements do not eat exceptions. All "Using" does is scope your object to the using block, and automatically calls Dispose() on the object when it leaves the block. There is a gotcha though, if a thread is forcefully aborted by an outside source, it is possible that Dispose will never be called.
C# "Using" Syntax Does the using catch the exception or throw it? i.e. using (StreamReader rdr = File.OpenText("file.txt")) { //do stuff } If the streamreader throws an exception is it caught by using or thrown so the calling function can handle it?
TITLE: C# "Using" Syntax QUESTION: Does the using catch the exception or throw it? i.e. using (StreamReader rdr = File.OpenText("file.txt")) { //do stuff } If the streamreader throws an exception is it caught by using or thrown so the calling function can handle it? ANSWER: using statements do not eat exceptions. All...
[ "c#", "exception", "using", "using-statement" ]
51
36
34,706
11
0
2008-09-29T16:55:23.743000
2008-09-29T16:58:43.423000
149,617
158,693
How could I guess a checksum algorithm?
Let's assume that I have some packets with a 16-bit checksum at the end. I would like to guess which checksum algorithm is used. For a start, from dump data I can see that one byte change in the packet's payload totally changes the checksum, so I can assume that it isn't some kind of simple XOR or sum. Then I tried sev...
There are a number of variables to consider for a CRC: Polynomial No of bits (16 or 32) Normal (LSB first) or Reverse (MSB first) Initial value How the final value is manipulated (e.g. subtracted from 0xffff), or is a constant value Typical CRCs: LRC: Polynomial=0x81; 8 bits; Normal; Initial=0; Final=as calculated CRC1...
How could I guess a checksum algorithm? Let's assume that I have some packets with a 16-bit checksum at the end. I would like to guess which checksum algorithm is used. For a start, from dump data I can see that one byte change in the packet's payload totally changes the checksum, so I can assume that it isn't some kin...
TITLE: How could I guess a checksum algorithm? QUESTION: Let's assume that I have some packets with a 16-bit checksum at the end. I would like to guess which checksum algorithm is used. For a start, from dump data I can see that one byte change in the packet's payload totally changes the checksum, so I can assume that...
[ "checksum", "crc" ]
19
21
18,658
4
0
2008-09-29T16:56:37.127000
2008-10-01T17:14:13.697000
149,627
149,650
SQL clone record with a unique index
Is there a clean way of cloning a record in SQL that has an index(auto increment). I want to clone all the fields except the index. I currently have to enumerate every field, and use that in an insert select, and I would rather not explicitly list all of the fields, as they may change over time.
Not unless you want to get into dynamic SQL. Since you wrote "clean", I'll assume not. Edit: Since he asked for a dynamic SQL example, I'll take a stab at it. I'm not connected to any databases at the moment, so this is off the top of my head and will almost certainly need revision. But hopefully it captures the spirit...
SQL clone record with a unique index Is there a clean way of cloning a record in SQL that has an index(auto increment). I want to clone all the fields except the index. I currently have to enumerate every field, and use that in an insert select, and I would rather not explicitly list all of the fields, as they may chan...
TITLE: SQL clone record with a unique index QUESTION: Is there a clean way of cloning a record in SQL that has an index(auto increment). I want to clone all the fields except the index. I currently have to enumerate every field, and use that in an insert select, and I would rather not explicitly list all of the fields...
[ "sql", "mysql", "database" ]
2
1
3,077
6
0
2008-09-29T16:58:21.020000
2008-09-29T17:01:19.470000
149,632
149,907
Way to Stop a Windows Service when CanStop is set to False (C#)
Ok so part two of I have no will power experiment is: Summary Question - Is there a way to set the CanStop property on a windows service dynamically? Whole Spiel - I have a service that is currently checking and killing processes (IE Games) I have told it to if it's day I'm not allowed. Great. I set the CanStop to fals...
The "CanStop" is a attribute of the services registration in the windows service control manager. You can't change it mid-stride. And, of course, if you're smart enough to write your own service then you're smart enough to bring up task-man and simply kill the service process. CanStop will not prevent you from pulling ...
Way to Stop a Windows Service when CanStop is set to False (C#) Ok so part two of I have no will power experiment is: Summary Question - Is there a way to set the CanStop property on a windows service dynamically? Whole Spiel - I have a service that is currently checking and killing processes (IE Games) I have told it ...
TITLE: Way to Stop a Windows Service when CanStop is set to False (C#) QUESTION: Ok so part two of I have no will power experiment is: Summary Question - Is there a way to set the CanStop property on a windows service dynamically? Whole Spiel - I have a service that is currently checking and killing processes (IE Game...
[ "c#", "windows", "service" ]
2
3
4,676
2
0
2008-09-29T16:59:04.467000
2008-09-29T18:00:58.297000
149,639
150,920
SQL to reorder nodes in a hierarchy
I've got a 'task list' database that uses the adjacency list model (see below) so each 'task' can have unlimited sub-tasks. The table has an 'TaskOrder' column so everything renders in the correct order on a treeview. Is there an SQL statement (MS-SQL 2005) that will select all the child nodes for a specified parent an...
Couple of different ways... Since the TaskOrder is scoped by parent id, it's not terribly difficult to gather it. In SQL Server, I'd put a trigger on delete that decrements all the ones 'higher' than the one you deleted, thereby closing the gap (pseudocode follows): CREATE TRIGGER ON yourtable FOR DELETE AS UPDATE Task...
SQL to reorder nodes in a hierarchy I've got a 'task list' database that uses the adjacency list model (see below) so each 'task' can have unlimited sub-tasks. The table has an 'TaskOrder' column so everything renders in the correct order on a treeview. Is there an SQL statement (MS-SQL 2005) that will select all the c...
TITLE: SQL to reorder nodes in a hierarchy QUESTION: I've got a 'task list' database that uses the adjacency list model (see below) so each 'task' can have unlimited sub-tasks. The table has an 'TaskOrder' column so everything renders in the correct order on a treeview. Is there an SQL statement (MS-SQL 2005) that wil...
[ "sql", "sql-server", "hierarchy", "adjacency-list-model" ]
3
1
1,687
5
0
2008-09-29T16:59:47.820000
2008-09-29T22:04:20.287000
149,646
150,302
Best way to make NSRunLoop wait for a flag to be set?
In the Apple documentation for NSRunLoop there is sample code demonstrating suspending execution while waiting for a flag to be set by something else. BOOL shouldKeepRunning = YES; // global NSRunLoop *theRL = [NSRunLoop currentRunLoop]; while (shouldKeepRunning && [theRL runMode:NSDefaultRunLoopMode beforeDate:[NSDate...
Runloops can be a bit of a magic box where stuff just happens. Basically you're telling the runloop to go process some events and then return. OR return if it doesn't process any events before the timeout is hit. With 0.1 second timeout, you're htting the timeout more often than not. The runloop fires, doesn't process ...
Best way to make NSRunLoop wait for a flag to be set? In the Apple documentation for NSRunLoop there is sample code demonstrating suspending execution while waiting for a flag to be set by something else. BOOL shouldKeepRunning = YES; // global NSRunLoop *theRL = [NSRunLoop currentRunLoop]; while (shouldKeepRunning && ...
TITLE: Best way to make NSRunLoop wait for a flag to be set? QUESTION: In the Apple documentation for NSRunLoop there is sample code demonstrating suspending execution while waiting for a flag to be set by something else. BOOL shouldKeepRunning = YES; // global NSRunLoop *theRL = [NSRunLoop currentRunLoop]; while (sho...
[ "objective-c", "cocoa", "macos" ]
41
37
52,425
7
0
2008-09-29T17:00:58.160000
2008-09-29T19:40:03.957000
149,690
149,770
Search for text between delimiters in MySQL
I am trying to extract a certain part of a column that is between delimiters. e.g. find foo in the following test 'esf:foo: bar So in the above I'd want to return foo, but all the regexp functions only return true|false, is there a way to do this in MySQL
Here ya go, bud: SELECT SUBSTR(column, LOCATE(':',column)+1, (CHAR_LENGTH(column) - LOCATE(':',REVERSE(column)) - LOCATE(':',column))) FROM table Yea, no clue why you're doing this, but this will do the trick. By performing a LOCATE, we can find the first ':'. To find the last ':', there's no reverse LOCATE, so we have...
Search for text between delimiters in MySQL I am trying to extract a certain part of a column that is between delimiters. e.g. find foo in the following test 'esf:foo: bar So in the above I'd want to return foo, but all the regexp functions only return true|false, is there a way to do this in MySQL
TITLE: Search for text between delimiters in MySQL QUESTION: I am trying to extract a certain part of a column that is between delimiters. e.g. find foo in the following test 'esf:foo: bar So in the above I'd want to return foo, but all the regexp functions only return true|false, is there a way to do this in MySQL A...
[ "mysql" ]
12
22
25,706
11
0
2008-09-29T17:08:28.047000
2008-09-29T17:32:05.747000
149,697
149,733
Best strategy to implement stackoverflow style badges system in asp.net mvc
I was wondering what would be the best strategy to implement a badges system using asp.net mvc. The one that stackoverflow has is pretty interesting. What do you suggest? I guess I need to clarify the question a bit. The problem would be the different criteria for earning every badges. How do make that logic extensible...
I'd do it purely in T-SQL, and set up a SQL job that runs periodically (Jeff did it using C#, and has a goofy system where it runs the process based on a page request). Basicly, in your SQL Job, scan your member tables and calculate if anyone is qualified for a badge, if so, update the badge table(s). Then in the front...
Best strategy to implement stackoverflow style badges system in asp.net mvc I was wondering what would be the best strategy to implement a badges system using asp.net mvc. The one that stackoverflow has is pretty interesting. What do you suggest? I guess I need to clarify the question a bit. The problem would be the di...
TITLE: Best strategy to implement stackoverflow style badges system in asp.net mvc QUESTION: I was wondering what would be the best strategy to implement a badges system using asp.net mvc. The one that stackoverflow has is pretty interesting. What do you suggest? I guess I need to clarify the question a bit. The probl...
[ "asp.net-mvc", "badge" ]
7
4
1,365
1
0
2008-09-29T17:11:08.883000
2008-09-29T17:21:38.907000
149,718
149,734
Pitfalls/gotchas of ClickOnce/smart-client deployment in .NET
I have several.NET Windows Forms applications that I'm preparing to convert into a ClickOnce /smart-client deployment scenario. I've read the isn't-this-great tutorials, but are there pitfalls or "gotchas" that I should be aware of? There are several minor applications used off and on, but the main application is in C#...
Here are a few that I am aware of. Can't put an icon on the desktop. You can now. I can't install for all users. I need to jump through hoops to move the deployment to a different server. It is not a problem if you are developing internally, and the users can see the server that you are publishing to or if you are depl...
Pitfalls/gotchas of ClickOnce/smart-client deployment in .NET I have several.NET Windows Forms applications that I'm preparing to convert into a ClickOnce /smart-client deployment scenario. I've read the isn't-this-great tutorials, but are there pitfalls or "gotchas" that I should be aware of? There are several minor a...
TITLE: Pitfalls/gotchas of ClickOnce/smart-client deployment in .NET QUESTION: I have several.NET Windows Forms applications that I'm preparing to convert into a ClickOnce /smart-client deployment scenario. I've read the isn't-this-great tutorials, but are there pitfalls or "gotchas" that I should be aware of? There a...
[ ".net", "winforms", "clickonce", "smartclient" ]
31
12
17,917
11
0
2008-09-29T17:16:20.337000
2008-09-29T17:21:47.097000
149,753
149,778
Programs don't work on Vista and Server 2008
Many, if not all, of my old VC++ 6.0 MFC apps don't work in Vista and Server 2008. I had that migration was a problem, but now it's my problem:( How do I go about making these things work? Is that possible? I've searched, but is there some repository of knowledge on this subject? edit: Compatibility mode seems to work.
Without recompiling, have you tried setting the compatibility mode on the program to Windows 98 or ME?
Programs don't work on Vista and Server 2008 Many, if not all, of my old VC++ 6.0 MFC apps don't work in Vista and Server 2008. I had that migration was a problem, but now it's my problem:( How do I go about making these things work? Is that possible? I've searched, but is there some repository of knowledge on this sub...
TITLE: Programs don't work on Vista and Server 2008 QUESTION: Many, if not all, of my old VC++ 6.0 MFC apps don't work in Vista and Server 2008. I had that migration was a problem, but now it's my problem:( How do I go about making these things work? Is that possible? I've searched, but is there some repository of kno...
[ "mfc", "windows-vista", "windows-server-2008", "visual-c++-6", "code-migration" ]
1
1
509
3
0
2008-09-29T17:26:42.793000
2008-09-29T17:33:24.820000
149,763
149,802
How do you determine if WPF is using Hardware or Software Rendering?
I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering. I seem to recall a call to determine this, but can't lay my hands on it right now. Also, is there an easy, code based way to force one rendering pipeline over the other?
Check RenderCapability.Tier Graphics Rendering Tiers RenderCapability Class [ UPDATE ] RenderCapability.IsPixelShaderVersionSupported - Gets a value that indicates whether the specified pixel shader version is supported. RenderCapability.IsShaderEffectSoftwareRenderingSupported - Gets a value that indicates whether the...
How do you determine if WPF is using Hardware or Software Rendering? I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering. I seem to recall a call to determine this, but can't lay my hands on it right now. Also, is there an easy, code...
TITLE: How do you determine if WPF is using Hardware or Software Rendering? QUESTION: I'm benchmarking a WPF application on various platforms and I need an easy way to determine if WPF is using hardware or software rendering. I seem to recall a call to determine this, but can't lay my hands on it right now. Also, is t...
[ "wpf", "rendering", "pipeline" ]
35
40
34,462
7
0
2008-09-29T17:29:00.090000
2008-09-29T17:39:21.500000
149,772
149,799
How to use GROUP BY to concatenate strings in MySQL?
Basically the question is how to get from this: foo_id foo_name 1 A 1 B 2 C to this: foo_id foo_name 1 A B 2 C
SELECT id, GROUP_CONCAT(name SEPARATOR ' ') FROM table GROUP BY id; https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.html#function_group-concat From the link above, GROUP_CONCAT: This function returns a string result with the concatenated non-NULL values from a group. It returns NULL if there are no non-NULL...
How to use GROUP BY to concatenate strings in MySQL? Basically the question is how to get from this: foo_id foo_name 1 A 1 B 2 C to this: foo_id foo_name 1 A B 2 C
TITLE: How to use GROUP BY to concatenate strings in MySQL? QUESTION: Basically the question is how to get from this: foo_id foo_name 1 A 1 B 2 C to this: foo_id foo_name 1 A B 2 C ANSWER: SELECT id, GROUP_CONCAT(name SEPARATOR ' ') FROM table GROUP BY id; https://dev.mysql.com/doc/refman/8.0/en/aggregate-functions.h...
[ "sql", "mysql", "string", "aggregate", "concatenation" ]
453
673
363,729
6
0
2008-09-29T17:32:45.493000
2008-09-29T17:38:37.057000
149,776
149,842
Using respond_to for graceful degradation with ajax in RoR 2.x
I was going through the AWDR book on web development with ruby on rails and one of the issues with the old code was it didn't use respond_to to make sure the view used would be the javascript view. Now in some updated examples I've seen people mention they later, when implementing graceful degradation, use request.xhr?...
Well you can refactor like this: def function basic_stuff # executed regardless of the mime types accepted respond_to do |format| format.html do user_redirect end end # will fall back rendering the default view - which you should ensure will be js end request.xhr? looks at the request‘s X-Requested-With header (to see ...
Using respond_to for graceful degradation with ajax in RoR 2.x I was going through the AWDR book on web development with ruby on rails and one of the issues with the old code was it didn't use respond_to to make sure the view used would be the javascript view. Now in some updated examples I've seen people mention they ...
TITLE: Using respond_to for graceful degradation with ajax in RoR 2.x QUESTION: I was going through the AWDR book on web development with ruby on rails and one of the issues with the old code was it didn't use respond_to to make sure the view used would be the javascript view. Now in some updated examples I've seen pe...
[ "ruby-on-rails", "ruby", "ajax", "graceful-degradation" ]
3
2
3,136
1
0
2008-09-29T17:33:15.587000
2008-09-29T17:47:20.077000
149,777
149,845
what's the fundamental difference between a jsp taglib vs including a jsp page?
i have several common elements (components), that will generate some html. it seems my options are creating a taglib, or just putting that logic into a jsp page and including the jsp. whats the difference? positives vs negatives?
When you use a taglib the container typically: Writes and calls a helper method from within _jspService Inside the helper method an instance of the tag class is created and standard methods are called (setParent(), doStartTag(), doEndTag() etc...) This keeps all the code within the same resource (the request does not g...
what's the fundamental difference between a jsp taglib vs including a jsp page? i have several common elements (components), that will generate some html. it seems my options are creating a taglib, or just putting that logic into a jsp page and including the jsp. whats the difference? positives vs negatives?
TITLE: what's the fundamental difference between a jsp taglib vs including a jsp page? QUESTION: i have several common elements (components), that will generate some html. it seems my options are creating a taglib, or just putting that logic into a jsp page and including the jsp. whats the difference? positives vs neg...
[ "jsp", "taglib", "jspinclude" ]
8
4
3,227
4
0
2008-09-29T17:33:15.663000
2008-09-29T17:48:29.420000
149,784
149,792
How do you copy a record in a SQL table but swap out the unique id of the new row?
This question comes close to what I need, but my scenario is slightly different. The source table and destination table are the same and the primary key is a uniqueidentifier (guid). When I try this: insert into MyTable select * from MyTable where uniqueId = @Id; I obviously get a primary key constraint violation, sinc...
Try this: insert into MyTable(field1, field2, id_backup) select field1, field2, uniqueId from MyTable where uniqueId = @Id; Any fields not specified should receive their default value (which is usually NULL when not defined).
How do you copy a record in a SQL table but swap out the unique id of the new row? This question comes close to what I need, but my scenario is slightly different. The source table and destination table are the same and the primary key is a uniqueidentifier (guid). When I try this: insert into MyTable select * from MyT...
TITLE: How do you copy a record in a SQL table but swap out the unique id of the new row? QUESTION: This question comes close to what I need, but my scenario is slightly different. The source table and destination table are the same and the primary key is a uniqueidentifier (guid). When I try this: insert into MyTable...
[ "sql", "sql-server", "sql-server-2005", "t-sql" ]
156
225
222,816
11
0
2008-09-29T17:35:04.833000
2008-09-29T17:37:23.843000
149,796
150,305
Is there a disadvantage to blindly using INSERT in MySQL?
Often I want to add a value to a table or update the value if its key already exists. This can be accomplished in several ways, assuming a primary or unique key is set on the 'user_id' and 'pref_key' columns in the example: 1. Blind insert, update if receiving a duplicate key error: // Try to insert as a new value INSE...
Will there be concurrent INSERTs to these rows? DELETEs? "ON DUPLICATE" sounds great (the behavior is just what you want) provided that you're not concerned about portability to non-MySQL databases. The "blind insert" seems reasonable and robust provided that rows are never deleted. (If the INSERT case fails because th...
Is there a disadvantage to blindly using INSERT in MySQL? Often I want to add a value to a table or update the value if its key already exists. This can be accomplished in several ways, assuming a primary or unique key is set on the 'user_id' and 'pref_key' columns in the example: 1. Blind insert, update if receiving a...
TITLE: Is there a disadvantage to blindly using INSERT in MySQL? QUESTION: Often I want to add a value to a table or update the value if its key already exists. This can be accomplished in several ways, assuming a primary or unique key is set on the 'user_id' and 'pref_key' columns in the example: 1. Blind insert, upd...
[ "sql", "mysql" ]
3
2
1,495
9
0
2008-09-29T17:37:58.413000
2008-09-29T19:40:49.383000
149,800
149,926
Multi-line label in RadioButton component (AS3)
I'm making a small quiz-application in Flash (and ActionScript 3). Decided to use the RadioButton-component for radiobuttons, but I'm having some problems getting the word-wrapping to work. The code for creating the button can be found below. _button = new RadioButton(); _button.setStyle("textFormat", _format); _button...
Two possibilities: width should be in pixels, not in characters. In addition, don't forget that the button itself uses up some of the width. If you can't get it to work, instead of banging your head on it, might want to just create the label separately, either a simple TextField, or using a Label component. Slightly mo...
Multi-line label in RadioButton component (AS3) I'm making a small quiz-application in Flash (and ActionScript 3). Decided to use the RadioButton-component for radiobuttons, but I'm having some problems getting the word-wrapping to work. The code for creating the button can be found below. _button = new RadioButton(); ...
TITLE: Multi-line label in RadioButton component (AS3) QUESTION: I'm making a small quiz-application in Flash (and ActionScript 3). Decided to use the RadioButton-component for radiobuttons, but I'm having some problems getting the word-wrapping to work. The code for creating the button can be found below. _button = n...
[ "flash", "actionscript-3", "radio-button", "word-wrap" ]
2
2
10,307
3
0
2008-09-29T17:39:03.107000
2008-09-29T18:04:55.230000
149,821
149,859
Use jQuery to send Excel data using AJAX
I have the following function that is pulling data from a database. The ajax call is working correctly. How can I send the tab delimited data in my success function to the user? Setting the contect type to "application/vnd.ms-excel" didn't work. The alert on success shows the correctly formatted data. function SendToEx...
AJAX is... the wrong choice. Redirect the user to a server resource that will send the data down with the proper MIME type, and let the browser figure out what to do with it.
Use jQuery to send Excel data using AJAX I have the following function that is pulling data from a database. The ajax call is working correctly. How can I send the tab delimited data in my success function to the user? Setting the contect type to "application/vnd.ms-excel" didn't work. The alert on success shows the co...
TITLE: Use jQuery to send Excel data using AJAX QUESTION: I have the following function that is pulling data from a database. The ajax call is working correctly. How can I send the tab delimited data in my success function to the user? Setting the contect type to "application/vnd.ms-excel" didn't work. The alert on su...
[ "jquery", "ajax", "excel" ]
37
13
84,586
4
0
2008-09-29T17:42:19.573000
2008-09-29T17:51:37.197000
149,823
150,288
Accessing a dynamitcally added buttoncolumn's (in a Datagrid) click event. C#/ASP.NET
When I dynamically create a Datagrid and add in a new buttoncolumn how do I access the buttoncolumn_click event? Thanks.
protected void Page_Load(object sender, EventArgs e) { DataGrid dg = new DataGrid(); dg.GridLines = GridLines.Both; dg.Columns.Add(new ButtonColumn { CommandName = "add", HeaderText = "Event Details", Text = "Details", ButtonType = ButtonColumnType.PushButton }); dg.DataSource = getDataTable(); dg.DataBind(); dg.It...
Accessing a dynamitcally added buttoncolumn's (in a Datagrid) click event. C#/ASP.NET When I dynamically create a Datagrid and add in a new buttoncolumn how do I access the buttoncolumn_click event? Thanks.
TITLE: Accessing a dynamitcally added buttoncolumn's (in a Datagrid) click event. C#/ASP.NET QUESTION: When I dynamically create a Datagrid and add in a new buttoncolumn how do I access the buttoncolumn_click event? Thanks. ANSWER: protected void Page_Load(object sender, EventArgs e) { DataGrid dg = new DataGrid(); ...
[ "c#", "asp.net" ]
2
3
3,570
3
0
2008-09-29T17:42:37.810000
2008-09-29T19:32:46.813000
149,825
149,867
What the heck does loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource)); do?
I ran across the following code in Ely Greenfield's SuperImage from his Book component - I understand loader.load() but what does the rest of do? loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource)); It looks like some kind of crazy inline if statement but still, I'm a little preplexed. And if it...
? is called the 'ternary operator' and it's basic use is: (expression)? (evaluate to this if expression is true): (evaluate to this otherwise); In this case, if newSource is a URLRequest, loader.load will be passed newSource directly, otherwise it will be passed a new URLRequest built from newSource. The ternary operat...
What the heck does loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource)); do? I ran across the following code in Ely Greenfield's SuperImage from his Book component - I understand loader.load() but what does the rest of do? loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource)...
TITLE: What the heck does loader.load((newSource is URLRequest)? newSource:new URLRequest(newSource)); do? QUESTION: I ran across the following code in Ely Greenfield's SuperImage from his Book component - I understand loader.load() but what does the rest of do? loader.load((newSource is URLRequest)? newSource:new URL...
[ "apache-flex", "flash", "actionscript-3" ]
0
11
1,188
4
0
2008-09-29T17:42:55.687000
2008-09-29T17:53:17.347000
149,827
151,007
Preferred path to applications on OSX?
I want to be able to run a text editor from my app, as given by the user in the TEXT_EDITOR environment variable. Now, assuming there is nothing in that variable, I want to default to the TextEdit program that ships with OSX. Is it kosher to hardcode /Applications/TextEdit.app/Contents/MacOS/TextEdit into my app, or is...
In your second edit it makes it sound like you just want to get the path to TextEdit, this can be done easily by using NSWorkspace method absolutePathForAppBundleWithIdentifier: NSString *path = [[NSWorkspace sharedWorkspace] absolutePathForAppBundleWithIdentifier:@"com.apple.TextEdit"];
Preferred path to applications on OSX? I want to be able to run a text editor from my app, as given by the user in the TEXT_EDITOR environment variable. Now, assuming there is nothing in that variable, I want to default to the TextEdit program that ships with OSX. Is it kosher to hardcode /Applications/TextEdit.app/Con...
TITLE: Preferred path to applications on OSX? QUESTION: I want to be able to run a text editor from my app, as given by the user in the TEXT_EDITOR environment variable. Now, assuming there is nothing in that variable, I want to default to the TextEdit program that ships with OSX. Is it kosher to hardcode /Application...
[ "macos", "text-editor" ]
4
4
1,448
5
0
2008-09-29T17:43:34.877000
2008-09-29T22:31:37.193000
149,844
150,230
How do you write Valid XHTML 1.0 Strict code when you are using javascript to fill an element that requires a child?
I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation error. I'm including certain badges from various services in the site that provide their own API and code for inclusion on an external sit...
The following fragment is valid XHTML and does the job: Twitter Updates
How do you write Valid XHTML 1.0 Strict code when you are using javascript to fill an element that requires a child? I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation error. I'm including ...
TITLE: How do you write Valid XHTML 1.0 Strict code when you are using javascript to fill an element that requires a child? QUESTION: I'm running my site through the W3C's validator trying to get it to validate as XHTML 1.0 Strict and I've gotten down to a particularly sticky (at least in my experience) validation err...
[ "javascript", "validation", "twitter", "w3c-validation", "xhtml-1.0-strict" ]
0
7
2,374
6
0
2008-09-29T17:48:23.523000
2008-09-29T19:20:56.577000
149,848
149,854
Classic ASP SQL Injection Protection
What is a strong way to protect against sql injection for a classic asp app? FYI I am using it with an access DB. (I didnt write the app)
Stored Procedures and/or prepared statements: https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-sql-injection-attacks Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? Catching SQL Injection and other Malicious Web Requests With Access DB, y...
Classic ASP SQL Injection Protection What is a strong way to protect against sql injection for a classic asp app? FYI I am using it with an access DB. (I didnt write the app)
TITLE: Classic ASP SQL Injection Protection QUESTION: What is a strong way to protect against sql injection for a classic asp app? FYI I am using it with an access DB. (I didnt write the app) ANSWER: Stored Procedures and/or prepared statements: https://stackoverflow.com/questions/1973/what-is-the-best-way-to-avoid-s...
[ "security", "ms-access", "asp-classic", "sql-injection" ]
36
28
57,708
8
0
2008-09-29T17:49:01.353000
2008-09-29T17:50:34.297000
149,851
149,880
.NET Log Soap Request on Client
I'm consuming a third party.NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on.NET 2.0 without the use of WCF or WSE.
If it's for debugging purposes I'd just configure the web request to use a proxy and send the entire request though fiddler ( http://www.fiddlertool.com ) then you can see exactly what's getting transmitted over the wire.
.NET Log Soap Request on Client I'm consuming a third party.NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on.NET 2.0 without the use of WCF or WSE.
TITLE: .NET Log Soap Request on Client QUESTION: I'm consuming a third party.NET WebService in my client application. For debugging purposes I want to capture the SOAP requests that are being sent from my server. How would I go about doing this? This is being done on.NET 2.0 without the use of WCF or WSE. ANSWER: If ...
[ ".net", "web-services", "logging", ".net-2.0" ]
8
5
21,707
6
0
2008-09-29T17:49:47.560000
2008-09-29T17:56:05.187000
149,874
150,470
Issues working with JSF redirect and WebTrends
On our new platform we are utilizing JSF. Our WebTrends tags are not reflecting the proper page title on this platform. It currently is displaying the name of the users previous page instead of the current page. We are making use of the JSF Navigation rule in which we have some "< redirect />" tags. Has anyone experien...
We solved this problem by using the webtrends javascript API to inject the correct page title into the page (instead of relying on the javascript to read the correct URL from the page). Since JSF mucks with your URLs, there really isn't much else you can do. The redirect tags will work, but you have to watch your manag...
Issues working with JSF redirect and WebTrends On our new platform we are utilizing JSF. Our WebTrends tags are not reflecting the proper page title on this platform. It currently is displaying the name of the users previous page instead of the current page. We are making use of the JSF Navigation rule in which we have...
TITLE: Issues working with JSF redirect and WebTrends QUESTION: On our new platform we are utilizing JSF. Our WebTrends tags are not reflecting the proper page title on this platform. It currently is displaying the name of the users previous page instead of the current page. We are making use of the JSF Navigation rul...
[ "jsp", "jsf", "webtrends" ]
0
0
1,067
1
0
2008-09-29T17:55:03.117000
2008-09-29T20:20:44.497000
149,876
151,548
How to transfer sql encrypted data between SQL Server 2005 databases?
I have an existing SQL Server 2005 database that contains data encrypted using a Symmetric key. The symmetric key is opened using a password. I am working on an upgrade to the front end applications that use this database, which include adding dozens of new tables, stored procedures, UDFs, etc. and dozens of modificati...
The Symmetric keys you are referring to are Database Master Keys (DMKs). They are held at the Database level, so a backup/restore to another SQL server should work OK (with the caveat of differing service accounts, which this thread alludes to) Before you do anything make sure you have a backup of your keys (presumably...
How to transfer sql encrypted data between SQL Server 2005 databases? I have an existing SQL Server 2005 database that contains data encrypted using a Symmetric key. The symmetric key is opened using a password. I am working on an upgrade to the front end applications that use this database, which include adding dozens...
TITLE: How to transfer sql encrypted data between SQL Server 2005 databases? QUESTION: I have an existing SQL Server 2005 database that contains data encrypted using a Symmetric key. The symmetric key is opened using a password. I am working on an upgrade to the front end applications that use this database, which inc...
[ "sql-server-2005", "encryption" ]
7
3
5,567
1
0
2008-09-29T17:55:16.437000
2008-09-30T02:30:38.027000
149,877
150,562
How Do I Profile the ADO.NET Connection Pool?
I'm profiling a ASP.NET web application. I believe it is very database connection intensive (excessive use of the ADO.NET connection pool). How to I tell w/out debugging how many times it is going to the pool and on average how many connections are available in the pool? Are there counters that will give me this info i...
Look at ADO.NET performance counters: http://msdn.microsoft.com/en-us/library/ms254503.aspx
How Do I Profile the ADO.NET Connection Pool? I'm profiling a ASP.NET web application. I believe it is very database connection intensive (excessive use of the ADO.NET connection pool). How to I tell w/out debugging how many times it is going to the pool and on average how many connections are available in the pool? Ar...
TITLE: How Do I Profile the ADO.NET Connection Pool? QUESTION: I'm profiling a ASP.NET web application. I believe it is very database connection intensive (excessive use of the ADO.NET connection pool). How to I tell w/out debugging how many times it is going to the pool and on average how many connections are availab...
[ "asp.net", "ado.net", "connection-pooling" ]
2
4
4,219
1
0
2008-09-29T17:55:40.807000
2008-09-29T20:46:14.360000
149,898
149,938
preconditions and exceptions
Suppose you have a method with some pre and post-conditions. Is it ok to create an exception class for each pre-condition that is not accomplished? For example: Not accomplishing pre1 means throwing a notPre1Exception instance.
Yes and no. Yes - Violating a precondition is certainly an appropriate time to throw an exception. Throwing a more specific exception will make catching that specific exception simpler. No - Declaring a new exception class for every precondition in your program/api seems way overkill. This could result in hundreds or t...
preconditions and exceptions Suppose you have a method with some pre and post-conditions. Is it ok to create an exception class for each pre-condition that is not accomplished? For example: Not accomplishing pre1 means throwing a notPre1Exception instance.
TITLE: preconditions and exceptions QUESTION: Suppose you have a method with some pre and post-conditions. Is it ok to create an exception class for each pre-condition that is not accomplished? For example: Not accomplishing pre1 means throwing a notPre1Exception instance. ANSWER: Yes and no. Yes - Violating a precon...
[ "language-agnostic", "exception", "preconditions" ]
3
4
4,235
12
0
2008-09-29T17:59:29.843000
2008-09-29T18:08:17.467000
149,909
150,132
How can I use a type with generic arguments as a constraint?
I would like to specify a constraint which is another type with a generic argument. class KeyFrame { public float Time; public T Value; } // I want any kind of Keyframe to be accepted class Timeline where T: Keyframe<*> { } But this cannot be done in c# as of yet, (and I really doubt it will ever be). Is there any ele...
Read about this from Eric Lippert's blog Basically, you have to find a way to refer to the type you want without specifying the secondary type parameter. In his post, he shows this example as a possible solution: public abstract class FooBase { private FooBase() {} // Not inheritable by anyone else public class Foo: Fo...
How can I use a type with generic arguments as a constraint? I would like to specify a constraint which is another type with a generic argument. class KeyFrame { public float Time; public T Value; } // I want any kind of Keyframe to be accepted class Timeline where T: Keyframe<*> { } But this cannot be done in c# as o...
TITLE: How can I use a type with generic arguments as a constraint? QUESTION: I would like to specify a constraint which is another type with a generic argument. class KeyFrame { public float Time; public T Value; } // I want any kind of Keyframe to be accepted class Timeline where T: Keyframe<*> { } But this cannot ...
[ "c#", "generics", "constraints" ]
2
2
572
4
0
2008-09-29T18:01:35.800000
2008-09-29T18:57:59.860000
149,932
149,960
Naming conventions for threads?
It's helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes. Is there a particular naming convention for threads in a heavily multi-threaded application that works better than another? Any guidelines? What kind of information should go into the name for a thread? ...
There's to my knowledge no standard. Over the time I've found these guidelines to be helpful: Use short names because they don't make the lines in a log file too long. Create names where the important part is at the beginning. Log viewers in a graphical user interface tend to have tables with columns, and the thread co...
Naming conventions for threads? It's helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes. Is there a particular naming convention for threads in a heavily multi-threaded application that works better than another? Any guidelines? What kind of information should...
TITLE: Naming conventions for threads? QUESTION: It's helpful to name threads so one can sort out which threads are doing what for diagnostic and debugging purposes. Is there a particular naming convention for threads in a heavily multi-threaded application that works better than another? Any guidelines? What kind of ...
[ "c#", "java", "multithreading" ]
47
44
15,356
7
0
2008-09-29T18:06:22.120000
2008-09-29T18:14:04.927000
149,937
149,946
Creating non-reverse-engineerable Java programs
Is there a way to deploy a Java program in a format that is not reverse-engineerable? I know how to convert my application into an executable JAR file, but I want to make sure that the code cannot be reverse engineered, or at least, not easily. Obfuscation of the source code doesn't count... it makes it harder to under...
You could obfuscate your JAR file with YGuard. It doesn't obfuscate your source code, but the compiled classes, so there is no problem about maintaining the code later. If you want to hide some string, you could encrypt it, making it harder to get it through looking at the source code (it is even better if you obfuscat...
Creating non-reverse-engineerable Java programs Is there a way to deploy a Java program in a format that is not reverse-engineerable? I know how to convert my application into an executable JAR file, but I want to make sure that the code cannot be reverse engineered, or at least, not easily. Obfuscation of the source c...
TITLE: Creating non-reverse-engineerable Java programs QUESTION: Is there a way to deploy a Java program in a format that is not reverse-engineerable? I know how to convert my application into an executable JAR file, but I want to make sure that the code cannot be reverse engineered, or at least, not easily. Obfuscati...
[ "java", "jar", "compilation" ]
5
12
9,776
14
0
2008-09-29T18:07:53.350000
2008-09-29T18:10:33.780000
149,939
150,013
jsp create scripting variable like jsp:usebean does
I would like to do something like /`> <% someService.methodCall(); %> where gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example /> <% someDate.getYear(); %> how do i make my own objects available as a scritping variable?
The way this is done in a Tag Library is by using a Tag Extra Info (TEI) class. You can find an example here.
jsp create scripting variable like jsp:usebean does I would like to do something like /`> <% someService.methodCall(); %> where gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example /> <% someDate.getYear(); %> how do i make my own objects available ...
TITLE: jsp create scripting variable like jsp:usebean does QUESTION: I would like to do something like /`> <% someService.methodCall(); %> where gets and instantiates a service bean and creates a scripting variable for use. similar to how jsp:usebean works for example /> <% someDate.getYear(); %> how do i make my own ...
[ "jsp", "tagfile" ]
1
3
1,153
2
0
2008-09-29T18:08:20.667000
2008-09-29T18:29:13.267000
149,956
149,996
How to determine when copy finishes in VBScript?
Does anyone know of a method to determine when a file copy completes in VBScript? I'm using the following to copy: set sa = CreateObject("Shell.Application") set zip = sa.NameSpace(saveFile) set Fol = sa.NameSpace(folderToZip) zip.copyHere (Fol.items)
Do Until zip.Items.Count = Fol.Items.Count WScript.Sleep 300 Loop When the loop finishes your copy is finished. But if you only want to copy and not zip, FSO or WMI is better. If you are zipping and want them in a file you have to create the zip-file yourself, with the right header first. Else you only get compressed f...
How to determine when copy finishes in VBScript? Does anyone know of a method to determine when a file copy completes in VBScript? I'm using the following to copy: set sa = CreateObject("Shell.Application") set zip = sa.NameSpace(saveFile) set Fol = sa.NameSpace(folderToZip) zip.copyHere (Fol.items)
TITLE: How to determine when copy finishes in VBScript? QUESTION: Does anyone know of a method to determine when a file copy completes in VBScript? I'm using the following to copy: set sa = CreateObject("Shell.Application") set zip = sa.NameSpace(saveFile) set Fol = sa.NameSpace(folderToZip) zip.copyHere (Fol.items) ...
[ "vbscript", "copy", "filesystems" ]
4
6
5,818
3
0
2008-09-29T18:13:19.500000
2008-09-29T18:21:31.757000
149,962
149,970
How to avoid a postback in JavaScript?
I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this?
Adding "return false;" to the onclick attribute of the button will prevent the automatic postback.
How to avoid a postback in JavaScript? I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this?
TITLE: How to avoid a postback in JavaScript? QUESTION: I have an ASP.NET page which has a button it it. The button click launches a modal dialog box using JavaScript. Based on the value returned by the modal dialog box, I want to proceed with, or cancel the post back that happens. How do I do this? ANSWER: Adding "r...
[ "javascript", "asp.net" ]
9
17
18,567
4
0
2008-09-29T18:14:31.540000
2008-09-29T18:15:55.250000
149,977
163,755
C# ResetBinding flip the DataGridView *Updated with example*
I had a problem that was partially solved. To explain it quickly: I have a grid binded to a complex object that require to be serialized. When the object is build back from the serialization, event like on the grid doesn't refresh the table display. Someone told me to rebuild the event once unserialize, it works! But t...
I have solve this problem by adding in the BindingList (by inheritance) a method [OnDeserialization] within I added code that add event on the OnListChange. This way when 1 property change, the whole line is refreshed.
C# ResetBinding flip the DataGridView *Updated with example* I had a problem that was partially solved. To explain it quickly: I have a grid binded to a complex object that require to be serialized. When the object is build back from the serialization, event like on the grid doesn't refresh the table display. Someone t...
TITLE: C# ResetBinding flip the DataGridView *Updated with example* QUESTION: I had a problem that was partially solved. To explain it quickly: I have a grid binded to a complex object that require to be serialized. When the object is build back from the serialization, event like on the grid doesn't refresh the table ...
[ "c#", "data-binding", "serialization", "datagridview" ]
0
0
2,583
1
0
2008-09-29T18:17:54.417000
2008-10-02T18:10:23.973000
149,995
150,009
Getting different header size by changing window size
I have a C++ program representing a TCP header as a struct: #include "stdafx.h" /* TCP HEADER 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+...
See this question: Why isn't sizeof for a struct equal to the sum of sizeof of each member?. I believe that compiler takes a hint to disable padding when you use the "unsigned int wWindow:16" syntax. Also, note that a short is not guaranteed to be 16 bits. The guarantee is that: 16 bits <= size of a short <= size of an...
Getting different header size by changing window size I have a C++ program representing a TCP header as a struct: #include "stdafx.h" /* TCP HEADER 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port | Destination Port...
TITLE: Getting different header size by changing window size QUESTION: I have a C++ program representing a TCP header as a struct: #include "stdafx.h" /* TCP HEADER 0 1 2 3 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ | Source Port ...
[ "c++", "c", "struct", "packing" ]
7
2
2,921
9
0
2008-09-29T18:21:29.230000
2008-09-29T18:28:36.500000
150,010
150,021
How do I persist a ByRef variable into .net winforms dialog form?
I am creating a "department picker" form that is going to serve as a modal popup form with many of my "primary" forms of a Winforms application. Ideally the user is going to click on an icon next to a text box that will pop up the form, they will select the department they need, and when they click OK, the dialog will ...
In such cases, I usually either Write a ShowDialog function that does what I want (e.g. return the value) or Just let the result be a property in the dialog. This is how the common file dialogs do it in the BCL. The caller must then read the property to get the result. That's fine in my opinion. You can also combine th...
How do I persist a ByRef variable into .net winforms dialog form? I am creating a "department picker" form that is going to serve as a modal popup form with many of my "primary" forms of a Winforms application. Ideally the user is going to click on an icon next to a text box that will pop up the form, they will select ...
TITLE: How do I persist a ByRef variable into .net winforms dialog form? QUESTION: I am creating a "department picker" form that is going to serve as a modal popup form with many of my "primary" forms of a Winforms application. Ideally the user is going to click on an icon next to a text box that will pop up the form,...
[ ".net", "winforms", "reference", "modal-dialog" ]
3
4
2,385
5
0
2008-09-29T18:29:09.167000
2008-09-29T18:34:22.617000
150,011
150,644
Precision of reals through writeln/readln in Delphi
My clients application exports and imports quite a few variables of type real through a text file using writeln and readln. I've tried to increase the width of the fields written so the code looks like: writeln(file, exportRealvalue:30); //using excess width of field.... readln(file, importRealvalue); When I export and...
If you want to specify the precision of a real with a WriteLn, use the following: WriteLn(RealVar:12:3); It outputs the value Realvar with at least 12 positions and a precision of 3.
Precision of reals through writeln/readln in Delphi My clients application exports and imports quite a few variables of type real through a text file using writeln and readln. I've tried to increase the width of the fields written so the code looks like: writeln(file, exportRealvalue:30); //using excess width of field....
TITLE: Precision of reals through writeln/readln in Delphi QUESTION: My clients application exports and imports quite a few variables of type real through a text file using writeln and readln. I've tried to increase the width of the fields written so the code looks like: writeln(file, exportRealvalue:30); //using exce...
[ "delphi", "floating-point", "text-files", "precision" ]
3
2
3,522
6
0
2008-09-29T18:29:10.257000
2008-09-29T21:01:40.467000
150,014
150,026
Load in memory text into WebBrowser control
On the.Net WebBrowser control the only way I can see to load a page to it is to set the URL property. But I would like to instead give it some HTML code that I already have in memory without writing it out to a file first. Is there any way to do this? Or are there any controls that will do this?
You want the DocumentText Property: http://msdn.microsoft.com/en-us/library/system.windows.forms.webbrowser.documenttext.aspx? from http://www.codeguru.com/forum/showpost.php?p=1691329&postcount=9: Also you should provide a couple things: Don't set DocumentText in the constructor. Use Form_Load or your own method. If y...
Load in memory text into WebBrowser control On the.Net WebBrowser control the only way I can see to load a page to it is to set the URL property. But I would like to instead give it some HTML code that I already have in memory without writing it out to a file first. Is there any way to do this? Or are there any control...
TITLE: Load in memory text into WebBrowser control QUESTION: On the.Net WebBrowser control the only way I can see to load a page to it is to set the URL property. But I would like to instead give it some HTML code that I already have in memory without writing it out to a file first. Is there any way to do this? Or are...
[ ".net", "controls" ]
8
15
9,713
3
0
2008-09-29T18:31:03.920000
2008-09-29T18:35:37.900000
150,017
150,408
Case Sensitivity when querying SQL Server 2005 from .NET using OleDB
I have a query that I'm executing from a.NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return quickly). As I was reconstructing the query by adding in elements to see which portion...
I suspect that this is a procedure cache issue. One benefit of stored procedures is that the plan is stored for you, which speeds things up. Unfortunately, it's possible to get a bad plan in the cache (even when using dynamic queries). Just for fun, I checked my procedure cache, ran an adhoc query, checked again, then ...
Case Sensitivity when querying SQL Server 2005 from .NET using OleDB I have a query that I'm executing from a.NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return quickly). As I wa...
TITLE: Case Sensitivity when querying SQL Server 2005 from .NET using OleDB QUESTION: I have a query that I'm executing from a.NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return...
[ "c#", ".net", "sql-server", "oledb", "case-sensitive" ]
1
3
1,899
7
0
2008-09-29T18:32:42.980000
2008-09-29T20:04:19.187000
150,020
151,514
What needs checking in for a Grails app?
What parts of a Grails application need to be stored in source-control? Some obvious parts that are needed: grails-app directory test directory web-app directory Now we reach questions like: If we use a Grails plug-in (like gldapo), do we need to check in that plugin? Do Grails plugins install in the Grails directory, ...
You do not want./plugins/core (Core Grails plugins) under SVN You do not want anything under./web-app/WEB-INF/ under SVN. You should not usually need to put files in here. Files from./conf are copied to WEB-INF/classes so they are on the classpath, if you need to supply anything. Here's a link to the docs describing in...
What needs checking in for a Grails app? What parts of a Grails application need to be stored in source-control? Some obvious parts that are needed: grails-app directory test directory web-app directory Now we reach questions like: If we use a Grails plug-in (like gldapo), do we need to check in that plugin? Do Grails ...
TITLE: What needs checking in for a Grails app? QUESTION: What parts of a Grails application need to be stored in source-control? Some obvious parts that are needed: grails-app directory test directory web-app directory Now we reach questions like: If we use a Grails plug-in (like gldapo), do we need to check in that ...
[ "version-control", "grails" ]
8
8
2,435
3
0
2008-09-29T18:33:54.363000
2008-09-30T02:14:39.077000
150,027
150,175
Has anyone run into problems in TortoiseSVN where the 'author' isn't written to the log?
I have someone connecting to my repository using the url (substituted the IP address): svn+ssh://craig@123.45.67.89/subversion Yet when they commit files, the author entry is "null". According to this article: http://tortoisesvn.net/node/80 it should be working fine. Does anyone have any suggestions?
Check your server configuration in [repository]/conf/svnserve.conf file if it has set anon-acces=write auth-access=write Usually, with the default settings anon-access = read auth-access = write (you can just comment out the lines), the author information should be preserved.
Has anyone run into problems in TortoiseSVN where the 'author' isn't written to the log? I have someone connecting to my repository using the url (substituted the IP address): svn+ssh://craig@123.45.67.89/subversion Yet when they commit files, the author entry is "null". According to this article: http://tortoisesvn.ne...
TITLE: Has anyone run into problems in TortoiseSVN where the 'author' isn't written to the log? QUESTION: I have someone connecting to my repository using the url (substituted the IP address): svn+ssh://craig@123.45.67.89/subversion Yet when they commit files, the author entry is "null". According to this article: htt...
[ "tortoisesvn", "svn" ]
1
1
197
1
0
2008-09-29T18:35:42.440000
2008-09-29T19:09:05.200000
150,031
150,065
Implementing rulers in C# form
Does anyone have a good technique (or tutorial) to implement rulers within a C# Windows Forms application? I want to display an image while showing rulers that indicate your mouse position to allow a more accurate positioning of the cursor. Just like the image below: I tried using splitter controls to hold the tick mar...
I would build a custom control to do this in both X and Y location and use two controls. The control would have to override Paint() and use GDI methods to display the tick marks, it would then capture mouse events and update locations appropriately.
Implementing rulers in C# form Does anyone have a good technique (or tutorial) to implement rulers within a C# Windows Forms application? I want to display an image while showing rulers that indicate your mouse position to allow a more accurate positioning of the cursor. Just like the image below: I tried using splitte...
TITLE: Implementing rulers in C# form QUESTION: Does anyone have a good technique (or tutorial) to implement rulers within a C# Windows Forms application? I want to display an image while showing rulers that indicate your mouse position to allow a more accurate positioning of the cursor. Just like the image below: I t...
[ "c#", "winforms", "controls" ]
3
3
6,491
2
0
2008-09-29T18:36:14.997000
2008-09-29T18:42:56.650000
150,032
150,574
Ideas to replace Stored Procedure in Cash Flow report
We have a Cash flow report which is basically in this structure: Date |Credit|Debit|balance| 09/29| 20 | 10 | 10 | 09/30| 0 | 10 | 0 | The main problem is the balance, and as we are using a DataSet for the Data, it's kinda hard to calculate the balance on the DataSet, because we always need the balance from the previou...
This may be too big a change or off the mark for you, but a cash flow report indicates to me that you are probably maintaining, either formally or informally, a general ledger arrangement of some sort. If you are, then maybe I am naive about this but I think you should maintain your general ledger detail as a single ta...
Ideas to replace Stored Procedure in Cash Flow report We have a Cash flow report which is basically in this structure: Date |Credit|Debit|balance| 09/29| 20 | 10 | 10 | 09/30| 0 | 10 | 0 | The main problem is the balance, and as we are using a DataSet for the Data, it's kinda hard to calculate the balance on the DataSe...
TITLE: Ideas to replace Stored Procedure in Cash Flow report QUESTION: We have a Cash flow report which is basically in this structure: Date |Credit|Debit|balance| 09/29| 20 | 10 | 10 | 09/30| 0 | 10 | 0 | The main problem is the balance, and as we are using a DataSet for the Data, it's kinda hard to calculate the bal...
[ "delphi", "stored-procedures", "report" ]
0
1
571
3
0
2008-09-29T18:36:52.423000
2008-09-29T20:48:00.063000
150,033
150,078
Regular expression to match non-ASCII characters?
What is the easiest way to match non-ASCII characters in a regex? I would like to match all words individually in an input string, but the language may not be English, so I will need to match things like ü, ö, ß, and ñ. Also, this is in Javascript/jQuery, so any solution will need to apply to that.
This should do it: [^\x00-\x7F]+ It matches any character which is not contained in the ASCII character set (0-127, i.e. 0x0 to 0x7F). You can do the same thing with Unicode: [^\u0000-\u007F]+ For unicode you can look at this 2 resources: Code charts list of Unicode ranges This tool to create a regex filtered by Unicod...
Regular expression to match non-ASCII characters? What is the easiest way to match non-ASCII characters in a regex? I would like to match all words individually in an input string, but the language may not be English, so I will need to match things like ü, ö, ß, and ñ. Also, this is in Javascript/jQuery, so any solutio...
TITLE: Regular expression to match non-ASCII characters? QUESTION: What is the easiest way to match non-ASCII characters in a regex? I would like to match all words individually in an input string, but the language may not be English, so I will need to match things like ü, ö, ß, and ñ. Also, this is in Javascript/jQue...
[ "javascript", "jquery", "regex" ]
316
332
331,653
9
0
2008-09-29T18:37:07.633000
2008-09-29T18:45:10.797000
150,042
150,087
What regEx can I use to Split a string into whole words but only if they start with #?
I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item("Post"), "\b\#\b") But it is splitting all words, I want an array of words that start with# Thanks!
This seems to work... c# Regex MyRegex = new Regex("\\#\\w+"); MatchCollection ms = MyRegex.Matches(InputText); or vb.net Dim MyRegex as Regex = new Regex("\#\w+") Dim ms as MatchCollection = MyRegex.Matches(InputText) Given input text of... "asdfas asdf #asdf asd fas df asd fas #df asd f asdf"...this will yield.... "#...
What regEx can I use to Split a string into whole words but only if they start with #? I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item("Post"), "\b\#\b") But it is splitting all words, I want an array of words that start with# Thanks!
TITLE: What regEx can I use to Split a string into whole words but only if they start with #? QUESTION: I have tried this... Dim myMatches As String() = System.Text.RegularExpressions.Regex.Split(postRow.Item("Post"), "\b\#\b") But it is splitting all words, I want an array of words that start with# Thanks! ANSWER: T...
[ "regex", "vb.net" ]
5
4
2,292
5
0
2008-09-29T18:39:34.677000
2008-09-29T18:47:07.140000
150,044
150,072
Using asp:content markup more than once in the masterpage
I'm new to ASP.NET and want to have an asp:content control for the page title, but I want that value to be used for the tag and for a page header. When I tried to do this with two tags with the same id, it complained that I couldn't have two tags with the same id. Is there a way to achieve this with contentplaceholders...
Title is actually an attribute on content pages, so you do something like: <%@ Page Language="C#" MasterPageFile="~/default.master" Title="My Content Title" %> on the content page. To get that into a header, on the master page just render the page title: <%= this.Page.Title %>
Using asp:content markup more than once in the masterpage I'm new to ASP.NET and want to have an asp:content control for the page title, but I want that value to be used for the tag and for a page header. When I tried to do this with two tags with the same id, it complained that I couldn't have two tags with the same i...
TITLE: Using asp:content markup more than once in the masterpage QUESTION: I'm new to ASP.NET and want to have an asp:content control for the page title, but I want that value to be used for the tag and for a page header. When I tried to do this with two tags with the same id, it complained that I couldn't have two ta...
[ "asp.net" ]
0
1
310
3
0
2008-09-29T18:39:52.120000
2008-09-29T18:44:22.560000
150,047
153,741
MSBuild - Getting the target called from command line
Does anyone know how to get the name of the TARGET (/t) called from the MSBuild command line? There are a few types of targets that can be called and I want to use that property in a notification to users. Example: msbuild Project.proj /t:ApplicationDeployment /p:Environment=DEV I want access to the target words Applic...
I found the answer! I would like to give partial credit to apathetic. Not sure how to do that.
MSBuild - Getting the target called from command line Does anyone know how to get the name of the TARGET (/t) called from the MSBuild command line? There are a few types of targets that can be called and I want to use that property in a notification to users. Example: msbuild Project.proj /t:ApplicationDeployment /p:En...
TITLE: MSBuild - Getting the target called from command line QUESTION: Does anyone know how to get the name of the TARGET (/t) called from the MSBuild command line? There are a few types of targets that can be called and I want to use that property in a notification to users. Example: msbuild Project.proj /t:Applicati...
[ "msbuild", "build-automation", "automated-deploy" ]
14
8
5,787
4
0
2008-09-29T18:40:23.630000
2008-09-30T16:04:10.487000
150,053
150,092
How to run Visual Studio post-build events for debug build only
How can I limit my post-build events to running only for one type of build? I'm using the events to copy DLL files to a local IIS virtual directory, but I don't want this happening on the build server in release mode.
Pre- and Post-Build Events run as a batch script. You can do a conditional statement on $(ConfigurationName). For instance if $(ConfigurationName) == Debug xcopy something somewhere
How to run Visual Studio post-build events for debug build only How can I limit my post-build events to running only for one type of build? I'm using the events to copy DLL files to a local IIS virtual directory, but I don't want this happening on the build server in release mode.
TITLE: How to run Visual Studio post-build events for debug build only QUESTION: How can I limit my post-build events to running only for one type of build? I'm using the events to copy DLL files to a local IIS virtual directory, but I don't want this happening on the build server in release mode. ANSWER: Pre- and Po...
[ "visual-studio", "build-process" ]
669
836
266,480
12
0
2008-09-29T18:41:33.567000
2008-09-29T18:48:19.120000
150,058
1,350,520
mysql "drop database" takes time -- why?
mysql5.0 with a pair of databases "A" and "B", both with large innodb tables. "drop database A;" freezes database "B" for a couple minutes. Nothing is using "A" at that point, so why is this such an intensive operation? Bonus points: Given that we use "A", upload data into "B", and then switch to using "B", how can we ...
So I'm not sure Matt Rogish's answer is going to help 100%. The problem is that MySQL* has a mutex (mutually exclusive lock) around opening and closing tables, so that basically means that if a table is in the process of being closed/deleted, no other tables can be opened. This is described by a colleague of mine here:...
mysql "drop database" takes time -- why? mysql5.0 with a pair of databases "A" and "B", both with large innodb tables. "drop database A;" freezes database "B" for a couple minutes. Nothing is using "A" at that point, so why is this such an intensive operation? Bonus points: Given that we use "A", upload data into "B", ...
TITLE: mysql "drop database" takes time -- why? QUESTION: mysql5.0 with a pair of databases "A" and "B", both with large innodb tables. "drop database A;" freezes database "B" for a couple minutes. Nothing is using "A" at that point, so why is this such an intensive operation? Bonus points: Given that we use "A", uplo...
[ "mysql", "database", "schema", "innodb" ]
11
13
20,251
3
0
2008-09-29T18:42:14.657000
2009-08-29T05:05:05.253000
150,076
150,194
How Do I Authenticate to ActiveResource to Avoid the InvalidAuthenticityToken Response?
I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How do I authenticate to avoid this response? require 'rubygems' require 'activeresource' class Event < Active...
I found an answer to this issue which works since I am writing a command-line application. I added the following to my controller: # you can disable csrf protection on controller-by-controller basis: skip_before_filter:verify_authenticity_token
How Do I Authenticate to ActiveResource to Avoid the InvalidAuthenticityToken Response? I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How do I authenticate t...
TITLE: How Do I Authenticate to ActiveResource to Avoid the InvalidAuthenticityToken Response? QUESTION: I created a Rails application normally. Then created the scaffold for an event class. Then tried the following code. When run it complains about a InvalidAuthenticityToken when the destroy method is executed. How d...
[ "ruby-on-rails", "ruby", "activeresource" ]
2
2
1,302
2
0
2008-09-29T18:45:03.107000
2008-09-29T19:16:05.060000
150,084
226,818
Abstracting storage data structures within XPath
I have a collection of data stored in XDocuments and DataTables, and I'd like to address both as a single unified data space with XPath queries. So, for example, "/Root/Tables/Orders/FirstName" would fetch the value of the Firstname column in every row of the DataTable named "Orders". Is there a way to do this without ...
I eventually figured out the answer to this myself. I discovered a class in System.Xml.LINQ called XStreamingElement that can create an XML structure on-the-fly from a LINQ expression. Here's an example of casting a DataTable into an XML-space. Dictionary Tables = new Dictionary (); //... populate dictionary of tables....
Abstracting storage data structures within XPath I have a collection of data stored in XDocuments and DataTables, and I'd like to address both as a single unified data space with XPath queries. So, for example, "/Root/Tables/Orders/FirstName" would fetch the value of the Firstname column in every row of the DataTable n...
TITLE: Abstracting storage data structures within XPath QUESTION: I have a collection of data stored in XDocuments and DataTables, and I'd like to address both as a single unified data space with XPath queries. So, for example, "/Root/Tables/Orders/FirstName" would fetch the value of the Firstname column in every row ...
[ "c#", "xml", ".net-3.5", "datatable" ]
1
1
513
5
0
2008-09-29T18:46:46.347000
2008-10-22T17:45:04.740000
150,095
150,115
Interpolating a string into a regex
I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example: foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /value of foo here dynamically/ puts "success!" end
Same as string insertion. if goo =~ /#{Regexp.quote(foo)}/ #...
Interpolating a string into a regex I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example: foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /value of foo here dynamically/ puts "success!" end
TITLE: Interpolating a string into a regex QUESTION: I need to substitute the value of a string into my regular expression in Ruby. Is there an easy way to do this? For example: foo = "0.0.0.0" goo = "here is some other stuff 0.0.0.0" if goo =~ /value of foo here dynamically/ puts "success!" end ANSWER: Same as strin...
[ "ruby", "regex" ]
180
303
61,441
7
0
2008-09-29T18:48:33.673000
2008-09-29T18:53:54.597000
150,104
150,196
Exception Thrown Causes RunTime Error
We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message. BlockUI is a jQuery plugIn that blocks the screen and ...
By default, ASP.NET web applications will hide errors from remote machines accessing the site, and will only return the generic 'Runtime Error'. ASP.NET will only show application specific error messages when the site is accessed locally (i.e. if the ASP.NET application server is running on your local development machi...
Exception Thrown Causes RunTime Error We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message. BlockUI is a jQu...
TITLE: Exception Thrown Causes RunTime Error QUESTION: We have developed a website that uses MVC, C#, and jQuery. In one of my controller classes we are validating inputs from the user and if it fails we throw an exception that the Ajax error parameter(aka option) handles. (We use Block UI to display the error message...
[ "c#", "jquery", "exception", "web" ]
1
2
1,424
1
0
2008-09-29T18:51:32.933000
2008-09-29T19:16:11.453000
150,113
150,125
Error sending mail with System.Web.Mail
An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com. Other addresses appear to be working correctly. We changed our mail server to Exchange 2007 when the errors started, so I assume that is where the problem is. Does anyone know what is happening? Here is the exceptio...
Here's a tutorial for diagnosing those exceptions (a very common one with a lot of meanings).
Error sending mail with System.Web.Mail An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com. Other addresses appear to be working correctly. We changed our mail server to Exchange 2007 when the errors started, so I assume that is where the problem is. Does anyone know...
TITLE: Error sending mail with System.Web.Mail QUESTION: An older application using System.Web.Mail is throwing an exception on emails coming from hr@domain.com. Other addresses appear to be working correctly. We changed our mail server to Exchange 2007 when the errors started, so I assume that is where the problem is...
[ ".net", "email", "exchange-server" ]
2
0
3,215
2
0
2008-09-29T18:53:34.007000
2008-09-29T18:56:24.247000
150,114
150,123
Parsing Performance (If, TryParse, Try-Catch)
I know plenty about the different ways of handling parsing text for information. For parsing integers for example, what kind of performance can be expected. I am wondering if anyone knows of any good stats on this. I am looking for some real numbers from someone who has tested this. Which of these offers the best perfo...
Always use T.TryParse(string str, out T value). Throwing exceptions is expensive and should be avoided if you can handle the situation a priori. Using a try-catch block to "save" on performance (because your invalid data rate is low) is an abuse of exception handling at the expense of maintainability and good coding pr...
Parsing Performance (If, TryParse, Try-Catch) I know plenty about the different ways of handling parsing text for information. For parsing integers for example, what kind of performance can be expected. I am wondering if anyone knows of any good stats on this. I am looking for some real numbers from someone who has tes...
TITLE: Parsing Performance (If, TryParse, Try-Catch) QUESTION: I know plenty about the different ways of handling parsing text for information. For parsing integers for example, what kind of performance can be expected. I am wondering if anyone knows of any good stats on this. I am looking for some real numbers from s...
[ "c#", "parsing", "text" ]
34
66
18,289
3
0
2008-09-29T18:53:35.503000
2008-09-29T18:56:09.240000
150,124
150,144
C# .NET / javascript : Collapsable Table Rows - what about this is wrong?
I have a C#.NET page where I want to make rows collapse when a button is pressed. I found many tutorials like this one ( http://codingforums.com/archive/index.php?t-90375.html ), tried to implement their solutions, but none of them do anything for me when I click my button. To make sure I wasn't going crazy, I made a s...
1) The display is (probably) not 'block' initially. Try: if(id_table.display == 'none') { id_table.display = ''; } else { id_table.display = 'none'; } 2) The id of the control will not be what you think it is, thanks to Naming Containers. Check your HTML Source
C# .NET / javascript : Collapsable Table Rows - what about this is wrong? I have a C#.NET page where I want to make rows collapse when a button is pressed. I found many tutorials like this one ( http://codingforums.com/archive/index.php?t-90375.html ), tried to implement their solutions, but none of them do anything fo...
TITLE: C# .NET / javascript : Collapsable Table Rows - what about this is wrong? QUESTION: I have a C#.NET page where I want to make rows collapse when a button is pressed. I found many tutorials like this one ( http://codingforums.com/archive/index.php?t-90375.html ), tried to implement their solutions, but none of t...
[ "c#", ".net", "collapsable" ]
0
3
1,711
1
0
2008-09-29T18:56:22.983000
2008-09-29T19:00:43.100000
150,129
150,185
What is a Lambda?
Could someone provide a good description of what a Lambda is? We have a tag for them and they're on the secrets of C# question, but I have yet to find a good definition and explanation of what they are in the first place.
Closures, lambdas, and anonymous functions are not necessarily the same thing. An anonymous function is any function that doesn't have (or, at least, need) its own name. A closure is a function that can access variables that were in its lexical scope when it was declared, even after they have fallen out of scope. Anony...
What is a Lambda? Could someone provide a good description of what a Lambda is? We have a tag for them and they're on the secrets of C# question, but I have yet to find a good definition and explanation of what they are in the first place.
TITLE: What is a Lambda? QUESTION: Could someone provide a good description of what a Lambda is? We have a tag for them and they're on the secrets of C# question, but I have yet to find a good definition and explanation of what they are in the first place. ANSWER: Closures, lambdas, and anonymous functions are not ne...
[ "language-agnostic", "lambda", "computer-science", "terminology" ]
95
135
18,681
7
0
2008-09-29T18:56:51.110000
2008-09-29T19:12:54.160000
150,146
373,588
Separation of Presentation and Business Tiers with Spring
In my just-completed project, I was working getting distributed transactions working. We implemented this using JBoss's Arjuna Transaction Manager, and Spring's declarative transaction boundaries. Our request sequence looked like: browser -> secured servlet -> 'wafer-thin' SLSB -> spring TX-aware proxy -> request-handl...
Requiring an EJB3 app server just for a SLSB that is a facade doesn't seem like it's worth the effort to me. There is no reason you couldn't just remove that and have your servlet work directly with Spring. You can add the ContextLoaderListener to the WAR to load your ApplicationContext and then WebApplicationContextUt...
Separation of Presentation and Business Tiers with Spring In my just-completed project, I was working getting distributed transactions working. We implemented this using JBoss's Arjuna Transaction Manager, and Spring's declarative transaction boundaries. Our request sequence looked like: browser -> secured servlet -> '...
TITLE: Separation of Presentation and Business Tiers with Spring QUESTION: In my just-completed project, I was working getting distributed transactions working. We implemented this using JBoss's Arjuna Transaction Manager, and Spring's declarative transaction boundaries. Our request sequence looked like: browser -> se...
[ "spring", "n-tier-architecture" ]
4
2
1,066
2
0
2008-09-29T19:02:04.267000
2008-12-17T03:37:38.470000
150,150
150,706
How do I share a menu definition between a context menu and a regular menu in WPF
I have a defined MenuItem that I would like to share between two different menus on one page. The menu contains functionallity that is the same between both menus and I do not want two copies of it. Is there anyway to define a MenuItem in the Page.Resources and reference it in the ContextMenu XAML below? Something hard...
I've done this by setting x:Shared="False" on the menu item itself. Resources are shared between each place that uses them by default (meaning one instance across all uses), so turning that off means that a new "copy" of the resource is made each time. So: You'll still get a "copy" of it, but you only need to define it...
How do I share a menu definition between a context menu and a regular menu in WPF I have a defined MenuItem that I would like to share between two different menus on one page. The menu contains functionallity that is the same between both menus and I do not want two copies of it. Is there anyway to define a MenuItem in...
TITLE: How do I share a menu definition between a context menu and a regular menu in WPF QUESTION: I have a defined MenuItem that I would like to share between two different menus on one page. The menu contains functionallity that is the same between both menus and I do not want two copies of it. Is there anyway to de...
[ ".net", "wpf", "xaml" ]
2
6
2,604
3
0
2008-09-29T19:02:59.130000
2008-09-29T21:15:27.830000
150,153
150,166
NHibernate ICriteria - Does the sort allow for null?
Using NHibernate ICriteria and adding.AddOrder... I want to sort by a property that is sometimes null with all the populated ones at the top. Will.AddOrder allow me to do this? If not is there an alternative? The sorting options for ILists leave a lot to be desired.
You should get the non-null values first by using that method. We use sorting in that way on my project, and have not had any issues with the null values... they get listed at end.
NHibernate ICriteria - Does the sort allow for null? Using NHibernate ICriteria and adding.AddOrder... I want to sort by a property that is sometimes null with all the populated ones at the top. Will.AddOrder allow me to do this? If not is there an alternative? The sorting options for ILists leave a lot to be desired.
TITLE: NHibernate ICriteria - Does the sort allow for null? QUESTION: Using NHibernate ICriteria and adding.AddOrder... I want to sort by a property that is sometimes null with all the populated ones at the top. Will.AddOrder allow me to do this? If not is there an alternative? The sorting options for ILists leave a l...
[ "c#", "nhibernate", ".net-3.5" ]
4
3
3,343
2
0
2008-09-29T19:03:39.347000
2008-09-29T19:07:48.340000
150,161
150,326
Waiting for user input with a timeout
I have searched but apparently my google foo is weak. What I need is a way to prompt for user input in the console and have the request time out after a period of time and continue executing the script if no input comes in. As near as I can tell, Read-Host does not provide this functionality. Neither does $host.UI.Prom...
Found something here: $counter = 0 while(!$Host.UI.RawUI.KeyAvailable -and ($counter++ -lt 600)) { [Threading.Thread]::Sleep( 1000 ) }
Waiting for user input with a timeout I have searched but apparently my google foo is weak. What I need is a way to prompt for user input in the console and have the request time out after a period of time and continue executing the script if no input comes in. As near as I can tell, Read-Host does not provide this fun...
TITLE: Waiting for user input with a timeout QUESTION: I have searched but apparently my google foo is weak. What I need is a way to prompt for user input in the console and have the request time out after a period of time and continue executing the script if no input comes in. As near as I can tell, Read-Host does no...
[ "powershell" ]
29
22
30,673
10
0
2008-09-29T19:05:48.063000
2008-09-29T19:44:47.937000
150,167
150,181
How do I list / export private keys from a keystore?
How do I list and export a private key from a keystore?
A portion of code originally from Example Depot for listing all of the aliases in a key store: // Load input stream into keystore keystore.load(is, password.toCharArray()); // List the aliases Enumeration aliases = keystore.aliases(); for (; aliases.hasMoreElements(); ) { String alias = (String)aliases.nextElement(); ...
How do I list / export private keys from a keystore? How do I list and export a private key from a keystore?
TITLE: How do I list / export private keys from a keystore? QUESTION: How do I list and export a private key from a keystore? ANSWER: A portion of code originally from Example Depot for listing all of the aliases in a key store: // Load input stream into keystore keystore.load(is, password.toCharArray()); // List th...
[ "java", "ssl", "keystore" ]
62
32
137,511
9
0
2008-09-29T19:07:49.807000
2008-09-29T19:12:01.997000
150,177
150,259
transaction isolation problem or wrong approach?
I was helping out some colleagues of mine with an SQL problem. Mainly they wanted to move all the rows from table A to table B (both tables having the same columns (names and types)). Although this was done in Oracle 11g I don't think it really matters. Their initial naive implementation was something like BEGIN INSERT...
Depending on your isolation level, selecting all the rows from a table does not prevent new inserts, it will just lock the rows you read. In SQL Server, if you use the Serializable isolation level then it will prevent new rows if they would have been including in your select query. http://msdn.microsoft.com/en-us/libra...
transaction isolation problem or wrong approach? I was helping out some colleagues of mine with an SQL problem. Mainly they wanted to move all the rows from table A to table B (both tables having the same columns (names and types)). Although this was done in Oracle 11g I don't think it really matters. Their initial nai...
TITLE: transaction isolation problem or wrong approach? QUESTION: I was helping out some colleagues of mine with an SQL problem. Mainly they wanted to move all the rows from table A to table B (both tables having the same columns (names and types)). Although this was done in Oracle 11g I don't think it really matters....
[ "sql", "sql-server", "oracle", "transactions", "database" ]
7
8
2,731
11
0
2008-09-29T19:09:48.897000
2008-09-29T19:26:06.533000
150,186
150,249
How to order headers in .NET C++ projects
I'm trying to build a new.NET C++ project from scratch. I am planning to mix managed and unmanaged code in this project. this forum thread IDataObject: ambiguous symbol error answers a problem I've seen multiple times. Post #4 states "Move all 'using namespace XXXX' from.h to.cpp" this looks like a good idea but now in...
It's a good idea to always use fully qualified names in header files. Because the using statement affects all following code regardless of #include, putting a using statement in a header file affects everybody that might include that header. So you would change your function declaration in your header file to: void loa...
How to order headers in .NET C++ projects I'm trying to build a new.NET C++ project from scratch. I am planning to mix managed and unmanaged code in this project. this forum thread IDataObject: ambiguous symbol error answers a problem I've seen multiple times. Post #4 states "Move all 'using namespace XXXX' from.h to.c...
TITLE: How to order headers in .NET C++ projects QUESTION: I'm trying to build a new.NET C++ project from scratch. I am planning to mix managed and unmanaged code in this project. this forum thread IDataObject: ambiguous symbol error answers a problem I've seen multiple times. Post #4 states "Move all 'using namespace...
[ ".net", "c++", "reference", "header" ]
0
2
258
4
0
2008-09-29T19:12:56.423000
2008-09-29T19:24:02.450000
150,191
150,206
In firebug, how do I find out all of the css styles being applied to a particular element?
I'm way buried in many nested levels of css, and I can't tell which style layer/level is messing up my display. How can I find out everything that's being applied to a particular element?
Click Inspect (upper left) to select the element you want to check then on the right panel select the tab labeled "Style". It will also tell you from which.css file that particular property comes from
In firebug, how do I find out all of the css styles being applied to a particular element? I'm way buried in many nested levels of css, and I can't tell which style layer/level is messing up my display. How can I find out everything that's being applied to a particular element?
TITLE: In firebug, how do I find out all of the css styles being applied to a particular element? QUESTION: I'm way buried in many nested levels of css, and I can't tell which style layer/level is messing up my display. How can I find out everything that's being applied to a particular element? ANSWER: Click Inspect ...
[ "css", "firebug" ]
4
14
3,721
4
0
2008-09-29T19:15:05.980000
2008-09-29T19:17:54.743000
150,192
150,204
Using underscores in Java variables and method names
Even nowadays I often see underscores in Java variables and methods. An example are member variables (like "m_count" or "_count"). As far as I remember, to use underscores in these cases is called bad style by Sun. The only place they should be used is in constants (like in "public final static int IS_OKAY = 1;"), beca...
If you have no code using it now, I'd suggest continuing that. If your codebase uses it, continue that. The biggest thing about coding style is consistency. If you have nothing to be consistent with, then the language vendor's recommendations are likely a good place to start.
Using underscores in Java variables and method names Even nowadays I often see underscores in Java variables and methods. An example are member variables (like "m_count" or "_count"). As far as I remember, to use underscores in these cases is called bad style by Sun. The only place they should be used is in constants (...
TITLE: Using underscores in Java variables and method names QUESTION: Even nowadays I often see underscores in Java variables and methods. An example are member variables (like "m_count" or "_count"). As far as I remember, to use underscores in these cases is called bad style by Sun. The only place they should be used...
[ "java", "naming-conventions" ]
91
152
115,797
15
0
2008-09-29T19:15:06.653000
2008-09-29T19:17:43.573000
150,208
4,854,628
How do I convert HTML to RTF (Rich Text) in .NET without paying for a component?
Is there a free third-party or.NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)? The "free" requirement comes from the fact that I'm only working on a prototype and can just load the BrowserControl and just render HTML if need be (even if it is slow) and that Developer Expr...
Actually there is a simple and free solution: use your browser, ok this is the trick I used: var webBrowser = new WebBrowser(); webBrowser.CreateControl(); // only if needed webBrowser.DocumentText = *yourhtmlstring*; while (_webBrowser.DocumentText!= *yourhtmlstring*) Application.DoEvents(); webBrowser.Document.ExecCo...
How do I convert HTML to RTF (Rich Text) in .NET without paying for a component? Is there a free third-party or.NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)? The "free" requirement comes from the fact that I'm only working on a prototype and can just load the BrowserCon...
TITLE: How do I convert HTML to RTF (Rich Text) in .NET without paying for a component? QUESTION: Is there a free third-party or.NET class that will convert HTML to RTF (for use in a rich-text enabled Windows Forms control)? The "free" requirement comes from the fact that I'm only working on a prototype and can just l...
[ ".net", "html", "rtf", "richtext" ]
40
43
104,494
6
0
2008-09-29T19:17:56.490000
2011-01-31T18:34:04.107000
150,213
150,334
How do I use LINQ to query for items, but also include missing items?
I'm trying to chart the number of registrations per day in our registration system. I have an Attendee table in sql server that has a smalldatetime field A_DT, which is the date and time the person registered. I started with this: var dailyCountList = (from a in showDC.Attendee let justDate = new DateTime(a.A_DT.Year, ...
O(n) with 2 enumerations. It's very good to pull the items into memory before trying this. Database has enough to do without thinking about this stuff. if (!dailyCountList.Any()) return; //make a dictionary to provide O(1) lookups for later Dictionary lookup = dailyCountList.ToDictionary(r => r.EventDateTime); DateT...
How do I use LINQ to query for items, but also include missing items? I'm trying to chart the number of registrations per day in our registration system. I have an Attendee table in sql server that has a smalldatetime field A_DT, which is the date and time the person registered. I started with this: var dailyCountList ...
TITLE: How do I use LINQ to query for items, but also include missing items? QUESTION: I'm trying to chart the number of registrations per day in our registration system. I have an Attendee table in sql server that has a smalldatetime field A_DT, which is the date and time the person registered. I started with this: v...
[ "c#", "asp.net", "linq" ]
1
1
2,540
3
0
2008-09-29T19:18:50.810000
2008-09-29T19:47:58.790000
150,223
2,443,798
SQL 2005 Express Edition - Install new instance
Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. Executing the command in my installer is not the issue, it's more ...
After months/years of looking into this it appears it can't be done. Oh well, I guess I just reinstall each time I want a new instance. I guess it's because each instance is it's own service.
SQL 2005 Express Edition - Install new instance Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. Executing the comm...
TITLE: SQL 2005 Express Edition - Install new instance QUESTION: Looking for a way to programatically, or otherwise, add a new instance of SQL 2005 Express Edition to a system that already has an instance installed. Traditionally, you run Micrsoft's installer like I am in the command line below and it does the trick. ...
[ "command-line", "installation", "sql-server-express", "instance", "sql-server-2005-express" ]
6
0
17,617
3
0
2008-09-29T19:20:21.337000
2010-03-14T21:09:44.460000
150,250
150,297
While-clause in T-SQL that loops forever
I was recently tasked with debugging a strange problem within an e-commerce application. After an application upgrade the site started to hang from time to time and I was sent in to debug. After checking the event log I found that the SQL-server wrote ~200 000 events in a couple of minutes with the message saying that ...
Are you operating in explicit or implicit transaction mode? Since you're in explicit mode, I think you need to surround the DELETE operation with BEGIN TRANSACTION and COMMIT TRANSACTION statements. WHILE EXISTS (SELECT * FROM ShoppingCartItem WHERE ShoppingCartItem.PurchID = @PurchID) BEGIN SELECT TOP 1 @TmpGFSID = Sh...
While-clause in T-SQL that loops forever I was recently tasked with debugging a strange problem within an e-commerce application. After an application upgrade the site started to hang from time to time and I was sent in to debug. After checking the event log I found that the SQL-server wrote ~200 000 events in a couple...
TITLE: While-clause in T-SQL that loops forever QUESTION: I was recently tasked with debugging a strange problem within an e-commerce application. After an application upgrade the site started to hang from time to time and I was sent in to debug. After checking the event log I found that the SQL-server wrote ~200 000 ...
[ "sql", "sql-server", "t-sql" ]
7
3
17,423
7
0
2008-09-29T19:24:07.567000
2008-09-29T19:37:05.367000
150,284
150,309
What is the difference between __reduce__ and __reduce_ex__?
I understand that these methods are for pickling/unpickling and have no relation to the reduce built-in function, but what's the difference between the 2 and why do we need both?
The docs say that If provided, at pickling time __reduce__() will be called with no arguments, and it must return either a string or a tuple. On the other hand, It is sometimes useful to know the protocol version when implementing __reduce__. This can be done by implementing a method named __reduce_ex__ instead of __re...
What is the difference between __reduce__ and __reduce_ex__? I understand that these methods are for pickling/unpickling and have no relation to the reduce built-in function, but what's the difference between the 2 and why do we need both?
TITLE: What is the difference between __reduce__ and __reduce_ex__? QUESTION: I understand that these methods are for pickling/unpickling and have no relation to the reduce built-in function, but what's the difference between the 2 and why do we need both? ANSWER: The docs say that If provided, at pickling time __red...
[ "python", "pickle" ]
25
35
12,953
2
0
2008-09-29T19:31:50.077000
2008-09-29T19:41:37.243000
150,294
150,300
How to programmatically get the CPU cache line size in C++?
I'd like my program to read the cache line size of the CPU it's running on in C++. I know that this can't be done portably, so I will need a solution for Linux and another for Windows (Solutions for other systems could be useful to others, so post them if you know them). For Linux I could read the content of /proc/cpui...
On Win32, GetLogicalProcessorInformation will give you back a SYSTEM_LOGICAL_PROCESSOR_INFORMATION which contains a CACHE_DESCRIPTOR, which has the information you need.
How to programmatically get the CPU cache line size in C++? I'd like my program to read the cache line size of the CPU it's running on in C++. I know that this can't be done portably, so I will need a solution for Linux and another for Windows (Solutions for other systems could be useful to others, so post them if you ...
TITLE: How to programmatically get the CPU cache line size in C++? QUESTION: I'd like my program to read the cache line size of the CPU it's running on in C++. I know that this can't be done portably, so I will need a solution for Linux and another for Windows (Solutions for other systems could be useful to others, so...
[ "c++", "linux", "windows", "cpu", "cpu-cache" ]
30
21
16,677
8
0
2008-09-29T19:35:18.273000
2008-09-29T19:38:50.060000
150,301
150,758
How can I extract the address information from a Compressed ESRI shapefile datasource?
When I download the zip file from the website it contains files with the following extensions:.dbf.prj.sbn.sbx.shp.shp.xml.shx Is this is a common data file format that I download or purchase a converter? I think this is some kind of mapping data file but I all need are the addresses it contains to push into our existi...
Much thanks to everyone who provided information. I found a CodePlex C# project that was exactly what I needed. I did have to make one small modification which I posted back on the project discussion board which was for an unknown column type of "F". But the command line program DBF2CSV worked beautifully to create a w...
How can I extract the address information from a Compressed ESRI shapefile datasource? When I download the zip file from the website it contains files with the following extensions:.dbf.prj.sbn.sbx.shp.shp.xml.shx Is this is a common data file format that I download or purchase a converter? I think this is some kind of...
TITLE: How can I extract the address information from a Compressed ESRI shapefile datasource? QUESTION: When I download the zip file from the website it contains files with the following extensions:.dbf.prj.sbn.sbx.shp.shp.xml.shx Is this is a common data file format that I download or purchase a converter? I think th...
[ "database", "csv", "gis", "dbf", "esri" ]
1
2
1,975
5
0
2008-09-29T19:39:23.083000
2008-09-29T21:26:35.633000
150,329
150,460
404 page that displays requested page
I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That part isn't a problem. How can I obtain the requested UR...
I do basically the same thing you ask in a custom 404 error handling page. On IIS 6 the original URL is in the query string. The code below shows how to grab the original URL and then forward the user. In my case I switched from old ASP to new ASP.NET, so all the.asp pages had to be forwarded to.aspx pages. Also, some ...
404 page that displays requested page I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That part isn't a prob...
TITLE: 404 page that displays requested page QUESTION: I recently migrated a website to a new CMS (Umbraco). A lot of the links have changed, but they can be easily corrected by searching for patters in the url, so I would like to write something that will redirect to the correct page if the old one is not found. That...
[ "c#", "asp.net", "vb.net", "asp-classic", "umbraco" ]
1
3
3,883
7
0
2008-09-29T19:45:40.993000
2008-09-29T20:18:18.340000
150,332
150,343
Combining Lists in Lambda/LINQ
If I have variable of type IEnumerable > is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable?
SelectMany - i.e. IEnumerable > someList =...; IEnumerable all = someList.SelectMany(x => x); For each item in someList, this then uses the lambda "x => x" to get an IEnumerable for the inner items. In this case, each "x" is a List, which is already IEnumerable. These are then returned as a contiguous block. Essentiall...
Combining Lists in Lambda/LINQ If I have variable of type IEnumerable > is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable?
TITLE: Combining Lists in Lambda/LINQ QUESTION: If I have variable of type IEnumerable > is there a LINQ statement or lambda expression I can apply to it which will combine the lists returning an IEnumerable? ANSWER: SelectMany - i.e. IEnumerable > someList =...; IEnumerable all = someList.SelectMany(x => x); For eac...
[ "c#", ".net", "linq", "lambda" ]
16
34
9,441
6
0
2008-09-29T19:46:38.777000
2008-09-29T19:50:00.983000
150,335
151,584
Best way to dynamically create RDLC xml as input to VS2005 Report Viewer?
What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer? I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.
Lisa Nicholls gives a complete answer in this thread about dynamically defining a report. You'll want to scroll down some before you get to a useful answer. This thread most directly answers your question about controlling which columns are displayed. These same techniques can be used to size the columns programmatical...
Best way to dynamically create RDLC xml as input to VS2005 Report Viewer? What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer? I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed.
TITLE: Best way to dynamically create RDLC xml as input to VS2005 Report Viewer? QUESTION: What is the best way to dynamically create RDLC xml as input to VS2005 Report Viewer? I would like to autosize columns based on the data sizes. I would also like to programmatically control what columns are displayed. ANSWER: L...
[ "visual-studio", "reportviewer", "rdlc" ]
3
4
10,412
2
0
2008-09-29T19:48:19.037000
2008-09-30T02:52:14.433000
150,339
150,448
Generating an Excel file in ASP.NET
I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would you return the data? I'm looking for something that's as...
CSV Pros: Simple Cons: It may not work in other locales or in different Excel configurations (i.e. List separator) Can't apply formatting, formulas, etc HTML Pros: Still pretty Simple Supports simple formating and formulas Cons: You have to name the file as xls and Excel may warn you about opening a non native Excel fi...
Generating an Excel file in ASP.NET I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would you return the data?...
TITLE: Generating an Excel file in ASP.NET QUESTION: I am about to add a section to an ASP.NET app (VB.NET codebehind) that will allow a user to get data returned to them as an Excel file, which I will generate based on database data. While there are several ways of doing this, each has its own drawbacks. How would yo...
[ "asp.net", "vb.net", "export-to-excel" ]
100
133
62,983
26
0
2008-09-29T19:49:11.407000
2008-09-29T20:15:47.677000
150,341
150,480
TDD and Mocking out TcpClient
How do people approach mocking out TcpClient (or things like TcpClient)? I have a service that takes in a TcpClient. Should I wrap that in something else more mockable? How should I approach this?
When coming to mock classes that are not test friendly (i.e. sealed/not implementing any interface/methods are not virtual), you would probably want to use the Adapter design pattern. In this pattern you add a wrapping class that implements an interface. You should then mock the interface, and make sure all your code u...
TDD and Mocking out TcpClient How do people approach mocking out TcpClient (or things like TcpClient)? I have a service that takes in a TcpClient. Should I wrap that in something else more mockable? How should I approach this?
TITLE: TDD and Mocking out TcpClient QUESTION: How do people approach mocking out TcpClient (or things like TcpClient)? I have a service that takes in a TcpClient. Should I wrap that in something else more mockable? How should I approach this? ANSWER: When coming to mock classes that are not test friendly (i.e. seale...
[ "c#", "networking", "tdd", "mocking" ]
10
26
5,372
3
0
2008-09-29T19:49:40.097000
2008-09-29T20:23:38.720000
150,355
150,971
Programmatically find the number of cores on a machine
Is there a way to determine how many cores a machine has from C/C++ in a platform-independent way? If no such thing exists, what about determining it per-platform (Windows/*nix/Mac)?
C++11 #include //may return 0 when not able to detect const auto processor_count = std::thread::hardware_concurrency(); Reference: std::thread::hardware_concurrency In C++ prior to C++11, there's no portable way. Instead, you'll need to use one or more of the following methods (guarded by appropriate #ifdef lines): Win...
Programmatically find the number of cores on a machine Is there a way to determine how many cores a machine has from C/C++ in a platform-independent way? If no such thing exists, what about determining it per-platform (Windows/*nix/Mac)?
TITLE: Programmatically find the number of cores on a machine QUESTION: Is there a way to determine how many cores a machine has from C/C++ in a platform-independent way? If no such thing exists, what about determining it per-platform (Windows/*nix/Mac)? ANSWER: C++11 #include //may return 0 when not able to detect c...
[ "c++", "c", "multithreading", "multiplatform" ]
556
852
276,147
21
0
2008-09-29T19:51:45.580000
2008-09-29T22:14:07.143000
150,375
150,376
How do you break into the debugger from Python source code?
What do you insert into Python source code to have it break into pdb (when execution gets to that spot)?
import pdb; pdb.set_trace() See Python: Coding in the Debugger for Beginners for this and more helpful hints.
How do you break into the debugger from Python source code? What do you insert into Python source code to have it break into pdb (when execution gets to that spot)?
TITLE: How do you break into the debugger from Python source code? QUESTION: What do you insert into Python source code to have it break into pdb (when execution gets to that spot)? ANSWER: import pdb; pdb.set_trace() See Python: Coding in the Debugger for Beginners for this and more helpful hints.
[ "python", "debugging", "breakpoints", "pdb" ]
31
43
12,723
2
0
2008-09-29T19:55:12.593000
2008-09-29T19:55:20.143000
150,384
150,391
Text that only exists if CSS is enabled
I have a website in which I provide tool-tips for certain things using a hidden tag and JavaScript to track various mouse events. It works excellently. This site somewhat caters towards people with vision issues, so I try to make things degrade as well as possible if there is no JavaScript or CSS and generally I would ...
Perhaps you need to re-think the way you are providing tooltips. Could the content be contained in the title attribute of a semantically appropriate element? EDIT: If you provide more info, someone might be able to suggest more of a solution. What sorts of elements are the tooltips popping up on? Images? Would the abbr...
Text that only exists if CSS is enabled I have a website in which I provide tool-tips for certain things using a hidden tag and JavaScript to track various mouse events. It works excellently. This site somewhat caters towards people with vision issues, so I try to make things degrade as well as possible if there is no ...
TITLE: Text that only exists if CSS is enabled QUESTION: I have a website in which I provide tool-tips for certain things using a hidden tag and JavaScript to track various mouse events. It works excellently. This site somewhat caters towards people with vision issues, so I try to make things degrade as well as possib...
[ "html", "css" ]
1
3
349
3
0
2008-09-29T19:55:56.493000
2008-09-29T19:58:35.503000
150,397
150,399
.NET File Sync Library
Is there a good.NET file syncing library? It can be pretty basic and only needs to work on local and mapped drives (no server client model like rsync is needed). And yes, I know there is the MS Sync Services, but that is a lot more than what I need.
Can you put something together yourself based on the FileSystemWatcher component, or are you looking for something more complete?
.NET File Sync Library Is there a good.NET file syncing library? It can be pretty basic and only needs to work on local and mapped drives (no server client model like rsync is needed). And yes, I know there is the MS Sync Services, but that is a lot more than what I need.
TITLE: .NET File Sync Library QUESTION: Is there a good.NET file syncing library? It can be pretty basic and only needs to work on local and mapped drives (no server client model like rsync is needed). And yes, I know there is the MS Sync Services, but that is a lot more than what I need. ANSWER: Can you put somethin...
[ ".net", "synchronization" ]
5
1
5,112
3
0
2008-09-29T19:59:51.897000
2008-09-29T20:01:08.320000
150,403
150,529
Desktop Applications: Architectural Frameworks?
I'm wondering if there are any architectural frameworks out there to create desktop or standalone applications, in Java or C# for instance. It seems that there are tons of them available for web applications but I can't find many good resources on frameworks or architectural best-practices for desktop development. Idea...
While not directly related to desktop applications if you are looking for decent source code for well written projects I asked a similar question: Open source C# projects that have extremely high code quality to learn from. People gave some pretty good suggestions there: Scott Hanselman's The Weekly Source Code series ...
Desktop Applications: Architectural Frameworks? I'm wondering if there are any architectural frameworks out there to create desktop or standalone applications, in Java or C# for instance. It seems that there are tons of them available for web applications but I can't find many good resources on frameworks or architectu...
TITLE: Desktop Applications: Architectural Frameworks? QUESTION: I'm wondering if there are any architectural frameworks out there to create desktop or standalone applications, in Java or C# for instance. It seems that there are tons of them available for web applications but I can't find many good resources on framew...
[ "c#", "java", "architecture", "frameworks" ]
22
8
11,231
13
0
2008-09-29T20:02:35.947000
2008-09-29T20:36:25.817000
150,404
150,412
What is the easiest way to read/manipulate query string params using javascript?
The examples I've seen online seem much more complex than I expected (manually parsing &/?/= into pairs, using regular expressions, etc). We're using asp.net ajax (don't see anything in their client side reference) and would consider adding jQuery if it would really help. I would think there is a more elegant solution ...
There is indeed a QueryString plugin for jQuery, if you're willing to install the jQuery core and the plugin it could prove useful.
What is the easiest way to read/manipulate query string params using javascript? The examples I've seen online seem much more complex than I expected (manually parsing &/?/= into pairs, using regular expressions, etc). We're using asp.net ajax (don't see anything in their client side reference) and would consider addin...
TITLE: What is the easiest way to read/manipulate query string params using javascript? QUESTION: The examples I've seen online seem much more complex than I expected (manually parsing &/?/= into pairs, using regular expressions, etc). We're using asp.net ajax (don't see anything in their client side reference) and wo...
[ "javascript", "query-string" ]
13
12
30,377
7
0
2008-09-29T20:03:04.277000
2008-09-29T20:05:41.773000
150,405
150,409
Will upgrading Php 5.2.5 to 5.2.6 result in any problems?
We're currently running with php 5.2.5. We have now encountered a bug that creates a seg fault. Our first idea at the solution is upgrading to version 5.2.6 but are skeptical of problems that it will create. We are running Apache and host a dozen or so sites. Will any existing code break? Are there any significant chan...
It's impossible for any of us to say definitely yes or no about your existing code breaking without performing an analysis on it first. This is exactly what test environments are for. If you have a test environment set up, you can perform the upgrade, then do regression testing to see if anything breaks. Without this e...
Will upgrading Php 5.2.5 to 5.2.6 result in any problems? We're currently running with php 5.2.5. We have now encountered a bug that creates a seg fault. Our first idea at the solution is upgrading to version 5.2.6 but are skeptical of problems that it will create. We are running Apache and host a dozen or so sites. Wi...
TITLE: Will upgrading Php 5.2.5 to 5.2.6 result in any problems? QUESTION: We're currently running with php 5.2.5. We have now encountered a bug that creates a seg fault. Our first idea at the solution is upgrading to version 5.2.6 but are skeptical of problems that it will create. We are running Apache and host a doz...
[ "php", "upgrade" ]
2
11
615
5
0
2008-09-29T20:03:27.223000
2008-09-29T20:05:09.137000
150,416
150,431
Tracking Globalization progress
With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. My thought was to use a custom Attribute and place it on all classes that have been "fixed". What do you think? Does anyone have a bette...
Using an attribute to determine which classes have been globalized would then require a tool to process the code and determine which classes have and haven't been "processed", it seems like it's getting a bit complicated. A more traditional project tracking process would probably be better - and wouldn't "pollute" your...
Tracking Globalization progress With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. My thought was to use a custom Attribute and place it on all classes that have been "fixed". What do you...
TITLE: Tracking Globalization progress QUESTION: With our next major release we are looking to globalize our ASP.Net application and I was asked to think of a way to keep track of what code has been already worked on in this effort. My thought was to use a custom Attribute and place it on all classes that have been "f...
[ "c#", "globalization" ]
1
1
193
3
0
2008-09-29T20:07:32.237000
2008-09-29T20:11:28.887000
150,429
150,700
Retrieve NTLM Active Directory user data to Rails w/o IIS
I believe that we can allow Firefox to sent NTLM data to SharePoint sites to do automatic authentication, and I think that this is doable with IIS. I'd like to do the same thing with an internal Rails site. Does anyone know of way that I could authenticate NTLM type user information through a Apache/mongrel setup (prov...
I'm assuming you've already worked out which HTTP headers you need to send in order to get firefox and IE to send back the NTLM authentication stuff, and are just needing to handle that on the server side? You could use some of ruby's win32 libraries to access the underlying windows authentication functions which handl...
Retrieve NTLM Active Directory user data to Rails w/o IIS I believe that we can allow Firefox to sent NTLM data to SharePoint sites to do automatic authentication, and I think that this is doable with IIS. I'd like to do the same thing with an internal Rails site. Does anyone know of way that I could authenticate NTLM ...
TITLE: Retrieve NTLM Active Directory user data to Rails w/o IIS QUESTION: I believe that we can allow Firefox to sent NTLM data to SharePoint sites to do automatic authentication, and I think that this is doable with IIS. I'd like to do the same thing with an internal Rails site. Does anyone know of way that I could ...
[ "ruby-on-rails", "active-directory", "ntlm" ]
6
2
4,324
7
0
2008-09-29T20:11:20.747000
2008-09-29T21:13:29.160000
150,446
1,111,983
How do I detect when someone shakes an iPhone?
I want to react when somebody shakes the iPhone. I don't particularly care how they shake it, just that it was waved vigorously about for a split second. Does anyone know how to detect this?
In 3.0, there's now an easier way - hook into the new motion events. The main trick is that you need to have some UIView (not UIViewController) that you want as firstResponder to receive the shake event messages. Here's the code that you can use in any UIView to get shake events: @implementation ShakingView - (void)mo...
How do I detect when someone shakes an iPhone? I want to react when somebody shakes the iPhone. I don't particularly care how they shake it, just that it was waved vigorously about for a split second. Does anyone know how to detect this?
TITLE: How do I detect when someone shakes an iPhone? QUESTION: I want to react when somebody shakes the iPhone. I don't particularly care how they shake it, just that it was waved vigorously about for a split second. Does anyone know how to detect this? ANSWER: In 3.0, there's now an easier way - hook into the new m...
[ "ios", "accelerometer", "motion-detection", "shake" ]
346
293
127,315
17
0
2008-09-29T20:14:59.737000
2009-07-10T21:06:33.907000
150,454
153,717
Is there some way to make variables like $a and $b in regard to strict?
In light of Michael Carman's comment, I have decided to rewrite the question. Note that 11 comments appear before this edit, and give credence to Michael's observation that I did not write the question in a way that made it clear what I was asking. Question: What is the standard--or cleanest way--to fake the special st...
If I'm understanding your question you want to write a module that declares variables in the user's namespace (so they don't have to) and which get localized automatically in callbacks. Is that right? You can do this by declaring globals and exporting them. (Though do note that it's generally considered bad form to exp...
Is there some way to make variables like $a and $b in regard to strict? In light of Michael Carman's comment, I have decided to rewrite the question. Note that 11 comments appear before this edit, and give credence to Michael's observation that I did not write the question in a way that made it clear what I was asking....
TITLE: Is there some way to make variables like $a and $b in regard to strict? QUESTION: In light of Michael Carman's comment, I have decided to rewrite the question. Note that 11 comments appear before this edit, and give credence to Michael's observation that I did not write the question in a way that made it clear ...
[ "perl", "timtowtdi" ]
5
2
622
13
0
2008-09-29T20:16:37.893000
2008-09-30T16:00:07.563000
150,479
310,967
Order of items in classes: Fields, Properties, Constructors, Methods
Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods? I'm curious if there is a hard and fast rule about the order of items? I'm kind of all over the place. I want to stick with a particular standard so I can do it...
According to the StyleCop Rules Documentation the ordering is as follows. Within a class, struct or interface: (SA1201 and SA1203) Constant Fields Fields Constructors Finalizers (Destructors) Delegates Events Enums Interfaces ( interface implementations ) Properties Indexers Methods Structs Classes Within each of these...
Order of items in classes: Fields, Properties, Constructors, Methods Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods? I'm curious if there is a hard and fast rule about the order of items? I'm kind of all over...
TITLE: Order of items in classes: Fields, Properties, Constructors, Methods QUESTION: Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public Fields Private Fields Properties Constructors Methods? I'm curious if there is a hard and fast rule about the order of items? I'...
[ "c#", ".net", "code-cleanup", "code-structure" ]
813
1,269
369,249
16
0
2008-09-29T20:23:21.793000
2008-11-22T06:41:49.557000
150,499
152,746
Adding AutoComplete to an Infragisitcs UltraDateTimeEditor control
I'm attempting to modify an Infragisitcs UltraDateTimeEditor control so that the current year and a default time are inserted when the user only enters values for the month and day. The control has an AutoFillDate property, however setting this to "year" seems to overwrite user input entirely. Also changing the Invalid...
Turns out the Event to handle for this is "BeforeExitEditMode." I was able to inspect and modify the user input before the validators fired.
Adding AutoComplete to an Infragisitcs UltraDateTimeEditor control I'm attempting to modify an Infragisitcs UltraDateTimeEditor control so that the current year and a default time are inserted when the user only enters values for the month and day. The control has an AutoFillDate property, however setting this to "year...
TITLE: Adding AutoComplete to an Infragisitcs UltraDateTimeEditor control QUESTION: I'm attempting to modify an Infragisitcs UltraDateTimeEditor control so that the current year and a default time are inserted when the user only enters values for the month and day. The control has an AutoFillDate property, however set...
[ ".net", "winforms", "infragistics" ]
0
0
1,289
1
0
2008-09-29T20:27:53.013000
2008-09-30T12:05:53.180000
150,501
151,114
Slicehost installation profile
I'm no UNIX Guru, but I've had to set up a handful of slices for various web projects. I've used the articles on there to set up users, a basic firewall, nginx or apache, and other bits and pieces of a basic web server. I foresee more slice administration in my future. Is there a more efficient way to set up users, per...
It sounds like you can create a new slice from the backup of an existing one. This might not work for you if the slices would be different sizes, different distros, etc. Their forums mention this: Clone a slice?
Slicehost installation profile I'm no UNIX Guru, but I've had to set up a handful of slices for various web projects. I've used the articles on there to set up users, a basic firewall, nginx or apache, and other bits and pieces of a basic web server. I foresee more slice administration in my future. Is there a more eff...
TITLE: Slicehost installation profile QUESTION: I'm no UNIX Guru, but I've had to set up a handful of slices for various web projects. I've used the articles on there to set up users, a basic firewall, nginx or apache, and other bits and pieces of a basic web server. I foresee more slice administration in my future. I...
[ "unix", "server-configuration", "slicehost" ]
3
4
427
2
0
2008-09-29T20:28:13.247000
2008-09-29T23:01:17.780000
150,505
150,518
How to get GET request values in Django?
I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the HttpRequest object? My HttpRequest.GET currently returns an empty QueryDict object. I'd like to learn how to do this without a library, so I can get to k...
When a URL is like domain/search/?q=haha, you would use request.GET.get('q', ''). q is the parameter you want, and '' is the default value if q isn't found. However, if you are instead just configuring your URLconf **, then your captures from the regex are passed to the function as arguments (or named arguments). Such ...
How to get GET request values in Django? I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the HttpRequest object? My HttpRequest.GET currently returns an empty QueryDict object. I'd like to learn how to do ...
TITLE: How to get GET request values in Django? QUESTION: I am currently defining regular expressions in order to capture parameters in a URL, as described in the tutorial. How do I access parameters from the URL as part the HttpRequest object? My HttpRequest.GET currently returns an empty QueryDict object. I'd like t...
[ "python", "django", "url", "get", "url-parameters" ]
629
848
917,440
19
0
2008-09-29T20:29:55.223000
2008-09-29T20:31:43.347000
150,513
150,536
HTML input style to hide the box but show the contents
I have a form in HTML where our users fill in the data and then print it. The data isn't saved anywhere. These forms come from outside our company and are built as html pages to resemble the original as closely as possible and then stuffed away and forgotten in a folder on the intranet. Normally another developer does ...
Add a separate CSS file for printing by doing something like this: add it to the section of the page. In this(print.css) file include styling relevant to what you want to see when the page is printed, for example: input{border: 0px} should hide the border of input boxes when printing.
HTML input style to hide the box but show the contents I have a form in HTML where our users fill in the data and then print it. The data isn't saved anywhere. These forms come from outside our company and are built as html pages to resemble the original as closely as possible and then stuffed away and forgotten in a f...
TITLE: HTML input style to hide the box but show the contents QUESTION: I have a form in HTML where our users fill in the data and then print it. The data isn't saved anywhere. These forms come from outside our company and are built as html pages to resemble the original as closely as possible and then stuffed away an...
[ "html", "css", "printing" ]
4
12
34,414
3
0
2008-09-29T20:30:54.193000
2008-09-29T20:38:55.873000
150,514
150,587
Custom method in model to return an object
In the database I have a field named 'body' that has an XML in it. The method I created in the model looks like this: def self.get_personal_data_module(person_id) person_module = find_by_person_id(person_id) item_module = Hpricot(person_module.body) personal_info = Array.new personal_info = {:studies => (item_module/"s...
This is relatively simple; you're getting an Array because the code is building one. If you wanted to return an object, you'd do something like this: class PersonalData attr_accessor:studies attr_accessor:birth_place attr_accessor:marital_status def initialize(studies,birth_place,marital_status) @studies = studies @bi...
Custom method in model to return an object In the database I have a field named 'body' that has an XML in it. The method I created in the model looks like this: def self.get_personal_data_module(person_id) person_module = find_by_person_id(person_id) item_module = Hpricot(person_module.body) personal_info = Array.new p...
TITLE: Custom method in model to return an object QUESTION: In the database I have a field named 'body' that has an XML in it. The method I created in the model looks like this: def self.get_personal_data_module(person_id) person_module = find_by_person_id(person_id) item_module = Hpricot(person_module.body) personal_...
[ "ruby-on-rails", "ruby" ]
1
4
12,680
3
0
2008-09-29T20:31:02.680000
2008-09-29T20:50:31.197000