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
157,938
157,975
Hiding a password in a python script (insecure obfuscation only)
I have got a python script which is creating an ODBC connection. The ODBC connection is generated with a connection string. In this connection string I have to include the username and password for this connection. Is there an easy way to obscure this password in the file (just that nobody can read the password when I'...
Base64 encoding is in the standard library and will do to stop shoulder surfers: >>> import base64 >>> print(base64.b64encode("password".encode("utf-8"))) cGFzc3dvcmQ= >>> print(base64.b64decode("cGFzc3dvcmQ=").decode("utf-8")) password
Hiding a password in a python script (insecure obfuscation only) I have got a python script which is creating an ODBC connection. The ODBC connection is generated with a connection string. In this connection string I have to include the username and password for this connection. Is there an easy way to obscure this pas...
TITLE: Hiding a password in a python script (insecure obfuscation only) QUESTION: I have got a python script which is creating an ODBC connection. The ODBC connection is generated with a connection string. In this connection string I have to include the username and password for this connection. Is there an easy way t...
[ "python", "security" ]
168
144
316,454
21
0
2008-10-01T14:37:17.053000
2008-10-01T14:43:51.030000
157,944
157,950
Create ArrayList from array
Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList? ArrayList arrayList =...;
You can use the following instruction: new ArrayList<>(Arrays.asList(array));
Create ArrayList from array Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList? ArrayList arrayList =...;
TITLE: Create ArrayList from array QUESTION: Element[] array = {new Element(1), new Element(2), new Element(3)}; How do I convert the above variable of type Element[] into a variable of type ArrayList? ArrayList arrayList =...; ANSWER: You can use the following instruction: new ArrayList<>(Arrays.asList(array));
[ "java", "arrays", "arraylist", "type-conversion" ]
4,103
5,122
1,842,189
42
0
2008-10-01T14:38:32.667000
2008-10-01T14:39:12.010000
157,947
158,616
What is the latency in an AMD PowerNow state change operation?
In low latency trading applications we are very conscious of latency issues. There is some concern that our application may experience increased latency if the server on which it is running changes PowerNow state. Any kernel developers familiar with calling PowerNow changes and how much processor time is used for the o...
The Linux kernel appears to assume an upper bound of a fifth of a millisecond for a PowerNow state change operation to complete. I would have thought a bigger worry than the cost of the state change itself, though, would be that downclocking the CPU will make your application run slower, increasing latency across the b...
What is the latency in an AMD PowerNow state change operation? In low latency trading applications we are very conscious of latency issues. There is some concern that our application may experience increased latency if the server on which it is running changes PowerNow state. Any kernel developers familiar with calling...
TITLE: What is the latency in an AMD PowerNow state change operation? QUESTION: In low latency trading applications we are very conscious of latency issues. There is some concern that our application may experience increased latency if the server on which it is running changes PowerNow state. Any kernel developers fam...
[ "kernel" ]
5
2
445
2
0
2008-10-01T14:39:03.320000
2008-10-01T16:53:26.227000
157,959
166,201
How do I make the apple terminal window auto change colour scheme when I ssh to a specific server
When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. How can I make it automatically detect that I have ssh'ed somewhere, and if that somewhere is on a specific list, cha...
Put following script in ~/bin/ssh (ensure ~/bin/ is checked before /usr/bin/ in your PATH): #!/bin/sh HOSTNAME=`echo $@ | sed s/.*@//` set_bg () { osascript -e "tell application \"Terminal\" to set background color of window 1 to $1" } on_exit () { set_bg "{0, 0, 0, 50000}" } trap on_exit EXIT case $HOSTNAME in pro...
How do I make the apple terminal window auto change colour scheme when I ssh to a specific server When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. How can I make it a...
TITLE: How do I make the apple terminal window auto change colour scheme when I ssh to a specific server QUESTION: When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. H...
[ "macos", "terminal", "osx-leopard" ]
56
56
21,078
11
0
2008-10-01T14:41:38.243000
2008-10-03T10:12:06.057000
158,004
158,808
What is the consensus on "Voice-family" Hacks?
I just started working for a pretty large company and my group manages all of their public facing websites. I opened the style sheet for the first time today and have seen over 20 instances of the designers using the voice-family hack to fix an IE bug. (I don't know why they allow graphic designers to write any kind of...
Hacks of any kind are dangerous as they are prone to have unintended effects in future browsers (lots broke with IE7). The safe ways of filtering CSS are: (For IE only) Using conditional comments. These will always work on Microsoft browsers and always be ignored by all other browsers as they are within comments Featur...
What is the consensus on "Voice-family" Hacks? I just started working for a pretty large company and my group manages all of their public facing websites. I opened the style sheet for the first time today and have seen over 20 instances of the designers using the voice-family hack to fix an IE bug. (I don't know why th...
TITLE: What is the consensus on "Voice-family" Hacks? QUESTION: I just started working for a pretty large company and my group manages all of their public facing websites. I opened the style sheet for the first time today and have seen over 20 instances of the designers using the voice-family hack to fix an IE bug. (I...
[ "html", "css", "xhtml" ]
4
4
749
4
0
2008-10-01T14:49:34.403000
2008-10-01T17:40:47.830000
158,008
158,114
How do I specify IP Ranges (RegEx) for SkipHosts in AWStats config files?
I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file: # Do not include access from clients that match following criteria. # If your log file contains IP addresses in host field, you must enter here # matching IP addresses criteria. # If DNS lo...
Assuming that character classes are supported within REGEX[ ]: SkipHosts = "REGEX[^192\.168\.1\.(9[7-9]|10[0-9]|110)$]"
How do I specify IP Ranges (RegEx) for SkipHosts in AWStats config files? I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file: # Do not include access from clients that match following criteria. # If your log file contains IP addresses in hos...
TITLE: How do I specify IP Ranges (RegEx) for SkipHosts in AWStats config files? QUESTION: I'm updating some old AWStats config files to filter out some specific IP ranges. Here's the pertinent section of the config file: # Do not include access from clients that match following criteria. # If your log file contains I...
[ "regex", "awstats" ]
1
2
3,098
3
0
2008-10-01T14:50:35.553000
2008-10-01T15:09:49.953000
158,044
158,235
How to use 'find' to search for files created on a specific date?
How do I use the UNIX command find to search for files created on a specific date?
As pointed out by Max, you can't, but checking files modified or accessed is not all that hard. I wrote a tutorial about this, as late as today. The essence of which is to use -newerXY and! -newerXY: Example: To find all files modified on the 7th of June, 2007: $ find. -type f -newermt 2007-06-07! -newermt 2007-06-08 T...
How to use 'find' to search for files created on a specific date? How do I use the UNIX command find to search for files created on a specific date?
TITLE: How to use 'find' to search for files created on a specific date? QUESTION: How do I use the UNIX command find to search for files created on a specific date? ANSWER: As pointed out by Max, you can't, but checking files modified or accessed is not all that hard. I wrote a tutorial about this, as late as today....
[ "bash", "unix", "find" ]
310
405
481,158
9
0
2008-10-01T14:56:37.770000
2008-10-01T15:30:48.250000
158,055
158,063
Why can't I use Template Toolkit?
I am trying to use TemplateToolkit instead of good ole' variable interpolation and my server is giving me a lot of grief. Here are the errors I am getting: *** 'D:\Inetpub\gic\source\extjs_source.plx' error message at: 2008/09/30 15:27:37 failed to create context: failed to create context: failed to load Template/Stash...
I figured this one out after a long time. Apparently the ActiveState people didn't check much into the package because it requires Template::Stash::XS, but that's not actually available in PPM. To fix this issue just edit the Template/Config.pm and change Template::Stash::XS to Template::Stash.
Why can't I use Template Toolkit? I am trying to use TemplateToolkit instead of good ole' variable interpolation and my server is giving me a lot of grief. Here are the errors I am getting: *** 'D:\Inetpub\gic\source\extjs_source.plx' error message at: 2008/09/30 15:27:37 failed to create context: failed to create cont...
TITLE: Why can't I use Template Toolkit? QUESTION: I am trying to use TemplateToolkit instead of good ole' variable interpolation and my server is giving me a lot of grief. Here are the errors I am getting: *** 'D:\Inetpub\gic\source\extjs_source.plx' error message at: 2008/09/30 15:27:37 failed to create context: fai...
[ "perl", "iis", "template-toolkit", "activestate" ]
3
14
1,744
2
0
2008-10-01T14:58:10.357000
2008-10-01T14:59:25.563000
158,070
2,781,557
How to position one element relative to another with jQuery?
I have a hidden DIV which contains a toolbar-like menu. I have a number of DIVs which are enabled to show the menu DIV when the mouse hovers over them. Is there a built-in function which will move the menu DIV to the top right of the active (mouse hover) DIV? I'm looking for something like $(menu).position("topright", ...
NOTE: This requires jQuery UI (not just jQuery). You can now use: $("#my_div").position({ my: "left top", at: "left bottom", of: this, // or $("#otherdiv") collision: "fit" }); For fast positioning ( jQuery UI/Position ). You can download jQuery UI here.
How to position one element relative to another with jQuery? I have a hidden DIV which contains a toolbar-like menu. I have a number of DIVs which are enabled to show the menu DIV when the mouse hovers over them. Is there a built-in function which will move the menu DIV to the top right of the active (mouse hover) DIV?...
TITLE: How to position one element relative to another with jQuery? QUESTION: I have a hidden DIV which contains a toolbar-like menu. I have a number of DIVs which are enabled to show the menu DIV when the mouse hovers over them. Is there a built-in function which will move the menu DIV to the top right of the active ...
[ "jquery" ]
362
210
437,659
8
0
2008-10-01T15:01:01.660000
2010-05-06T13:37:40.750000
158,091
159,387
DotNetNuke "keepalive"
I've got a couple DNN portals I manage and I need a solution to keep them "alive" during slack traffic times. After a given time of inactivity IIS will unload the DNN application from memory which will effect load time for the first client request. DNN has the "KeepAlive.aspx" file that I hit with a wget command from a...
A good website monitoring service will most likely provide you with a URL to check to see if the site is functioning, that is what the Keepalive URL is for. Have the service check the URL more frequently than 15 minutes and you should be good to go with keeping the site up. There's always a chance the site will go down...
DotNetNuke "keepalive" I've got a couple DNN portals I manage and I need a solution to keep them "alive" during slack traffic times. After a given time of inactivity IIS will unload the DNN application from memory which will effect load time for the first client request. DNN has the "KeepAlive.aspx" file that I hit wit...
TITLE: DotNetNuke "keepalive" QUESTION: I've got a couple DNN portals I manage and I need a solution to keep them "alive" during slack traffic times. After a given time of inactivity IIS will unload the DNN application from memory which will effect load time for the first client request. DNN has the "KeepAlive.aspx" f...
[ "asp.net", "dotnetnuke" ]
3
2
2,355
3
0
2008-10-01T15:03:56.363000
2008-10-01T19:46:47.650000
158,104
158,288
Echo A Link, Get A Trailing Slash?
I've discovered that any time I do the following: echo ' huzzah '; I end up with the following being rendered to the browser: huzzah This is particularly annoying when I link to a file with an extension, as it breaks the link. Any ideas why this is happening and how I can fix it? Update: For those asking about my exact...
Firefox, especially, shows you the html source the way it's seeing it which is rarely the way you've sent it. Clearly something about your link or it's context is making the browser interpret a trailing slash. I wonder if it's a side effect of the url encoding. If you rawurldecode it will that help. If there are parts ...
Echo A Link, Get A Trailing Slash? I've discovered that any time I do the following: echo ' huzzah '; I end up with the following being rendered to the browser: huzzah This is particularly annoying when I link to a file with an extension, as it breaks the link. Any ideas why this is happening and how I can fix it? Upda...
TITLE: Echo A Link, Get A Trailing Slash? QUESTION: I've discovered that any time I do the following: echo ' huzzah '; I end up with the following being rendered to the browser: huzzah This is particularly annoying when I link to a file with an extension, as it breaks the link. Any ideas why this is happening and how ...
[ "php", "jfilechooser" ]
1
2
6,184
7
0
2008-10-01T15:07:05.123000
2008-10-01T15:43:29.233000
158,120
158,140
Math.IEEERemainder returns negative results. Why?
The.net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces. Example: Math.IEEERemainder(0, 2) = 0 Math.IEEERemainder(1, 2) = 1 Math.IEEERemainder(2, 2) = 0 Math.IEEERemainder(3, 2) = -1
If you read the example given at System.Math.IEEERemainder's MSDN page, you'll notice that two positive numbers can have a negative remainder. Return Value A number equal to x - (y Q), where Q is the quotient of x / y rounded to the nearest integer (if x / y falls halfway between two integers, the even integer is retur...
Math.IEEERemainder returns negative results. Why? The.net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces. Example: Math.IEEERemainder(0, 2) = 0 Math.IEEERemainder(1, 2) = 1 Math.IEEERemai...
TITLE: Math.IEEERemainder returns negative results. Why? QUESTION: The.net framework includes Math.IEEERemainder(x, y) in addition to the standard mod operator. What is this function really doing? I dont understand the negative numbers that this produces. Example: Math.IEEERemainder(0, 2) = 0 Math.IEEERemainder(1, 2) ...
[ ".net", ".net-2.0" ]
8
9
4,184
1
0
2008-10-01T15:10:54.833000
2008-10-01T15:15:21.440000
158,121
158,409
Why do SocketChannel writes always complete for the full amount even on non-blocking sockets?
Using the Sun Java VM 1.5 or 1.6 on Windows, I connect a non-blocking socket. I then fill a ByteBuffer with a message to output, and attempt to write() to the SocketChannel. I expect the write to complete only partially if the amount to be written is greater than the amount of space in the socket's TCP output buffer (t...
I managed to reproduce a situation that might be similar to yours. I think, ironically enough, your recipient is consuming the data faster than you're writing it. import java.io.InputStream; import java.net.ServerSocket; import java.net.Socket; public class MyServer { public static void main(String[] args) throws Exce...
Why do SocketChannel writes always complete for the full amount even on non-blocking sockets? Using the Sun Java VM 1.5 or 1.6 on Windows, I connect a non-blocking socket. I then fill a ByteBuffer with a message to output, and attempt to write() to the SocketChannel. I expect the write to complete only partially if the...
TITLE: Why do SocketChannel writes always complete for the full amount even on non-blocking sockets? QUESTION: Using the Sun Java VM 1.5 or 1.6 on Windows, I connect a non-blocking socket. I then fill a ByteBuffer with a message to output, and attempt to write() to the SocketChannel. I expect the write to complete onl...
[ "java", "sockets", "network-programming", "nio" ]
5
7
3,259
6
0
2008-10-01T15:11:06.580000
2008-10-01T16:12:16.763000
158,124
158,142
Best way to count file downloads on a website
It's surprising how difficult it is to find a simple, concise answer to this question: I have a file, foo.zip, on my website What can I do to find out how many people have accessed this file? I could use Tomcat calls if necessary
Or you could parse the log file if you don't need the data in realtime. grep foo.zip /path/to/access.log | grep 200 | wc -l In reply to comment: The log file also contains bytes downloaded, but as someone else pointed out, this may not reflect the correct count if a user cancels the download on the client side.
Best way to count file downloads on a website It's surprising how difficult it is to find a simple, concise answer to this question: I have a file, foo.zip, on my website What can I do to find out how many people have accessed this file? I could use Tomcat calls if necessary
TITLE: Best way to count file downloads on a website QUESTION: It's surprising how difficult it is to find a simple, concise answer to this question: I have a file, foo.zip, on my website What can I do to find out how many people have accessed this file? I could use Tomcat calls if necessary ANSWER: Or you could pars...
[ "counter" ]
10
12
15,611
4
0
2008-10-01T15:12:13.693000
2008-10-01T15:15:47.757000
158,129
158,366
Best open-source, cross-platform, compiled, GUI alternative to Visual Basic?
I'm about to write a little GUI app that will sit in the system tray, doing a little FTP and ODBC. I'd like to develop in Linux, if possible. What would you recommend? Thanks a bunch!
I still think that wxWidgets is a grat cross-platform UI development toolkit that is under active development and has great community support.
Best open-source, cross-platform, compiled, GUI alternative to Visual Basic? I'm about to write a little GUI app that will sit in the system tray, doing a little FTP and ODBC. I'd like to develop in Linux, if possible. What would you recommend? Thanks a bunch!
TITLE: Best open-source, cross-platform, compiled, GUI alternative to Visual Basic? QUESTION: I'm about to write a little GUI app that will sit in the system tray, doing a little FTP and ODBC. I'd like to develop in Linux, if possible. What would you recommend? Thanks a bunch! ANSWER: I still think that wxWidgets is ...
[ "open-source" ]
6
2
13,673
11
0
2008-10-01T15:13:24.923000
2008-10-01T16:04:38.373000
158,133
158,224
When would I use AutoResetEvent and ManualResetEvent instead of Monitor.Wait()/Monitor.Pulse()?
They both seem to fulfill the same purpose. When would I chose one over the other?
Use the events when you've got a thread that is waiting on one of or all of a number of events to do something. Use the monitor if you want to restrict access to a data structure by limiting how many threads can access it. Monitors usually protect a resource, whereas events tell you something's happening, like the appl...
When would I use AutoResetEvent and ManualResetEvent instead of Monitor.Wait()/Monitor.Pulse()? They both seem to fulfill the same purpose. When would I chose one over the other?
TITLE: When would I use AutoResetEvent and ManualResetEvent instead of Monitor.Wait()/Monitor.Pulse()? QUESTION: They both seem to fulfill the same purpose. When would I chose one over the other? ANSWER: Use the events when you've got a thread that is waiting on one of or all of a number of events to do something. Us...
[ ".net", "multithreading", "synchronization", "locking" ]
20
15
11,225
4
0
2008-10-01T15:13:58.447000
2008-10-01T15:29:00.003000
158,149
158,179
How do you restrict the size of a file being uploaded with JavaScript (or Java) without transferring the entire file?
Is there a way to validate on the client side browser whether the size of a file being uploaded from a JSP page is over a set size limit without forcing the user to upload the entire file only to find out it was too large? I would like to stay away from any proprietary controls or techniques like Flash or ActiveX if po...
This isn't a perfect solution, but if you check the Content-Length HTTP header with request.getHeader("Content-Length") then you can choose to not transfer the entire file. By way of explanation, an extremely large file will not be transferred all at once. You'd have to actually open a stream representing that chunk of...
How do you restrict the size of a file being uploaded with JavaScript (or Java) without transferring the entire file? Is there a way to validate on the client side browser whether the size of a file being uploaded from a JSP page is over a set size limit without forcing the user to upload the entire file only to find o...
TITLE: How do you restrict the size of a file being uploaded with JavaScript (or Java) without transferring the entire file? QUESTION: Is there a way to validate on the client side browser whether the size of a file being uploaded from a JSP page is over a set size limit without forcing the user to upload the entire f...
[ "java", "javascript", "jsp", "file-upload" ]
11
4
3,508
3
0
2008-10-01T15:16:40.313000
2008-10-01T15:22:23.420000
158,150
158,186
Upgrading SVN 1.4 to 1.5.3 and CC.Net from 1.3 to 1.4
I think this is a multi-part question, so bear with me. Currently all of our developers use the version of Tortise built for SVN 1.4 and our SVN server is running 1.4. Our build server is running CC.Net and is using SVN 1.4. We want to upgrade. I've established that upgrading our clients to 1.5, then our server to 1.5 ...
Hard to answer as it seems you're asking for a plan for your environment, which I'm not in. However, here's what I'd do: Upgrade cc.net (you have a known good starting point, and this is the most likely breaking step. do it without any other variables so it is easier to roll back) Test & Verify Upgrade all the svn clie...
Upgrading SVN 1.4 to 1.5.3 and CC.Net from 1.3 to 1.4 I think this is a multi-part question, so bear with me. Currently all of our developers use the version of Tortise built for SVN 1.4 and our SVN server is running 1.4. Our build server is running CC.Net and is using SVN 1.4. We want to upgrade. I've established that...
TITLE: Upgrading SVN 1.4 to 1.5.3 and CC.Net from 1.3 to 1.4 QUESTION: I think this is a multi-part question, so bear with me. Currently all of our developers use the version of Tortise built for SVN 1.4 and our SVN server is running 1.4. Our build server is running CC.Net and is using SVN 1.4. We want to upgrade. I'v...
[ "svn", "tortoisesvn", "continuous-integration", "cruisecontrol.net" ]
0
3
1,270
2
0
2008-10-01T15:16:41.763000
2008-10-01T15:23:08.270000
158,151
158,171
How can I save a screenshot directly to a file in Windows?
Is there a one button way to save a screenshot directly to a file in Windows? TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for posterity. This is a very important question as the 316K views shows as of 2021. Asked in 2008, SO closed this question around ...
You can code something pretty simple that will hook the PrintScreen and save the capture in a file. Here is something to start to capture and save to a file. You will just need to hook the key "Print screen". using System; using System.Drawing; using System.IO; using System.Drawing.Imaging; using System.Runtime.Interop...
How can I save a screenshot directly to a file in Windows? Is there a one button way to save a screenshot directly to a file in Windows? TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for posterity. This is a very important question as the 316K views shows...
TITLE: How can I save a screenshot directly to a file in Windows? QUESTION: Is there a one button way to save a screenshot directly to a file in Windows? TheSoftwareJedi accurately answered above question for Windows 8 and 10. Below original extra material remains for posterity. This is a very important question as th...
[ "windows", "screenshot" ]
119
51
322,010
20
0
2008-10-01T15:16:53.743000
2008-10-01T15:21:28.973000
158,155
158,173
What are the potential pitfalls of using HTML Frames for templating?
We could also include IFrames as well.
With standard frames/frameset: Bookmarking can be difficult to accomplish. The Back button can be broken. Arrival from search engines could be into an inner frame. Printing won't work the same across browsers. Scrollbars could be in non-standard/unexpected places. More here.
What are the potential pitfalls of using HTML Frames for templating? We could also include IFrames as well.
TITLE: What are the potential pitfalls of using HTML Frames for templating? QUESTION: We could also include IFrames as well. ANSWER: With standard frames/frameset: Bookmarking can be difficult to accomplish. The Back button can be broken. Arrival from search engines could be into an inner frame. Printing won't work t...
[ "html", "iframe" ]
0
2
561
3
0
2008-10-01T15:18:10.573000
2008-10-01T15:21:56.290000
158,172
1,987,721
Formatting numbers with significant figures in C#
I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become 12300 and 0.012345 will become 0.0123. Occasionall...
See: RoundToSignificantFigures by "P Daddy". I've combined his method with another one I liked. Rounding to significant figures is a lot easier in TSQL where the rounding method is based on rounding position, not number of decimal places - which is the case with.Net math.round. You could round a number in TSQL to negat...
Formatting numbers with significant figures in C# I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so 12345 will become ...
TITLE: Formatting numbers with significant figures in C# QUESTION: I have some decimal data that I am pushing into a SharePoint list where it is to be viewed. I'd like to restrict the number of significant figures displayed in the result data based on my knowledge of the specific calculation. Sometimes it'll be 3, so ...
[ "c#", "significant-digits" ]
32
25
42,369
9
0
2008-10-01T15:21:32.673000
2010-01-01T02:18:04.273000
158,174
158,216
Why would you ever implement finalize()?
I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources. I saw someone comment that they use it to clean up Connections, which is really scary since the only way to come as ...
You could use it as a backstop for an object holding an external resource (socket, file, etc). Implement a close() method and document that it needs to be called. Implement finalize() to do the close() processing if you detect it hasn't been done. Maybe with something dumped to stderr to point out that you're cleaning ...
Why would you ever implement finalize()? I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources. I saw someone comment that they use it to clean up Connections, which is re...
TITLE: Why would you ever implement finalize()? QUESTION: I've been reading through a lot of the rookie Java questions on finalize() and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources. I saw someone comment that they use it to clean up Connec...
[ "java", "jvm", "finalize" ]
395
244
107,953
21
0
2008-10-01T15:22:09.627000
2008-10-01T15:27:50.363000
158,189
158,252
How to trunc a date to seconds in Oracle
This page mentions how to trunc a timestamp to minutes/hours/etc. in Oracle. How would you trunc a timestamp to seconds in the same manner?
Since the precision of DATE is to the second (and no fractions of seconds), there is no need to TRUNC at all. The data type TIMESTAMP allows for fractions of seconds. If you convert it to a DATE the fractional seconds will be removed - e.g. select cast(systimestamp as date) from dual;
How to trunc a date to seconds in Oracle This page mentions how to trunc a timestamp to minutes/hours/etc. in Oracle. How would you trunc a timestamp to seconds in the same manner?
TITLE: How to trunc a date to seconds in Oracle QUESTION: This page mentions how to trunc a timestamp to minutes/hours/etc. in Oracle. How would you trunc a timestamp to seconds in the same manner? ANSWER: Since the precision of DATE is to the second (and no fractions of seconds), there is no need to TRUNC at all. Th...
[ "sql", "oracle" ]
15
32
66,996
7
0
2008-10-01T15:23:35.770000
2008-10-01T15:35:24.993000
158,209
158,258
Bit Twiddle to perform this conversion
curious if anyone might have some insight in how I would do the following to a binary number: convert 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 -> 10 10 -> 01 so, 10101000010100011100 01010100101010100010 and to clarify that this isn't a simple inversion: 000000100000000000 000001010000000000 I was thi...
Let's say x is your variable. Then you'd have: unsigned myBitOperation(unsigned x) { return ((x<<1) | (x>>1)) & (~x); }
Bit Twiddle to perform this conversion curious if anyone might have some insight in how I would do the following to a binary number: convert 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 -> 10 10 -> 01 so, 10101000010100011100 01010100101010100010 and to clarify that this isn't a simple inversion: 00000010...
TITLE: Bit Twiddle to perform this conversion QUESTION: curious if anyone might have some insight in how I would do the following to a binary number: convert 01+0 -> 10+1 (+ as in regular expressions, one or more) 01 -> 10 10 -> 01 so, 10101000010100011100 01010100101010100010 and to clarify that this isn't a simple i...
[ "bit-manipulation", "bit" ]
2
11
413
2
0
2008-10-01T15:26:45.937000
2008-10-01T15:36:14.977000
158,218
158,271
Project dependencies across multiple Visual Studio versions
I have 3.net projects. Project1.dll is generated by a VS2008 project. Project2.dll is generated by a VS2005 project that references Project1.dll. Project3.dll is generated by a VS2008 project that references both Project1.dll and Project2.dll. Right now, I build Project1.dll, and manually copy it to the place where Pro...
Probably the best option would be to have a common build folder for all three projects. This can be done in the Project Properties-> Build -> Output path. Then point the references to the output folder. That way anytime you build any of the lower projects, the higher projects would have the latest versions. You can set...
Project dependencies across multiple Visual Studio versions I have 3.net projects. Project1.dll is generated by a VS2008 project. Project2.dll is generated by a VS2005 project that references Project1.dll. Project3.dll is generated by a VS2008 project that references both Project1.dll and Project2.dll. Right now, I bui...
TITLE: Project dependencies across multiple Visual Studio versions QUESTION: I have 3.net projects. Project1.dll is generated by a VS2008 project. Project2.dll is generated by a VS2005 project that references Project1.dll. Project3.dll is generated by a VS2008 project that references both Project1.dll and Project2.dll...
[ "visual-studio", "projects-and-solutions", "project-organization" ]
3
4
1,022
5
0
2008-10-01T15:28:19.613000
2008-10-01T15:39:41.847000
158,219
158,242
What would cause the current directory of an executing app to change?
I have a C# application that includes the following code: string file = "relativePath.txt"; //Time elapses... string contents = File.ReadAllText(file); This works fine, most of the time. The file is read relative to the directory that the app was started from. However, in testing, it has been found that if left alone...
If the file is always in a path relative to the executable assembly, then yes, use Assembly.Location. I mostly use Assembly.GetExecutingAssembly if applicable though instead of Assembly.GetEntryAssembly. This means that if you're accessing the file from a DLL, the path will be relative to the DLL path.
What would cause the current directory of an executing app to change? I have a C# application that includes the following code: string file = "relativePath.txt"; //Time elapses... string contents = File.ReadAllText(file); This works fine, most of the time. The file is read relative to the directory that the app was s...
TITLE: What would cause the current directory of an executing app to change? QUESTION: I have a C# application that includes the following code: string file = "relativePath.txt"; //Time elapses... string contents = File.ReadAllText(file); This works fine, most of the time. The file is read relative to the directory ...
[ "c#", ".net", "filesystems", "working-directory" ]
2
5
2,329
6
0
2008-10-01T15:28:23.950000
2008-10-01T15:32:44.750000
158,256
158,293
What is the best free, Ajax.NET (System.Web.Extensions 3.5) compatible Rich Text Box control?
I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with.NET Framework 3.5 Ajax, specifically one that can easily provide its values from inside an UpdatePanel. I got burned by RicherComponents RichTextBox which still does not reference the Framework 3.5. thanks!
Look at FCKEditor for a free solution. I'm unsure if it's usable inside an update panel, but it's free and opensource. http://www.fckeditor.net/
What is the best free, Ajax.NET (System.Web.Extensions 3.5) compatible Rich Text Box control? I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with.NET Framework 3.5 Ajax, specifically one that can easily provide its values from inside an UpdatePanel. I got burned by RicherComponents R...
TITLE: What is the best free, Ajax.NET (System.Web.Extensions 3.5) compatible Rich Text Box control? QUESTION: I'm looking for a good ASP.NET RichTextBox component that integrates fairly easily with.NET Framework 3.5 Ajax, specifically one that can easily provide its values from inside an UpdatePanel. I got burned by ...
[ "c#", "asp.net", ".net-3.5", "richtext", "ajax.net" ]
6
2
1,866
3
0
2008-10-01T15:35:58.910000
2008-10-01T15:44:57.467000
158,257
158,440
WebRequest from localhost to localhost : why is it being denied?
My app uses a WebRequest at certain points to get pages from itself. This shouldn't be a problem. It actually works fine on the server, which is a "shared" hosting package with Medium trust. Locally, I use a custom security policy based on Medium trust, which includes the following — copied straight from the default Me...
My ignorance. I didn't know that the $OriginHost$ token was replaced using the originUrl attribute of the trust level — I thought it just came from the url of the app. I had originally left this attribute blank.
WebRequest from localhost to localhost : why is it being denied? My app uses a WebRequest at certain points to get pages from itself. This shouldn't be a problem. It actually works fine on the server, which is a "shared" hosting package with Medium trust. Locally, I use a custom security policy based on Medium trust, w...
TITLE: WebRequest from localhost to localhost : why is it being denied? QUESTION: My app uses a WebRequest at certain points to get pages from itself. This shouldn't be a problem. It actually works fine on the server, which is a "shared" hosting package with Medium trust. Locally, I use a custom security policy based ...
[ "asp.net", "security", "configuration", "webrequest" ]
0
0
3,862
3
0
2008-10-01T15:36:08.860000
2008-10-01T16:17:09.137000
158,268
158,403
Python module dependency
Ok I have two modules, each containing a class, the problem is their classes reference each other. Lets say for example I had a room module and a person module containing CRoom and CPerson. The CRoom class contains infomation about the room, and a CPerson list of every one in the room. The CPerson class however sometim...
No need to import CRoom You don't use CRoom in person.py, so don't import it. Due to dynamic binding, Python doesn't need to "see all class definitions at compile time". If you actually do use CRoom in person.py, then change from room import CRoom to import room and use module-qualified form room.CRoom. See Effbot's Ci...
Python module dependency Ok I have two modules, each containing a class, the problem is their classes reference each other. Lets say for example I had a room module and a person module containing CRoom and CPerson. The CRoom class contains infomation about the room, and a CPerson list of every one in the room. The CPer...
TITLE: Python module dependency QUESTION: Ok I have two modules, each containing a class, the problem is their classes reference each other. Lets say for example I had a room module and a person module containing CRoom and CPerson. The CRoom class contains infomation about the room, and a CPerson list of every one in ...
[ "python", "module", "circular-dependency" ]
20
22
18,453
5
0
2008-10-01T15:38:58.217000
2008-10-01T16:11:41.477000
158,277
161,731
Can't see subreport in the Report Manager
I've been following this tutorial (lesson 6) in order to build and deploy a sample report with an embedded subreport which reads its parameters' values from the parent report. This subreport is embedded in one of the group rows of the report's table, and both share the same datasource. Additionally, detail rows appear ...
I'm beginning to think this could be an issue with the browser. I'm currently using Internet Explorer 8 Beta and I'm also experiencing weird behavior from the Report Manager. I've tried with Google Chrome and Firefox 3 and, although the navigation is not as smooth as I like, the problem seems fixed.
Can't see subreport in the Report Manager I've been following this tutorial (lesson 6) in order to build and deploy a sample report with an embedded subreport which reads its parameters' values from the parent report. This subreport is embedded in one of the group rows of the report's table, and both share the same dat...
TITLE: Can't see subreport in the Report Manager QUESTION: I've been following this tutorial (lesson 6) in order to build and deploy a sample report with an embedded subreport which reads its parameters' values from the parent report. This subreport is embedded in one of the group rows of the report's table, and both ...
[ "reporting-services", "subreport", "reportmanager" ]
0
1
5,062
4
0
2008-10-01T15:41:07.867000
2008-10-02T10:48:48.967000
158,278
158,329
Working with Silverlight B2 and RC0
I've been reading about the new developer-only RC0 for Silverlight, and the fact that it is supposed to be used only by developers to solve any breaking changes when upgrading from beta 2, so that when the actual S2 is released, migration is smoother. My question is, since you are supposed to uninstall B2 tools and ins...
A VM is really the only solution I've heard of so far for this. Hopefully we won't be in this limbo for too horribly long. One thing you could do to make the VM a bit smaller is if you do your RC0 stuff on the VM, you can use Visual Web Developer Express 2008 SP1 on there instead of the full blown Visual Studio. Unfort...
Working with Silverlight B2 and RC0 I've been reading about the new developer-only RC0 for Silverlight, and the fact that it is supposed to be used only by developers to solve any breaking changes when upgrading from beta 2, so that when the actual S2 is released, migration is smoother. My question is, since you are su...
TITLE: Working with Silverlight B2 and RC0 QUESTION: I've been reading about the new developer-only RC0 for Silverlight, and the fact that it is supposed to be used only by developers to solve any breaking changes when upgrading from beta 2, so that when the actual S2 is released, migration is smoother. My question is...
[ "silverlight", "upgrade", "silverlight-2-rc0" ]
2
4
98
1
0
2008-10-01T15:41:19.893000
2008-10-01T15:53:11.270000
158,279
158,538
How do I install MySQL modules within PHP?
I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here. I get this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub... MySQL doesn't show up in my phpinfo; report. I've updated the c:\Windows\php.ini file from; Directory in which the loadable extensions (modules) res...
As the others say these two values in php.ini are crucial. I have the following in my php.ini: note the trailing slash - not sure if it is needed - but it does work. extension_dir = "H:\apps\php\ext\" extension=php_mysql.dll Also it is worth ensuring that you only have one copy of php.ini on your machine - I've had pro...
How do I install MySQL modules within PHP? I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here. I get this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub... MySQL doesn't show up in my phpinfo; report. I've updated the c:\Windows\php.ini file from; Directory in ...
TITLE: How do I install MySQL modules within PHP? QUESTION: I've updated php.ini and moved php_mysql.dll as explained in steps 6 and 8 here. I get this error… Fatal error: Call to undefined function mysql_connect() in C:\inetpub... MySQL doesn't show up in my phpinfo; report. I've updated the c:\Windows\php.ini file f...
[ "php", "mysql", "windows" ]
2
5
15,455
4
0
2008-10-01T15:41:37.693000
2008-10-01T16:36:06.813000
158,282
158,312
Is DirectSound the best audio abstraction layer for Windows?
Is DirectSound the best audio abstraction layer for Windows? Switching my app from a very bad sound implementation, built to a specific chipset, to an abstration layer. App is native Winform,.net 3.5. DirectX/DirectSound is the likely choice, but a little concerned about the overhead. Any other options? Or is it silly ...
DirectSound is not getting the same love from Microsoft today as it got in the past. As far as DirectX is concerned, you may try XAudio2 or XACT instead. Some people love those, others hate them. XAudio2 is more low-level, while XACT is rather high-level. Both are accessible from Microsoft XNA, which is like Managed Di...
Is DirectSound the best audio abstraction layer for Windows? Is DirectSound the best audio abstraction layer for Windows? Switching my app from a very bad sound implementation, built to a specific chipset, to an abstration layer. App is native Winform,.net 3.5. DirectX/DirectSound is the likely choice, but a little con...
TITLE: Is DirectSound the best audio abstraction layer for Windows? QUESTION: Is DirectSound the best audio abstraction layer for Windows? Switching my app from a very bad sound implementation, built to a specific chipset, to an abstration layer. App is native Winform,.net 3.5. DirectX/DirectSound is the likely choice...
[ "directx", "audio", "directsound" ]
4
6
9,164
6
0
2008-10-01T15:42:02.653000
2008-10-01T15:48:40.627000
158,283
158,378
IE7 detected as IE6 on Vista...Why?
I have two vista Business machines. I have IE 7 installed on both. On my first machine (Computer1) if I go to this site ( http://www.quirksmode.org/js/detect.html ), it says I am using "Explorer 6 on Windows". If I use Computer2 with Vista Business and IE7, it says I am using "Explorer 7 on Windows". Here is a screen c...
Computer1: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0; Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1); SLCC1;.NET CLR 2.0.50727; Media Center PC 5.0; InfoPath.2;.NET CLR 3.5.21022;.NET CLR 3.5.30729;.NET CLR 3.0.30618; MS-RTC LM 8;.NET CLR 1.1.4322) Rick Kierner (11 minutes ago) Computer2: Mozilla/4.0 (...
IE7 detected as IE6 on Vista...Why? I have two vista Business machines. I have IE 7 installed on both. On my first machine (Computer1) if I go to this site ( http://www.quirksmode.org/js/detect.html ), it says I am using "Explorer 6 on Windows". If I use Computer2 with Vista Business and IE7, it says I am using "Explor...
TITLE: IE7 detected as IE6 on Vista...Why? QUESTION: I have two vista Business machines. I have IE 7 installed on both. On my first machine (Computer1) if I go to this site ( http://www.quirksmode.org/js/detect.html ), it says I am using "Explorer 6 on Windows". If I use Computer2 with Vista Business and IE7, it says ...
[ "windows-vista", "internet-explorer-6", "internet-explorer-7", "user-agent" ]
1
5
982
7
0
2008-10-01T15:42:11.687000
2008-10-01T16:08:23.153000
158,310
158,347
Tool for translation of Oracle PL/SQL into Postgresql PL/pgSQL
Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language into Postgresql's PL/pgSQL stored procedure language?
There is a tool available at http://ora2pg.darold.net/ which can be used to transalate Oracle Schemas to Postgres schemas, but I'm not sure if it will also translate the stored procedures. But it might provide a place to start.
Tool for translation of Oracle PL/SQL into Postgresql PL/pgSQL Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language into Postgresql's PL/pgSQL stored procedure language?
TITLE: Tool for translation of Oracle PL/SQL into Postgresql PL/pgSQL QUESTION: Is there a tool (preferably free) which will translate Oracle's PL/SQL stored procedure language into Postgresql's PL/pgSQL stored procedure language? ANSWER: There is a tool available at http://ora2pg.darold.net/ which can be used to tra...
[ "oracle", "postgresql", "plsql", "translation", "plpgsql" ]
8
6
21,173
4
0
2008-10-01T15:48:23.200000
2008-10-01T15:58:36.717000
158,319
201,406
Is there a cross-browser onload event when clicking the back button?
For all major browsers (except IE), the JavaScript onload event doesn’t fire when the page loads as a result of a back button operation — it only fires when the page is first loaded. Can someone point me at some sample cross-browser code (Firefox, Opera, Safari, IE, …) that solves this problem? I’m familiar with Firefo...
Guys, I found that JQuery has only one effect: the page is reloaded when the back button is pressed. This has nothing to do with " ready ". How does this work? Well, JQuery adds an onunload event listener. // http://code.jquery.com/jquery-latest.js jQuery(window).bind("unload", function() { //... By default, it does no...
Is there a cross-browser onload event when clicking the back button? For all major browsers (except IE), the JavaScript onload event doesn’t fire when the page loads as a result of a back button operation — it only fires when the page is first loaded. Can someone point me at some sample cross-browser code (Firefox, Ope...
TITLE: Is there a cross-browser onload event when clicking the back button? QUESTION: For all major browsers (except IE), the JavaScript onload event doesn’t fire when the page loads as a result of a back button operation — it only fires when the page is first loaded. Can someone point me at some sample cross-browser ...
[ "javascript", "pageload" ]
202
127
198,920
16
0
2008-10-01T15:50:36.300000
2008-10-14T14:32:27.130000
158,328
158,338
How would I go about creating a mod_rewrite that redirects to launch.php?i=/the/url/that/they/want?
So if the user types mydomain.com/dashboard, the document the server actually sends them is /launch.php?i=/dashboard. The one caveat is that I would like to leave requests for /flags /people /posters /css /icons /images /libraries /patterns alone, and they should request the actual folder. How would I create such a mod...
This is the.htaccess file for the CakePHP Framework. Please replace the index.php and?url= to fit your needs. RewriteEngine On RewriteCond %{REQUEST_FILENAME}!-d RewriteCond %{REQUEST_FILENAME}!-f RewriteRule ^(.*)$ index.php?url=$1 [QSA,L] The "!-d" tells Apache to follow existing folders and "!-f" to follow existing ...
How would I go about creating a mod_rewrite that redirects to launch.php?i=/the/url/that/they/want? So if the user types mydomain.com/dashboard, the document the server actually sends them is /launch.php?i=/dashboard. The one caveat is that I would like to leave requests for /flags /people /posters /css /icons /images ...
TITLE: How would I go about creating a mod_rewrite that redirects to launch.php?i=/the/url/that/they/want? QUESTION: So if the user types mydomain.com/dashboard, the document the server actually sends them is /launch.php?i=/dashboard. The one caveat is that I would like to leave requests for /flags /people /posters /c...
[ "apache", "url", "mod-rewrite" ]
0
5
107
1
0
2008-10-01T15:52:45.997000
2008-10-01T15:55:57.533000
158,330
158,894
http/AJAX (GWT) vs Eclipse gui for thin client deployment
I am starting a project for which we will have a thin client, sending requests and getting responses from a server. We are still in the planning stages, so we have a choice to settle on either an Eclipse based GUI (Eclipse plugin) or using GWT as a fromtend for the application. I am not very familiar with Eclipse as a ...
If you are thinking of using Eclipse to build a standalone client or a plugin that's just added to an existing Eclipse install, how are you planning to communicate with your server? Our team tried building an Eclipse Rich Client Platform application and having that communicate with a J2EE EJB-based middle tier over RMI...
http/AJAX (GWT) vs Eclipse gui for thin client deployment I am starting a project for which we will have a thin client, sending requests and getting responses from a server. We are still in the planning stages, so we have a choice to settle on either an Eclipse based GUI (Eclipse plugin) or using GWT as a fromtend for ...
TITLE: http/AJAX (GWT) vs Eclipse gui for thin client deployment QUESTION: I am starting a project for which we will have a thin client, sending requests and getting responses from a server. We are still in the planning stages, so we have a choice to settle on either an Eclipse based GUI (Eclipse plugin) or using GWT ...
[ "java", "ajax", "eclipse", "user-interface", "gwt" ]
1
1
1,278
2
0
2008-10-01T15:53:17.633000
2008-10-01T18:00:27.297000
158,336
158,358
Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup?
I need to remove temp files on Tomcat startup, the pass to a folder which contains temp files is in applicationContext.xml. Is there a way to run a method/class only on Tomcat startup?
You could write a ServletContextListener which calls your method from the contextInitialized() method. You attach the listener to your webapp in web.xml, e.g. my.Listener and package my; public class Listener implements javax.servlet.ServletContextListener { public void contextInitialized(ServletContext context) { My...
Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup? I need to remove temp files on Tomcat startup, the pass to a folder which contains temp files is in applicationContext.xml. Is there a way to run a method/class only on Tomcat startup?
TITLE: Is there a way to run a method/class only on Tomcat/Wildfly/Glassfish startup? QUESTION: I need to remove temp files on Tomcat startup, the pass to a folder which contains temp files is in applicationContext.xml. Is there a way to run a method/class only on Tomcat startup? ANSWER: You could write a ServletCont...
[ "java", "tomcat", "jakarta-ee", "web-applications", "startup" ]
54
81
41,747
3
0
2008-10-01T15:55:06.617000
2008-10-01T16:01:17.180000
158,341
158,351
Is there a way to make SQL Management Studio never generate USE [database-name] in scripts?
Is there a way to turn this 'feature' off?
Awesome, I just found it: Tools -> Options -> Sql Server Object Explorer -> General Scripting Options Script USE -> False
Is there a way to make SQL Management Studio never generate USE [database-name] in scripts? Is there a way to turn this 'feature' off?
TITLE: Is there a way to make SQL Management Studio never generate USE [database-name] in scripts? QUESTION: Is there a way to turn this 'feature' off? ANSWER: Awesome, I just found it: Tools -> Options -> Sql Server Object Explorer -> General Scripting Options Script USE -> False
[ "sql-server", "ssms" ]
2
5
199
2
0
2008-10-01T15:57:20.637000
2008-10-01T16:00:18.337000
158,343
159,194
Remote clients Can't open XLS file using ASP.NET/ADO
I'm trying to do the following: User goes to web page, uploads XLS file use ADO.NET to open XLS file using JET engine connection to locally uploaded file on web server This all works fine locally (my machine as the client and the web server) - and in fact is working on the customer's web server with remote clients but ...
Ok, figured it out - turns out that even with IIS using impersonation and the TMP/TEMP environment variables being set to C:\WINDOWS\Temp the ASP.NET process is still running under the ASPNET account and each individual user needed permissions to the Documents and Settings\ASPNET\Local Settings\Temp folder The other wa...
Remote clients Can't open XLS file using ASP.NET/ADO I'm trying to do the following: User goes to web page, uploads XLS file use ADO.NET to open XLS file using JET engine connection to locally uploaded file on web server This all works fine locally (my machine as the client and the web server) - and in fact is working ...
TITLE: Remote clients Can't open XLS file using ASP.NET/ADO QUESTION: I'm trying to do the following: User goes to web page, uploads XLS file use ADO.NET to open XLS file using JET engine connection to locally uploaded file on web server This all works fine locally (my machine as the client and the web server) - and i...
[ "c#", "asp.net", "iis", "ado.net" ]
1
2
1,763
2
0
2008-10-01T15:57:50.680000
2008-10-01T19:06:29.993000
158,359
158,456
In PowerShell, how can I determine if the current drive is a networked drive or not?
I need to know, from within Powershell, if the current drive is a mapped drive or not. Unfortunately, Get-PSDrive is not working "as expected": PS:24 H:\temp >get-psdrive h Name Provider Root CurrentLocation ---- -------- ---- --------------- H FileSystem H:\ temp but in MS-Dos "net use" shows that H: is really a mapp...
Use the.NET framework: PS H:\> $x = new-object system.io.driveinfo("h:\") PS H:\> $x.drivetype Network
In PowerShell, how can I determine if the current drive is a networked drive or not? I need to know, from within Powershell, if the current drive is a mapped drive or not. Unfortunately, Get-PSDrive is not working "as expected": PS:24 H:\temp >get-psdrive h Name Provider Root CurrentLocation ---- -------- ---- -------...
TITLE: In PowerShell, how can I determine if the current drive is a networked drive or not? QUESTION: I need to know, from within Powershell, if the current drive is a mapped drive or not. Unfortunately, Get-PSDrive is not working "as expected": PS:24 H:\temp >get-psdrive h Name Provider Root CurrentLocation ---- ---...
[ "c#", "powershell", "networking", "mapped-drive" ]
7
10
7,622
6
0
2008-10-01T16:01:23.230000
2008-10-01T16:19:27.400000
158,369
158,417
Possible to detect the *type of mobile device* via javascript or HTTP Headers?
I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported devices. So far I've found that the HTTP Headers (submitted by mobile IE) contain information suc...
What exactly does the customer mean by "supported". Surely it means that the phone in question supports the web application and it's inner functionality - wouldn't it be better then to forget device detection and simply focus on detecting those capabilities required for the app to function properly? For example, if my ...
Possible to detect the *type of mobile device* via javascript or HTTP Headers? I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported devices. So far I'...
TITLE: Possible to detect the *type of mobile device* via javascript or HTTP Headers? QUESTION: I've got a request from a customer to automatically detect the type of mobile device (not the browser, the type. ex: Moto Q, Blackjack II, etc.) and automatically select the device from a drop down with a list of supported ...
[ "javascript", "http", "windows-mobile", "http-headers" ]
2
2
3,154
3
0
2008-10-01T16:05:13.503000
2008-10-01T16:13:31.860000
158,372
158,408
How do I build a WPF application where I can drag and drop a user control between windows?
I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in. The relevant UIElements in my app are: Window1 (Window) TodoList (User Control) TodoStackCard (User Control) Window1 looks like this: TodoList looks like this: I ha...
You have to call DoDragDrop to initialize the Drag And Drop framework. Jaime Rodriguez provides a guide to Drag and Drop here
How do I build a WPF application where I can drag and drop a user control between windows? I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in. The relevant UIElements in my app are: Window1 (Window) TodoList (User Co...
TITLE: How do I build a WPF application where I can drag and drop a user control between windows? QUESTION: I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in. The relevant UIElements in my app are: Window1 (Window)...
[ "c#", "wpf", "windows", "user-interface" ]
3
2
10,827
2
0
2008-10-01T16:06:02.907000
2008-10-01T16:12:09.977000
158,382
158,435
Open an ANSI file and Save a a Unicode file using Delphi
For some reason, lately the *.UDL files on many of my client systems are no longer compatible as they were once saved as ANSI files, which is no longer compatible with the expected UNICODE file format. The end result is an error dialog which states "the file is not a valid compound file". What is the easiest way to pro...
This is very simple to do with my TGpTextFile unit. I'll put together a short sample and post it here. It should also be very simple with the new Delphi 2009 - are you maybe using it? EDIT: This his how you can do it using my stuff in pre-2009 Delphis. var strAnsi: TGpTextFile; strUnicode: TGpTextFile; begin strAnsi:= ...
Open an ANSI file and Save a a Unicode file using Delphi For some reason, lately the *.UDL files on many of my client systems are no longer compatible as they were once saved as ANSI files, which is no longer compatible with the expected UNICODE file format. The end result is an error dialog which states "the file is n...
TITLE: Open an ANSI file and Save a a Unicode file using Delphi QUESTION: For some reason, lately the *.UDL files on many of my client systems are no longer compatible as they were once saved as ANSI files, which is no longer compatible with the expected UNICODE file format. The end result is an error dialog which sta...
[ "delphi", "unicode", "delphi-2009", "delphi-2006" ]
6
8
10,071
2
0
2008-10-01T16:08:34.617000
2008-10-01T16:15:52.260000
158,384
158,404
What happens first? .htaccess or php code?
If I use mod_rewrite to control all my 301 redirects, does this happen before my page is served? so if I also have a bunch of redirect rules in a php script that runs on my page, will the.htaccess kick in first?
When a request is made to the URI affected by the.htaccess file, then Apache will handle any rewrite rules before any of your PHP code executes.
What happens first? .htaccess or php code? If I use mod_rewrite to control all my 301 redirects, does this happen before my page is served? so if I also have a bunch of redirect rules in a php script that runs on my page, will the.htaccess kick in first?
TITLE: What happens first? .htaccess or php code? QUESTION: If I use mod_rewrite to control all my 301 redirects, does this happen before my page is served? so if I also have a bunch of redirect rules in a php script that runs on my page, will the.htaccess kick in first? ANSWER: When a request is made to the URI affe...
[ "php", "apache", ".htaccess", "mod-rewrite" ]
10
20
1,972
8
0
2008-10-01T16:08:52.823000
2008-10-01T16:11:43.567000
158,385
166,969
Citrix - how to keep smartclient apps from re-downloading every time they are launched
Our company uses Citrix to remote into a terminal server for remote users to launch smart client apps within a virtual window on their machine. The problem is that smartclient apps are being downloaded each time the user launches them eventhough the version on the remote citrix server has not change. This is due to the...
I can't speak to details on Citrix servers. However, with ClickOnce you have no say over where an application is installed. It's installed under the user profile, no ifs, ands, or buts. One of the major goals with ClickOnce was improved security and installing apps to the profile makes that easier. So, if you're cleari...
Citrix - how to keep smartclient apps from re-downloading every time they are launched Our company uses Citrix to remote into a terminal server for remote users to launch smart client apps within a virtual window on their machine. The problem is that smartclient apps are being downloaded each time the user launches the...
TITLE: Citrix - how to keep smartclient apps from re-downloading every time they are launched QUESTION: Our company uses Citrix to remote into a terminal server for remote users to launch smart client apps within a virtual window on their machine. The problem is that smartclient apps are being downloaded each time the...
[ "c#", "deployment", "clickonce", "citrix", "smartclient" ]
4
3
2,408
2
0
2008-10-01T16:09:19.187000
2008-10-03T13:49:32.477000
158,388
158,401
How can I make a program start up automatically in OSX?
I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google, I read that I can create a.profile file in my user's home folder, and th...
From here and into the future, look into launchd for what you want to do. All other methods have been deprecated or are now unsupported. This is probably a bit more heavy-weight than what you want, though. It could also be a problem with your version of the bash shell not correctly executing your.profile. Try putting t...
How can I make a program start up automatically in OSX? I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google, I read that I ca...
TITLE: How can I make a program start up automatically in OSX? QUESTION: I have a little program that I want to make open automatically when my mac is started up. Because this program accepts command line arguments, its not as simple as just going to System Prefs/Accounts/Login items and adding it there... From google...
[ "macos", "osx-leopard", "launchd" ]
6
11
3,005
7
0
2008-10-01T16:09:47.173000
2008-10-01T16:11:20.883000
158,392
158,432
Primary Key versus Unique Constraint?
I'm currently designing a brand new database. In school, we always learned to put a primary key in each table. I read a lot of articles/discussions/newsgroups posts saying that it's better to use unique constraint (aka unique index for some db) instead of PK. What's your point of view?
Can you provide references to these articles? I see no reason to change the tried and true methods. After all, Primary Keys are a fundamental design feature of relational databases. Using UNIQUE to serve the same purpose sounds really hackish to me. What is their rationale? Edit: My attention just got drawn back to thi...
Primary Key versus Unique Constraint? I'm currently designing a brand new database. In school, we always learned to put a primary key in each table. I read a lot of articles/discussions/newsgroups posts saying that it's better to use unique constraint (aka unique index for some db) instead of PK. What's your point of v...
TITLE: Primary Key versus Unique Constraint? QUESTION: I'm currently designing a brand new database. In school, we always learned to put a primary key in each table. I read a lot of articles/discussions/newsgroups posts saying that it's better to use unique constraint (aka unique index for some db) instead of PK. What...
[ "database", "database-design" ]
47
38
44,978
16
0
2008-10-01T16:10:15.770000
2008-10-01T16:15:25.630000
158,420
1,129,973
What is the best way to separate UI (designer/editor) logic from the Package framework (like Visual Studio Package)
I want to separate concerns here. Create and embed all the UI logic for the Custom XML designer, object model, validations etc in to a separate assembly. Then the Package framework should only register the designer information and ask for a UI Service and everything works magically. This way I don't need to play with t...
I've created a VSPackage that loads an editor. The Editor sits in a separate assembly and implements an interface that I defined. The VSPackage works with the interface, so any changes I make to the editor (and its assembly) does not affect the VSPackage as long as I don't change the interface.
What is the best way to separate UI (designer/editor) logic from the Package framework (like Visual Studio Package) I want to separate concerns here. Create and embed all the UI logic for the Custom XML designer, object model, validations etc in to a separate assembly. Then the Package framework should only register th...
TITLE: What is the best way to separate UI (designer/editor) logic from the Package framework (like Visual Studio Package) QUESTION: I want to separate concerns here. Create and embed all the UI logic for the Custom XML designer, object model, validations etc in to a separate assembly. Then the Package framework shoul...
[ "visual-studio", "user-interface", "vsx" ]
2
2
504
3
0
2008-10-01T16:13:59.800000
2009-07-15T07:43:18.573000
158,428
317,420
Selecting Office 2003/2007 COM Object (Correct One) in Winforms Application
We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM object at runtime?
Unless you want to use any of the newly added objects and methods of the Office 2007 object model, it is fine to build referencing the Office 2003 PIAs, just make sure the correct version of the PIAs is deployed on the target system: Another way around this problem is to remove the dependency on the later PIAs. Because...
Selecting Office 2003/2007 COM Object (Correct One) in Winforms Application We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and reference the correct COM...
TITLE: Selecting Office 2003/2007 COM Object (Correct One) in Winforms Application QUESTION: We are creating a Windows Form application (C# or VB.NET) that needs to reference an Office 2003 or Office 2007 COM object, depending on the version of office installed. What is the best way to handle this scenario and referen...
[ "winforms", "com", "ms-office", "officedev" ]
1
1
599
2
0
2008-10-01T16:15:01.530000
2008-11-25T13:59:12.947000
158,431
158,547
SQL Server Reporting Services 2005 - How to Handle Empty Reports
I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty. When I go to report delivery options, there's no such configuration. Edit: I'm running SQL Server Reporting Services 2005. Some possible workarounds as mentioned below: MSDN: Reporting ...
I believe the answer is no, at least not out of the box. It shouldn't be difficult to write your own delivery extension given the printing delivery extension sample included in RS.
SQL Server Reporting Services 2005 - How to Handle Empty Reports I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty. When I go to report delivery options, there's no such configuration. Edit: I'm running SQL Server Reporting Services 200...
TITLE: SQL Server Reporting Services 2005 - How to Handle Empty Reports QUESTION: I was wondering if it is possible to not attach Excel sheet if it is empty, and maybe write a different comment in the email if empty. When I go to report delivery options, there's no such configuration. Edit: I'm running SQL Server Repo...
[ "sql", "reporting-services", "reporting", "report" ]
5
1
5,425
4
0
2008-10-01T16:15:24.930000
2008-10-01T16:37:10.243000
158,438
158,550
IE7 form not prompted for remember password when submitted through javascript
I have a website where we use Javascript to submit the login form. On Firefox it prompts the user to remember their password, when they login, but on IE7 it doesn't. After doing some research it looks like the user is only prompted in IE7 when the form is submitted via a Submit control. I've created some sample html to...
Why not try hooking the form submission this way? test autocomplete Submit That way your function will be called whether the link is clicked or the submit button is pushed (or the enter key is pressed) and you can cancel the submission by returning false. This may affect the way IE7 interprets the form's submission. Ed...
IE7 form not prompted for remember password when submitted through javascript I have a website where we use Javascript to submit the login form. On Firefox it prompts the user to remember their password, when they login, but on IE7 it doesn't. After doing some research it looks like the user is only prompted in IE7 whe...
TITLE: IE7 form not prompted for remember password when submitted through javascript QUESTION: I have a website where we use Javascript to submit the login form. On Firefox it prompts the user to remember their password, when they login, but on IE7 it doesn't. After doing some research it looks like the user is only p...
[ "javascript", "html", "internet-explorer-7" ]
4
5
4,392
3
0
2008-10-01T16:16:32.400000
2008-10-01T16:37:24.923000
158,457
158,471
Daemon logging in Linux
So I have a daemon running on a Linux system, and I want to have a record of its activities: a log. The question is, what is the "best" way to accomplish this? My first idea is to simply open a file and write to it. FILE* log = fopen("logfile.log", "w"); /* daemon works...needs to write to log */ fprintf(log, "foo%s\n"...
Unix has had for a long while a special logging framework called syslog. Type in your shell man 3 syslog and you'll get the help for the C interface to it. Some examples #include #include #include int main(void) { openlog("slog", LOG_PID|LOG_CONS, LOG_USER); syslog(LOG_INFO, "A different kind of Hello world... "); clo...
Daemon logging in Linux So I have a daemon running on a Linux system, and I want to have a record of its activities: a log. The question is, what is the "best" way to accomplish this? My first idea is to simply open a file and write to it. FILE* log = fopen("logfile.log", "w"); /* daemon works...needs to write to log *...
TITLE: Daemon logging in Linux QUESTION: So I have a daemon running on a Linux system, and I want to have a record of its activities: a log. The question is, what is the "best" way to accomplish this? My first idea is to simply open a file and write to it. FILE* log = fopen("logfile.log", "w"); /* daemon works...needs...
[ "c", "linux", "logging", "daemon" ]
70
104
68,708
10
0
2008-10-01T16:19:28.913000
2008-10-01T16:21:47.410000
158,460
158,481
Search file in directory using complex pattern
I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant: dir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2 **/test/** --> Matches all files that have a test element in their p...
Coding it yourself wouldnt be that hard. Just use a correctly formulated regular expression with System.IO methods to build the full path
Search file in directory using complex pattern I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant: dir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2 **/test/** --> Matche...
TITLE: Search file in directory using complex pattern QUESTION: I am looking for a C# library for getting files or directory from a directory using a complex pattern like the one used in Ant: dir1/dir2/**/SVN/* --> Matches all files in SVN directories that are located anywhere in the directory tree under dir1/dir2 **/...
[ "c#", "search", "file", "design-patterns" ]
1
1
2,197
2
0
2008-10-01T16:20:02.093000
2008-10-01T16:23:53.427000
158,474
158,484
How to obtain longitude and latitude for a street address programmatically (and legally)
Supposedly, it is possible to get this from Google Maps or some such service. (US addresses only is not good enough.)
The term you're looking for is geocoding and yes Google does provide this service. New V3 API: http://code.google.com/apis/maps/documentation/geocoding/ Old V2 API: http://code.google.com/apis/maps/documentation/services.html#Geocoding
How to obtain longitude and latitude for a street address programmatically (and legally) Supposedly, it is possible to get this from Google Maps or some such service. (US addresses only is not good enough.)
TITLE: How to obtain longitude and latitude for a street address programmatically (and legally) QUESTION: Supposedly, it is possible to get this from Google Maps or some such service. (US addresses only is not good enough.) ANSWER: The term you're looking for is geocoding and yes Google does provide this service. New...
[ "web-services", "api", "geolocation", "geocoding", "street-address" ]
76
71
97,615
15
0
2008-10-01T16:22:21.277000
2008-10-01T16:24:29.633000
158,479
158,824
Programmatically recognize text from scans in a PDF File
I have a PDF file, which contains data that we need to import into a database. The files seem to be pdf scans of printed alphanumeric text. Looks like 10 pt. Times New Roman. Are there any tools or components that can will allow me to recognize and parse this text?
I've used pdftohtml to successfully strip tables out of PDF into CSV. It's based on Xpdf, which is a more general purpose tool, that includes pdftotext. I just wrap it as a Process.Start call from C#. If you're looking for something a little more DIY, there's the iTextSharp library - a port of Java's iText - and PDFBox...
Programmatically recognize text from scans in a PDF File I have a PDF file, which contains data that we need to import into a database. The files seem to be pdf scans of printed alphanumeric text. Looks like 10 pt. Times New Roman. Are there any tools or components that can will allow me to recognize and parse this tex...
TITLE: Programmatically recognize text from scans in a PDF File QUESTION: I have a PDF file, which contains data that we need to import into a database. The files seem to be pdf scans of printed alphanumeric text. Looks like 10 pt. Times New Roman. Are there any tools or components that can will allow me to recognize ...
[ "pdf", "ocr" ]
31
23
62,512
10
0
2008-10-01T16:23:47.733000
2008-10-01T17:43:25.157000
158,482
158,526
Inject data members to an object
This question is based on another question of mine (thankfully answered). So if in a model I have this: def self.find_extended person = Person.find(:first) complete_name = person.firstname + ', ' + person.lastname return person end How can I inject complete name in the person object so in my controller/view I can acces...
I think the best way to do this is creation of complete_name attribute in your Person class: def complete_name firstname + ', ' + lastname end
Inject data members to an object This question is based on another question of mine (thankfully answered). So if in a model I have this: def self.find_extended person = Person.find(:first) complete_name = person.firstname + ', ' + person.lastname return person end How can I inject complete name in the person object so ...
TITLE: Inject data members to an object QUESTION: This question is based on another question of mine (thankfully answered). So if in a model I have this: def self.find_extended person = Person.find(:first) complete_name = person.firstname + ', ' + person.lastname return person end How can I inject complete name in the...
[ "ruby-on-rails", "ruby", "oop" ]
0
6
309
4
0
2008-10-01T16:24:02.053000
2008-10-01T16:33:53.527000
158,492
158,530
c# network login
How do I perform a network login, to access a shared driver for instance, programmatically in c#? The same can be achieved by either attempting to open a share through the explorer, or by the net use shell command.
P/Invoke call to WNetAddConnection2 will do the trick. Look here for more info. [DllImport("mpr.dll")] public static extern int WNetAddConnection2A ( [MarshalAs(UnmanagedType.LPArray)] NETRESOURCEA[] lpNetResource, [MarshalAs(UnmanagedType.LPStr)] string lpPassword, [MarshalAs(UnmanagedType.LPStr)] string UserName, int...
c# network login How do I perform a network login, to access a shared driver for instance, programmatically in c#? The same can be achieved by either attempting to open a share through the explorer, or by the net use shell command.
TITLE: c# network login QUESTION: How do I perform a network login, to access a shared driver for instance, programmatically in c#? The same can be achieved by either attempting to open a share through the explorer, or by the net use shell command. ANSWER: P/Invoke call to WNetAddConnection2 will do the trick. Look h...
[ "c#", "networking" ]
5
5
2,770
2
0
2008-10-01T16:26:58.100000
2008-10-01T16:34:38.190000
158,508
159,003
ReportViewer Division by zero
I have some formulas in my reports, and to prevent divsion by zero I do like this in the expression field: =IIF(Fields!F1.Value <> 0, Fields!F2.Value/Fields!F1.Value, 0) This normally works fine, but when both F1 and F2 are zero, I get "#Error" in the report, and I get this warning: "The Value expression for the textbo...
There has to be a prettier way than this, but this should work: =IIF(Fields!F1.Value <> 0, Fields!F2.Value / IIF(Fields!F1.Value <> 0, Fields!F1.Value, 42), 0)
ReportViewer Division by zero I have some formulas in my reports, and to prevent divsion by zero I do like this in the expression field: =IIF(Fields!F1.Value <> 0, Fields!F2.Value/Fields!F1.Value, 0) This normally works fine, but when both F1 and F2 are zero, I get "#Error" in the report, and I get this warning: "The V...
TITLE: ReportViewer Division by zero QUESTION: I have some formulas in my reports, and to prevent divsion by zero I do like this in the expression field: =IIF(Fields!F1.Value <> 0, Fields!F2.Value/Fields!F1.Value, 0) This normally works fine, but when both F1 and F2 are zero, I get "#Error" in the report, and I get th...
[ "reportviewer" ]
1
2
3,991
3
0
2008-10-01T16:30:37.233000
2008-10-01T18:27:11.853000
158,509
162,791
.NET enterprise application platform (same as JBoss to Java)
As a.NET developer I'm asking whether JBoss alternatives exist to be "more suitable for.NET development" as an enterprise application platform. Please do not make any suggestions, such as "make JBoss to expose WebServices"...
Java lacks a "hosting" solution - this is where (mainly) all the solutions like JBoss and WhebLogic are popping up from. In.NET you have so many different hosting solutions like: services, IIS, SQL, BizTalk... Now with the recent WCF features you can implement your own JBoss in 5 minutes - create an object with a Data ...
.NET enterprise application platform (same as JBoss to Java) As a.NET developer I'm asking whether JBoss alternatives exist to be "more suitable for.NET development" as an enterprise application platform. Please do not make any suggestions, such as "make JBoss to expose WebServices"...
TITLE: .NET enterprise application platform (same as JBoss to Java) QUESTION: As a.NET developer I'm asking whether JBoss alternatives exist to be "more suitable for.NET development" as an enterprise application platform. Please do not make any suggestions, such as "make JBoss to expose WebServices"... ANSWER: Java l...
[ ".net", "jboss", "middleware" ]
7
6
2,645
3
0
2008-10-01T16:30:38.403000
2008-10-02T14:58:51.283000
158,514
158,570
Is it possible to make git svn dcommit result in a single svn commit?
According to the manual, git dcommit “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the svn commit?
If you work on a branch in git, you can git-merge --squash, which does that within git. You could then push that one squashed commit to SVN. Of course, lots of small commits are good, so why would you want to squash them?
Is it possible to make git svn dcommit result in a single svn commit? According to the manual, git dcommit “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the svn commit?
TITLE: Is it possible to make git svn dcommit result in a single svn commit? QUESTION: According to the manual, git dcommit “will create a revision in SVN for each commit in git.” But is there a way to avoid multiple Subversion revisions? That is, to have git merge all changes prior to performing the svn commit? ANSW...
[ "svn", "git", "git-svn" ]
42
34
15,905
3
0
2008-10-01T16:31:22.737000
2008-10-01T16:43:10.010000
158,520
158,531
In PowerShell, how can I determine the root of a drive (supposing it's a networked drive)
In PowerShell, even if it's possible to know if a drive is a network drive: see In PowerShell, how can I determine if the current drive is a networked drive or not? When I try to get the "root" of the drive, I get back the drive letter. The setup: MS-Dos "net use" shows that H: is really a mapped network drive: New con...
Try WMI: Get-WMIObject -query "Select ProviderName From Win32_LogicalDisk Where DeviceID='H:'"
In PowerShell, how can I determine the root of a drive (supposing it's a networked drive) In PowerShell, even if it's possible to know if a drive is a network drive: see In PowerShell, how can I determine if the current drive is a networked drive or not? When I try to get the "root" of the drive, I get back the drive l...
TITLE: In PowerShell, how can I determine the root of a drive (supposing it's a networked drive) QUESTION: In PowerShell, even if it's possible to know if a drive is a network drive: see In PowerShell, how can I determine if the current drive is a networked drive or not? When I try to get the "root" of the drive, I ge...
[ "powershell", "networking", "mapped-drive" ]
2
2
4,431
4
0
2008-10-01T16:33:08.867000
2008-10-01T16:35:01.247000
158,521
158,545
Is there an easy way to implement LINQ to object with a DataContext?
I have a working LINQ to SQL model. I want to be able to use the same model but with a connection to a DataSet object, instead of SQL Server. I need to be able to query the model, modify fields, as well as do insert and delete operations. Is there an easy way to accomplish this? I noticed another question mentions a si...
You can use LINQ to DataSet directly but the LINQ to SQL query translator converts expression trees into SQL statements and that can't be changed. For lists of inserts/updates/deletes for a given DataContext, you can call DataContext.GetChangeSet()
Is there an easy way to implement LINQ to object with a DataContext? I have a working LINQ to SQL model. I want to be able to use the same model but with a connection to a DataSet object, instead of SQL Server. I need to be able to query the model, modify fields, as well as do insert and delete operations. Is there an ...
TITLE: Is there an easy way to implement LINQ to object with a DataContext? QUESTION: I have a working LINQ to SQL model. I want to be able to use the same model but with a connection to a DataSet object, instead of SQL Server. I need to be able to query the model, modify fields, as well as do insert and delete operat...
[ ".net", "linq", "orm" ]
0
1
372
2
0
2008-10-01T16:33:26.867000
2008-10-01T16:37:04.037000
158,539
158,549
</br> not working in firefox and chrome
break line tag is not working in firefox, neither in chrome. When i see the source of my page i get: Zugang zu Testaccount: peter petrelli sein Standardpwd. peter.heroes.com However when i do view selected source, i get: Zugang zu Testaccount: peter petrelli sein Standardpwd. peter.heroes.com It seems firefox is filter...
You're looking for instead of Self closing tags such as br have the slash at the end of the tag. Here are the other self-closing tags in XHTML: What are all the valid self-closing tags in XHTML (as implemented by the major browsers)?
</br> not working in firefox and chrome break line tag is not working in firefox, neither in chrome. When i see the source of my page i get: Zugang zu Testaccount: peter petrelli sein Standardpwd. peter.heroes.com However when i do view selected source, i get: Zugang zu Testaccount: peter petrelli sein Standardpwd. pet...
TITLE: </br> not working in firefox and chrome QUESTION: break line tag is not working in firefox, neither in chrome. When i see the source of my page i get: Zugang zu Testaccount: peter petrelli sein Standardpwd. peter.heroes.com However when i do view selected source, i get: Zugang zu Testaccount: peter petrelli sei...
[ "html" ]
13
67
87,877
14
0
2008-10-01T16:36:07.360000
2008-10-01T16:37:19.387000
158,544
159,786
Check/uncheck parents and children
Can you do a better code? I need to check/uncheck all childs according to parent and when an child is checked, check parent, when all childs are unchecked uncheck parent. $(".parent").children("input").click(function() { $(this).parent().siblings("input").attr("checked", this.checked); }); $(".parent").siblings("input...
$(".parent").children("input").click(function() { $(this).parent().siblings("input").attr("checked", this.checked); }); $(".parent").siblings("input").click(function() { $(this).siblings("div").children("input").attr("checked", this.checked || $(this).siblings("input[checked]").length>0 ); });
Check/uncheck parents and children Can you do a better code? I need to check/uncheck all childs according to parent and when an child is checked, check parent, when all childs are unchecked uncheck parent. $(".parent").children("input").click(function() { $(this).parent().siblings("input").attr("checked", this.checked)...
TITLE: Check/uncheck parents and children QUESTION: Can you do a better code? I need to check/uncheck all childs according to parent and when an child is checked, check parent, when all childs are unchecked uncheck parent. $(".parent").children("input").click(function() { $(this).parent().siblings("input").attr("check...
[ "javascript", "jquery" ]
3
1
4,832
4
0
2008-10-01T16:36:59.213000
2008-10-01T21:14:55.473000
158,546
158,753
Best way to store and use a large text-file in python
I'm creating a networked server for a boggle-clone I wrote in python, which accepts users, solves the boards, and scores the player input. The dictionary file I'm using is 1.8MB (the ENABLE2K dictionary), and I need it to be available to several game solver classes. Right now, I have it so that each class iterates thro...
If you create a dictionary.py module, containing code which reads the file and builds a dictionary, this code will only be executed the first time it is imported. Further imports will return a reference to the existing module instance. As such, your classes can: import dictionary dictionary.words[whatever] where dicti...
Best way to store and use a large text-file in python I'm creating a networked server for a boggle-clone I wrote in python, which accepts users, solves the boards, and scores the player input. The dictionary file I'm using is 1.8MB (the ENABLE2K dictionary), and I need it to be available to several game solver classes....
TITLE: Best way to store and use a large text-file in python QUESTION: I'm creating a networked server for a boggle-clone I wrote in python, which accepts users, solves the boards, and scores the player input. The dictionary file I'm using is 1.8MB (the ENABLE2K dictionary), and I need it to be available to several ga...
[ "python", "boggle" ]
5
11
2,981
4
0
2008-10-01T16:37:08.153000
2008-10-01T17:30:41.083000
158,557
158,582
Get street address at lat/long pair
I've seen that it's possible to get the latitude and longitude (geocoding, like in Google Maps API ) from a street address, but is it possible to do the reverse and get the street address when you know what the lat/long already is? The application would be an iPhone app (and why the app already knows lat/long), so anyt...
Google again http://nicogoeminne.googlepages.com/documentation.html http://groups.google.com/group/Google-Maps-API/web/resources-non-google-geocoders
Get street address at lat/long pair I've seen that it's possible to get the latitude and longitude (geocoding, like in Google Maps API ) from a street address, but is it possible to do the reverse and get the street address when you know what the lat/long already is? The application would be an iPhone app (and why the ...
TITLE: Get street address at lat/long pair QUESTION: I've seen that it's possible to get the latitude and longitude (geocoding, like in Google Maps API ) from a street address, but is it possible to do the reverse and get the street address when you know what the lat/long already is? The application would be an iPhone...
[ "iphone", "web-services", "gis", "geocoding", "street-address" ]
22
14
19,806
5
0
2008-10-01T16:38:55.903000
2008-10-01T16:45:55.403000
158,568
981,443
Tomcat 6: how to delete temporary files after a web method call has ended?
I have a temporary file with data that's returned as part of a SOAP response via a MTOM binary attachment. I would like to trash it as soon as the method call "ends" (i.e., finishes transferring). What's the best way for me to do this? The best way I can figure out how to do this is to delete them when the session is d...
I ran into this same problem. The issue is that the JAX-WS stack manages the file. It is not possible to determine in your code when JAX-WS is done with the file so you do not know when to delete it. In my case, I am using a DataHandler on my object model rather than a file. MyFileResult would have the following field ...
Tomcat 6: how to delete temporary files after a web method call has ended? I have a temporary file with data that's returned as part of a SOAP response via a MTOM binary attachment. I would like to trash it as soon as the method call "ends" (i.e., finishes transferring). What's the best way for me to do this? The best ...
TITLE: Tomcat 6: how to delete temporary files after a web method call has ended? QUESTION: I have a temporary file with data that's returned as part of a SOAP response via a MTOM binary attachment. I would like to trash it as soon as the method call "ends" (i.e., finishes transferring). What's the best way for me to ...
[ "java", "web-services", "tomcat", "jax-ws" ]
9
16
11,879
3
0
2008-10-01T16:43:03.630000
2009-06-11T14:29:05.007000
158,571
158,601
Best practices: .NET: How to return PK against an oracle database?
With SQLServer, it seems to be generally accepted that adding a SELECT SCOPE_IDENTITY() to the end of your insert is the best way to return the PK of the newly-inserted record, assuming you're using an auto-increment field for the pk. However, I can't seem to find the equivalent for Oracle. Best practice seems to be to...
You can use the RETURNING clause to do this in Oracle stored procs. For example: TABLEA has NAME and EMP_ID. EMP_ID is populated internally when records are inserted. INSERT INTO TABLEA(NAME) VALUES ('BOB') RETURNING EMP_ID INTO o_EMP_ID; That's assuming that line is in a stored proc with an output parameter of o_EMP_I...
Best practices: .NET: How to return PK against an oracle database? With SQLServer, it seems to be generally accepted that adding a SELECT SCOPE_IDENTITY() to the end of your insert is the best way to return the PK of the newly-inserted record, assuming you're using an auto-increment field for the pk. However, I can't s...
TITLE: Best practices: .NET: How to return PK against an oracle database? QUESTION: With SQLServer, it seems to be generally accepted that adding a SELECT SCOPE_IDENTITY() to the end of your insert is the best way to return the PK of the newly-inserted record, assuming you're using an auto-increment field for the pk. ...
[ ".net", "oracle" ]
6
9
2,044
3
0
2008-10-01T16:43:20.727000
2008-10-01T16:49:14.583000
158,574
3,321,130
Programmatically align a toolbar on top of the iPhone keyboard
In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example). Currently I am specifying the toolbar's rectangle with constants but because other elements of the interface are in flux - toolbars and nav bars at the top of the screen - ...
As of iOS 3.2 there's a new way to achieve this effect: UITextFields and UITextViews have an inputAccessoryView property, which you can set to any view, that is automatically displayed above and animated with the keyboard. Note that the view you use should neither be in the view hierarchy elsewhere, nor should you add ...
Programmatically align a toolbar on top of the iPhone keyboard In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example). Currently I am specifying the toolbar's rectangle with constants but because other elements of the interface ...
TITLE: Programmatically align a toolbar on top of the iPhone keyboard QUESTION: In several cases I want to add a toolbar to the top of the iPhone keyboard (as in iPhone Safari when you're navigating form elements, for example). Currently I am specifying the toolbar's rectangle with constants but because other elements...
[ "ios", "iphone", "cocoa-touch", "keyboard" ]
94
141
69,256
7
0
2008-10-01T16:43:33.583000
2010-07-23T18:15:25.043000
158,584
158,646
Simple .net portal. Easy to add new modules
I am writing a simple database with web access. I have previous experience with microsoft's (very!) old IBuySpy portal system. I am sure there must be something a bit more up to date I could use now! I want a simple light weight system that will allow my friend to have tabs with news and pictures etc, and it be easy fo...
You should have a look on this page: http://www.asp.net/community/projects/. They list a few portals, DNN for example. But they also have some CMS's etc that you may want to have a look at. It almost sounds to me like a CMS would be better for you then a portal would. I have played around with the Graffiti CMS system a...
Simple .net portal. Easy to add new modules I am writing a simple database with web access. I have previous experience with microsoft's (very!) old IBuySpy portal system. I am sure there must be something a bit more up to date I could use now! I want a simple light weight system that will allow my friend to have tabs w...
TITLE: Simple .net portal. Easy to add new modules QUESTION: I am writing a simple database with web access. I have previous experience with microsoft's (very!) old IBuySpy portal system. I am sure there must be something a bit more up to date I could use now! I want a simple light weight system that will allow my fri...
[ ".net" ]
1
2
494
7
0
2008-10-01T16:46:36.850000
2008-10-01T17:01:07.113000
158,585
158,614
How do you add a timed delay to a C++ program?
I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at? I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed delay I am not sure on how I should even attempt...
In Win32: #include Sleep(milliseconds); In Unix: #include unsigned int microsecond = 1000000; usleep(3 * microsecond);//sleeps for 3 second sleep() only takes a number of seconds which is often too long.
How do you add a timed delay to a C++ program? I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at? I wish I had more details on how I am implementing this timed delay, but until I have more information on how to add a timed d...
TITLE: How do you add a timed delay to a C++ program? QUESTION: I am trying to add a timed delay in a C++ program, and was wondering if anyone has any suggestions on what I can try or information I can look at? I wish I had more details on how I am implementing this timed delay, but until I have more information on ho...
[ "c++", "time" ]
142
126
706,311
14
0
2008-10-01T16:46:37.367000
2008-10-01T16:52:13.623000
158,593
158,700
How do I rig Firebug 1.2 to behave the way previous versions did?
After waffling for months I've installed Firefox 3 on my development machine and am regretting it, because the new Firebug is sucking my will to live. Flakiness aside--it's not catching basic syntax errors--there's a whole new layer of UI all over everything, and it's making me THINK. Please, can somebody tell me the s...
Progress... smart co-worker pointed me at about:config for part of the answer. I toggled extensions.firebug.allowDoublePost to true, restarted Firefox, and the Net tab quit asking me to re-POST.
How do I rig Firebug 1.2 to behave the way previous versions did? After waffling for months I've installed Firefox 3 on my development machine and am regretting it, because the new Firebug is sucking my will to live. Flakiness aside--it's not catching basic syntax errors--there's a whole new layer of UI all over everyt...
TITLE: How do I rig Firebug 1.2 to behave the way previous versions did? QUESTION: After waffling for months I've installed Firefox 3 on my development machine and am regretting it, because the new Firebug is sucking my will to live. Flakiness aside--it's not catching basic syntax errors--there's a whole new layer of ...
[ "firebug" ]
2
1
188
1
0
2008-10-01T16:48:24.070000
2008-10-01T17:17:14.733000
158,617
158,928
Synchronize DataSet
What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: We can't simply reload the data because it's bound to a UI control which a user may have configured (it's a tree grid that they may expand/collapse) We can't use a changeflag (like a UpdatedTimeStamp) in the database ...
DataSet.Merge works well for this if you have a primary key defined for each DataTable; the DataSet will raise changed events to any databound GUI controls if your table is small you can just re-read all of the rows and merge periodically, otherwise limiting the set to be read with a timestamp is a good idea - just tel...
Synchronize DataSet What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: We can't simply reload the data because it's bound to a UI control which a user may have configured (it's a tree grid that they may expand/collapse) We can't use a changeflag (like a UpdatedTimeSta...
TITLE: Synchronize DataSet QUESTION: What is the best approach to synchronizing a DataSet with data in a database? Here are the parameters: We can't simply reload the data because it's bound to a UI control which a user may have configured (it's a tree grid that they may expand/collapse) We can't use a changeflag (lik...
[ "sql-server", "ado.net", "dataset" ]
3
1
1,966
2
0
2008-10-01T16:53:56.240000
2008-10-01T18:08:35.033000
158,618
158,663
MainSoft Grasshopper, .Net to Java
I just stumbled upon MainSoft's Grasshopper, which claims to cross-compile.Net ILM to Java bytecode. It seems to use the Mono implementation of the.Net libraries. All of the samples refer to web apps, but my requirement would be to cross-compile a.Net API (class library) to a Java API so that Java clients can use the A...
I tried it about 12-18 months ago for porting a ASPNET site to something I could run on top of Apache. I know that's not your intended purpose but stay with me. The process wasn't smooth. There were parts of the.net framework that (at the time) weren't implemented in the grasshopper codebase and once we'd evaluated the...
MainSoft Grasshopper, .Net to Java I just stumbled upon MainSoft's Grasshopper, which claims to cross-compile.Net ILM to Java bytecode. It seems to use the Mono implementation of the.Net libraries. All of the samples refer to web apps, but my requirement would be to cross-compile a.Net API (class library) to a Java API...
TITLE: MainSoft Grasshopper, .Net to Java QUESTION: I just stumbled upon MainSoft's Grasshopper, which claims to cross-compile.Net ILM to Java bytecode. It seems to use the Mono implementation of the.Net libraries. All of the samples refer to web apps, but my requirement would be to cross-compile a.Net API (class libr...
[ "java", ".net", "interop" ]
4
7
2,174
1
0
2008-10-01T16:54:42.697000
2008-10-01T17:04:56.307000
158,628
158,669
Marshal C++ "string" class in C# P/Invoke
I have a function in a native DLL defined as follows: #include void SetPath(string path); I tried to put this in Microsoft's P/Invoke Interop Assistant, but it chokes on the "string" class (which I think is from MFC?). I have tried marshaling it as a variety of different types (C# String, char[], byte[]) but every time...
Looks like you're trying to use the C++ standard library string class. I doubt that will be easy to Marshal. Better to stick with a char * and Marshal as StringBuilder. That's what I usually do. You'll have to add a wrapper that generates the C++ string for you.
Marshal C++ "string" class in C# P/Invoke I have a function in a native DLL defined as follows: #include void SetPath(string path); I tried to put this in Microsoft's P/Invoke Interop Assistant, but it chokes on the "string" class (which I think is from MFC?). I have tried marshaling it as a variety of different types ...
TITLE: Marshal C++ "string" class in C# P/Invoke QUESTION: I have a function in a native DLL defined as follows: #include void SetPath(string path); I tried to put this in Microsoft's P/Invoke Interop Assistant, but it chokes on the "string" class (which I think is from MFC?). I have tried marshaling it as a variety o...
[ ".net", "c++", "string", "interop", "marshalling" ]
7
6
6,181
3
0
2008-10-01T16:58:01.660000
2008-10-01T17:06:41.920000
158,633
158,657
How can I send an HTTP POST request to a server from Excel using VBA?
What VBA code is required to perform an HTTP POST from an Excel spreadsheet?
Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") URL = "http://www.somedomain.com" objHTTP.Open "POST", URL, False objHTTP.setRequestHeader "User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0)" objHTTP.send "" Alternatively, for greater control over the HTTP request you can use WinHttp.WinHttpRequest.5.1...
How can I send an HTTP POST request to a server from Excel using VBA? What VBA code is required to perform an HTTP POST from an Excel spreadsheet?
TITLE: How can I send an HTTP POST request to a server from Excel using VBA? QUESTION: What VBA code is required to perform an HTTP POST from an Excel spreadsheet? ANSWER: Set objHTTP = CreateObject("MSXML2.ServerXMLHTTP") URL = "http://www.somedomain.com" objHTTP.Open "POST", URL, False objHTTP.setRequestHeader "Use...
[ "excel", "vba", "http", "post", "serverxmlhttp" ]
168
176
369,017
6
0
2008-10-01T16:59:14.183000
2008-10-01T17:03:29.323000
158,634
158,675
Doing a Cast Within a LINQ Query
Is it possible to do a cast within a LINQ query (for the compiler's sake)? The following code isn't terrible, but it would be nice to make it into one query: Content content = dataStore.RootControl as Controls.Content; List tabList = (from t in content.ChildControls select t).OfType ().ToList(); List paragraphList = ...
Try this: from TabSection t in content.ChildControls Also, even if this were not available (or for a different, future scenario you may encounter), you wouldn't be restricted to converting everything to Lists. Converting to a List causes query evaluation on the spot. But if you removing the ToList call, you could work ...
Doing a Cast Within a LINQ Query Is it possible to do a cast within a LINQ query (for the compiler's sake)? The following code isn't terrible, but it would be nice to make it into one query: Content content = dataStore.RootControl as Controls.Content; List tabList = (from t in content.ChildControls select t).OfType ()...
TITLE: Doing a Cast Within a LINQ Query QUESTION: Is it possible to do a cast within a LINQ query (for the compiler's sake)? The following code isn't terrible, but it would be nice to make it into one query: Content content = dataStore.RootControl as Controls.Content; List tabList = (from t in content.ChildControls s...
[ "c#", ".net", "linq", ".net-3.5" ]
30
27
56,331
5
0
2008-10-01T16:59:25.713000
2008-10-01T17:08:41.010000
158,651
158,989
Same Presenter working with different Repositories
You do you manage the same presenter working with different repositories using the MVP pattern? I just have multiple constructor overloads and the presenter simply uses the one that is suitable for the scenario. AddCustomerPresenter presenter = new AddCustomerPresenter(this,customerRepository); presenter.AddCustomer();...
Thanks Will! But CustomerRepository and ArchiveRepository are not related in any way. They are two completely different things.
Same Presenter working with different Repositories You do you manage the same presenter working with different repositories using the MVP pattern? I just have multiple constructor overloads and the presenter simply uses the one that is suitable for the scenario. AddCustomerPresenter presenter = new AddCustomerPresenter...
TITLE: Same Presenter working with different Repositories QUESTION: You do you manage the same presenter working with different repositories using the MVP pattern? I just have multiple constructor overloads and the presenter simply uses the one that is suitable for the scenario. AddCustomerPresenter presenter = new Ad...
[ "design-patterns" ]
0
0
111
2
0
2008-10-01T17:01:49.250000
2008-10-01T18:22:06.403000
158,665
159,711
How do I delete a dirset of directories with Ant?
I want to delete all directories and subdirectories under a root directory that are contain "tmp" in their names. This should include any.svn files too. My first guess is to use This does not seem to work as you can't nest a dirset in a delete tag. Is this a correct approach, or should I be doing something else? ant ve...
Here's the answer that worked for me: I had an added complication I needed to remove.svn directories too. With defaultexcludes,.* files were being excluded, and so the empty directories weren't really empty, and so weren't getting removed. The attribute includeemptydirs (thanks, flicken, XL-Plüschhase) enables the trai...
How do I delete a dirset of directories with Ant? I want to delete all directories and subdirectories under a root directory that are contain "tmp" in their names. This should include any.svn files too. My first guess is to use This does not seem to work as you can't nest a dirset in a delete tag. Is this a correct app...
TITLE: How do I delete a dirset of directories with Ant? QUESTION: I want to delete all directories and subdirectories under a root directory that are contain "tmp" in their names. This should include any.svn files too. My first guess is to use This does not seem to work as you can't nest a dirset in a delete tag. Is ...
[ "java", "ant", "build" ]
14
23
27,696
3
0
2008-10-01T17:05:45.433000
2008-10-01T21:00:10.797000
158,673
1,262,811
onbeforeunload support detection
I'd like to check if the current browser supports the onbeforeunload event. The common javascript way to do this does not seem to work: if (window.onbeforeunload) { alert('yes'); } else { alert('no'); } Actually, it only checks whether some handler has been attached to the event. Is there a way to detect if onbeforeunl...
I wrote about a more-or-less reliable inference for detecting event support in modern browsers some time ago. You can see on a demo page that "beforeunload" is supported in at least Safari 4+, FF3.x+ and IE. Edit: This technique is now used in jQuery, Prototype.js, Modernizr, and likely other scripts and libraries.
onbeforeunload support detection I'd like to check if the current browser supports the onbeforeunload event. The common javascript way to do this does not seem to work: if (window.onbeforeunload) { alert('yes'); } else { alert('no'); } Actually, it only checks whether some handler has been attached to the event. Is the...
TITLE: onbeforeunload support detection QUESTION: I'd like to check if the current browser supports the onbeforeunload event. The common javascript way to do this does not seem to work: if (window.onbeforeunload) { alert('yes'); } else { alert('no'); } Actually, it only checks whether some handler has been attached to...
[ "javascript" ]
21
28
27,155
10
0
2008-10-01T17:08:28.610000
2009-08-11T20:46:28
158,674
158,763
TCP Connection Life
How long can I expect a client/server TCP connection to last in the wild? I want it to stay permanently connected, but things happen, so the client will have to reconnect. At what point do I say that there's a problem in the code rather than there's a problem with some external equipment?
I agree with Zan Lynx. There's no guarantee, but you can keep a connection alive almost indefinitely by sending data over it, assuming there are no connectivity or bandwidth issues. Generally I've gone for the application level keep-alive approach, although this has usually because it's been in the client spec so I've ...
TCP Connection Life How long can I expect a client/server TCP connection to last in the wild? I want it to stay permanently connected, but things happen, so the client will have to reconnect. At what point do I say that there's a problem in the code rather than there's a problem with some external equipment?
TITLE: TCP Connection Life QUESTION: How long can I expect a client/server TCP connection to last in the wild? I want it to stay permanently connected, but things happen, so the client will have to reconnect. At what point do I say that there's a problem in the code rather than there's a problem with some external equ...
[ "tcp" ]
28
18
29,779
6
0
2008-10-01T17:08:39.560000
2008-10-01T17:32:13.823000
158,695
158,713
Spreadsheet-like functionality in web app
I have a web app for commercial property management that needs spreadsheet-like functionality for doing budgets. I don't want to use Google Sheets because my users won't necessarily have a Google account. So is there anything out there that I could use? I looked and could only find SocialCalc which wasn't quite good en...
If you don't mind implementing the logic yourself, the ExtJS grid component is a JavaScript grid component with lots of powerful features, and it is available in both open-source and commercial versions.
Spreadsheet-like functionality in web app I have a web app for commercial property management that needs spreadsheet-like functionality for doing budgets. I don't want to use Google Sheets because my users won't necessarily have a Google account. So is there anything out there that I could use? I looked and could only ...
TITLE: Spreadsheet-like functionality in web app QUESTION: I have a web app for commercial property management that needs spreadsheet-like functionality for doing budgets. I don't want to use Google Sheets because my users won't necessarily have a Google account. So is there anything out there that I could use? I look...
[ "spreadsheet", "xml-spreadsheet" ]
0
1
1,071
6
0
2008-10-01T17:14:41.900000
2008-10-01T17:21:10.777000
158,703
2,771,486
Is it OK to use HttpRuntime.Cache outside ASP.NET applications?
Scott Hanselman says yes. Adding System.Web to your non-web project is a good way to get folks to panic. Another is adding a reference to Microsoft.VisualBasic in a C# application. Both are reasonable and darned useful things to do, though. MSDN says no. The Cache class is not intended for use outside of ASP.NET applic...
I realize this question is old, but in the interest of helping anyone who finds this via search, its worth noting that.net v4 includes a new general purpose cache for this type of scenario. It's in the System.Runtime.Caching namespace: https://msdn.microsoft.com/en-us/library/dd997357(v=vs.110).aspx The static referenc...
Is it OK to use HttpRuntime.Cache outside ASP.NET applications? Scott Hanselman says yes. Adding System.Web to your non-web project is a good way to get folks to panic. Another is adding a reference to Microsoft.VisualBasic in a C# application. Both are reasonable and darned useful things to do, though. MSDN says no. T...
TITLE: Is it OK to use HttpRuntime.Cache outside ASP.NET applications? QUESTION: Scott Hanselman says yes. Adding System.Web to your non-web project is a good way to get folks to panic. Another is adding a reference to Microsoft.VisualBasic in a C# application. Both are reasonable and darned useful things to do, thoug...
[ ".net", "caching" ]
39
27
12,381
8
0
2008-10-01T17:17:54.937000
2010-05-05T08:08:48.220000
158,706
158,752
How do I properly clean up Excel interop objects?
I'm using the Excel interop in C# ( ApplicationClass ) and have placed the following code in my finally clause: while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet)!= 0) { } excelSheet = null; GC.Collect(); GC.WaitForPendingFinalizers(); Although this kind of works, the Excel.exe process is still ...
Excel does not quit because your application is still holding references to COM objects. I guess you're invoking at least one member of a COM object without assigning it to a variable. For me it was the excelApp.Worksheets object which I directly used without assigning it to a variable: Worksheet sheet = excelApp.Works...
How do I properly clean up Excel interop objects? I'm using the Excel interop in C# ( ApplicationClass ) and have placed the following code in my finally clause: while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet)!= 0) { } excelSheet = null; GC.Collect(); GC.WaitForPendingFinalizers(); Although t...
TITLE: How do I properly clean up Excel interop objects? QUESTION: I'm using the Excel interop in C# ( ApplicationClass ) and have placed the following code in my finally clause: while (System.Runtime.InteropServices.Marshal.ReleaseComObject(excelSheet)!= 0) { } excelSheet = null; GC.Collect(); GC.WaitForPendingFinali...
[ "c#", "excel", "interop", "com-interop" ]
805
710
349,092
43
0
2008-10-01T17:18:43.513000
2008-10-01T17:30:41.020000
158,710
163,931
How do you find the largest font size that won't break a given text?
I'm trying to use CSS ( under @media print ) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, so simply using a fixed-width font is not an option. To put it another way, I'm looking ...
Here's some code I ended up using, in case someone might find it useful. All you need to do is make the outer DIV the size you want in inches. function make_big(id) // must be an inline element inside a block-level element { var e = document.getElementById(id); e.style.whiteSpace = 'nowrap'; e.style.textAlign = 'center...
How do you find the largest font size that won't break a given text? I'm trying to use CSS ( under @media print ) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, so simply using a f...
TITLE: How do you find the largest font size that won't break a given text? QUESTION: I'm trying to use CSS ( under @media print ) and JavaScript to print a one-page document with a given piece of text made as large as possible while still fitting inside a given width. The length of the text is not known beforehand, s...
[ "javascript", "css", "printing" ]
2
0
2,352
3
0
2008-10-01T17:20:32.497000
2008-10-02T18:46:39.690000
158,716
158,847
How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N
The question gives all necessary data: what is an efficient algorithm to generate a sequence of K non-repeating integers within a given interval [0,N-1]. The trivial algorithm (generating random numbers and, before adding them to the sequence, looking them up to see if they were already there) is very expensive if K is...
The random module from Python library makes it extremely easy and effective: from random import sample print sample(xrange(N), K) sample function returns a list of K unique elements chosen from the given sequence. xrange is a "list emulator", i.e. it behaves like a list of consecutive numbers without creating it in mem...
How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N The question gives all necessary data: what is an efficient algorithm to generate a sequence of K non-repeating integers within a given interval [0,N-1]. The trivial algorithm (generating random numbers and, before adding ...
TITLE: How do you efficiently generate a list of K non-repeating integers between 0 and an upper bound N QUESTION: The question gives all necessary data: what is an efficient algorithm to generate a sequence of K non-repeating integers within a given interval [0,N-1]. The trivial algorithm (generating random numbers a...
[ "arrays", "algorithm", "random", "permutation" ]
30
12
20,688
13
0
2008-10-01T17:21:30.637000
2008-10-01T17:47:01.573000
158,729
243,828
What information has been released regarding the .NET Framework 4.0?
As Microsoft seems to have started their trickle feed of information regarding.NET 4.0, I thought I'd ask the question as I'm sure there's more out there than I've spotted! What information has been released regarding the.NET Framework 4.0?
InfoQ has some good information, but doesn't go into the details. Type embedding Dynamic types in C# Optional parameters in C# Type covariance and contravariance Microsoft have an information page for downloading the Visual Studio 2010 and.Net 4 CTP here.
What information has been released regarding the .NET Framework 4.0? As Microsoft seems to have started their trickle feed of information regarding.NET 4.0, I thought I'd ask the question as I'm sure there's more out there than I've spotted! What information has been released regarding the.NET Framework 4.0?
TITLE: What information has been released regarding the .NET Framework 4.0? QUESTION: As Microsoft seems to have started their trickle feed of information regarding.NET 4.0, I thought I'd ask the question as I'm sure there's more out there than I've spotted! What information has been released regarding the.NET Framewo...
[ ".net", ".net-4.0" ]
2
1
327
5
0
2008-10-01T17:26:42.543000
2008-10-28T15:55:00.630000
158,737
158,858
How would you migrate a multi-site ClearCase/ClearQuest environment to all Open Source?
I work in an multi-site environment that's currently using Rational ClearCase for source control and Rational ClearQuest for issue tracking (I accept your condolences ahead of time). As a rough estimate I would say this is supporting 200 engineers. How would you effectively migrate this SCM methodology to a comparative...
First, why do you think this would improve developer productivity? I haven't used ClearCase much, and ClearQuest not at all. What about these tools is hindering development? Once you know what you want, you need to look at various tools. I'm fond of Subversion for SCM, as a general rule, but there are situations it isn...
How would you migrate a multi-site ClearCase/ClearQuest environment to all Open Source? I work in an multi-site environment that's currently using Rational ClearCase for source control and Rational ClearQuest for issue tracking (I accept your condolences ahead of time). As a rough estimate I would say this is supportin...
TITLE: How would you migrate a multi-site ClearCase/ClearQuest environment to all Open Source? QUESTION: I work in an multi-site environment that's currently using Rational ClearCase for source control and Rational ClearQuest for issue tracking (I accept your condolences ahead of time). As a rough estimate I would say...
[ "open-source", "version-control", "clearcase", "migrate", "clearquest" ]
3
1
3,112
6
0
2008-10-01T17:28:09.810000
2008-10-01T17:49:41.740000
158,741
158,773
What is an appropriate use for ASP.NET's MultiView control?
What are some scenarios where MultiView would be a good choice? The MultiView control along with its View controls simply seem to extend the notion of Panels. Both Panels and MultiViews seem prone to abuse. If your UI concerns and biz logic concerns are properly separated, why lump views together in a single ASPX?
I have used MultiViews as a more flexible basis for a Wizard control. I do agree that lumping lots of views together is a code smell. In the case of a wizard there are often lots of pieces of state you want to share throughout the process. The multiview allows this state to be simply stored in the viewstate. Most of th...
What is an appropriate use for ASP.NET's MultiView control? What are some scenarios where MultiView would be a good choice? The MultiView control along with its View controls simply seem to extend the notion of Panels. Both Panels and MultiViews seem prone to abuse. If your UI concerns and biz logic concerns are proper...
TITLE: What is an appropriate use for ASP.NET's MultiView control? QUESTION: What are some scenarios where MultiView would be a good choice? The MultiView control along with its View controls simply seem to extend the notion of Panels. Both Panels and MultiViews seem prone to abuse. If your UI concerns and biz logic c...
[ "asp.net", "panel", "multiview" ]
12
11
4,506
5
0
2008-10-01T17:29:27.233000
2008-10-01T17:33:42.183000
158,760
158,797
Using Linq with WCF
I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. I am wondering how things like deffered execution works over WCF (if it works at all)? Cyclic references supp...
There isn't any LINQ provider that I'm aware of for generic WCF-based queries. LINQ to ADO.NET Data Services, however, lets you query an Entity model over WCF/REST. From Andy Conrad's blog: static void Main(string[] args) { var context=new WebDataContext("http://localhost:18752/Northwind.svc"); var query = from p in c...
Using Linq with WCF I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. I am wondering how things like deffered execution works over WCF (if it works at all)? Cy...
TITLE: Using Linq with WCF QUESTION: I am looking for any examples or guides to using Linq over WCF (n-tier application). Please specify if you are showing something for Linq-to-SQL or Linq-to-entities. I would like to see usage examples for both. I am wondering how things like deffered execution works over WCF (if it...
[ "linq", "wcf", "linq-to-sql", "linq-to-entities" ]
5
7
4,360
3
0
2008-10-01T17:31:43.840000
2008-10-01T17:39:02.793000
158,772
158,873
Handle exception on service startup
I'm writing a series of Windows services. I want them to fail if errors are thrown during startup (in OnStart() method). I had assumed that merely throwing an error in OnStart() would do this, but I'm finding that instead it "Starts" and presents me with a message stating "The service has started, but is inactive. Is t...
if you are running.NET 2.0 or higher, you can use ServiceBase.Stop to stop the service from OnStart. Otherwise call Stop from a new thread. ref [devnewsgroups] ( http://www.devnewsgroups.net/group/microsoft.public.dotnet.framework/topic50404.aspx ) (news group gone)
Handle exception on service startup I'm writing a series of Windows services. I want them to fail if errors are thrown during startup (in OnStart() method). I had assumed that merely throwing an error in OnStart() would do this, but I'm finding that instead it "Starts" and presents me with a message stating "The servic...
TITLE: Handle exception on service startup QUESTION: I'm writing a series of Windows services. I want them to fail if errors are thrown during startup (in OnStart() method). I had assumed that merely throwing an error in OnStart() would do this, but I'm finding that instead it "Starts" and presents me with a message s...
[ "c#", ".net", "windows-services", "error-handling" ]
18
8
27,812
3
0
2008-10-01T17:33:35.053000
2008-10-01T17:54:39.997000
158,775
159,395
Are there any data warehouse frameworks?
I've got a lot of mysql data that I need to generate reports from. It's mostly historic data so it won't be changing much, but it weighs in at 20-30 gigabytes easily and is expected to grow. I currently have a collection of php scripts that will do some complex queries and output csv and excel files. I also use phpMyAd...
I'll discuss a few points on the {budget, business utility function, time frame} spectrum out there. For convenience, let's follow the architecture conceptualization you linked to at WikipediaDataWarehouseArticle Operational database layer The source data for the data warehouse - Normalized for In One Place Only data m...
Are there any data warehouse frameworks? I've got a lot of mysql data that I need to generate reports from. It's mostly historic data so it won't be changing much, but it weighs in at 20-30 gigabytes easily and is expected to grow. I currently have a collection of php scripts that will do some complex queries and outpu...
TITLE: Are there any data warehouse frameworks? QUESTION: I've got a lot of mysql data that I need to generate reports from. It's mostly historic data so it won't be changing much, but it weighs in at 20-30 gigabytes easily and is expected to grow. I currently have a collection of php scripts that will do some complex...
[ "frameworks", "reporting", "data-warehouse", "anchor-modeling" ]
15
8
5,031
7
0
2008-10-01T17:34:17.207000
2008-10-01T19:47:21.957000
158,778
158,809
Should I return null from or apply the "null object" pattern to a function returning a Date?
Let's say you have a function that returns a date: Date myFunc(paramA, paramB){ //conditionally return a date? } Is it appropriate to return null from this function? This seems ugly because it forces clients to check for null. The "null object" pattern is an implementation pattern that addresses this concern. I'm not a...
The null object pattern is not for what you are trying to do. That pattern is about creating an object with no functionality in it's implementation that you can pass to a given function that requires an object not being null. An example is NullProgressMonitor in Eclipse, which is an empty implementation of IProgressMon...
Should I return null from or apply the "null object" pattern to a function returning a Date? Let's say you have a function that returns a date: Date myFunc(paramA, paramB){ //conditionally return a date? } Is it appropriate to return null from this function? This seems ugly because it forces clients to check for null. ...
TITLE: Should I return null from or apply the "null object" pattern to a function returning a Date? QUESTION: Let's say you have a function that returns a date: Date myFunc(paramA, paramB){ //conditionally return a date? } Is it appropriate to return null from this function? This seems ugly because it forces clients t...
[ "java" ]
2
7
723
8
0
2008-10-01T17:34:54.753000
2008-10-01T17:40:50.293000
158,780
158,841
Update fonts recursively on a Delphi form
I'm trying to iterate all the controls on a form and enable ClearType font smoothing. Something like this: procedure TForm4.UpdateControls(AParent: TWinControl); var I: Integer; ACtrl: TControl; tagLOGFONT: TLogFont; begin for I:= 0 to AParent.ControlCount-1 do begin ACtrl:= AParent.Controls[I]; // if ParentFont=False...
You use TypInfo unit, more specifically methods IsPublishedProp and GetOrdProp. In your case, it would be something like: if IsPublishedProp(ACtrl, 'Font') then ModifyFont(TFont(GetOrdProp(ACtrl, 'Font'))) A fragment from one of my libraries that should put you on the right path: function ContainsNonemptyControl(contro...
Update fonts recursively on a Delphi form I'm trying to iterate all the controls on a form and enable ClearType font smoothing. Something like this: procedure TForm4.UpdateControls(AParent: TWinControl); var I: Integer; ACtrl: TControl; tagLOGFONT: TLogFont; begin for I:= 0 to AParent.ControlCount-1 do begin ACtrl:= AP...
TITLE: Update fonts recursively on a Delphi form QUESTION: I'm trying to iterate all the controls on a form and enable ClearType font smoothing. Something like this: procedure TForm4.UpdateControls(AParent: TWinControl); var I: Integer; ACtrl: TControl; tagLOGFONT: TLogFont; begin for I:= 0 to AParent.ControlCount-1 d...
[ "windows", "delphi" ]
4
6
1,965
4
0
2008-10-01T17:35:24.597000
2008-10-01T17:46:21.340000
158,783
160,307
Is there a way to override ConfigurationManager.AppSettings?
I really want to be able to have a way to take an app that currently gets its settings using ConfigurationManager.AppSettings["mysettingkey"] to actually have those settings come from a centralized database instead of the app.config file. I can make a custom config section for handling this sort of thing, but I really ...
If you don't mind hacking around the framework and you can reasonably assume the.net framework version the application is running on (i.e. it's a web application or an intranet application) then you could try something like this: using System; using System.Collections.Specialized; using System.Configuration; using Syst...
Is there a way to override ConfigurationManager.AppSettings? I really want to be able to have a way to take an app that currently gets its settings using ConfigurationManager.AppSettings["mysettingkey"] to actually have those settings come from a centralized database instead of the app.config file. I can make a custom ...
TITLE: Is there a way to override ConfigurationManager.AppSettings? QUESTION: I really want to be able to have a way to take an app that currently gets its settings using ConfigurationManager.AppSettings["mysettingkey"] to actually have those settings come from a centralized database instead of the app.config file. I ...
[ ".net", "configuration", "app-config" ]
22
25
15,254
6
0
2008-10-01T17:36:05.500000
2008-10-02T00:04:25.643000
158,800
159,226
Get the NTLM credentials from the Response on an APSX page
I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed access to both servers.). Server B is also not open to anonymous ac...
You can certainly obtain the login name of the caller, but not the password. NTLM uses a challenge/response mechanism, so the password is never transmitted. Your server must have access to a password-equivalent (a hash) in order to form the challenge and check the response, but even if you can get hold of it that passw...
Get the NTLM credentials from the Response on an APSX page I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally be allowed access t...
TITLE: Get the NTLM credentials from the Response on an APSX page QUESTION: I have an ASPX page (On server A) which is invoked using NTLM credentials. Part of that page's job is to call an HTML page (On server B) and proxy it back to the client. (The firewall allows access to A, but not to B. The user would normally b...
[ "c#", "asp.net", "credentials" ]
1
1
2,658
3
0
2008-10-01T17:39:22.980000
2008-10-01T19:11:50.730000
158,804
158,825
Change .NET Framework version of application pool to 3.5?
I've installed.NET Framework 3.5 SP1 on web server (Server 2008 Enterprise), so running IIS 7.0. I want to change the version of.NET Framework used by an existing site. So I right-click on appropriate Application Pool and selected Edit Application Pool. The.NET Framework dropdown does not include an explicit entry for ...
The 3.5 framework still runs on top of the 2.0 CLR so what you are seeing is correct. Scott Hanselman has a nice blog post about the details of this: The marketing term ".NET Framework 3.5" refers to a few things. First, LINQ, which is huge, and includes new language compilers for C# and VB. Second, the REST support ad...
Change .NET Framework version of application pool to 3.5? I've installed.NET Framework 3.5 SP1 on web server (Server 2008 Enterprise), so running IIS 7.0. I want to change the version of.NET Framework used by an existing site. So I right-click on appropriate Application Pool and selected Edit Application Pool. The.NET ...
TITLE: Change .NET Framework version of application pool to 3.5? QUESTION: I've installed.NET Framework 3.5 SP1 on web server (Server 2008 Enterprise), so running IIS 7.0. I want to change the version of.NET Framework used by an existing site. So I right-click on appropriate Application Pool and selected Edit Applicat...
[ ".net-3.5", "iis-7", "application-pool" ]
11
17
31,474
5
0
2008-10-01T17:40:00.607000
2008-10-01T17:43:38.633000
158,806
159,446
jEditable input-box CSS style
I am trying to style an input-box rendered using jEditable. I want to change the color of the table-cell when the text is double-clicked and made editable. Like this: alt text http://www.hongaijitsu.com/temp/foobar/public/Picture-2.png This is where I am at the moment: jEditable CSS Problem (double-click the text in th...
jQuery/JavaScript is manipulating the DOM and dynamically adding/setting the widths of the input fields each time you doubleclick. Since inline styles (here dynamically generated in the DOM) take precedence over all other styles, you can not alter dynamically rendered inline styles with new attributes in the attached c...
jEditable input-box CSS style I am trying to style an input-box rendered using jEditable. I want to change the color of the table-cell when the text is double-clicked and made editable. Like this: alt text http://www.hongaijitsu.com/temp/foobar/public/Picture-2.png This is where I am at the moment: jEditable CSS Proble...
TITLE: jEditable input-box CSS style QUESTION: I am trying to style an input-box rendered using jEditable. I want to change the color of the table-cell when the text is double-clicked and made editable. Like this: alt text http://www.hongaijitsu.com/temp/foobar/public/Picture-2.png This is where I am at the moment: jE...
[ "javascript", "jquery", "css" ]
7
2
7,742
1
0
2008-10-01T17:40:39.280000
2008-10-01T20:01:03.110000