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
154,900
154,984
What does `$hash{$key} |= {}` do in Perl?
I was wrestling with some Perl that uses hash references. In the end it turned out that my problem was the line: $myhash{$key} |= {}; That is, "assign $myhash{$key} a reference to an empty hash, unless it already has a value". Dereferencing this and trying to use it as a hash reference, however, resulted in interpreter...
Perl has shorthand assignment operators. The ||= operator is often used to set default values for variables due to Perl's feature of having logical operators return the last value evaluated. The problem is that you used |= which is a bitwise or instead of ||= which is a logical or. As of Perl 5.10 it's better to use //...
What does `$hash{$key} |= {}` do in Perl? I was wrestling with some Perl that uses hash references. In the end it turned out that my problem was the line: $myhash{$key} |= {}; That is, "assign $myhash{$key} a reference to an empty hash, unless it already has a value". Dereferencing this and trying to use it as a hash r...
TITLE: What does `$hash{$key} |= {}` do in Perl? QUESTION: I was wrestling with some Perl that uses hash references. In the end it turned out that my problem was the line: $myhash{$key} |= {}; That is, "assign $myhash{$key} a reference to an empty hash, unless it already has a value". Dereferencing this and trying to ...
[ "perl", "initialization", "hash-reference" ]
4
17
3,338
4
0
2008-09-30T20:27:56.843000
2008-09-30T20:40:13.443000
154,902
154,930
Syntax error with different gcc version?
I wrote a program in C with Ubuntu Linux and now I need to port it over to a UNIX machine (or what I believe to be a UNIX box). It compiles fine on my Ubuntu with GCC but when I try to compile it with GCC on the UNIX box, it gives this error: a.c: In function `goUpDir': a.c:44: parse error before `char' a.c:45: `newDir...
If you are compiling pure C, variables must be declared on the beggining of the functions. I mention this because most people compile their C programs using C++ compilers, which offers then some resources not normally available to pure C compilers, the most common example being the // comment lines.
Syntax error with different gcc version? I wrote a program in C with Ubuntu Linux and now I need to port it over to a UNIX machine (or what I believe to be a UNIX box). It compiles fine on my Ubuntu with GCC but when I try to compile it with GCC on the UNIX box, it gives this error: a.c: In function `goUpDir': a.c:44: ...
TITLE: Syntax error with different gcc version? QUESTION: I wrote a program in C with Ubuntu Linux and now I need to port it over to a UNIX machine (or what I believe to be a UNIX box). It compiles fine on my Ubuntu with GCC but when I try to compile it with GCC on the UNIX box, it gives this error: a.c: In function `...
[ "c", "gcc", "syntax-error" ]
1
3
5,031
9
0
2008-09-30T20:28:12.193000
2008-09-30T20:31:39.813000
154,920
154,936
How do I fix connection manager error that causes the package to fail in production?
I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me. Here is the error: Error: The AcquireConection method call to the connection manager "DestinationConnectionOLEDB" failed with error code 0xC0202009. I have figured out the cause,...
Disable the password by setting the ProtectionLevel in the package properties to DontSaveSensitive. I also recommend moving the connection string to a package variable and make an expression on the connection. Enable package configurations. Then you are free to change the connection and to use integrated security or no...
How do I fix connection manager error that causes the package to fail in production? I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me. Here is the error: Error: The AcquireConection method call to the connection manager "Destina...
TITLE: How do I fix connection manager error that causes the package to fail in production? QUESTION: I have created an SSIS package and it works great on my dev machine. But, when I try to run it on the production server, it errors out on me. Here is the error: Error: The AcquireConection method call to the connectio...
[ "sql", "sql-server", "ssis" ]
1
6
5,135
1
0
2008-09-30T20:30:28.990000
2008-09-30T20:33:10.497000
154,959
155,652
Apache/Rails/Passenger Displaying Site Index?
I have a Rails app that I have successfully tested with Mongrel and Webkit. Now I want to test deployment. I set up a VMWare Image using Ubuntu 8.04. I have installed Rails following this method https://help.ubuntu.com/community/RubyOnRails with the exception of using Gems 1.3 instead of 1.2. I have configured and inst...
Two questions: 1) Is Rails running at all on the server? Passenger should start Rails automatically on first request - if you do a ps, do you see it running? 2) Which directory are you seeing - is it your rails directory or the public/ directory? If it's the former, your symlink is likely pointing the wrong place (it s...
Apache/Rails/Passenger Displaying Site Index? I have a Rails app that I have successfully tested with Mongrel and Webkit. Now I want to test deployment. I set up a VMWare Image using Ubuntu 8.04. I have installed Rails following this method https://help.ubuntu.com/community/RubyOnRails with the exception of using Gems ...
TITLE: Apache/Rails/Passenger Displaying Site Index? QUESTION: I have a Rails app that I have successfully tested with Mongrel and Webkit. Now I want to test deployment. I set up a VMWare Image using Ubuntu 8.04. I have installed Rails following this method https://help.ubuntu.com/community/RubyOnRails with the except...
[ "ruby-on-rails", "ubuntu", "apache2", "passenger" ]
6
8
3,639
1
0
2008-09-30T20:35:59.070000
2008-09-30T23:59:49.517000
154,964
154,997
How do you avoid adding timestamp fields to your tables?
I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record that we see in many solutions. My question: Is there a better alternative? Scenario: You have a huge DB (in terms of tables, not records), and then the customer comes and asks you to add "timestamping" to 80% of your t...
While you're at it, also record the user who made the change. The flaw with the separate-table design (in addition to the join performance highlighted by others) is that it makes the assumption that every table has an identity column for the key. That's not always true. If you use SQL Server, the new 2008 version suppo...
How do you avoid adding timestamp fields to your tables? I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record that we see in many solutions. My question: Is there a better alternative? Scenario: You have a huge DB (in terms of tables, not records), and then the customer ...
TITLE: How do you avoid adding timestamp fields to your tables? QUESTION: I have a question regarding the two additional columns (timeCreated, timeLastUpdated) for each record that we see in many solutions. My question: Is there a better alternative? Scenario: You have a huge DB (in terms of tables, not records), and ...
[ "database", "timestamp" ]
14
12
3,982
11
0
2008-09-30T20:37:17.103000
2008-09-30T20:41:50.523000
154,993
155,040
Reading .resx files programmatically
I have an application where the contents of e-mails that get sent are stored in a.resx file. This is an ASP.Net application, the.resx file lives in /App_GlobalResources When I need to send an e-mail, i'm reading this using: HttpContext.GetGlobalResourceObject("MailContents", "EmailID").ToString Now, I need to use the s...
I think I answered my own question... There's a ResXResourceReader class. I couldn't find it because it's in the Windows Forms namespace, which is not included in my current DLL references. Unfortunately, this will only let me iterate through results, so i'll implement some cute caching (read: memoization) over it...
Reading .resx files programmatically I have an application where the contents of e-mails that get sent are stored in a.resx file. This is an ASP.Net application, the.resx file lives in /App_GlobalResources When I need to send an e-mail, i'm reading this using: HttpContext.GetGlobalResourceObject("MailContents", "EmailI...
TITLE: Reading .resx files programmatically QUESTION: I have an application where the contents of e-mails that get sent are stored in a.resx file. This is an ASP.Net application, the.resx file lives in /App_GlobalResources When I need to send an e-mail, i'm reading this using: HttpContext.GetGlobalResourceObject("Mail...
[ ".net", ".net-2.0", "resource-files" ]
2
3
5,138
3
0
2008-09-30T20:41:34.423000
2008-09-30T20:49:48.477000
154,998
157,311
Beginner Help for Developing Web Pages for Smart Phones
I have just started authoring web pages for use on "smart phones". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience developing UI for these devices? What emulation kits would you recommend, and h...
Check out WURFL - the Wireless Universal Resource File The WURFL is an XML configuration file which contains information about capabilities and features of many mobile devices. The main scope of the file is to collect as much information as we can about all the existing mobile devices that access WAP pages so that deve...
Beginner Help for Developing Web Pages for Smart Phones I have just started authoring web pages for use on "smart phones". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience developing UI for these...
TITLE: Beginner Help for Developing Web Pages for Smart Phones QUESTION: I have just started authoring web pages for use on "smart phones". I need to target Blackberry, WinCE, iPhone, etc. What resources or books would you recommend for someone with ample web and software development experience but no experience devel...
[ "iphone", "html", "blackberry" ]
0
1
598
3
0
2008-09-30T20:42:04.157000
2008-10-01T12:19:55.603000
155,022
155,048
What is the easiest way to find out how much memory an object uses in .NET?
What is the easiest way to find out how much memory an object uses in.NET? Preferably without having to resort to a third party tool. Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of types. Some related posts: Object Memory Analysis in.NET Does an empty array in.NET use any spa...
you could also do something like this: int startMem = GC.GetTotalMemory(true); YourClass c = new YourClass(); int endMem = GC.GetTotalMemory(true); int usedMeme = endMem - startMem;
What is the easiest way to find out how much memory an object uses in .NET? What is the easiest way to find out how much memory an object uses in.NET? Preferably without having to resort to a third party tool. Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of types. Some related...
TITLE: What is the easiest way to find out how much memory an object uses in .NET? QUESTION: What is the easiest way to find out how much memory an object uses in.NET? Preferably without having to resort to a third party tool. Marshal.SizeOf or the sizeof operator look useful but only work with a restricted range of t...
[ "c#", ".net", "memory" ]
2
0
821
3
0
2008-09-30T20:46:29.687000
2008-09-30T20:52:56.050000
155,054
155,061
mysql timestamp column
Is it possible to define a timestamp column in a MySQL table that will automatically be updated every time a field in the same row is modified? Ideally this column should initially be set to the time a row was inserted. Cheers, Don
That is the default functionality of the timestamp column type. However, note that the format of this type is yyyymmddhhmmss (all digits, no colons or other separation). EDIT: The above comment about the format is only true for versions of MySQL < 4.1... Later versions format it like a DateTime
mysql timestamp column Is it possible to define a timestamp column in a MySQL table that will automatically be updated every time a field in the same row is modified? Ideally this column should initially be set to the time a row was inserted. Cheers, Don
TITLE: mysql timestamp column QUESTION: Is it possible to define a timestamp column in a MySQL table that will automatically be updated every time a field in the same row is modified? Ideally this column should initially be set to the time a row was inserted. Cheers, Don ANSWER: That is the default functionality of t...
[ "mysql", "timestamp" ]
35
24
72,275
4
0
2008-09-30T20:54:19.150000
2008-09-30T20:56:14.530000
155,064
155,073
Development PC: AMD vs Intel and 32-bit vs 64-bit
I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine. My primary development environment will be Microsoft, Visual Studio 2008 (and support of older Visual Studio 6 code a...
There are some instruction level differences between AMD and Intel but nothing that Visual Studio is going to uncover. Perhaps if you were developing with Sun Studio you might run into them (I have!). I would go for a 64 bit machine and run 32 bit VMs on it if you feel the need to do testing in that environment. The co...
Development PC: AMD vs Intel and 32-bit vs 64-bit I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine. My primary development environment will be Microsoft, Visual Studio...
TITLE: Development PC: AMD vs Intel and 32-bit vs 64-bit QUESTION: I am looking to purchase a new development PC. My budget is not more than $1,000 USD (including monitor). I am open to laptop (desktop replacement type) or the traditional desktop PC would do just fine. My primary development environment will be Micros...
[ "64-bit", "intel", "32-bit", "amd-processor" ]
9
6
5,939
8
0
2008-09-30T20:57:18.800000
2008-09-30T21:00:07.780000
155,065
155,214
brokenImageSkin dimensions in Flex
I am trying to implement a custom "broken image" icon to appear if I cannot load an image. To accomplish this, I used the brokenImageSkin parameter, but it renders the image at its true resolution, which ends up cutting off the image if the size of the control is constrained. How can I scale the brokenImageSkin to a cu...
I see that in this example, http://blog.flexexamples.com/2008/03/02/setting-a-custom-broken-image-skin-for-the-image-control-in-flex/#more-538, there is an IO error event where you could set the width and height of the image.
brokenImageSkin dimensions in Flex I am trying to implement a custom "broken image" icon to appear if I cannot load an image. To accomplish this, I used the brokenImageSkin parameter, but it renders the image at its true resolution, which ends up cutting off the image if the size of the control is constrained. How can ...
TITLE: brokenImageSkin dimensions in Flex QUESTION: I am trying to implement a custom "broken image" icon to appear if I cannot load an image. To accomplish this, I used the brokenImageSkin parameter, but it renders the image at its true resolution, which ends up cutting off the image if the size of the control is con...
[ "apache-flex" ]
0
1
859
2
0
2008-09-30T20:57:30.703000
2008-09-30T21:40:00.680000
155,069
156,753
How does one get started with procedural generation?
Procedural generation has been brought into the spotlight recently (by Spore, MMOs, etc), and it seems like an interesting/powerful programming technique. My questions are these: Do you know of any mid-sized projects that utilize procedural generation techniques? What language/class of languages is best for procedural ...
You should probably start with a little theory and simple examples such as the midpoint displacement algorithm. You should also learn a little about Perlin Noise if you are interested in generating graphics. I used this to get me started with my final year project on procedural generation. Fractals are closely related ...
How does one get started with procedural generation? Procedural generation has been brought into the spotlight recently (by Spore, MMOs, etc), and it seems like an interesting/powerful programming technique. My questions are these: Do you know of any mid-sized projects that utilize procedural generation techniques? Wha...
TITLE: How does one get started with procedural generation? QUESTION: Procedural generation has been brought into the spotlight recently (by Spore, MMOs, etc), and it seems like an interesting/powerful programming technique. My questions are these: Do you know of any mid-sized projects that utilize procedural generati...
[ "procedural-generation" ]
157
125
166,624
10
0
2008-09-30T20:59:27.063000
2008-10-01T08:50:36.607000
155,071
155,137
Simple Debounce Routine
Do you have a simple debounce routine handy to deal with a single switch input? This is a simple bare metal system without any OS. I would like to avoid a looping construct with a specific count, as the processor speed might fluctuate.
I think you could learn a lot about this here: http://www.ganssle.com/debouncing.pdf Your best bet is always to do this in hardware if possible, but there are some thoughts on software in there as well. Simple example code from TFA: #define CHECK_MSEC 5 // Read hardware every 5 msec #define PRESS_MSEC 10 // Stable time...
Simple Debounce Routine Do you have a simple debounce routine handy to deal with a single switch input? This is a simple bare metal system without any OS. I would like to avoid a looping construct with a specific count, as the processor speed might fluctuate.
TITLE: Simple Debounce Routine QUESTION: Do you have a simple debounce routine handy to deal with a single switch input? This is a simple bare metal system without any OS. I would like to avoid a looping construct with a specific count, as the processor speed might fluctuate. ANSWER: I think you could learn a lot abo...
[ "embedded", "debouncing" ]
10
11
32,729
11
0
2008-09-30T20:59:45.237000
2008-09-30T21:18:23.320000
155,074
155,082
Stored Procedure Default Value
I'm a newbie when it comes to SQL. When creating a stored procedure with parameters as such: @executed bit, @failure bit, @success bit, @testID int, @time float = 0, @name varchar(200) = '', @description varchar(200) = '', @executionDateTime nvarchar(max) = '', @message nvarchar(max) = '' This is the correct form for d...
A better approach would be to change the CommandText to just the name of the SP, and the CommandType to StoredProcedure - then the parameters will work much more cleanly: cmd.CommandText = "insert_test_result"; cmd.CommandType = CommandType.StoredProcedure; This also allows simpler passing by name, rather than position...
Stored Procedure Default Value I'm a newbie when it comes to SQL. When creating a stored procedure with parameters as such: @executed bit, @failure bit, @success bit, @testID int, @time float = 0, @name varchar(200) = '', @description varchar(200) = '', @executionDateTime nvarchar(max) = '', @message nvarchar(max) = ''...
TITLE: Stored Procedure Default Value QUESTION: I'm a newbie when it comes to SQL. When creating a stored procedure with parameters as such: @executed bit, @failure bit, @success bit, @testID int, @time float = 0, @name varchar(200) = '', @description varchar(200) = '', @executionDateTime nvarchar(max) = '', @message ...
[ "c#", "sql", "sql-server", "t-sql", "stored-procedures" ]
3
12
8,812
3
0
2008-09-30T21:00:52.770000
2008-09-30T21:02:34.030000
155,087
155,185
How can you inherit from a sealed class using reflection in .Net?
Before you start firing at me, I'm NOT looking to do this, but someone in another post said it was possible. How is it possible? I've never heard of inheriting from anything using reflection. But I've seen some strange things...
Without virtual functions to override, there's not much point in subclassing a sealed class. If you try write a sealed class with a virtual function in it, you get the following compiler error: // error CS0549: 'Seal.GetName()' is a new virtual member in sealed class 'Seal' However, you can get virtual functions into s...
How can you inherit from a sealed class using reflection in .Net? Before you start firing at me, I'm NOT looking to do this, but someone in another post said it was possible. How is it possible? I've never heard of inheriting from anything using reflection. But I've seen some strange things...
TITLE: How can you inherit from a sealed class using reflection in .Net? QUESTION: Before you start firing at me, I'm NOT looking to do this, but someone in another post said it was possible. How is it possible? I've never heard of inheriting from anything using reflection. But I've seen some strange things... ANSWER...
[ ".net", "inheritance" ]
21
17
22,077
5
0
2008-09-30T21:03:57.567000
2008-09-30T21:31:53.507000
155,097
155,176
Microsoft Excel mangles Diacritics in .csv files?
I am programmatically exporting data (using PHP 5.2) into a.csv test file. Example data: Numéro 1 (note the accented e). The data is utf-8 (no prepended BOM). When I open this file in MS Excel is displays as Numéro 1. I am able to open this in a text editor (UltraEdit) which displays it correctly. UE reports the chara...
A correctly formatted UTF8 file can have a Byte Order Mark as its first three octets. These are the hex values 0xEF, 0xBB, 0xBF. These octets serve to mark the file as UTF8 (since they are not relevant as "byte order" information). 1 If this BOM does not exist, the consumer/reader is left to infer the encoding type of ...
Microsoft Excel mangles Diacritics in .csv files? I am programmatically exporting data (using PHP 5.2) into a.csv test file. Example data: Numéro 1 (note the accented e). The data is utf-8 (no prepended BOM). When I open this file in MS Excel is displays as Numéro 1. I am able to open this in a text editor (UltraEdit)...
TITLE: Microsoft Excel mangles Diacritics in .csv files? QUESTION: I am programmatically exporting data (using PHP 5.2) into a.csv test file. Example data: Numéro 1 (note the accented e). The data is utf-8 (no prepended BOM). When I open this file in MS Excel is displays as Numéro 1. I am able to open this in a text ...
[ "excel", "encoding", "csv", "diacritics" ]
207
267
163,262
22
0
2008-09-30T21:07:06.827000
2008-09-30T21:30:17.317000
155,101
155,353
Make DocumentBuilder.parse ignore DTD references
When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this File object into a Document object while ignoring DTD reference error...
A similar approach to the one suggested by @anjanb builder.setEntityResolver(new EntityResolver() { @Override public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException { if (systemId.contains("foo.dtd")) { return new InputSource(new StringReader("")); } else { return null; } } ...
Make DocumentBuilder.parse ignore DTD references When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this File object into a D...
TITLE: Make DocumentBuilder.parse ignore DTD references QUESTION: When I parse my xml file (variable f) in this method, I get an error C:\Documents and Settings\joe\Desktop\aicpcudev\OnlineModule\map.dtd (The system cannot find the path specified) I know I do not have the dtd, nor do I need it. How can I parse this Fi...
[ "java", "document", "dtd" ]
90
61
88,463
7
0
2008-09-30T21:08:02.520000
2008-09-30T22:19:26.357000
155,105
155,149
How come classes in subfolders in my App_Code folder are not being found correctly?
I am getting the following error when I put class files in subfolders of my App_Code folder: errorCS0246: The type or namespace name 'MyClassName' could not be found (are you missing a using directive or an assembly reference?) This class is not in a namespace at all. Any ideas?
You need to add codeSubDirectories to your compilation element in web.config
How come classes in subfolders in my App_Code folder are not being found correctly? I am getting the following error when I put class files in subfolders of my App_Code folder: errorCS0246: The type or namespace name 'MyClassName' could not be found (are you missing a using directive or an assembly reference?) This cla...
TITLE: How come classes in subfolders in my App_Code folder are not being found correctly? QUESTION: I am getting the following error when I put class files in subfolders of my App_Code folder: errorCS0246: The type or namespace name 'MyClassName' could not be found (are you missing a using directive or an assembly re...
[ "c#", "asp.net", "namespaces", "app-code" ]
7
20
20,231
6
0
2008-09-30T21:09:11.283000
2008-09-30T21:22:47.773000
155,116
155,129
Best methodology for developing c# long running processor apps
I have several different c# worker applications that run various continuous tasks: sending emails from queue, importing new orders from website database to orders database, making database backups and restores, running data processing for OLTP -> OLAP, and other related tasks. Before, I released these as windows servic...
I like the console app approach. I typically have things set up so I can pass a switch like -unattended that suppresses the console screen.
Best methodology for developing c# long running processor apps I have several different c# worker applications that run various continuous tasks: sending emails from queue, importing new orders from website database to orders database, making database backups and restores, running data processing for OLTP -> OLAP, and ...
TITLE: Best methodology for developing c# long running processor apps QUESTION: I have several different c# worker applications that run various continuous tasks: sending emails from queue, importing new orders from website database to orders database, making database backups and restores, running data processing for ...
[ "background", "long-integer", "task", "worker", "runner" ]
2
2
2,182
8
0
2008-09-30T21:12:44.833000
2008-09-30T21:16:21.190000
155,144
155,228
How can I share application configuration in a .net application?
I've got a relatively large.Net system that consists of a number of different applications. Rather than having lots of different app.config files, I would like to share a single configuration file between all the apps. I would also like to have one version when developing on my machine, one version for someone else dev...
For large amounts of configuration which is needed by multiple applications, I would put this configuration into a central repository, e.g. a database, file in a common location. To use different versions of a configuration file for different environments, create a build configuration for each of the different environm...
How can I share application configuration in a .net application? I've got a relatively large.Net system that consists of a number of different applications. Rather than having lots of different app.config files, I would like to share a single configuration file between all the apps. I would also like to have one versio...
TITLE: How can I share application configuration in a .net application? QUESTION: I've got a relatively large.Net system that consists of a number of different applications. Rather than having lots of different app.config files, I would like to share a single configuration file between all the apps. I would also like ...
[ "c#", ".net", "app-config" ]
8
6
1,953
5
0
2008-09-30T21:21:44.123000
2008-09-30T21:43:44.883000
155,152
155,208
Nested dropdown
I'm building a form with php/mysql. I've got a table with a list of locations and sublocations. Each sublocation has a parent location. A column "parentid" references another locationid in the same table. I now want to load these values into a dropdown in the following manner: --Location 1 ----Sublocation 1 ----Subloca...
NOTE: This is only psuedo-code.. I didn't try running it, though you should be able to adjust the concepts to what you need. $parentsql = "SELECT parentid, parentname FROM table"; $result = mysql_query($parentsql); print " "; while($row = mysql_fetch_assoc($result)){ $childsql = "SELECT childID, childName from table w...
Nested dropdown I'm building a form with php/mysql. I've got a table with a list of locations and sublocations. Each sublocation has a parent location. A column "parentid" references another locationid in the same table. I now want to load these values into a dropdown in the following manner: --Location 1 ----Sublocati...
TITLE: Nested dropdown QUESTION: I'm building a form with php/mysql. I've got a table with a list of locations and sublocations. Each sublocation has a parent location. A column "parentid" references another locationid in the same table. I now want to load these values into a dropdown in the following manner: --Locati...
[ "php", "mysql", "html", "forms" ]
2
1
2,348
5
0
2008-09-30T21:23:20.657000
2008-09-30T21:37:23.417000
155,164
587,621
Connection error for sqlserver rake db:migrate
I am getting the following error: Open OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. HRESULT error code:0×80020009 Exception occurred. I have tried following the directions here with no luck. Any ideas? FIXED My spe...
My specifc issue I believe was related to having to many mixed systems installed on my laptop. I had Visual Studio 2005 and 2008 componets and SQL Server Managment Standard loaded with SQL Server Express Edition as well as various other componets that might have effected the stability of my envirnomnet. Once I reloaded...
Connection error for sqlserver rake db:migrate I am getting the following error: Open OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. HRESULT error code:0×80020009 Exception occurred. I have tried following the direct...
TITLE: Connection error for sqlserver rake db:migrate QUESTION: I am getting the following error: Open OLE error code:80004005 in Microsoft OLE DB Provider for SQL Server [DBNETLIB][ConnectionOpen (Connect()).]SQL Server does not exist or access denied. HRESULT error code:0×80020009 Exception occurred. I have tried fo...
[ "sql-server", "ruby-on-rails", "ruby" ]
2
0
623
3
0
2008-09-30T21:27:52.363000
2009-02-25T20:06:13.330000
155,168
155,405
Setting background colour of Silverlight Listbox
How do I set the background colour of a listbox? I have a listbox with textblocks in it and there does not appear to be anyway that actually works to set the background colour of these controls, why is this seemingly so hard? In the interests of full disclosure I asked a similar question earlier
You can do this using the ListBox.ItemContainerStyle property. Very nice explanation of this can be found here. Based on that example, we can set the ItemContainterStyle to have a transparent background color and then wrap the ListBox in a Border (the ListBox doesn't display its background color). If you just want to s...
Setting background colour of Silverlight Listbox How do I set the background colour of a listbox? I have a listbox with textblocks in it and there does not appear to be anyway that actually works to set the background colour of these controls, why is this seemingly so hard? In the interests of full disclosure I asked a...
TITLE: Setting background colour of Silverlight Listbox QUESTION: How do I set the background colour of a listbox? I have a listbox with textblocks in it and there does not appear to be anyway that actually works to set the background colour of these controls, why is this seemingly so hard? In the interests of full di...
[ "silverlight" ]
0
2
3,958
1
0
2008-09-30T21:28:42.050000
2008-09-30T22:37:58.030000
155,171
155,635
Handling exceptions raised during method called via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:
What happens to exceptions raised while in myMethod: if it is invoked via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:? In particular, can I catch them in the scope of the call to performSelectorOnMainThread like this... @try { [self performSelectorOnMainThread:@selector(myMethod) withObject:nil wai...
You won't be able to catch them like that. Cocoa may catch and log the exceptions to the console, but it won't re-raise them in the thread that called -perform. Instead, you could catch them in -myMethod: (or a wrapper that calls -myMethod:) and have it store them somewhere that your other thread can read them.
Handling exceptions raised during method called via NSObject's performSelectorOnMainThread:withObject:waitUntilDone: What happens to exceptions raised while in myMethod: if it is invoked via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:? In particular, can I catch them in the scope of the call to per...
TITLE: Handling exceptions raised during method called via NSObject's performSelectorOnMainThread:withObject:waitUntilDone: QUESTION: What happens to exceptions raised while in myMethod: if it is invoked via NSObject's performSelectorOnMainThread:withObject:waitUntilDone:? In particular, can I catch them in the scope ...
[ "objective-c", "cocoa", "macos", "exception" ]
4
5
549
1
0
2008-09-30T21:29:52.140000
2008-09-30T23:52:12.750000
155,183
155,254
Ideal user feedback for HTML input
Let's face it: writing proper, standards compliant HTML is quite difficult to do. Writing semantic HTML is even more so, but I don't think it's possible for a computer to figure that out. So my question to you is what would the "ideal" feedback for a user who entered HTML be? Would it be a W3C validator style list of e...
The output from the Firefox "HTML validator" add-on is pretty good. It shows you the source in a big window, and a list of errors in a small window (smallness doesn't matter, since you generally only care about the first one, since you're aiming for a total of none). Click an error to highlight, and an expanded explana...
Ideal user feedback for HTML input Let's face it: writing proper, standards compliant HTML is quite difficult to do. Writing semantic HTML is even more so, but I don't think it's possible for a computer to figure that out. So my question to you is what would the "ideal" feedback for a user who entered HTML be? Would it...
TITLE: Ideal user feedback for HTML input QUESTION: Let's face it: writing proper, standards compliant HTML is quite difficult to do. Writing semantic HTML is even more so, but I don't think it's possible for a computer to figure that out. So my question to you is what would the "ideal" feedback for a user who entered...
[ "html", "interface", "usability", "standards", "w3c" ]
0
1
281
2
0
2008-09-30T21:31:19.173000
2008-09-30T21:51:29.343000
155,188
155,263
Trigger a button click with JavaScript on the Enter key in a text box
I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit button on my current page, so I can't simply make the button a submit button. And, I only want the Enter key to click this...
In jQuery, the following would work: $("#id_of_textbox").keyup(function(event) { if (event.keyCode === 13) { $("#id_of_button").click(); } }); $("#pw").keyup(function(event) { if (event.keyCode === 13) { $("#myButton").click(); } }); $("#myButton").click(function() { alert("Button code executed."); }); Usernam...
Trigger a button click with JavaScript on the Enter key in a text box I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit button on my current page, so I can't simply make th...
TITLE: Trigger a button click with JavaScript on the Enter key in a text box QUESTION: I have one text input and one button (see below). How can I use JavaScript to trigger the button's click event when the Enter key is pressed inside the text box? There is already a different submit button on my current page, so I ca...
[ "javascript", "button", "onclick", "onkeydown", "onkeypress" ]
1,460
1,544
1,765,140
31
0
2008-09-30T21:32:09.577000
2008-09-30T21:52:16.970000
155,191
155,213
Windows API commctrl.h using application doesn't work on machines without the Platform SDK
I have written something that uses the following includes: #include #include #include #include #include #include This code works fine on 2 machines with the Platform SDK installed, but doesn't run (neither debug nor release versions) on clean installs of windows (VMs of course). It dies with the quite familiar: -------...
Use Dependency Walker. Download and install from http://www.dependencywalker.com/ (just unzip to install). Then load up your executable. The tool will highlight which DLL is missing. Then you can find the redistributable pack which you need to ship with your executable. If you use VS2005, most cases will be covered by ...
Windows API commctrl.h using application doesn't work on machines without the Platform SDK I have written something that uses the following includes: #include #include #include #include #include #include This code works fine on 2 machines with the Platform SDK installed, but doesn't run (neither debug nor release versi...
TITLE: Windows API commctrl.h using application doesn't work on machines without the Platform SDK QUESTION: I have written something that uses the following includes: #include #include #include #include #include #include This code works fine on 2 machines with the Platform SDK installed, but doesn't run (neither debug...
[ "c++", "windows", "dll" ]
2
5
4,179
3
0
2008-09-30T21:33:06.967000
2008-09-30T21:39:20.447000
155,202
156,562
"network location cannot be reached" error in IIS6
I am troubleshooting an issue with IIS6 where all sites bound to ip addresses other than the default give an error message "network location cannot be reached" when trying to start any of these sites. The nic has all the ip addresses configured. When I do a httpcfg query iplisten, I see only the default ip address. Whe...
The solution was to use httpcfg without specifying the port number.
"network location cannot be reached" error in IIS6 I am troubleshooting an issue with IIS6 where all sites bound to ip addresses other than the default give an error message "network location cannot be reached" when trying to start any of these sites. The nic has all the ip addresses configured. When I do a httpcfg que...
TITLE: "network location cannot be reached" error in IIS6 QUESTION: I am troubleshooting an issue with IIS6 where all sites bound to ip addresses other than the default give an error message "network location cannot be reached" when trying to start any of these sites. The nic has all the ip addresses configured. When ...
[ "iis-6" ]
3
3
3,601
3
0
2008-09-30T21:36:32.077000
2008-10-01T07:25:09.727000
155,203
155,238
Good error handling practice
What is a good error handling practice for an asp.net site? Examples? Thanks!
As with any.net project I find the best way is to only catch specific error types if they are may to happen on the given page. For example you could catch Format Exceptions for a users given input (just incase JavaScript validation fails and you have not use tryparse) but always leave the catching of the top level Exce...
Good error handling practice What is a good error handling practice for an asp.net site? Examples? Thanks!
TITLE: Good error handling practice QUESTION: What is a good error handling practice for an asp.net site? Examples? Thanks! ANSWER: As with any.net project I find the best way is to only catch specific error types if they are may to happen on the given page. For example you could catch Format Exceptions for a users g...
[ "asp.net", "error-handling" ]
10
9
2,279
7
0
2008-09-30T21:36:34.883000
2008-09-30T21:47:16.623000
155,234
157,964
Capistrano not restarting Mongrel clusters properly
I have a cluster of three mongrels running under nginx, and I deploy the app using Capistrano 2.4.3. When I "cap deploy" when there is a running system, the behavior is: The app is deployed. The code is successfully updated. In the cap deploy output, there is this: executing "sudo -p 'sudo password: ' mongrel_rails clu...
You can explicitly tell the mongrel_cluster recipes to remove the pid files before a start by adding the following in your capistrano recipes: # helps keep mongrel pid files clean set:mongrel_clean, true This causes it to pass the --clean option to mongrel_cluster_ctl. I went back and looked at one of my deployment rec...
Capistrano not restarting Mongrel clusters properly I have a cluster of three mongrels running under nginx, and I deploy the app using Capistrano 2.4.3. When I "cap deploy" when there is a running system, the behavior is: The app is deployed. The code is successfully updated. In the cap deploy output, there is this: ex...
TITLE: Capistrano not restarting Mongrel clusters properly QUESTION: I have a cluster of three mongrels running under nginx, and I deploy the app using Capistrano 2.4.3. When I "cap deploy" when there is a running system, the behavior is: The app is deployed. The code is successfully updated. In the cap deploy output,...
[ "ruby-on-rails", "ruby", "deployment", "capistrano", "mongrel" ]
5
4
1,926
5
0
2008-09-30T21:46:38.760000
2008-10-01T14:42:16.323000
155,246
155,275
How do you truncate all tables in a database using TSQL?
I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. What is the best way to remove all the data from all the tables using TSQL? Are there system stored procedures, views, e...
For SQL 2005, EXEC sp_MSForEachTable 'TRUNCATE TABLE?' Couple more links for 2000 and 2005/2008..
How do you truncate all tables in a database using TSQL? I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. What is the best way to remove all the data from all the tables...
TITLE: How do you truncate all tables in a database using TSQL? QUESTION: I have a test environment for a database that I want to reload with new data at the start of a testing cycle. I am not interested in rebuilding the entire database- just simply "re-setting" the data. What is the best way to remove all the data f...
[ "sql-server", "t-sql" ]
231
208
353,421
17
0
2008-09-30T21:49:17.663000
2008-09-30T21:56:32.310000
155,250
155,293
Help me understand how QA works in Scrum
Apparently we use the Scrum development methodology. Here's generally how it goes: Developers thrash around trying to accomplish their tasks. Generally the tasks take most of the sprint to complete. QA pesters Dev to release something they can test, Dev finally throws some buggy code out to QA a day or two before the s...
My opinion is that you have an estimation problem. It seems that the time to test each feature is missing, and only the building part is being considered when planning the sprint. I'm not saying it is an easy problem to solve, because it is more common than anything. But things that could help are: Consider QA as membe...
Help me understand how QA works in Scrum Apparently we use the Scrum development methodology. Here's generally how it goes: Developers thrash around trying to accomplish their tasks. Generally the tasks take most of the sprint to complete. QA pesters Dev to release something they can test, Dev finally throws some buggy...
TITLE: Help me understand how QA works in Scrum QUESTION: Apparently we use the Scrum development methodology. Here's generally how it goes: Developers thrash around trying to accomplish their tasks. Generally the tasks take most of the sprint to complete. QA pesters Dev to release something they can test, Dev finally...
[ "agile", "scrum" ]
64
41
40,227
13
0
2008-09-30T21:50:13.150000
2008-09-30T21:59:37.717000
155,260
155,296
What is the "< >" syntax within C#
I have been learning about the basics of C# but haven't come across a good explanation of what this is: var l = new List (); I don't know what the is doing or if it's the List that is doing the magic. I have also seen objects been thrown within the < > tags. Can someone explain this to me with examples, please?
That is the generic syntax for C#. The basic concept is that it allows you to use a Type placeholder and substitute the actual real type in at compile time. For example, the old way: ArrayList foos = new Arraylist(); foos.Add("Test"); worked by making ArrayList store a list of System.Objects (The base type for all thin...
What is the "< >" syntax within C# I have been learning about the basics of C# but haven't come across a good explanation of what this is: var l = new List (); I don't know what the is doing or if it's the List that is doing the magic. I have also seen objects been thrown within the < > tags. Can someone explain this t...
TITLE: What is the "< >" syntax within C# QUESTION: I have been learning about the basics of C# but haven't come across a good explanation of what this is: var l = new List (); I don't know what the is doing or if it's the List that is doing the magic. I have also seen objects been thrown within the < > tags. Can some...
[ "c#", ".net" ]
6
24
1,196
7
0
2008-09-30T21:51:48.810000
2008-09-30T22:00:04.797000
155,271
499,209
how to hide the text limit line in netbeans 6.5?
Is there a way to hide the text limit line in netbeans 6.5?
line is not moving to 200 column, but you can hide it setting its color to same as the background
how to hide the text limit line in netbeans 6.5? Is there a way to hide the text limit line in netbeans 6.5?
TITLE: how to hide the text limit line in netbeans 6.5? QUESTION: Is there a way to hide the text limit line in netbeans 6.5? ANSWER: line is not moving to 200 column, but you can hide it setting its color to same as the background
[ "netbeans" ]
7
9
9,127
9
0
2008-09-30T21:55:32.123000
2009-01-31T17:28:56.063000
155,299
159,134
Adding Combo Box to setup using Orca
I am trying to display a combo box in a dialog during setup of a component. Currently, we have a Radio Button Group. I figured that replacing it with the combo box should be as simple as adding proper entries in the "ComboBox" table in the MSI and in the "Control" table, replacing the references to the radio button gro...
Aha!! Figured out what it was. I was doing everything right, except that when i replaced the radio button with the combo box, there was still one element (Previous Button) which had the Radio Button Group as its next element (Sort of like a tab stop). And on form load, it tried to find the radio buttons and could not f...
Adding Combo Box to setup using Orca I am trying to display a combo box in a dialog during setup of a component. Currently, we have a Radio Button Group. I figured that replacing it with the combo box should be as simple as adding proper entries in the "ComboBox" table in the MSI and in the "Control" table, replacing t...
TITLE: Adding Combo Box to setup using Orca QUESTION: I am trying to display a combo box in a dialog during setup of a component. Currently, we have a Radio Button Group. I figured that replacing it with the combo box should be as simple as adding proper entries in the "ComboBox" table in the MSI and in the "Control" ...
[ "windows-installer", "installation", "orca" ]
2
2
1,287
1
0
2008-09-30T22:01:11.020000
2008-10-01T18:51:12.077000
155,303
155,487
.NET - How can you split a "caps" delimited string into an array?
How do I go from this string: "ThisIsMyCapsDelimitedString"...to this string: "This Is My Caps Delimited String" Fewest lines of code in VB.net is preferred but C# is also welcome. Cheers!
I made this a while ago. It matches each component of a CamelCase name. /([A-Z]+(?=$|[A-Z][a-z])|[A-Z]?[a-z]+)/g For example: "SimpleHTTPServer" => ["Simple", "HTTP", "Server"] "camelCase" => ["camel", "Case"] To convert that to just insert spaces between the words: Regex.Replace(s, "([a-z](?=[A-Z])|[A-Z](?=[A-Z][a-z])...
.NET - How can you split a "caps" delimited string into an array? How do I go from this string: "ThisIsMyCapsDelimitedString"...to this string: "This Is My Caps Delimited String" Fewest lines of code in VB.net is preferred but C# is also welcome. Cheers!
TITLE: .NET - How can you split a "caps" delimited string into an array? QUESTION: How do I go from this string: "ThisIsMyCapsDelimitedString"...to this string: "This Is My Caps Delimited String" Fewest lines of code in VB.net is preferred but C# is also welcome. Cheers! ANSWER: I made this a while ago. It matches ea...
[ ".net", "regex", "algorithm", "string", "pascalcasing" ]
123
187
25,685
19
0
2008-09-30T22:03:42.213000
2008-09-30T22:59:25.123000
155,306
155,404
Cross browser "jump to"/"scroll" textarea
I have a textarea with many lines of input, and a JavaScript event fires that necessitates I scroll the textarea to line 345. scrollTop sort of does what I want, except as far as I can tell it's pixel level, and I want something that operates on a line level. What also complicates things is that, afaik once again, it's...
You can stop wrapping with the wrap attribute. It is not part of HTML 4, but most browsers support it. You can compute the height of a line by dividing the height of the area by its number of rows. Tested OK in FF3 and IE6.
Cross browser "jump to"/"scroll" textarea I have a textarea with many lines of input, and a JavaScript event fires that necessitates I scroll the textarea to line 345. scrollTop sort of does what I want, except as far as I can tell it's pixel level, and I want something that operates on a line level. What also complica...
TITLE: Cross browser "jump to"/"scroll" textarea QUESTION: I have a textarea with many lines of input, and a JavaScript event fires that necessitates I scroll the textarea to line 345. scrollTop sort of does what I want, except as far as I can tell it's pixel level, and I want something that operates on a line level. ...
[ "javascript", "html", "css" ]
13
12
6,454
3
0
2008-09-30T22:04:20.717000
2008-09-30T22:37:17.220000
155,308
443,553
How do I get PHP to work with ADOdb and MySQL?
I'm trying to get a PHP site working in IIS on Windows Server with MySQL. I'm getting this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub...\adodb\drivers\adodb-mysql.inc.php on line 363 Update… This link outlines the steps I followed to install PHP on my server: How do I get PHP and MySQL...
I found the solution: How do I install MySQL modules within PHP?
How do I get PHP to work with ADOdb and MySQL? I'm trying to get a PHP site working in IIS on Windows Server with MySQL. I'm getting this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub...\adodb\drivers\adodb-mysql.inc.php on line 363 Update… This link outlines the steps I followed to insta...
TITLE: How do I get PHP to work with ADOdb and MySQL? QUESTION: I'm trying to get a PHP site working in IIS on Windows Server with MySQL. I'm getting this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub...\adodb\drivers\adodb-mysql.inc.php on line 363 Update… This link outlines the steps I...
[ "php", "mysql", "windows", "iis", "adodb" ]
1
1
6,770
4
0
2008-09-30T22:04:35.083000
2009-01-14T16:09:20.533000
155,314
418,953
How do I get a Video Thumbnail in .Net?
I'm looking to implement a function that retrieves a single frame from an input video, so I can use it as a thumbnail. Something along these lines should work: // filename examples: "test.avi", "test.dvr-ms" // position is from 0 to 100 percent (0.0 to 1.0) // returns a bitmap byte[] GetVideoThumbnail(string filename, ...
I ended up rolling my own stand alone class (with the single method I described), the source can be viewed here. Media browser is GPL but I am happy for the code I wrote for that file to be Public Domain. Keep in mind it uses interop from the directshow.net project so you will have to clear that portion of the code wit...
How do I get a Video Thumbnail in .Net? I'm looking to implement a function that retrieves a single frame from an input video, so I can use it as a thumbnail. Something along these lines should work: // filename examples: "test.avi", "test.dvr-ms" // position is from 0 to 100 percent (0.0 to 1.0) // returns a bitmap by...
TITLE: How do I get a Video Thumbnail in .Net? QUESTION: I'm looking to implement a function that retrieves a single frame from an input video, so I can use it as a thumbnail. Something along these lines should work: // filename examples: "test.avi", "test.dvr-ms" // position is from 0 to 100 percent (0.0 to 1.0) // r...
[ "c#", ".net", "video-processing" ]
28
10
38,311
5
0
2008-09-30T22:06:17.730000
2009-01-07T02:14:09.763000
155,321
156,352
What columns can be used in OUTPUT INTO clause?
I'm trying to build a mapping table to associate the IDs of new rows in a table with those that they're copied from. The OUTPUT INTO clause seems perfect for that, but it doesn't seem to behave according to the documentation. My code: DECLARE @Missing TABLE (SrcContentID INT PRIMARY KEY ) INSERT INTO @Missing ( SrcCont...
I've verified that the problem is that you can only use INSERTED columns. The documentation seems to indicate that you can use from_table_name, but I can't seem to get it to work (The multi-part identifier "m.ContentID" could not be bound.): TRUNCATE TABLE main SELECT * FROM incoming SELECT * FROM main DECLARE @Miss...
What columns can be used in OUTPUT INTO clause? I'm trying to build a mapping table to associate the IDs of new rows in a table with those that they're copied from. The OUTPUT INTO clause seems perfect for that, but it doesn't seem to behave according to the documentation. My code: DECLARE @Missing TABLE (SrcContentID ...
TITLE: What columns can be used in OUTPUT INTO clause? QUESTION: I'm trying to build a mapping table to associate the IDs of new rows in a table with those that they're copied from. The OUTPUT INTO clause seems perfect for that, but it doesn't seem to behave according to the documentation. My code: DECLARE @Missing TA...
[ "sql-server" ]
16
13
10,907
5
0
2008-09-30T22:08:43.637000
2008-10-01T05:35:22.160000
155,357
155,374
What are the best resources for learning CIL (MSIL)
I'm an expert C# 3 /.NET 3.5 programmer looking to start doing some runtime codegen using System.Reflection.Emit.DynamicMethod. I'd love to move up to the next level by becoming intimately familiar with IL. Any pointers (pun intended)?
The best way to learn it, is to write something you understand, then look at the IL it created. Also, depending on what you are doing, you can use expression trees instead of emitting IL, and then when you compile the expression trees, those smart guys at microsoft create the IL for ya.
What are the best resources for learning CIL (MSIL) I'm an expert C# 3 /.NET 3.5 programmer looking to start doing some runtime codegen using System.Reflection.Emit.DynamicMethod. I'd love to move up to the next level by becoming intimately familiar with IL. Any pointers (pun intended)?
TITLE: What are the best resources for learning CIL (MSIL) QUESTION: I'm an expert C# 3 /.NET 3.5 programmer looking to start doing some runtime codegen using System.Reflection.Emit.DynamicMethod. I'd love to move up to the next level by becoming intimately familiar with IL. Any pointers (pun intended)? ANSWER: The b...
[ "c#", ".net", "code-generation", "cil" ]
19
5
1,612
5
0
2008-09-30T22:21:15.183000
2008-09-30T22:28:01.080000
155,366
164,578
Control.Enter event doesn't fire when switching tasks. Is there an alternative that does?
Rep steps: create example.NET form application put a TextBox on the form wire a function up to the TextBox's Enter event When you run this application, the Control.Enter event fires when focus first goes to the TextBox. However, if you click away into another application and then click back into the test application, t...
If I try your example and click outside the control on another window, desktop, etc, I can get the Got and Lost Focus events to fire, but if you're only trying to click within a form or a control with only 1 control, these event will never be fired because it is the only thing to focus on. Neither will Entered or left,...
Control.Enter event doesn't fire when switching tasks. Is there an alternative that does? Rep steps: create example.NET form application put a TextBox on the form wire a function up to the TextBox's Enter event When you run this application, the Control.Enter event fires when focus first goes to the TextBox. However, i...
TITLE: Control.Enter event doesn't fire when switching tasks. Is there an alternative that does? QUESTION: Rep steps: create example.NET form application put a TextBox on the form wire a function up to the TextBox's Enter event When you run this application, the Control.Enter event fires when focus first goes to the T...
[ "c#", "events", "user-interface" ]
2
2
2,239
10
0
2008-09-30T22:25:17.030000
2008-10-02T20:58:57.393000
155,367
155,421
Does Oracle have something like Change Data Capture in SQL Server 2008?
Change Data Capture is a new feature in SQL Server 2008. From MSDN: Change data capture provides historical change information for a user table by capturing both the fact that DML changes were made and the actual data that was changed. Changes are captured by using an asynchronous process that reads the transaction log...
Sure. Oracle actually has a number of technologies for this sort of thing depending on the business requirements. Oracle has had something called Workspace Manager for a long time (8i days) that allows you to version-enable a table and track changes over time. This can be a bit heavyweight, though, because it is based ...
Does Oracle have something like Change Data Capture in SQL Server 2008? Change Data Capture is a new feature in SQL Server 2008. From MSDN: Change data capture provides historical change information for a user table by capturing both the fact that DML changes were made and the actual data that was changed. Changes are ...
TITLE: Does Oracle have something like Change Data Capture in SQL Server 2008? QUESTION: Change Data Capture is a new feature in SQL Server 2008. From MSDN: Change data capture provides historical change information for a user table by capturing both the fact that DML changes were made and the actual data that was cha...
[ "sql-server", "oracle" ]
3
5
4,275
5
0
2008-09-30T22:26:13.907000
2008-09-30T22:40:50.580000
155,371
4,240,940
XMLHttpRequest POST multipart/form-data
I want to use XMLHttpRequest in JavaScript to POST a form that includes a file type input element so that I can avoid page refresh and get useful XML back. I can submit the form without page refresh, using JavaScript to set the target attribute on the form to an iframe for MSIE or an object for Mozilla, but this has tw...
You can construct the 'multipart/form-data' request yourself (read more about it at http://www.faqs.org/rfcs/rfc2388.html ) and then use the send method (ie. xhr.send(your-multipart-form-data)). Similarly, but easier, in Firefox 4+ (also in Chrome 5+ and Safari 5+) you can use the FormData interface that helps to const...
XMLHttpRequest POST multipart/form-data I want to use XMLHttpRequest in JavaScript to POST a form that includes a file type input element so that I can avoid page refresh and get useful XML back. I can submit the form without page refresh, using JavaScript to set the target attribute on the form to an iframe for MSIE o...
TITLE: XMLHttpRequest POST multipart/form-data QUESTION: I want to use XMLHttpRequest in JavaScript to POST a form that includes a file type input element so that I can avoid page refresh and get useful XML back. I can submit the form without page refresh, using JavaScript to set the target attribute on the form to an...
[ "javascript", "ajax", "xmlhttprequest" ]
20
27
62,380
7
0
2008-09-30T22:27:46.010000
2010-11-21T23:02:18.970000
155,375
156,242
Why do I need OleDbCommand.Prepare()?
I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named "UpdatePaid", 3 paramaters as shown below) like so: OleDbCommand odc = new OleDbCommand("UpdatePaid", connection); OleDbParameter param; odc.CommandType = CommandType.StoredProcedure; param = odc.Parameters.A...
This is called, oddly enough, a prepared statement, and they're actually really nice. Basically what happens is you either create or get a sql statement (insert, delete, update) and instead of passing actual values, you pass "?" as a place holder. This is all well and good, except what we want is our values to get pass...
Why do I need OleDbCommand.Prepare()? I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named "UpdatePaid", 3 paramaters as shown below) like so: OleDbCommand odc = new OleDbCommand("UpdatePaid", connection); OleDbParameter param; odc.CommandType = CommandType.Stor...
TITLE: Why do I need OleDbCommand.Prepare()? QUESTION: I'm working with a datagrid and adapter that correspond with an MSAccess table through a stored query (named "UpdatePaid", 3 paramaters as shown below) like so: OleDbCommand odc = new OleDbCommand("UpdatePaid", connection); OleDbParameter param; odc.CommandType ...
[ "c#", ".net", "stored-procedures", "ole" ]
2
4
3,075
3
0
2008-09-30T22:28:56.583000
2008-10-01T04:30:49.490000
155,378
155,397
How to alter a float by its smallest increment (or close to it)?
I have a double value f and would like a way to nudge it very slightly larger (or smaller) to get a new value that will be as close as possible to the original but still strictly greater than (or less than) the original. It doesn't have to be close down to the last bit—it's more important that whatever change I make is...
Check your math.h file. If you're lucky you have the nextafter and nextafterf functions defined. They do exactly what you want in a portable and platform independent way and are part of the C99 standard. Another way to do it (could be a fallback solution) is to decompose your float into the mantissa and exponent part. ...
How to alter a float by its smallest increment (or close to it)? I have a double value f and would like a way to nudge it very slightly larger (or smaller) to get a new value that will be as close as possible to the original but still strictly greater than (or less than) the original. It doesn't have to be close down t...
TITLE: How to alter a float by its smallest increment (or close to it)? QUESTION: I have a double value f and would like a way to nudge it very slightly larger (or smaller) to get a new value that will be as close as possible to the original but still strictly greater than (or less than) the original. It doesn't have ...
[ "c++", "c", "floating-point" ]
51
67
11,590
7
0
2008-09-30T22:29:20.703000
2008-09-30T22:34:57.850000
155,391
155,433
Difference between a BitmapFrame and BitmapImage in WPF
What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?)
You should stick to using the abstract class BitmapSource if you need to get at the bits, or even ImageSource if you just want to draw it. The implementation BitmapFrame is just the object oriented nature of the implementation showing through. You shouldn't really have any need to distinguish between the implementation...
Difference between a BitmapFrame and BitmapImage in WPF What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?)
TITLE: Difference between a BitmapFrame and BitmapImage in WPF QUESTION: What is the difference between a BitmapFrame and BitmapImage in WPF? Where would you use each (ie. why would you use a BitmapFrame rather than a BitmapImage?) ANSWER: You should stick to using the abstract class BitmapSource if you need to get a...
[ ".net", "wpf" ]
15
13
13,842
3
0
2008-09-30T22:33:07.683000
2008-09-30T22:43:37.953000
155,400
156,377
FIPS compliant password encryption for .NET
I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save these credentials. I'd like to save these credentials with the ...
Look into the Data Protection API (DPAPI), which is FIPS compliant (as far as I can tell; you can review the evaluation here ). DPAPI is exposed in.NET 2.0 and greater with the System.Security.Cryptography.ProtectedData class. It uses the user's current credentials as the encryption key. See my more complete answer her...
FIPS compliant password encryption for .NET I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save these credentials. ...
TITLE: FIPS compliant password encryption for .NET QUESTION: I've working on a WinForms in VB.NET (3.5) application that requires the user to enter domain administrator credentials. To make things easier on the user, they should only have to enter the user name and password once, and then just rely on my app to save t...
[ ".net", "vb.net", "security", "encryption", "fips" ]
4
4
2,648
1
0
2008-09-30T22:35:47.410000
2008-10-01T05:50:49.813000
155,422
891,161
The best way to assert pre-condition and post-condition of arguments and values in .NET?
I have been thinking about design by contract lately and I was wondering what people think is the best way to assert pre-condition and post-condition of values in.NET? i.e. validating argument values to a method. Some people recommend Debug.Assert while others talk about using an if statement plus throwing an exception...
We'll eventually use Code Contracts when.NET 4.0 ships. However, in our production code right now we have had great success with a "Guard" class along with common way to generate exceptions. For more details, see my post about this.
The best way to assert pre-condition and post-condition of arguments and values in .NET? I have been thinking about design by contract lately and I was wondering what people think is the best way to assert pre-condition and post-condition of values in.NET? i.e. validating argument values to a method. Some people recomm...
TITLE: The best way to assert pre-condition and post-condition of arguments and values in .NET? QUESTION: I have been thinking about design by contract lately and I was wondering what people think is the best way to assert pre-condition and post-condition of values in.NET? i.e. validating argument values to a method. ...
[ ".net", "design-by-contract" ]
4
3
2,713
5
0
2008-09-30T22:41:04.027000
2009-05-21T02:27:52.127000
155,424
155,583
How do I resequence dropdown list controls like the NetFlix queue from the client side (Javascript)
We have a series of drop down controls that determine the sort order of columns. The problem we are having is when the user selects a column as the 2nd column the other dropdown lists need to have their values changed so that there is only one "2nd". Column A [1] Column B [2] Column C [3] Column D [4] Column E [5] In t...
Look at Javascript toolkits like Scriptaculous for client side reordering. You add your elements as " Sortables " and code your own callbacks to execute when the items are dragged, then dropped -- such as sending an asynchronous request to the server to persist the new order. Here is a full tutorial on creating sortabl...
How do I resequence dropdown list controls like the NetFlix queue from the client side (Javascript) We have a series of drop down controls that determine the sort order of columns. The problem we are having is when the user selects a column as the 2nd column the other dropdown lists need to have their values changed so...
TITLE: How do I resequence dropdown list controls like the NetFlix queue from the client side (Javascript) QUESTION: We have a series of drop down controls that determine the sort order of columns. The problem we are having is when the user selects a column as the 2nd column the other dropdown lists need to have their...
[ "asp.net", "javascript", "drop-down-menu" ]
2
2
878
2
0
2008-09-30T22:41:55.820000
2008-09-30T23:29:34.113000
155,426
156,189
Why does IE give unexpected errors when setting innerHTML
I tried to set innerHTML on an element in firefox and it worked fine, tried it in IE and got unexpected errors with no obvious reason why. For example if you try and set the innerHTML of a table to " hi from stu " it will fail, because the table must be followed by a sequence.
"Apparently firefox isn't this picky" ==> Apparently FireFox is so buggy, that it doesn't register this obvious violation of basic html-nesting rules... As someone pointed out in another forum, FireFox will accept, that you append an entire html-document as a child of a form-field or even an image,-(
Why does IE give unexpected errors when setting innerHTML I tried to set innerHTML on an element in firefox and it worked fine, tried it in IE and got unexpected errors with no obvious reason why. For example if you try and set the innerHTML of a table to " hi from stu " it will fail, because the table must be followed...
TITLE: Why does IE give unexpected errors when setting innerHTML QUESTION: I tried to set innerHTML on an element in firefox and it worked fine, tried it in IE and got unexpected errors with no obvious reason why. For example if you try and set the innerHTML of a table to " hi from stu " it will fail, because the tabl...
[ "javascript", "internet-explorer", "innerhtml" ]
6
0
8,218
10
0
2008-09-30T22:42:10.373000
2008-10-01T03:53:51.687000
155,427
155,437
How can I escape a DOM name in javascript?
I have a form element that I want to address via javascript, but it doesn't like the syntax. I want to be able to say: document.mycache.cache[m][2] but obviously I need to indicate that cache[m][2] is the whole name, and not an array reference to cache. Can it be done?
UPDATE: Actually, I was wrong, you can use [ or ] characters as part of a form elements id and/or name attribute. Here's some code that proves it: Update: You can also use the following to get the value from the form element: var value = document.forms.form1["field[m][2]"].value;
How can I escape a DOM name in javascript? I have a form element that I want to address via javascript, but it doesn't like the syntax. I want to be able to say: document.mycache.cache[m][2] but obviously I need to indicate that cache[m][2] is the whole name, and not an array reference to cache. Can it be done?
TITLE: How can I escape a DOM name in javascript? QUESTION: I have a form element that I want to address via javascript, but it doesn't like the syntax. I want to be able to say: document.mycache.cache[m][2] but obviously I need to indicate that cache[m][2] is the whole name, and not an array reference to cache. Can i...
[ "javascript" ]
1
3
737
4
0
2008-09-30T22:42:13.323000
2008-09-30T22:44:42.663000
155,435
155,529
ColdFusion: pick first non null value from a list
In JavaScript, you can do this: var a = null; var b = "I'm a value"; var c = null; var result = a || b || c; And 'result' will get the value of 'b' because JavaScript short-circuits the 'or' operator. I want a one-line idiom to do this in ColdFusion and the best I can come up with is: Can anyone do any better than this...
ColdFusion doesn't have nulls. Your example is basing the choice on which item is an empty string. If that is what you're after, and all your other values are simple values, you can do this: (Which works because the standard list functions ignore empty elements.)
ColdFusion: pick first non null value from a list In JavaScript, you can do this: var a = null; var b = "I'm a value"; var c = null; var result = a || b || c; And 'result' will get the value of 'b' because JavaScript short-circuits the 'or' operator. I want a one-line idiom to do this in ColdFusion and the best I can c...
TITLE: ColdFusion: pick first non null value from a list QUESTION: In JavaScript, you can do this: var a = null; var b = "I'm a value"; var c = null; var result = a || b || c; And 'result' will get the value of 'b' because JavaScript short-circuits the 'or' operator. I want a one-line idiom to do this in ColdFusion an...
[ "coldfusion", "idioms" ]
3
9
1,379
2
0
2008-09-30T22:43:57.873000
2008-09-30T23:10:05.923000
155,436
1,594,049
Unit test naming best practices
What are the best practices for naming unit test classes and test methods? This was discussed on SO before, at What are some popular naming conventions for Unit Tests? I don't know if this is a very good approach, but currently in my testing projects, I have one-to-one mappings between each production class and a test ...
Update (Jul 2021) It's been quite a while since my original answer (almost 12 years) and best practices have been changing a lot during this time. So I feel inclined to update my own answer and offer different naming strategies to the readers. Many comments and answers point out that the naming strategy I propose in my...
Unit test naming best practices What are the best practices for naming unit test classes and test methods? This was discussed on SO before, at What are some popular naming conventions for Unit Tests? I don't know if this is a very good approach, but currently in my testing projects, I have one-to-one mappings between e...
TITLE: Unit test naming best practices QUESTION: What are the best practices for naming unit test classes and test methods? This was discussed on SO before, at What are some popular naming conventions for Unit Tests? I don't know if this is a very good approach, but currently in my testing projects, I have one-to-one ...
[ "unit-testing", "naming-conventions" ]
647
607
508,403
11
0
2008-09-30T22:44:28.527000
2009-10-20T11:47:58.217000
155,445
156,737
How do I have YAHOO.util.KeyListener disabled when an input element is focused?
I have a MenuBar setup with YUI's MenuBar widget, and I have a YAHOO.util.KeyListener attached to document to get quick keyboard access to the menus and sub-menu items (e.g. 's' to open the Setup menu). The problem is that the keylistener will still fire when a user is in an input element. For example, a user might be ...
I commend you for trying to provide keyboard shortcuts, but be aware that this will be a bit of a pain to implement cross-platform. If it's feasible, I strongly recommend using access keys on tags. If you're still going, I guess accesskey won't work for you. I'll assume you've read the relevant YUI tutorial. If blur an...
How do I have YAHOO.util.KeyListener disabled when an input element is focused? I have a MenuBar setup with YUI's MenuBar widget, and I have a YAHOO.util.KeyListener attached to document to get quick keyboard access to the menus and sub-menu items (e.g. 's' to open the Setup menu). The problem is that the keylistener w...
TITLE: How do I have YAHOO.util.KeyListener disabled when an input element is focused? QUESTION: I have a MenuBar setup with YUI's MenuBar widget, and I have a YAHOO.util.KeyListener attached to document to get quick keyboard access to the menus and sub-menu items (e.g. 's' to open the Setup menu). The problem is that...
[ "javascript", "keyboard", "yui", "shortcut", "keylistener" ]
1
0
1,276
1
0
2008-09-30T22:46:56.183000
2008-10-01T08:45:13.030000
155,449
155,515
Vim auto-generate ctags
Right now I have the following in my.vimrc: au BufWritePost *.c,*.cpp,*.h!ctags -R There are a few problems with this: It's slow -- regenerates tags for files that haven't changed since the last tag generation. I have to push the enter button again after writing the file because of an inevitable "press Enter or type co...
au BufWritePost *.c,*.cpp,*.h silent!!ctags -R & The downside is that you won't have a useful tags file until it completes. As long as you're on a *nix system it should be ok to do multiple writes before the previous ctags has completed, but you should test that. On a Windows system it won't put it in the background an...
Vim auto-generate ctags Right now I have the following in my.vimrc: au BufWritePost *.c,*.cpp,*.h!ctags -R There are a few problems with this: It's slow -- regenerates tags for files that haven't changed since the last tag generation. I have to push the enter button again after writing the file because of an inevitable...
TITLE: Vim auto-generate ctags QUESTION: Right now I have the following in my.vimrc: au BufWritePost *.c,*.cpp,*.h!ctags -R There are a few problems with this: It's slow -- regenerates tags for files that haven't changed since the last tag generation. I have to push the enter button again after writing the file becaus...
[ "vim", "autocomplete", "ctags" ]
56
47
36,238
12
0
2008-09-30T22:47:30.393000
2008-09-30T23:05:04.220000
155,458
155,467
C# object is not null but (myObject != null) still return false
I need to do a comparaison between an object and NULL. When the object is not NULL I fill it with some data. Here is the code: if (region!= null) {.... } This is working but when looping and looping sometime the region object is NOT null (I can see data inside it in debug mode). In step-by-step when debugging, it doesn...
Is the == and/or!= operator overloaded for the region object's class? Now that you've posted the code for the overloads: The overloads should probably look like the following (code taken from postings made by Jon Skeet and Philip Rieck ): public static bool operator ==(Region r1, Region r2) { if (object.ReferenceEquals...
C# object is not null but (myObject != null) still return false I need to do a comparaison between an object and NULL. When the object is not NULL I fill it with some data. Here is the code: if (region!= null) {.... } This is working but when looping and looping sometime the region object is NOT null (I can see data in...
TITLE: C# object is not null but (myObject != null) still return false QUESTION: I need to do a comparaison between an object and NULL. When the object is not NULL I fill it with some data. Here is the code: if (region!= null) {.... } This is working but when looping and looping sometime the region object is NOT null ...
[ "c#", "null", "compare" ]
18
29
62,174
8
0
2008-09-30T22:49:02.900000
2008-09-30T22:51:49.570000
155,460
155,641
LINQ Submit Changes not submitting changes
I'm using LINQ to SQL and C#. I have two LINQ classes: User and Network. User has UserID (primary key) and NetworkID Network has NetworkID (primary key) and an AdminID (a UserID) The following code works fine: user.Network.AdminID = 0; db.SubmitChanges(); However, if I access the AdminID before making the change, the c...
I just ran a quick test and it works fine for me. I hate to ask this, but are you sure the if statement ever returns true? It could be you're just not hitting the code which changes the value. Other than that we might need more info. What are the properties of that member? Have you traced into the set statement to ensu...
LINQ Submit Changes not submitting changes I'm using LINQ to SQL and C#. I have two LINQ classes: User and Network. User has UserID (primary key) and NetworkID Network has NetworkID (primary key) and an AdminID (a UserID) The following code works fine: user.Network.AdminID = 0; db.SubmitChanges(); However, if I access ...
TITLE: LINQ Submit Changes not submitting changes QUESTION: I'm using LINQ to SQL and C#. I have two LINQ classes: User and Network. User has UserID (primary key) and NetworkID Network has NetworkID (primary key) and an AdminID (a UserID) The following code works fine: user.Network.AdminID = 0; db.SubmitChanges(); How...
[ "linq", "linq-to-sql" ]
0
2
2,802
3
0
2008-09-30T22:50:26.923000
2008-09-30T23:53:56.800000
155,462
155,543
What is "for" in Ruby
In Ruby: for i in A do # some code end is the same as: A.each do |i| # some code end for is not a kernel method: What exactly is " for " in ruby Is there a way to use other keywords to do similar things? Something like: total = sum i in I {x[i]} mapping to: total = I.sum {|i] x[i]}
It's almost syntax sugar. One difference is that, while for would use the scope of the code around it, each creates a separate scope within its block. Compare the following: for i in (1..3) x = i end p x # => 3 versus (1..3).each do |i| x = i end p x # => undefined local variable or method `x' for main:Object
What is "for" in Ruby In Ruby: for i in A do # some code end is the same as: A.each do |i| # some code end for is not a kernel method: What exactly is " for " in ruby Is there a way to use other keywords to do similar things? Something like: total = sum i in I {x[i]} mapping to: total = I.sum {|i] x[i]}
TITLE: What is "for" in Ruby QUESTION: In Ruby: for i in A do # some code end is the same as: A.each do |i| # some code end for is not a kernel method: What exactly is " for " in ruby Is there a way to use other keywords to do similar things? Something like: total = sum i in I {x[i]} mapping to: total = I.sum {|i] x[i...
[ "ruby", "metaprogramming" ]
23
46
8,073
3
0
2008-09-30T22:50:36.377000
2008-09-30T23:15:49.217000
155,490
1,148,048
OS-independent API to monitor file system?
I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\user\dirToBeMonitored). So, I could be able t...
A bonified answer, albeit one that requires a largish library dependency (well-worth it IMO)! QT provides the QFileSystemwatcher class, which uses the native mechanism of the underlying platform. Even better, you can use the QT language bindings for Python or Ruby. Here is a simple PyQT4 application which uses QFileSys...
OS-independent API to monitor file system? I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:\docs and setts\us...
TITLE: OS-independent API to monitor file system? QUESTION: I would like to experiment with ideas about distributed file synchronization/replication. To make it efficient when the user is working, I would like to implement some kind of daemon to monitor changes in some directory (e.g. /home/user/dirToBeMonitored or c:...
[ "platform-independent", "file-monitoring" ]
8
9
3,087
4
0
2008-09-30T22:59:30.207000
2009-07-18T17:15:18.280000
155,504
158,511
download mail attachment with Java
I had a look in the reference doc, and Spring seems to have pretty good support for sending mail. However, I need to login to a mail account, read the messages, and download any attachments. Is downloading mail attachments supported by the Spring mail API? I know you can do this with the Java Mail API, but in the past ...
Here's the class that I use for downloading e-mails (with attachment handling). You'll have to glance by some of the stuff it's doing (like ignore the logging classes and database writes). I've also re-named some of the packages for ease of reading. The general idea is that all attachments are saved as individual files...
download mail attachment with Java I had a look in the reference doc, and Spring seems to have pretty good support for sending mail. However, I need to login to a mail account, read the messages, and download any attachments. Is downloading mail attachments supported by the Spring mail API? I know you can do this with ...
TITLE: download mail attachment with Java QUESTION: I had a look in the reference doc, and Spring seems to have pretty good support for sending mail. However, I need to login to a mail account, read the messages, and download any attachments. Is downloading mail attachments supported by the Spring mail API? I know you...
[ "java", "spring", "email", "attachment" ]
8
21
35,621
6
0
2008-09-30T23:02:53.413000
2008-10-01T16:30:53.333000
155,507
155,510
How do I create a directory from within Emacs?
How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
to create the directory dir/to/create, type: M-x make-directory RET dir/to/create RET to create directories dir/parent1/node and dir/parent2/node, type: M-! mkdir -p dir/parent{1,2}/node RET It assumes that Emacs's inferior shell is bash / zsh or other compatible shell. or in a Dired mode + It doesn't create nonexisten...
How do I create a directory from within Emacs? How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)
TITLE: How do I create a directory from within Emacs? QUESTION: How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example) ANSWER: to create the directory dir/to/create, type: M-x make-directory RET dir/to/create RET to create directories dir/parent1/node an...
[ "emacs", "directory", "command" ]
160
221
64,505
6
0
2008-09-30T23:03:32.867000
2008-09-30T23:04:19.807000
155,517
160,893
Cancelling a long running process in VB6.0 without DoEvents?
Is it possible to cancel out of a long running process in VB6.0 without using DoEvents? For example: for i = 1 to someVeryHighNumber ' Do some work here '... if cancel then exit for end if next Sub btnCancel_Click() cancel = true End Sub I assume I need a "DoEvents" before the "if cancel then..." is there a better wa...
Nope, you got it right, you definitely want DoEvents in your loop. If you put the DoEvents in your main loop and find that slows down processing too much, try calling the Windows API function GetQueueStatus (which is much faster than DoEvents) to quickly determine if it's even necessary to call DoEvents. GetQueueStatus...
Cancelling a long running process in VB6.0 without DoEvents? Is it possible to cancel out of a long running process in VB6.0 without using DoEvents? For example: for i = 1 to someVeryHighNumber ' Do some work here '... if cancel then exit for end if next Sub btnCancel_Click() cancel = true End Sub I assume I need a "...
TITLE: Cancelling a long running process in VB6.0 without DoEvents? QUESTION: Is it possible to cancel out of a long running process in VB6.0 without using DoEvents? For example: for i = 1 to someVeryHighNumber ' Do some work here '... if cancel then exit for end if next Sub btnCancel_Click() cancel = true End Sub I...
[ "vb6" ]
22
30
11,382
8
0
2008-09-30T23:05:08.337000
2008-10-02T04:35:45.663000
155,532
156,533
XHTML 1.0 Strict (or Transitional) compliance in ASP.NET 2.0/3.5
Are there any good methods for getting ASP.NET 2.0 to validate under the XHTML 1.0 Strict (or Transitional) DTD? I'm interested to hear some ideas before I hack up the core of the HTTP response. One major problem is the form tag itself, this is the output I got from W3C when I tried to validate: Line 13, Column 11: the...
ASP.NET 2.0 and above can indeed output Strict (or Transitional) XHTML. This will resolve your 'there is no attribute "name"' validation error, amongst other things. To set this up, update your Web.config file with something like:... other configuration goes here... For Transitional XHTML, use mode="Transitional" inste...
XHTML 1.0 Strict (or Transitional) compliance in ASP.NET 2.0/3.5 Are there any good methods for getting ASP.NET 2.0 to validate under the XHTML 1.0 Strict (or Transitional) DTD? I'm interested to hear some ideas before I hack up the core of the HTTP response. One major problem is the form tag itself, this is the output...
TITLE: XHTML 1.0 Strict (or Transitional) compliance in ASP.NET 2.0/3.5 QUESTION: Are there any good methods for getting ASP.NET 2.0 to validate under the XHTML 1.0 Strict (or Transitional) DTD? I'm interested to hear some ideas before I hack up the core of the HTTP response. One major problem is the form tag itself, ...
[ "asp.net", "xhtml-1.0-strict" ]
10
11
3,038
3
0
2008-09-30T23:11:13.427000
2008-10-01T07:13:21.317000
155,540
155,588
How can I tell when .Net System.Diagnostics.Process ran successfully or failed?
I'm writing a scheduler or sorts. It's basically a table with a list of exes (like "C:\a.exe") and a console app that looks at the records in the table every minute or so and runs the tasks that haven't been run yet. I run the tasks like this: System.Diagnostics.Process p = new System.Diagnostics.Process(); p.StartInfo...
You can catch the Win32Exception to check if Process.Start() failed due to the file not existing or execute access is denied. But you can not catch exceptions thrown by the processes that you create using this class. In the first place, the application might not be written in.NET so there might not be a concept of exce...
How can I tell when .Net System.Diagnostics.Process ran successfully or failed? I'm writing a scheduler or sorts. It's basically a table with a list of exes (like "C:\a.exe") and a console app that looks at the records in the table every minute or so and runs the tasks that haven't been run yet. I run the tasks like th...
TITLE: How can I tell when .Net System.Diagnostics.Process ran successfully or failed? QUESTION: I'm writing a scheduler or sorts. It's basically a table with a list of exes (like "C:\a.exe") and a console app that looks at the records in the table every minute or so and runs the tasks that haven't been run yet. I run...
[ "c#", "sql", "error-handling" ]
5
8
5,709
4
0
2008-09-30T23:13:21.063000
2008-09-30T23:31:28.227000
155,559
155,570
Exception thrown in a referenced .dll how do I debug?
I'm using watermark extenders on textboxes and an exception is being thrown from the AJAX Control Toolkit.dll. It's strange because this just started happening. I tried debugging from the Ajax solution and Ajax examples (but with my code), but no dice. Is there a way to step into the Ajax.dll from my solution to see wh...
Couldn't you just get the source for the Ajax Control Toolkit and include it as a project in your solution and then reference it? You'd then be able to step into the code and if you really needed to, you can just put the precompiled one out when you deploy out.
Exception thrown in a referenced .dll how do I debug? I'm using watermark extenders on textboxes and an exception is being thrown from the AJAX Control Toolkit.dll. It's strange because this just started happening. I tried debugging from the Ajax solution and Ajax examples (but with my code), but no dice. Is there a wa...
TITLE: Exception thrown in a referenced .dll how do I debug? QUESTION: I'm using watermark extenders on textboxes and an exception is being thrown from the AJAX Control Toolkit.dll. It's strange because this just started happening. I tried debugging from the Ajax solution and Ajax examples (but with my code), but no d...
[ "ajax", "debugging", ".net-3.5" ]
2
3
319
4
0
2008-09-30T23:21:49.063000
2008-09-30T23:27:19.597000
155,560
156,296
Get the TThread object for the currently executing thread?
I want a function like GetCurrentThread which returns a TThread object of the current executing thread. I know there is a Win32 API call GetCurrentThread, but it returns the thread Id. If there is a possibility to get TThread object from that ID that's also fine.
The latest version of Delphi, Delphi 2009, has a CurrentThread class property on the TThread class. This will return the proper Delphi thread object if it's a native thread. If the thread is an "alien" thread, i.e. created using some other mechanism or on a callback from a third party thread, then it will create a wrap...
Get the TThread object for the currently executing thread? I want a function like GetCurrentThread which returns a TThread object of the current executing thread. I know there is a Win32 API call GetCurrentThread, but it returns the thread Id. If there is a possibility to get TThread object from that ID that's also fin...
TITLE: Get the TThread object for the currently executing thread? QUESTION: I want a function like GetCurrentThread which returns a TThread object of the current executing thread. I know there is a Win32 API call GetCurrentThread, but it returns the thread Id. If there is a possibility to get TThread object from that ...
[ "multithreading", "delphi" ]
17
23
23,375
6
0
2008-09-30T23:22:09.017000
2008-10-01T05:00:10.013000
155,566
155,643
How do you use git svn?
Please provide tips for effectively using git with svn. What are your "best practices"?
When you create the clone, use --prefix=svn/. It creates nicer branch names. Also, don't neglect the --trunk, --tags, and --branches arguments when doing clone or init. Fetching is one of the more time-consuming steps, so set up a cron job to do git svn fetch in the background. This is safe because fetching doesn't aff...
How do you use git svn? Please provide tips for effectively using git with svn. What are your "best practices"?
TITLE: How do you use git svn? QUESTION: Please provide tips for effectively using git with svn. What are your "best practices"? ANSWER: When you create the clone, use --prefix=svn/. It creates nicer branch names. Also, don't neglect the --trunk, --tags, and --branches arguments when doing clone or init. Fetching is ...
[ "svn", "git" ]
14
4
1,898
4
0
2008-09-30T23:26:20.347000
2008-09-30T23:55:58.763000
155,581
155,752
Understanding code metrics
I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects. It's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you what it really means. Does anyone know of any g...
I don't think that code metrics (sometimes referred to as software metrics ) provide valuable data in terms of where you can improve. With code metrics it is sort of nice to see how much code you write in an hour etc., but beyond they tell you nada about the quality of the code written, its documentation and code cover...
Understanding code metrics I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects. It's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you what it really means...
TITLE: Understanding code metrics QUESTION: I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects. It's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you wh...
[ "code-analysis", "metrics" ]
9
4
1,431
2
0
2008-09-30T23:29:01.323000
2008-10-01T00:47:23.647000
155,584
164,131
Is there any clean CSS method to make each letter in a word a different color?
I need a way to allow each letter of a word to rotate through 3 different colors. I know of some not so clean ways I can do this with asp.NET, but I'm wondering if there might be a cleaner CSS/JavaScript solution that is more search engine friendly. The designer is including a file like this for each page. I'd rather n...
Here is some JavaScript. var message = "The quick brown fox."; var colors = new Array("#ff0000","#00ff00","#0000ff"); // red, green, blue for (var i = 0; i < message.length; i++){ document.write(" " + message[i] + " "); }
Is there any clean CSS method to make each letter in a word a different color? I need a way to allow each letter of a word to rotate through 3 different colors. I know of some not so clean ways I can do this with asp.NET, but I'm wondering if there might be a cleaner CSS/JavaScript solution that is more search engine f...
TITLE: Is there any clean CSS method to make each letter in a word a different color? QUESTION: I need a way to allow each letter of a word to rotate through 3 different colors. I know of some not so clean ways I can do this with asp.NET, but I'm wondering if there might be a cleaner CSS/JavaScript solution that is mo...
[ "css", "colors" ]
10
13
14,819
4
0
2008-09-30T23:29:45.737000
2008-10-02T19:30:21.583000
155,586
497,673
Is there an existing way to turn source code back into a CodeCompileUnit?
We use the DesignSurface and all that good IDesignerHost goodness in our own designer. The designed forms are then persisted in our own bespoke format and all that works great. WE also want to export the forms to a text-based format (which we've done as it isn't that difficult). However, we also want to import that tex...
You could always write your own C# parser. That way you can be sure of it's completeness. In your case, because you don't need anything like intellisense, you could probably get away with just using a parser generator. Even if you wrote one by hand, however, it probably wouldn't take you more than about a month.
Is there an existing way to turn source code back into a CodeCompileUnit? We use the DesignSurface and all that good IDesignerHost goodness in our own designer. The designed forms are then persisted in our own bespoke format and all that works great. WE also want to export the forms to a text-based format (which we've ...
TITLE: Is there an existing way to turn source code back into a CodeCompileUnit? QUESTION: We use the DesignSurface and all that good IDesignerHost goodness in our own designer. The designed forms are then persisted in our own bespoke format and all that works great. WE also want to export the forms to a text-based fo...
[ "c#", "winforms", "serialization", "code-generation", "designer" ]
6
2
882
2
0
2008-09-30T23:30:38.747000
2009-01-30T23:25:06.017000
155,593
155,627
How can I determine the number of users on an ASP.NET site (IIS)? And their info?
Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, such as the number of sessions, and perhaps the requesting machines' addresses, or other credential i...
ASP.NET Performance Counters like State Server Sessions Active (The number of active user sessions) should help you out. Then you can just read and display the performance counters from your admin page..
How can I determine the number of users on an ASP.NET site (IIS)? And their info? Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, such as the number ...
TITLE: How can I determine the number of users on an ASP.NET site (IIS)? And their info? QUESTION: Is there a way to determine the number of users that have active sessions in an ASP.NET application? I have an admin/tools page in a particular application, and I would like to display info regarding all open sessions, s...
[ "asp.net", "iis", "session", "iis-7", "iis-6" ]
18
11
35,206
8
0
2008-09-30T23:35:01.543000
2008-09-30T23:50:04.113000
155,601
155,683
What is the best way to learn about RDF / OWL?
What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough tools (Protege, Topbraid, Jena, etc.) that knowing the syntax of the markup languages is not necessary, but knowing the concepts is, of course, still critical. I'm working through the w3c documents (particularly the RDF Primer ) bu...
A very good introduction to the semantic web in comparison to object-oriented languages is this document from W3C: A Semantic Web Primer for Object-Oriented Software Developers. It helped me clarify a lot of things from the beginning.
What is the best way to learn about RDF / OWL? What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough tools (Protege, Topbraid, Jena, etc.) that knowing the syntax of the markup languages is not necessary, but knowing the concepts is, of course, still critical. I'm working through the ...
TITLE: What is the best way to learn about RDF / OWL? QUESTION: What references offer a good summary/tutorial for using RDF/OWL? There seem to be enough tools (Protege, Topbraid, Jena, etc.) that knowing the syntax of the markup languages is not necessary, but knowing the concepts is, of course, still critical. I'm wo...
[ "rdf", "web-standards", "semantic-web", "owl" ]
23
22
8,399
10
0
2008-09-30T23:41:53.117000
2008-10-01T00:12:30.923000
155,603
155,617
Is it possible to use Mac Mail with MS Exchange if IMAP is disabled
Our network admins have disabled IMAP and POP for our exchange server, but do have RDP over HTTP enabled. Does Mac Mail only use IMAP to communicate with exchange servers, or does it also know how to use RDP over HTTP?
No. Mac mail uses IMAP for mail and uses HTTP to fetch calendar data, as far as I am aware.
Is it possible to use Mac Mail with MS Exchange if IMAP is disabled Our network admins have disabled IMAP and POP for our exchange server, but do have RDP over HTTP enabled. Does Mac Mail only use IMAP to communicate with exchange servers, or does it also know how to use RDP over HTTP?
TITLE: Is it possible to use Mac Mail with MS Exchange if IMAP is disabled QUESTION: Our network admins have disabled IMAP and POP for our exchange server, but do have RDP over HTTP enabled. Does Mac Mail only use IMAP to communicate with exchange servers, or does it also know how to use RDP over HTTP? ANSWER: No. Ma...
[ "exchange-server", "apple-mail" ]
0
1
1,305
2
0
2008-09-30T23:42:44.863000
2008-09-30T23:47:07.893000
155,609
155,655
What's the difference between a method and a function?
Can someone provide a simple explanation of methods vs. functions in OOP context?
A function is a piece of code that is called by name. It can be passed data to operate on (i.e. the parameters) and can optionally return data (the return value). All data that is passed to a function is explicitly passed. A method is a piece of code that is called by a name that is associated with an object. In most r...
What's the difference between a method and a function? Can someone provide a simple explanation of methods vs. functions in OOP context?
TITLE: What's the difference between a method and a function? QUESTION: Can someone provide a simple explanation of methods vs. functions in OOP context? ANSWER: A function is a piece of code that is called by name. It can be passed data to operate on (i.e. the parameters) and can optionally return data (the return v...
[ "oop", "language-agnostic", "terminology" ]
2,163
2,230
1,007,407
42
0
2008-09-30T23:45:10.007000
2008-10-01T00:00:13.977000
155,610
155,619
How do I specify the exit code of a console application in .NET?
I have a trivial console application in.NET. It's just a test part of a larger application. I'd like to specify the "exit code" of my console application. How do I do this?
Three options: You can return it from Main if you declare your Main method to return int. You can call Environment.Exit(code). You can set the exit code using properties: Environment.ExitCode = -1;. This will be used if nothing else sets the return code or uses one of the other options above). Depending on your applica...
How do I specify the exit code of a console application in .NET? I have a trivial console application in.NET. It's just a test part of a larger application. I'd like to specify the "exit code" of my console application. How do I do this?
TITLE: How do I specify the exit code of a console application in .NET? QUESTION: I have a trivial console application in.NET. It's just a test part of a larger application. I'd like to specify the "exit code" of my console application. How do I do this? ANSWER: Three options: You can return it from Main if you decla...
[ "c#", ".net", "exit-code" ]
574
722
406,423
14
0
2008-09-30T23:45:10.397000
2008-09-30T23:47:57.330000
155,615
155,636
Is it reasonable to assume my visitors have javascript enabled?
I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provide value for those who are running browsers with javascript disabled. Is it reasona...
I browse with NoScript in Firefox, and it always annoys me when I get pages that don't work. That said - know your audience. If you're trying to cater to paranoid computer security professionals - assume they might not have JavaScript enabled. If you're going for a general audience, JavaScript is probably on.
Is it reasonable to assume my visitors have javascript enabled? I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provide value for those ...
TITLE: Is it reasonable to assume my visitors have javascript enabled? QUESTION: I understand that server-side validation is an absolute must to prevent malicious users (or simply users who choose to disable javascript) from bypassing client-side validation. But that's mainly to protect your application, not to provid...
[ "javascript" ]
38
35
4,719
26
0
2008-09-30T23:46:45.883000
2008-09-30T23:52:12.983000
155,649
155,680
Circle coordinates to array in Javascript
What's the best way to add the coordinates of a circle to an array in JavaScript? So far I've only been able to do a half circle, but I need a formula that returns the whole circle to two different arrays: xValues and yValues. (I'm trying to get the coordinates so I can animate an object along a path.) Here's what I ha...
Your loop should be set up like this instead: for (var i = 0; i < steps; i++) { xValues[i] = (centerX + radius * Math.cos(2 * Math.PI * i / steps)); yValues[i] = (centerY + radius * Math.sin(2 * Math.PI * i / steps)); } Start your loop at 0 Step through the entire 2 * PI range, not just PI. You shouldn't have the var x...
Circle coordinates to array in Javascript What's the best way to add the coordinates of a circle to an array in JavaScript? So far I've only been able to do a half circle, but I need a formula that returns the whole circle to two different arrays: xValues and yValues. (I'm trying to get the coordinates so I can animate...
TITLE: Circle coordinates to array in Javascript QUESTION: What's the best way to add the coordinates of a circle to an array in JavaScript? So far I've only been able to do a half circle, but I need a formula that returns the whole circle to two different arrays: xValues and yValues. (I'm trying to get the coordinate...
[ "javascript", "arrays", "geometry", "formula" ]
16
28
22,549
6
0
2008-09-30T23:57:43.157000
2008-10-01T00:12:09.427000
155,670
155,703
Invert 4x4 matrix - Numerical most stable solution needed
I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact). With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but when dealing with fixed point numbers I get an unacceptab...
I think the answer to this depends on the exact form of the matrix. A standard decomposition method (LU, QR, Cholesky etc.) with pivoting (an essential) is fairly good on fixed point, especially for a small 4x4 matrix. See the book 'Numerical Recipes' by Press et al. for a description of these methods. This paper gives...
Invert 4x4 matrix - Numerical most stable solution needed I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact). With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked for me so far, but...
TITLE: Invert 4x4 matrix - Numerical most stable solution needed QUESTION: I want to invert a 4x4 matrix. My numbers are stored in fixed-point format (1.15.16 to be exact). With floating-point arithmetic I usually just build the adjoint matrix and divide by the determinant (e.g. brute force the solution). That worked ...
[ "language-agnostic", "matrix", "linear-algebra", "fixed-point", "matrix-inverse" ]
13
6
11,949
6
0
2008-10-01T00:08:44.613000
2008-10-01T00:23:51.037000
155,681
155,698
Displaying whitespace in HTML when pulling from MySQL TEXT column
I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spaces and newlines). I've tried a pre tag but it doesn't obey the width set in the cont...
You can cause the text inside the pre to wrap by using the following CSS pre { white-space: pre-wrap; /* css-3 */ white-space: -moz-pre-wrap; /* Mozilla, since 1999 */ white-space: -pre-wrap; /* Opera 4-6 */ white-space: -o-pre-wrap; /* Opera 7 */ word-wrap: break-word; /* Internet Explorer 5.5+ */ } Taken from this si...
Displaying whitespace in HTML when pulling from MySQL TEXT column I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spaces and newlines). ...
TITLE: Displaying whitespace in HTML when pulling from MySQL TEXT column QUESTION: I have saved input from a textarea element to a TEXT column in MySQL. I'm using PHP to pull that data out of the database and want to display it in a p element while still showing the whitespace that the user entered (e.g. multiple spac...
[ "php", "mysql", "html" ]
9
11
7,039
4
0
2008-10-01T00:12:20.470000
2008-10-01T00:20:32.120000
155,685
155,787
I need a LINQ expression to find an XElement where the element name and attributes match an input node
I need to replace the contents of a node in an XElement hierarchy when the element name and all the attribute names and values match an input element. (If there is no match, the new element can be added.) For example, if my data looks like this: one two three four five I want to find the last element when I call a meth...
This will match any given element with exact tag name and attribute name/value pairs: public static void ReplaceOrAdd(this XElement source, XElement node) { var q = from x in source.Elements() where x.Name == node.Name && x.Attributes().All(a =>node.Attributes().Any(b =>a.Name==b.Name && a.Value==b.Value)) select x; v...
I need a LINQ expression to find an XElement where the element name and attributes match an input node I need to replace the contents of a node in an XElement hierarchy when the element name and all the attribute names and values match an input element. (If there is no match, the new element can be added.) For example,...
TITLE: I need a LINQ expression to find an XElement where the element name and attributes match an input node QUESTION: I need to replace the contents of a node in an XElement hierarchy when the element name and all the attribute names and values match an input element. (If there is no match, the new element can be ad...
[ "c#", ".net", "xml", "linq", "linq-to-xml" ]
5
5
11,420
2
0
2008-10-01T00:13:59.373000
2008-10-01T00:59:24.070000
155,695
155,725
ChangeServiceConfig problem setting logon credentials
I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service (I CreateService it myself) to supply the logon credentials, but while the function succeeds (returns TRUE), if I try to start the service, it fails with a 1069 (logon failed). If I go into the service manager and modify credenti...
The user account must explicitly have rights to log on as a service ( SeServiceLogonRight ). Many users, including computer admins, may not have this flag set, and you may need to set it manually. The windows services control panel actually does this silently behind the scenes when you use it to configure services. I a...
ChangeServiceConfig problem setting logon credentials I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service (I CreateService it myself) to supply the logon credentials, but while the function succeeds (returns TRUE), if I try to start the service, it fails with a 1069 (logon failed)...
TITLE: ChangeServiceConfig problem setting logon credentials QUESTION: I've got this weird problem - I'm calling ChangeServiceConfig on a newly installed service (I CreateService it myself) to supply the logon credentials, but while the function succeeds (returns TRUE), if I try to start the service, it fails with a 1...
[ "winapi", "windows-services" ]
2
1
1,534
1
0
2008-10-01T00:19:43.213000
2008-10-01T00:34:40.883000
155,697
155,714
Ambiguous JavaScript error [nsSessionStore.js]
I'm seeing an ambiguous error in Firebug. I don't think it's particularly related to the script I'm writing, however I don't have enough details to be able to determine that from this one error alone. Has anyone seen something similar and have a suggestion? error: [Exception... "Component is not available" nsresult: "0...
I have run across the same error myself, and it is an internal FireFox issue, not an issue with your script at all. It is related to the saving of the FireFox state: According to: http://blogs.unbolt.net/index.php/brinley/2008/04/26/0x80040111_nssessionstore, it is caused by a corrupted session state. In short, I don't...
Ambiguous JavaScript error [nsSessionStore.js] I'm seeing an ambiguous error in Firebug. I don't think it's particularly related to the script I'm writing, however I don't have enough details to be able to determine that from this one error alone. Has anyone seen something similar and have a suggestion? error: [Excepti...
TITLE: Ambiguous JavaScript error [nsSessionStore.js] QUESTION: I'm seeing an ambiguous error in Firebug. I don't think it's particularly related to the script I'm writing, however I don't have enough details to be able to determine that from this one error alone. Has anyone seen something similar and have a suggestio...
[ "javascript", "firebug" ]
2
4
2,248
2
0
2008-10-01T00:20:11.217000
2008-10-01T00:29:22.160000
155,706
157,436
What are good tools/frameworks for i18n of a php codebase?
I have been looking at a few options for enabling localization and internationalization of a dynamic php application. There appears to be a variety of tools available such as gettext and Yahoo's R3 and I am interested in hearing from both developers and translators about which tools are good to use and what functionali...
PHP gettext implementation works very smoothly. And po files with po edit and gettext are about as good a way as you can get to deal with localization bearing in mind that no solution of this kind can completely handle the complexities of the various languages. For example, the gettext method is very good on plural for...
What are good tools/frameworks for i18n of a php codebase? I have been looking at a few options for enabling localization and internationalization of a dynamic php application. There appears to be a variety of tools available such as gettext and Yahoo's R3 and I am interested in hearing from both developers and transla...
TITLE: What are good tools/frameworks for i18n of a php codebase? QUESTION: I have been looking at a few options for enabling localization and internationalization of a dynamic php application. There appears to be a variety of tools available such as gettext and Yahoo's R3 and I am interested in hearing from both deve...
[ "php", "internationalization" ]
3
3
1,994
5
0
2008-10-01T00:25:16.210000
2008-10-01T12:54:10.450000
155,712
155,817
How do I visually "break out" of a Container in Flex?
Here's my problem - I have some code like this: So the problem is that the Button inside the canvas has an x property way in excess of the Canvas's width - since it's a child of the Canvas, the Canvas masks it and creates some scrollbars for me to scroll over to the button. What I'd like is to display the button - 800 ...
I figured it out - apparently the Container has a property called clipContent - here's the description from Adobe: Whether to apply a clip mask if the positions and/or sizes of this container's children extend outside the borders of this container. If false, the children of this container remain visible when they are m...
How do I visually "break out" of a Container in Flex? Here's my problem - I have some code like this: So the problem is that the Button inside the canvas has an x property way in excess of the Canvas's width - since it's a child of the Canvas, the Canvas masks it and creates some scrollbars for me to scroll over to the...
TITLE: How do I visually "break out" of a Container in Flex? QUESTION: Here's my problem - I have some code like this: So the problem is that the Button inside the canvas has an x property way in excess of the Canvas's width - since it's a child of the Canvas, the Canvas masks it and creates some scrollbars for me to ...
[ "apache-flex", "flash", "actionscript-3", "mxml" ]
8
8
1,123
2
0
2008-10-01T00:28:53.427000
2008-10-01T01:13:17.237000
155,733
155,747
Is there a difference between (local), '.' and localhost?
I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?
The final result is the same. The difference is: 'localhost' resolves at the TCP/IP level and is equivalent to the IP address 127.0.0.1 Depending on the application "(local)" could be just an alias for 'localhost'. In SQLServer, '(local)' and '.' mean that the connection will be made using the named pipes (shared memor...
Is there a difference between (local), '.' and localhost? I've used all three of these when making local programmatic connections to databases. Is there any real difference between them?
TITLE: Is there a difference between (local), '.' and localhost? QUESTION: I've used all three of these when making local programmatic connections to databases. Is there any real difference between them? ANSWER: The final result is the same. The difference is: 'localhost' resolves at the TCP/IP level and is equivalen...
[ "sql-server", "connection-string" ]
33
36
11,330
3
0
2008-10-01T00:39:11.373000
2008-10-01T00:44:51.670000
155,739
155,841
Detecting Unsaved Changes
I have a requirement to implement an "Unsaved Changes" prompt in an ASP.Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should appear warning them that they have unsaved changes, and give them the option to cancel and stay on the current page. The prompt...
Using jQuery: var _isDirty = false; $("input[type='text']").change(function(){ _isDirty = true; }); // replicate for other input types and selects Combine with onunload / onbeforeunload methods as required. From the comments, the following references all input fields, without duplicating code: $(':input').change(functi...
Detecting Unsaved Changes I have a requirement to implement an "Unsaved Changes" prompt in an ASP.Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should appear warning them that they have unsaved changes, and give them the option to cancel and stay on th...
TITLE: Detecting Unsaved Changes QUESTION: I have a requirement to implement an "Unsaved Changes" prompt in an ASP.Net application. If a user modifies controls on a web form, and attempts to navigate away before saving, a prompt should appear warning them that they have unsaved changes, and give them the option to can...
[ "javascript", "asp.net", "prompt" ]
97
100
104,918
17
0
2008-10-01T00:41:28.480000
2008-10-01T01:26:36.953000
155,742
155,754
Provider model in .net
When the.net 2.0 framework first came out, the provider model was all the rage. 2.0 even shipped with a bunch of default providers (Membership, sitemap, role). Since the release of 2.0, the hype has died down, and whilst I still use providers day to day, it seems to get far less press. I was wondering if this is becaus...
It actually hasn't died down. DI is still big. There are many DI frameworks out there to choose from. Yes, it's not hard-baked into every part framework like it should absolutely be, but its still a very good practice to follow. For instance, I was using the P&P's custom application blocks to do DI. Until they ditched ...
Provider model in .net When the.net 2.0 framework first came out, the provider model was all the rage. 2.0 even shipped with a bunch of default providers (Membership, sitemap, role). Since the release of 2.0, the hype has died down, and whilst I still use providers day to day, it seems to get far less press. I was wond...
TITLE: Provider model in .net QUESTION: When the.net 2.0 framework first came out, the provider model was all the rage. 2.0 even shipped with a bunch of default providers (Membership, sitemap, role). Since the release of 2.0, the hype has died down, and whilst I still use providers day to day, it seems to get far less...
[ "c#", ".net", "provider-model" ]
8
4
1,098
2
0
2008-10-01T00:43:19.943000
2008-10-01T00:47:50.137000
155,780
155,795
Safehandle in C#
What is SafeHandle? how does it differ from IntPtr? When should I use one? What are its advantages?
I think MSDN is pretty clear in definition: The SafeHandle class provides critical finalization of handle resources, preventing handles from being reclaimed prematurely by garbage collection and from being recycled by Windows to reference unintended unmanaged objects. Before the.NET Framework version 2.0, all operating...
Safehandle in C# What is SafeHandle? how does it differ from IntPtr? When should I use one? What are its advantages?
TITLE: Safehandle in C# QUESTION: What is SafeHandle? how does it differ from IntPtr? When should I use one? What are its advantages? ANSWER: I think MSDN is pretty clear in definition: The SafeHandle class provides critical finalization of handle resources, preventing handles from being reclaimed prematurely by garb...
[ "c#", ".net" ]
19
11
18,919
3
0
2008-10-01T00:57:58.253000
2008-10-01T01:01:11.960000
155,792
155,828
Advice on C# Expression Trees
I'm working on a method that accepts an expression tree as a parameter, along with a type (or instance) of a class. The basic idea is that this method will add certain things to a collection that will be used for validation. public interface ITestInterface { //Specify stuff here. } private static void DoSomething (Exp...
Collecting PropertyInfo objects from Expression.Body seems similar to my solution to another question.
Advice on C# Expression Trees I'm working on a method that accepts an expression tree as a parameter, along with a type (or instance) of a class. The basic idea is that this method will add certain things to a collection that will be used for validation. public interface ITestInterface { //Specify stuff here. } privat...
TITLE: Advice on C# Expression Trees QUESTION: I'm working on a method that accepts an expression tree as a parameter, along with a type (or instance) of a class. The basic idea is that this method will add certain things to a collection that will be used for validation. public interface ITestInterface { //Specify stu...
[ "c#", "reflection", "expression-trees" ]
3
2
2,530
3
0
2008-10-01T01:00:42.490000
2008-10-01T01:20:17.030000
155,797
155,813
Rhino Mocks: How to mock ADO.NET's DataRow?
ADO.NET has the notorious DataRow class which you cannot instantiate using new. This is a problem now that I find a need to mock it using Rhino Mocks. Does anyone have any ideas how I could get around this problem?
I'm curious as to why you need to mock the DataRow. Sometimes you can get caught up doing mocking and forget that it can be just as prudent to use the real thing. If you are passing around data rows then you can simply instantiate one with a helper method and use that as a return value on your mock. SetupResult.For(som...
Rhino Mocks: How to mock ADO.NET's DataRow? ADO.NET has the notorious DataRow class which you cannot instantiate using new. This is a problem now that I find a need to mock it using Rhino Mocks. Does anyone have any ideas how I could get around this problem?
TITLE: Rhino Mocks: How to mock ADO.NET's DataRow? QUESTION: ADO.NET has the notorious DataRow class which you cannot instantiate using new. This is a problem now that I find a need to mock it using Rhino Mocks. Does anyone have any ideas how I could get around this problem? ANSWER: I'm curious as to why you need to ...
[ ".net", "ado.net", "rhino-mocks" ]
4
12
3,204
4
0
2008-10-01T01:02:24.187000
2008-10-01T01:11:18.440000
155,810
155,830
How do I configure visual studio to use the code view as the default view for Webservices?
When you double click on a class (in 'solution explorer')... if that class happens to be an.asmx.cs webservice... then you get this... To add components to your class, drag them from the Toolbox and use the Properties window to set their properties. To create methods and events for your class, click here to switch to c...
You can set the default editor for any given file type (.cs,.xml,.xsd, etc). To change the default editor for a given type: Right-click a file of that type in your project, and select "Open With..." Select your preferred editor. You may want "CSharp Editor". Click "Set as Default". I don't see the behavior you see with...
How do I configure visual studio to use the code view as the default view for Webservices? When you double click on a class (in 'solution explorer')... if that class happens to be an.asmx.cs webservice... then you get this... To add components to your class, drag them from the Toolbox and use the Properties window to s...
TITLE: How do I configure visual studio to use the code view as the default view for Webservices? QUESTION: When you double click on a class (in 'solution explorer')... if that class happens to be an.asmx.cs webservice... then you get this... To add components to your class, drag them from the Toolbox and use the Prop...
[ "visual-studio", "web-services" ]
22
32
5,306
3
0
2008-10-01T01:08:32.003000
2008-10-01T01:20:45.983000
155,822
156,090
Programmatically focusing a hippo.CanvasEntry?
Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable text label. Clicking the text label replaces it with a Hippo CanvasEntry widget which contains the text of the label. import pygtk pygtk.require('2.0') import gtk, hippo def textClicked(text, event, row): input = hippo.CanvasEntry() ...
Underneath the CanvasEntry, there's a regular old gtk.Entry which you need to request the focus as soon as it's made visible. Here's a modified version of your textClicked function which does just that: def textClicked(text, event, row): input = hippo.CanvasEntry() input.set_property('text', text.get_property('text')) ...
Programmatically focusing a hippo.CanvasEntry? Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable text label. Clicking the text label replaces it with a Hippo CanvasEntry widget which contains the text of the label. import pygtk pygtk.require('2.0') import gtk, hippo def textClicked(...
TITLE: Programmatically focusing a hippo.CanvasEntry? QUESTION: Consider this Python program which uses PyGtk and Hippo Canvas to display a clickable text label. Clicking the text label replaces it with a Hippo CanvasEntry widget which contains the text of the label. import pygtk pygtk.require('2.0') import gtk, hippo...
[ "python", "focus", "pygtk" ]
2
2
295
1
0
2008-10-01T01:16:38.380000
2008-10-01T03:14:25.947000
155,829
155,833
Getting an error when filling a datatable from a data adapter
I am getting this error but only very occasionally. 99.9% of the time it works fine: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Does anyone have any idea on what the cause could be? I only use that datatable for viewing and not updating so is it...
This typically happens when the schema on your dataset is enforcing something that your database is not. Visual Studio will automatically read schema and try and set up some primary keys on your dataset, but if you are using a view that can possibly return multiple rows it will fail. It is easy enough to remove these c...
Getting an error when filling a datatable from a data adapter I am getting this error but only very occasionally. 99.9% of the time it works fine: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Does anyone have any idea on what the cause could be? I...
TITLE: Getting an error when filling a datatable from a data adapter QUESTION: I am getting this error but only very occasionally. 99.9% of the time it works fine: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. Does anyone have any idea on what the...
[ ".net", "sql-server", "database" ]
2
2
3,228
3
0
2008-10-01T01:20:21.790000
2008-10-01T01:22:40.737000
155,835
155,838
How do you reference MS office interops in C#?
I am trying to access Outlook 2007 from C#. I have installed the PIA msi after following the directions found on msdn. After a successful install nothing shows up in Visual Studio's references under the.net tab.
Office interaction is available through COM objects found on the 'COM' tab of the 'Add Reference' dialog window.
How do you reference MS office interops in C#? I am trying to access Outlook 2007 from C#. I have installed the PIA msi after following the directions found on msdn. After a successful install nothing shows up in Visual Studio's references under the.net tab.
TITLE: How do you reference MS office interops in C#? QUESTION: I am trying to access Outlook 2007 from C#. I have installed the PIA msi after following the directions found on msdn. After a successful install nothing shows up in Visual Studio's references under the.net tab. ANSWER: Office interaction is available th...
[ "c#", "office-interop" ]
2
2
411
2
0
2008-10-01T01:23:06.993000
2008-10-01T01:25:03.510000
155,848
155,851
How do I create a Microsoft Jet (Access) database without an interop assembly?
I need to create an access (mdb) database without using the ADOX interop assembly. How can this be done?
Before I throw away this code, it might as well live on stackoverflow Something along these lines seems to do the trick: if (!File.Exists(DB_FILENAME)) { var cnnStr = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + DB_FILENAME; // Use a late bound COM object to create a new catalog. This is so we avoid an interop as...
How do I create a Microsoft Jet (Access) database without an interop assembly? I need to create an access (mdb) database without using the ADOX interop assembly. How can this be done?
TITLE: How do I create a Microsoft Jet (Access) database without an interop assembly? QUESTION: I need to create an access (mdb) database without using the ADOX interop assembly. How can this be done? ANSWER: Before I throw away this code, it might as well live on stackoverflow Something along these lines seems to do...
[ "c#", "interop", "jet" ]
5
11
7,053
5
0
2008-10-01T01:29:57.413000
2008-10-01T01:31:50.780000
155,852
199,307
Design time serialization in C#
I have created a non-visual component in C# which is designed as a placeholder for meta-data on a form. The component has a property which is a collection of custom objects, this object is marked as Serializable and implements the GetObjectData for serilizing and public constuctor for deserilizing. In the resx file for...
I have since discovered where I was going wrong. The component I was implementing a custom collection (inherited from CollectionBase), I changed this to a List and added the DesignerSerializationVisibility(DesignerSerializationVisibility.Content) attribute to the List property, this list is also read-only. This would t...
Design time serialization in C# I have created a non-visual component in C# which is designed as a placeholder for meta-data on a form. The component has a property which is a collection of custom objects, this object is marked as Serializable and implements the GetObjectData for serilizing and public constuctor for de...
TITLE: Design time serialization in C# QUESTION: I have created a non-visual component in C# which is designed as a placeholder for meta-data on a form. The component has a property which is a collection of custom objects, this object is marked as Serializable and implements the GetObjectData for serilizing and public...
[ "c#", ".net", "serialization" ]
8
3
5,172
3
0
2008-10-01T01:32:09.407000
2008-10-13T22:42:49.527000
155,864
155,895
ASP.NET MVC - passing parameters to the controller
I have a controller with an action method as follows: public class InventoryController: Controller { public ActionResult ViewStockNext(int firstItem) { // Do some stuff } } And when I run it I get an error stating: The parameters dictionary does not contain a valid value of type 'System.Int32' for parameter 'firstItem'...
Your routing needs to be set up along the lines of {controller}/{action}/{firstItem}. If you left the routing as the default {controller}/{action}/{id} in your global.asax.cs file, then you will need to pass in id. routes.MapRoute( "Inventory", "Inventory/{action}/{firstItem}", new { controller = "Inventory", action = ...
ASP.NET MVC - passing parameters to the controller I have a controller with an action method as follows: public class InventoryController: Controller { public ActionResult ViewStockNext(int firstItem) { // Do some stuff } } And when I run it I get an error stating: The parameters dictionary does not contain a valid va...
TITLE: ASP.NET MVC - passing parameters to the controller QUESTION: I have a controller with an action method as follows: public class InventoryController: Controller { public ActionResult ViewStockNext(int firstItem) { // Do some stuff } } And when I run it I get an error stating: The parameters dictionary does not ...
[ "c#", "asp.net-mvc" ]
114
112
419,959
10
0
2008-10-01T01:38:11.747000
2008-10-01T01:46:32.817000
155,870
156,016
How do I declare an impicitly typed variable in VB inline in an ASP.Net page?
I want to do the following: <%=var t = ViewData.Model%> but in VB
<% Dim t = ViewData.Model %> VB doesn't use a special keyword for implicitly typed variables... just Dim.
How do I declare an impicitly typed variable in VB inline in an ASP.Net page? I want to do the following: <%=var t = ViewData.Model%> but in VB
TITLE: How do I declare an impicitly typed variable in VB inline in an ASP.Net page? QUESTION: I want to do the following: <%=var t = ViewData.Model%> but in VB ANSWER: <% Dim t = ViewData.Model %> VB doesn't use a special keyword for implicitly typed variables... just Dim.
[ "asp.net", "asp.net-mvc", "vb.net" ]
2
2
351
1
0
2008-10-01T01:39:13.147000
2008-10-01T02:37:42.150000
155,891
571,061
How do you rename a Verity collection in ColdFusion?
Can't seem to rename an existing Verity collection in ColdFusion without deleting, recreating, and rebuilding the collection. Problem is, I have some very large collections I'd rather not have to delete and rebuild from scratch. Any one have a handy trick for this conundrum?
For the Verity part (without considering ColdFusion), it's easy enough to detach a collection, rename it, and reattach it again: rcadmin> indexdetach Server Alias:YourDocserver Index Alias:CollectionName Index Type [(c)ollection,(t)ree,(p)arametric,(r)ecommendation]:c Save changes? [y|n]:y < > SUCCESS rcadmin> collpur...
How do you rename a Verity collection in ColdFusion? Can't seem to rename an existing Verity collection in ColdFusion without deleting, recreating, and rebuilding the collection. Problem is, I have some very large collections I'd rather not have to delete and rebuild from scratch. Any one have a handy trick for this co...
TITLE: How do you rename a Verity collection in ColdFusion? QUESTION: Can't seem to rename an existing Verity collection in ColdFusion without deleting, recreating, and rebuilding the collection. Problem is, I have some very large collections I'd rather not have to delete and rebuild from scratch. Any one have a handy...
[ "coldfusion", "verity" ]
2
1
424
3
0
2008-10-01T01:44:40.403000
2009-02-20T20:12:58.940000