question_id
int64
4
6.31M
answer_id
int64
7
6.31M
title
stringlengths
9
150
question_body
stringlengths
0
28.8k
answer_body
stringlengths
60
27.2k
question_text
stringlengths
40
28.9k
combined_text
stringlengths
124
39.6k
tags
listlengths
1
6
question_score
int64
0
26.3k
answer_score
int64
0
28.8k
view_count
int64
15
14M
answer_count
int64
0
182
favorite_count
int64
0
32
question_creation_date
stringdate
2008-07-31 21:42:52
2011-06-10 18:12:18
answer_creation_date
stringdate
2008-07-31 22:17:57
2011-06-10 18:14:17
154,079
154,234
What is the formula for alpha blending for a number of pixels?
I have a number of RGBA pixels, each of them has an alpha component. So I have a list of pixels: ( p0 p1 p2 p3 p4... pn ) where p_0_ is the front pixel and p_n_ is the farthest (at the back). The last (or any) pixel is not necessary opaque, so the resulting blended pixel can be somehow transparent also. I'm blending fr...
Alpha-blending is one of those topics that has more depth than you might think. It depends on what the alpha value means in your system, and if you guess wrong, then you'll end up with results that look kind of okay, but that display weird artifacts. Check out Porter and Duff's classic paper " Compositing Digital Image...
What is the formula for alpha blending for a number of pixels? I have a number of RGBA pixels, each of them has an alpha component. So I have a list of pixels: ( p0 p1 p2 p3 p4... pn ) where p_0_ is the front pixel and p_n_ is the farthest (at the back). The last (or any) pixel is not necessary opaque, so the resulting...
TITLE: What is the formula for alpha blending for a number of pixels? QUESTION: I have a number of RGBA pixels, each of them has an alpha component. So I have a list of pixels: ( p0 p1 p2 p3 p4... pn ) where p_0_ is the front pixel and p_n_ is the farthest (at the back). The last (or any) pixel is not necessary opaque...
[ "graphics", "alpha", "alphablending", "raytracing" ]
6
10
5,132
2
0
2008-09-30T17:22:49.737000
2008-09-30T18:03:46.830000
154,097
215,041
What's in your .emacs?
I've switched computers a few times recently, and somewhere along the way I lost my.emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use. So, if you use Emacs, what's in your.emacs? Mine is pretty barren right now, containing only: Global fon...
Use the ultimate dotfiles site. Add your '.emacs' here. Read the '.emacs' of others.
What's in your .emacs? I've switched computers a few times recently, and somewhere along the way I lost my.emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use. So, if you use Emacs, what's in your.emacs? Mine is pretty barren right now, cont...
TITLE: What's in your .emacs? QUESTION: I've switched computers a few times recently, and somewhere along the way I lost my.emacs. I'm trying to build it up again, but while I'm at it, I thought I'd pick up other good configurations that other people use. So, if you use Emacs, what's in your.emacs? Mine is pretty barr...
[ "emacs", "text-editor", "elisp", "dot-emacs" ]
53
45
16,037
29
0
2008-09-30T17:27:08.667000
2008-10-18T13:26:25.637000
154,109
154,296
Custom Compiler Warnings
When using the ObsoleteAtribute in.Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom attribute that I can use to mark methods or...
Update This is now possible with Roslyn (Visual Studio 2015). You can build a code analyzer to check for a custom attribute Original outdated answer: I don't believe it's possible. ObsoleteAttribute is treated specially by the compiler and is defined in the C# standard. Why on earth is ObsoleteAttribute not acceptable?...
Custom Compiler Warnings When using the ObsoleteAtribute in.Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom attribute that I c...
TITLE: Custom Compiler Warnings QUESTION: When using the ObsoleteAtribute in.Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom ...
[ "c#", ".net", "vb.net", "attributes", "compiler-warnings" ]
143
33
58,671
11
0
2008-09-30T17:31:02.963000
2008-09-30T18:20:07.587000
154,117
154,279
Can an ASP.NET ASPX Page be Processed From a Source that is not the File System?
Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers and Modules and writing to the Response, but there doesn't seem to be a way to execute/compile ASPX s...
Perhaps you need a virtual path provider. It allows you to store the ASPX and codebehind in different media - RDBMS, xml file etc.
Can an ASP.NET ASPX Page be Processed From a Source that is not the File System? Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers and Modules and writ...
TITLE: Can an ASP.NET ASPX Page be Processed From a Source that is not the File System? QUESTION: Is there a way to execute a full ASPX source file where the page source is from a string/database/resource and not a file on the file system? It's straightfoward to render dynamic content/images/etc using HTTP Handlers an...
[ "asp.net" ]
3
5
379
3
0
2008-09-30T17:32:45.407000
2008-09-30T18:16:44.427000
154,119
156,118
Got .PNG file. Want embeddded icon resource displayed as icon on form title bar
This was an interview question. Given Visual Studio 2008 and an icon saved as a.PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form. I'm looking for what would have been the model answer to this question, Both (working!) code and any Visual Studio tricks. ...
Fire up VS, start new Windows Application. Open the properties sheet, add the.png file as a resource (in this example: glider.png ). From hereon, you can access the resource as a Bitmap file as WindowsFormsApplication10.Properties.Resources.glider Code for using it as an application icon: public Form1() { InitializeCom...
Got .PNG file. Want embeddded icon resource displayed as icon on form title bar This was an interview question. Given Visual Studio 2008 and an icon saved as a.PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form. I'm looking for what would have been the mo...
TITLE: Got .PNG file. Want embeddded icon resource displayed as icon on form title bar QUESTION: This was an interview question. Given Visual Studio 2008 and an icon saved as a.PNG file, they required the image as an embedded resource and to be used as the icon within the title bar of a form. I'm looking for what woul...
[ "c#", ".net", "winforms" ]
41
66
41,764
5
0
2008-09-30T17:33:23.283000
2008-10-01T03:25:08.947000
154,132
156,258
Typical pitfalls of cross-browser compatibility
What are the most common browser compatibility issues across the major desktop browsers? No dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. "IE sux" is not a pitfall, but a call for down-vote. [Edit] Yes, I know it's a poll - I'm not posting answers in this to gather points - I'm ac...
Quirksmode has a comprehensive list of a lot of differencies requiring attention!-) -- but he is, like most other sites and bloggers on the net, focused in his way, and that results in some minor or major bugs and inconsistencies...
Typical pitfalls of cross-browser compatibility What are the most common browser compatibility issues across the major desktop browsers? No dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. "IE sux" is not a pitfall, but a call for down-vote. [Edit] Yes, I know it's a poll - I'm not p...
TITLE: Typical pitfalls of cross-browser compatibility QUESTION: What are the most common browser compatibility issues across the major desktop browsers? No dups please. Up-vote problems you've run into. I'm hoping for the list to self-sort. "IE sux" is not a pitfall, but a call for down-vote. [Edit] Yes, I know it's ...
[ "javascript", "html", "css", "cross-browser" ]
3
1
1,824
10
0
2008-09-30T17:35:50.610000
2008-10-01T04:41:54.707000
154,136
154,138
Why use apparently meaningless do-while and if-else statements in macros?
In many C/C++ macros I'm seeing the code of the macro wrapped in what seems like a meaningless do while loop. Here are examples. #define FOO(X) do { f(X); g(X); } while (0) #define FOO(X) if (1) { f(X); g(X); } else I can't see what the do while is doing. Why not just write this without it? #define FOO(X) f(X); g(X)
The do... while and if... else are there to make it so that a semicolon after your macro always means the same thing. Let's say you had something like your second macro. #define BAR(X) f(x); g(x) Now if you were to use BAR(X); in an if... else statement, where the bodies of the if statement were not wrapped in curly br...
Why use apparently meaningless do-while and if-else statements in macros? In many C/C++ macros I'm seeing the code of the macro wrapped in what seems like a meaningless do while loop. Here are examples. #define FOO(X) do { f(X); g(X); } while (0) #define FOO(X) if (1) { f(X); g(X); } else I can't see what the do while ...
TITLE: Why use apparently meaningless do-while and if-else statements in macros? QUESTION: In many C/C++ macros I'm seeing the code of the macro wrapped in what seems like a meaningless do while loop. Here are examples. #define FOO(X) do { f(X); g(X); } while (0) #define FOO(X) if (1) { f(X); g(X); } else I can't see ...
[ "c++", "c", "c-preprocessor", "c++-faq" ]
939
985
117,692
9
0
2008-09-30T17:36:24.213000
2008-09-30T17:36:35.693000
154,148
176,803
Changing embedded google videos src
I'm trying to recreate the functionality on Google Video where you can access certain parts of a video by putting #1h1m1m in the URL. So I have an embedded Google Video and links to the right that I want to link to at certain times in that video. I can do this with a page refresh but I'm trying to do it via javascript ...
If the google video you are embedding is a YouTube video, there are documented APIs for causing the player to seek to a specified time (expressed in secondes). See: YouTube Javascript API Reference
Changing embedded google videos src I'm trying to recreate the functionality on Google Video where you can access certain parts of a video by putting #1h1m1m in the URL. So I have an embedded Google Video and links to the right that I want to link to at certain times in that video. I can do this with a page refresh but...
TITLE: Changing embedded google videos src QUESTION: I'm trying to recreate the functionality on Google Video where you can access certain parts of a video by putting #1h1m1m in the URL. So I have an embedded Google Video and links to the right that I want to link to at certain times in that video. I can do this with ...
[ "javascript", "video" ]
0
1
277
1
0
2008-09-30T17:38:57.810000
2008-10-07T00:28:32.807000
154,163
154,222
Detect virtualized OS from an application?
I need to detect whether my application is running within a virtualized OS instance or not. I've found an article with some useful information on the topic. The same article appears in multiple places, I'm unsure of the original source. VMware implements a particular invalid x86 instruction to return information about ...
Have you heard about blue pill, red pill?. It's a technique used to see if you are running inside a virtual machine or not. The origin of the term stems from the matrix movie where Neo is offered a blue or a red pill (to stay inside the matrix = blue, or to enter the 'real' world = red). The following is some code that...
Detect virtualized OS from an application? I need to detect whether my application is running within a virtualized OS instance or not. I've found an article with some useful information on the topic. The same article appears in multiple places, I'm unsure of the original source. VMware implements a particular invalid x...
TITLE: Detect virtualized OS from an application? QUESTION: I need to detect whether my application is running within a virtualized OS instance or not. I've found an article with some useful information on the topic. The same article appears in multiple places, I'm unsure of the original source. VMware implements a pa...
[ "virtualbox", "vmware", "virtualization", "xen", "virtual-pc" ]
78
78
88,887
16
0
2008-09-30T17:42:42.217000
2008-09-30T17:59:12.380000
154,180
154,258
How does NUnit (and MSTest) handle tests that change static/shared variables?
I have some code that uses the shared gateway pattern to implement an inversion of control container. I have several hundred NUnit unit tests that exercises the code that uses this IOC. They all work (on my machine!) but I am concerned that these tests might fail under load. I seem to remember that NUnit (and MSTest) a...
Update: Visual Studio 2010 introduced the ability to run tests in parallel. Here is a step by step article about how to enable this. MsTest: So according to David Williamson, from Microsoft Visual Studio Team System, on this post in the MSDN forums: Tests absolutely do NOT run in parallel when run in VS or via mstest.e...
How does NUnit (and MSTest) handle tests that change static/shared variables? I have some code that uses the shared gateway pattern to implement an inversion of control container. I have several hundred NUnit unit tests that exercises the code that uses this IOC. They all work (on my machine!) but I am concerned that t...
TITLE: How does NUnit (and MSTest) handle tests that change static/shared variables? QUESTION: I have some code that uses the shared gateway pattern to implement an inversion of control container. I have several hundred NUnit unit tests that exercises the code that uses this IOC. They all work (on my machine!) but I a...
[ "unit-testing", "nunit", "parallel-processing" ]
10
8
4,799
1
0
2008-09-30T17:47:59.083000
2008-09-30T18:10:35.770000
154,184
155,591
Setting WPF dependency property without triggering events
I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? For clarification, what I am trying to do is hook up WPF sliders to a WinForms User Control. Currently in my ...
Here's a simply workaround/hack. Add a boolean to keep track whether you changed the setting, let's say "IsChangedByMe". When you change the dependency property in code, set the bool to true. In the ValueChanged event, if IsChangedByMe is true, don't do anything.
Setting WPF dependency property without triggering events I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? For clarification, what I am trying to do is hook u...
TITLE: Setting WPF dependency property without triggering events QUESTION: I need to set a dependency property on a control (Slider.Value) in my code without it triggering a ValueChanged event (since I set the value, not the user). What is the best way to handle this situation in WPF? For clarification, what I am tryi...
[ "c#", "wpf", "events", "dependency-properties" ]
4
7
7,953
3
0
2008-09-30T17:49:05.307000
2008-09-30T23:33:59.563000
154,185
154,201
What is object marshalling?
I have heard this concept used frequently, but I don't have a really good grasp of what it is.
Converting an object in memory into a format that can be written to disk, or sent over the wire, etc. Wikipedia's description.
What is object marshalling? I have heard this concept used frequently, but I don't have a really good grasp of what it is.
TITLE: What is object marshalling? QUESTION: I have heard this concept used frequently, but I don't have a really good grasp of what it is. ANSWER: Converting an object in memory into a format that can be written to disk, or sent over the wire, etc. Wikipedia's description.
[ "marshalling", "terminology", "glossary" ]
70
46
39,650
10
0
2008-09-30T17:49:10.907000
2008-09-30T17:52:43.520000
154,204
154,255
Modifying default tab size in RichTextBox
Is there any way to change the default tab size in a.NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste. Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control. From what I can understand, the SelectionTabs property requ...
You can set it by setting the SelectionTabs property. private void Form1_Load(object sender, EventArgs e) { richTextBox1.SelectionTabs = new int[] { 100, 200, 300, 400 }; } UPDATE: The sequence matters.... If you set the tabs prior to the control's text being initialized, then you don't have to select the text prior to...
Modifying default tab size in RichTextBox Is there any way to change the default tab size in a.NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste. Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control. From what I can u...
TITLE: Modifying default tab size in RichTextBox QUESTION: Is there any way to change the default tab size in a.NET RichTextBox? It currently seems to be set to the equivalent of 8 spaces which is kinda large for my taste. Edit: To clarify, I want to set the global default of "\t" displays as 4 spaces for the control....
[ ".net", "winforms", "tabs", "richtextbox" ]
21
25
25,814
5
0
2008-09-30T17:53:53.720000
2008-09-30T18:09:37.970000
154,206
154,227
Can You Use A DynamicResource in a Storyboard Contained Within Style Or ControlTemplate
I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate. But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error. What is going on here?
No, you can't use a DynamicResource in a Storyboard that is contained within a Style or ControlTemplate. In fact, you can't use a data binding expression either. The story here is that everything within a Style or ControlTemplate must be safe for use across threads and the timing system actually tries to freeze the Sty...
Can You Use A DynamicResource in a Storyboard Contained Within Style Or ControlTemplate I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate. But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error. What is going on here?
TITLE: Can You Use A DynamicResource in a Storyboard Contained Within Style Or ControlTemplate QUESTION: I am trying to use a DynamicResource in Storyboard contained within a ControlTemplate. But, when I try to do this, I get a 'Cannot freeze this Storyboard timeline tree for use across threads' error. What is going o...
[ "wpf", "animation" ]
13
31
7,457
4
0
2008-09-30T17:54:45.887000
2008-09-30T18:00:59.363000
154,207
154,244
Hitting Webservice on Different Subnet
I know this is somewhat of a server question, but I wanted to ask anyways in case someone has done this before. I have a web service that is on our internal 172.x.x.x subnet and a web server that is on our internal 10.x.x.x subnet. The webserver needs to hit the 172 web service, but is unable to route there. The real s...
As you mentioned, the best option is to cram the web server into the DMZ. That being impossible, see if the wiremonkeys can open up the appropriate port in the firewall just between the server and the web service (and just for http/https traffic). If both are impossible, I guess a proxy is possible (if the proxy is all...
Hitting Webservice on Different Subnet I know this is somewhat of a server question, but I wanted to ask anyways in case someone has done this before. I have a web service that is on our internal 172.x.x.x subnet and a web server that is on our internal 10.x.x.x subnet. The webserver needs to hit the 172 web service, b...
TITLE: Hitting Webservice on Different Subnet QUESTION: I know this is somewhat of a server question, but I wanted to ask anyways in case someone has done this before. I have a web service that is on our internal 172.x.x.x subnet and a web server that is on our internal 10.x.x.x subnet. The webserver needs to hit the ...
[ "web-services", "iis-7", "proxy" ]
1
1
576
3
0
2008-09-30T17:55:05.947000
2008-09-30T18:06:15.297000
154,209
156,708
How do I create a (Type, ID) (aka 'polymorphic')- foreign key column in MS Access?
In Ruby-on-Rails, this is called a "polymorphic association." I have several Commentable things in my application, the tables for each are below: Post id | title | text | author (FK:Person.id) |... Person id | name |... Photo id | title | owner (FK:Person.id) | path |... I'd like to add a Comments table as follows: C...
This technique is known colloquially in the SQL world as 'subclassing'. For a worked example (SQL Server syntax but is easily adapted for MS Access), see David Porta's blog.. In your scenario, the data items common to all comments would be in your Comments table; anything specific to each type would be in specialized t...
How do I create a (Type, ID) (aka 'polymorphic')- foreign key column in MS Access? In Ruby-on-Rails, this is called a "polymorphic association." I have several Commentable things in my application, the tables for each are below: Post id | title | text | author (FK:Person.id) |... Person id | name |... Photo id | titl...
TITLE: How do I create a (Type, ID) (aka 'polymorphic')- foreign key column in MS Access? QUESTION: In Ruby-on-Rails, this is called a "polymorphic association." I have several Commentable things in my application, the tables for each are below: Post id | title | text | author (FK:Person.id) |... Person id | name |.....
[ "ms-access", "rdbms" ]
4
4
872
2
0
2008-09-30T17:56:03.497000
2008-10-01T08:32:43.263000
154,245
155,098
Editing a text buffer
Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can handle all the rest of the code myself (file...
This is 2008. Don't write a text editor; you're reinventing fire. Still here? I'm not sure if this applies or what platforms you plan to support, but the Neatpad series of tutorials is a great place to start thinking about writing a text editor. They focus on Win32 as the basic platform, but many of the lessons learned...
Editing a text buffer Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can handle all the rest of...
TITLE: Editing a text buffer QUESTION: Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can hand...
[ "c++", "c", "open-source", "editor" ]
16
8
7,870
11
0
2008-09-30T18:06:54.017000
2008-09-30T21:07:11.570000
154,247
155,390
How do I configure IE7 to download filetype instead of opening in browser
I have written a watir script that downloads files. One of the files it downloads has a.dcf extension. Months ago, on my machine, I changed a setting somewhere so that.dcf files prompt for download ("Do you want to open or save this file?") instead of opening in the browser. This is the behavior that I desire. I am usi...
tloach 's link provided direction towards the answer I needed: I needed to open a windows explorer window and select Folder Options... from the Tools menu. I needed to go to the File Types tab and locate the extension for which I wanted to change behavior. I needed to have the Advanced button for the file type - it isn...
How do I configure IE7 to download filetype instead of opening in browser I have written a watir script that downloads files. One of the files it downloads has a.dcf extension. Months ago, on my machine, I changed a setting somewhere so that.dcf files prompt for download ("Do you want to open or save this file?") inste...
TITLE: How do I configure IE7 to download filetype instead of opening in browser QUESTION: I have written a watir script that downloads files. One of the files it downloads has a.dcf extension. Months ago, on my machine, I changed a setting somewhere so that.dcf files prompt for download ("Do you want to open or save ...
[ "internet-explorer", "download", "watir", "browser-automation" ]
1
0
5,053
3
0
2008-09-30T18:07:48.257000
2008-09-30T22:33:01.753000
154,248
154,734
How to add an attribute to an XML node in Java 1.4
I tried: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(f); Node mapNode = getMapNode(doc); System.out.print("\r\n elementName "+ mapNode.getNodeName());//This works fine. Element e = (Element) mapNode; //This is where the erro...
I was using a different dtd file on the server. That was causing the issue.
How to add an attribute to an XML node in Java 1.4 I tried: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(f); Node mapNode = getMapNode(doc); System.out.print("\r\n elementName "+ mapNode.getNodeName());//This works fine. Elem...
TITLE: How to add an attribute to an XML node in Java 1.4 QUESTION: I tried: DocumentBuilderFactory dbf = DocumentBuilderFactory.newInstance(); DocumentBuilder db = dbf.newDocumentBuilder(); Document doc = db.parse(f); Node mapNode = getMapNode(doc); System.out.print("\r\n elementName "+ mapNode.getNodeName());//This...
[ "java", "xml" ]
7
1
24,044
4
0
2008-09-30T18:07:59.020000
2008-09-30T20:04:07.463000
154,250
154,426
Running many virtual machines on a single host
I have a need to run a relatively large number of virtual machines on a relatively small number of physical hosts. Each virtual machine isn't doing to much - each only needs to run essentially one basic network service - think SMTP or the like. Furthermore, the load on each is going to be extremely light. Unfortunately...
there are three main fronts to make those fit: lower overhead. OpenVZ, Vserver, chroot, would be ideal if applicable. if you really need each instance be a real VM with it's own kernel, try KVM/Xen instead of VMWare. may be less mature, but you'll have a lot more flexibility. smaller guests. try Ubuntu JeOS, or roll yo...
Running many virtual machines on a single host I have a need to run a relatively large number of virtual machines on a relatively small number of physical hosts. Each virtual machine isn't doing to much - each only needs to run essentially one basic network service - think SMTP or the like. Furthermore, the load on eac...
TITLE: Running many virtual machines on a single host QUESTION: I have a need to run a relatively large number of virtual machines on a relatively small number of physical hosts. Each virtual machine isn't doing to much - each only needs to run essentially one basic network service - think SMTP or the like. Furthermor...
[ "performance", "vmware", "virtual-machine" ]
3
7
19,636
17
0
2008-09-30T18:08:26.040000
2008-09-30T18:51:32.113000
154,256
154,263
Is there a way to iterate through all enum values?
Possible Duplicate: C#: How to enumerate an enum? The subject says all. I want to use that to add the values of an enum in a combobox. Thanks vIceBerg
string[] names = Enum.GetNames (typeof(MyEnum)); Then just populate the dropdown withe the array
Is there a way to iterate through all enum values? Possible Duplicate: C#: How to enumerate an enum? The subject says all. I want to use that to add the values of an enum in a combobox. Thanks vIceBerg
TITLE: Is there a way to iterate through all enum values? QUESTION: Possible Duplicate: C#: How to enumerate an enum? The subject says all. I want to use that to add the values of an enum in a combobox. Thanks vIceBerg ANSWER: string[] names = Enum.GetNames (typeof(MyEnum)); Then just populate the dropdown withe the ...
[ "c#", "enumeration" ]
33
31
19,824
9
0
2008-09-30T18:09:54.787000
2008-09-30T18:11:53.287000
154,261
154,433
How to join the newest rows from a table?
I frequently run into problems of this form and haven't found a good solution yet: Assume we have two database tables representing an e-commerce system. userData (userId, name,...) orderData (orderId, userId, orderType, createDate,...) For all users in the system, select their user information, their most recent order ...
This should work, you'll have to adjust the table / column names: select ud.name, order1.order_id, order1.order_type, order1.create_date, order2.order_id, order2.order_type, order2.create_date from user_data ud, order_data order1, order_data order2 where ud.user_id = order1.user_id and ud.user_id = order2.user_id and o...
How to join the newest rows from a table? I frequently run into problems of this form and haven't found a good solution yet: Assume we have two database tables representing an e-commerce system. userData (userId, name,...) orderData (orderId, userId, orderType, createDate,...) For all users in the system, select their ...
TITLE: How to join the newest rows from a table? QUESTION: I frequently run into problems of this form and haven't found a good solution yet: Assume we have two database tables representing an e-commerce system. userData (userId, name,...) orderData (orderId, userId, orderType, createDate,...) For all users in the sys...
[ "sql", "aggregate", "pivot" ]
4
4
403
11
0
2008-09-30T18:11:36.453000
2008-09-30T18:54:24.667000
154,270
154,304
Stuff in Windows Form Move When Maximized - C#
It's been a while since I've programmed a GUI program, so this may end up being super simple, but I can't find the solution anywhere online. Basically my problem is that when I maximize my program, all the things inside of the window (buttons, textboxes, etc.) stay in the same position in the window, which results in a...
You want to check and properly set the Anchor and Dock properties on each control in the Form. The Anchor property on a control tells which sides of the form (top, bottom, left, right) the control is 'anchored' to. When the form is resized, the distance between the control and its anchors will stay the same. This lets ...
Stuff in Windows Form Move When Maximized - C# It's been a while since I've programmed a GUI program, so this may end up being super simple, but I can't find the solution anywhere online. Basically my problem is that when I maximize my program, all the things inside of the window (buttons, textboxes, etc.) stay in the ...
TITLE: Stuff in Windows Form Move When Maximized - C# QUESTION: It's been a while since I've programmed a GUI program, so this may end up being super simple, but I can't find the solution anywhere online. Basically my problem is that when I maximize my program, all the things inside of the window (buttons, textboxes, ...
[ "c#", "windows", "user-interface" ]
6
14
7,310
5
0
2008-09-30T18:14:06.900000
2008-09-30T18:22:33.977000
154,281
154,322
Windows path searching in LoadLibrary with manifest
If you call LoadLibrary without a path (e.g., LoadLibrary("whatever.dll"), Windows will generally follow its standard search algorithm, the same one it uses to find EXEs. My question is this: suppose that an application manifest specifies specifies a particular version of a system DLL, say, comctl32.dll 6.0. In that ca...
From Microsoft: Applications can control the location from which a DLL is loaded by specifying a full path, using DLL redirection, or by using a manifest. If none of these methods are used, the system searches for the DLL at load time as described in this topic. So yes, if a manifest is present, it will directly go to ...
Windows path searching in LoadLibrary with manifest If you call LoadLibrary without a path (e.g., LoadLibrary("whatever.dll"), Windows will generally follow its standard search algorithm, the same one it uses to find EXEs. My question is this: suppose that an application manifest specifies specifies a particular versio...
TITLE: Windows path searching in LoadLibrary with manifest QUESTION: If you call LoadLibrary without a path (e.g., LoadLibrary("whatever.dll"), Windows will generally follow its standard search algorithm, the same one it uses to find EXEs. My question is this: suppose that an application manifest specifies specifies a...
[ "windows", "dll", "manifest", "loadlibrary", "side-by-side" ]
4
6
6,630
2
0
2008-09-30T18:17:12.070000
2008-09-30T18:26:07.683000
154,292
156,600
Any issues with ActiveMQ broker and clients running on different JDKs?
We have a distributed system with components (including the ActiveMQ broker) running on jdk 1.6. A potential customer would like to integrate a component that was built on jdk 1.4 with our system. While this customer is willing to write code to integrate with our system, they are not comfortable moving from jdk 1.4. Wo...
ActiveMQ 5.x works on Java 1.5 or later - any JVM 1.5 or later should work fine as ActiveMQ uses its own marshalling layer and does not rely on serialisation etc. If you want to work with Java 1.4 you'll need to either install the Retrotranslator JIT or transform the jars to 1.4 complianct bytecode with Retrotranslator...
Any issues with ActiveMQ broker and clients running on different JDKs? We have a distributed system with components (including the ActiveMQ broker) running on jdk 1.6. A potential customer would like to integrate a component that was built on jdk 1.4 with our system. While this customer is willing to write code to inte...
TITLE: Any issues with ActiveMQ broker and clients running on different JDKs? QUESTION: We have a distributed system with components (including the ActiveMQ broker) running on jdk 1.6. A potential customer would like to integrate a component that was built on jdk 1.4 with our system. While this customer is willing to ...
[ "java", "activemq-classic" ]
2
2
762
1
0
2008-09-30T18:18:59.960000
2008-10-01T07:44:05.487000
154,299
154,343
How to set working directory when debugging VB6 app?
I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. How do I set working directory for VB6?
It doesn't seems to be a "out of the box" solution for this thing. Taken from The Old Joel On Software Forums Anyways.. to put this topic to rest.. the following was my VB6 solution: I define 2 symbols in my VB project "MPDEBUG" and "MPRELEASE" and call the following function as the first operation in my apps entry poi...
How to set working directory when debugging VB6 app? I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. How do I set working directory for VB6?
TITLE: How to set working directory when debugging VB6 app? QUESTION: I am debugging a VB6 executable. The executable loads dlls and files from it's current directory, when running. When run in debugger, the current directory seems to be VB6's dir. How do I set working directory for VB6? ANSWER: It doesn't seems to b...
[ "vb6" ]
13
11
22,920
5
0
2008-09-30T18:21:17.600000
2008-09-30T18:31:27.310000
154,305
154,380
Is it possible to ScaleTransform everything on a Canvas/Grid except for 1 Control?
Given the following canvas: Is it possible to scale 1 button, but not the other when ScaleX and ScaleY changes?
Not in XAML. You can do this in code by building the reverse transform and applying it to the object you don't want transformed. If you want to go fancy, you can build a dependency property that you can attach in XAML to any object you don't want to be transformed by any parent transforms. This dependency property will...
Is it possible to ScaleTransform everything on a Canvas/Grid except for 1 Control? Given the following canvas: Is it possible to scale 1 button, but not the other when ScaleX and ScaleY changes?
TITLE: Is it possible to ScaleTransform everything on a Canvas/Grid except for 1 Control? QUESTION: Given the following canvas: Is it possible to scale 1 button, but not the other when ScaleX and ScaleY changes? ANSWER: Not in XAML. You can do this in code by building the reverse transform and applying it to the obje...
[ "wpf" ]
3
9
10,788
3
0
2008-09-30T18:23:07.813000
2008-09-30T18:39:36.293000
154,307
976,871
Why are entries in addition order in a .Net Dictionary?
I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is supposed to be a HashTable internally, so I expected things to come out in A...
If you use.NET Reflector on the 3.5 class libraries you can see that the implementation of Dictionary actually stores the items in an array (which is resized as needed), and hashes indexes into that array. When getting the keys, it completely ignores the hashtable and iterates over the array of items. For this reason, ...
Why are entries in addition order in a .Net Dictionary? I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is supposed to be a Has...
TITLE: Why are entries in addition order in a .Net Dictionary? QUESTION: I just saw this behaviour and I'm a bit surprised by it... If I add 3 or 4 elements to a Dictionary, and then do a "For Each" to get all the keys, they appear in the same order I added them. The reason this surprises me is that a Dictionary is su...
[ ".net", "data-structures", "dictionary", "hashtable" ]
24
41
4,159
11
0
2008-09-30T18:23:32.993000
2009-06-10T16:54:38.010000
154,309
154,570
How can I figure out what is holding on to unfreed objects?
One of our programs is sometimes getting an OutOfMemory error on one user's machine, but of course not when I'm testing it. I just ran it with JProfiler (on a 10 day evaluation license because I've never used it before), and filtering on our code prefix, the biggest chunk both in total size and number of instances is 8...
Dump the heap and inspect it. I'm sure there's more than one way to do this, but here is a simple one. This description is for MS Windows, but similar steps can be taken on other operating systems. Install the JDK if you don't already have it. It comes with a bunch of neat tools. Start the application. Open task manage...
How can I figure out what is holding on to unfreed objects? One of our programs is sometimes getting an OutOfMemory error on one user's machine, but of course not when I'm testing it. I just ran it with JProfiler (on a 10 day evaluation license because I've never used it before), and filtering on our code prefix, the b...
TITLE: How can I figure out what is holding on to unfreed objects? QUESTION: One of our programs is sometimes getting an OutOfMemory error on one user's machine, but of course not when I'm testing it. I just ran it with JProfiler (on a 10 day evaluation license because I've never used it before), and filtering on our ...
[ "java", "garbage-collection", "jprofiler" ]
15
20
9,762
11
0
2008-09-30T18:24:33.893000
2008-09-30T19:28:17.737000
154,314
154,510
When should one use final for method parameters and local variables?
I've found a couple of references ( for example ) that suggest using final as much as possible and I'm wondering how important that is. This is mainly in the the context of method parameters and local variables, not final methods or classes. For constants, it makes obvious sense. On one hand, the compiler can make some...
Obsess over: Final fields - Marking fields as final forces them to be set by end of construction, making that field reference immutable. This allows safe publication of fields and can avoid the need for synchronization on later reads. (Note that for an object reference, only the field reference is immutable - things th...
When should one use final for method parameters and local variables? I've found a couple of references ( for example ) that suggest using final as much as possible and I'm wondering how important that is. This is mainly in the the context of method parameters and local variables, not final methods or classes. For const...
TITLE: When should one use final for method parameters and local variables? QUESTION: I've found a couple of references ( for example ) that suggest using final as much as possible and I'm wondering how important that is. This is mainly in the the context of method parameters and local variables, not final methods or ...
[ "java", "final" ]
201
212
73,447
15
0
2008-09-30T18:25:04.330000
2008-09-30T19:14:50.687000
154,318
154,344
How can I stream an XPS document to a browser and embed it in a webpage?
I'm looking for some suggestions on how to go about this. Any input is appreciated! Currently, I have an ASP.NET MVC application. On the client, I have a link with an ID of an XPS document. When the user clicks the link, they are taken to a page with details about the document. In addition to this information, I wish t...
I think the simplest way would be to provide the document as a link (target="_blank") from the details page. This has several advantages: You don't need to retrieve and stream the entire doc unless the user asks for it. On my system at least IE is already registered as the default XPS viewer, so by giving the doc it's ...
How can I stream an XPS document to a browser and embed it in a webpage? I'm looking for some suggestions on how to go about this. Any input is appreciated! Currently, I have an ASP.NET MVC application. On the client, I have a link with an ID of an XPS document. When the user clicks the link, they are taken to a page w...
TITLE: How can I stream an XPS document to a browser and embed it in a webpage? QUESTION: I'm looking for some suggestions on how to go about this. Any input is appreciated! Currently, I have an ASP.NET MVC application. On the client, I have a link with an ID of an XPS document. When the user clicks the link, they are...
[ "asp.net", "stream", "binaryfiles", "xpsdocument" ]
5
2
5,182
2
0
2008-09-30T18:25:39.117000
2008-09-30T18:31:50.773000
154,332
313,854
How can I use mysqldump to replicate views between accounts?
I'm using mysqldump to replicate a database between accounts on a particular machine. Everything works just great, except when we get to our defined views. Because the dump includes a line like the following... /*!50013 DEFINER=`user_a`@`localhost` SQL SECURITY DEFINER */... when loading the dump into mysql on user_b w...
same problem. I solved it that way: mysqldump -uuser1 -ppassword1 database1 > backup.sql sed '/^\/\*\!50013 DEFINER/d' backup.sql > backup_without_50013.sql mysql -u user2 -ppassword2 -D database2 < backup_without_50013.sql The interesting thing is the sed command which, here, removes all lines beginning with /*!5001...
How can I use mysqldump to replicate views between accounts? I'm using mysqldump to replicate a database between accounts on a particular machine. Everything works just great, except when we get to our defined views. Because the dump includes a line like the following... /*!50013 DEFINER=`user_a`@`localhost` SQL SECURI...
TITLE: How can I use mysqldump to replicate views between accounts? QUESTION: I'm using mysqldump to replicate a database between accounts on a particular machine. Everything works just great, except when we get to our defined views. Because the dump includes a line like the following... /*!50013 DEFINER=`user_a`@`loc...
[ "mysql" ]
20
27
13,837
4
0
2008-09-30T18:29:16.723000
2008-11-24T10:43:28.087000
154,348
154,453
ubuntu trouble with SDL
I'm trying to learn to use SDL for a little game I'm writing, but I have a problem. One single application can play sound at a given time on my system. If for example I have amarok or kaffeine ( or even firefox while playing a flash video ), no other application can play sound. The only solution I've found is to run ju...
I see from your tag that you're using Ubuntu Hardy Heron (8.04). There are some audio issues with pulse audio under this version, which are known to affect flash/firefox and maybe your other applications as well. See 'Known issues' on https://wiki.ubuntu.com/PulseAudio. Workarounds of sorts do exist (see the link), but...
ubuntu trouble with SDL I'm trying to learn to use SDL for a little game I'm writing, but I have a problem. One single application can play sound at a given time on my system. If for example I have amarok or kaffeine ( or even firefox while playing a flash video ), no other application can play sound. The only solution...
TITLE: ubuntu trouble with SDL QUESTION: I'm trying to learn to use SDL for a little game I'm writing, but I have a problem. One single application can play sound at a given time on my system. If for example I have amarok or kaffeine ( or even firefox while playing a flash video ), no other application can play sound....
[ "ubuntu", "audio", "sdl", "ubuntu-8.04" ]
0
3
416
1
0
2008-09-30T18:32:21.817000
2008-09-30T18:58:21.973000
154,352
169,484
Hibernate.initialize() and second-level cache
Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentation about this. The Java doc is (as usual) sparse. Thanks!
It does. As long as second level caching is activated and that your entity is declared cacheable, then cache takes precedence when there is no explicite querying. You can follow the cache query/hit/miss by configuring the org.hibernate.cache logger.
Hibernate.initialize() and second-level cache Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentation about this. Th...
TITLE: Hibernate.initialize() and second-level cache QUESTION: Does anybody know if Hibernate's static initialize() method, which populates a proxy object, will attempt to hit the second-level cache before going to the database? My code seems to be behaving that way, and I can't seem to find anything in the documentat...
[ "java", "hibernate", "jpa" ]
3
8
3,763
1
0
2008-09-30T18:33:13.750000
2008-10-04T01:13:17.510000
154,364
154,407
Convert nmake makefile into Visual Studio 2005 project
We have some old C code here that's built with nmake. Is there an automated way to pull the Makefile into Visual Studio 2005 and create a project? Some searching on MSDN indicates VS6 could do this, but it looks like VS7/8 dropped the feature. If necessary I can build the project from scratch using the project.mak file...
Here is a link to the VS 2005 docs on the subject. It also has links to VS 2003 & 2008, which are probably the same. Edit: I would only want to do this with old code that would not change much, especially in the way of compile and link parameters, as hand editing the make file is the only way to change how the code com...
Convert nmake makefile into Visual Studio 2005 project We have some old C code here that's built with nmake. Is there an automated way to pull the Makefile into Visual Studio 2005 and create a project? Some searching on MSDN indicates VS6 could do this, but it looks like VS7/8 dropped the feature. If necessary I can bu...
TITLE: Convert nmake makefile into Visual Studio 2005 project QUESTION: We have some old C code here that's built with nmake. Is there an automated way to pull the Makefile into Visual Studio 2005 and create a project? Some searching on MSDN indicates VS6 could do this, but it looks like VS7/8 dropped the feature. If ...
[ "c", "visual-studio-2005", "nmake" ]
7
1
18,190
3
0
2008-09-30T18:35:45.163000
2008-09-30T18:47:16.227000
154,365
154,379
search 25 000 words within a text
I need to find occurrences of ~ 25 000 words within a text. What is the most suitable algorithm/library for this purpose? target language is C++
build a hashtable with the words, and scan throuhgt the text, for each word lookup in the wordtable and stuff the needed info (increment count, add to a position list, whatever).
search 25 000 words within a text I need to find occurrences of ~ 25 000 words within a text. What is the most suitable algorithm/library for this purpose? target language is C++
TITLE: search 25 000 words within a text QUESTION: I need to find occurrences of ~ 25 000 words within a text. What is the most suitable algorithm/library for this purpose? target language is C++ ANSWER: build a hashtable with the words, and scan throuhgt the text, for each word lookup in the wordtable and stuff the ...
[ "c++", "full-text-search" ]
17
12
3,873
12
0
2008-09-30T18:35:55.163000
2008-09-30T18:39:09.633000
154,369
154,386
What is the Best Way to Represent Summer Time Rules?
I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole "half of Australia"/Arizona/Navaho problem is taken care of), but I'm wondering what the most efficient schema would be to accomplish ...
You're pretty much doomed to the first option. You can pre-generate dates as far ahead as you wish for countries that have "rules" regarding time changes, but some areas do not have any rule and the changes are enacted either by dictatorial fiat or by legislative vote annually (Brazil did so until this year). This is w...
What is the Best Way to Represent Summer Time Rules? I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole "half of Australia"/Arizona/Navaho problem is taken care of), but I'm wondering w...
TITLE: What is the Best Way to Represent Summer Time Rules? QUESTION: I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole "half of Australia"/Arizona/Navaho problem is taken care of), b...
[ "database", "time", "schema", "datetime" ]
6
16
817
4
0
2008-09-30T18:36:57.577000
2008-09-30T18:42:28.923000
154,372
155,723
How to list of all the tables defined for the database when using active record?
How do I get a list of all the tables defined for the database when using active record?
Call ActiveRecord::ConnectionAdapters::SchemaStatements#tables. This method is undocumented in the MySQL adapter, but is documented in the PostgreSQL adapter. SQLite/SQLite3 also has the method implemented, but undocumented. >> ActiveRecord::Base.connection.tables => ["accounts", "assets",...] See activerecord/lib/acti...
How to list of all the tables defined for the database when using active record? How do I get a list of all the tables defined for the database when using active record?
TITLE: How to list of all the tables defined for the database when using active record? QUESTION: How do I get a list of all the tables defined for the database when using active record? ANSWER: Call ActiveRecord::ConnectionAdapters::SchemaStatements#tables. This method is undocumented in the MySQL adapter, but is do...
[ "activerecord" ]
134
278
76,051
5
0
2008-09-30T18:37:02.350000
2008-10-01T00:34:18.077000
154,387
154,470
How to draw delphi group boxes to have transparent backgrounds
I'm trying to get something very subtle to work, it looks pretty awful right now. I'm trying to paint the background of a TGroupBox which I have overloaded the paint function of so that the corners are show through to their parent object. I've got a bunch of nested group boxes that look very decent without XPThemes. Is...
I'm trying to duplicate this problem with the following steps: 1 - Set theme to Windows XP default 2 - Drop a TGroupBox on an empty form (align = alNone) 3 - Drop two TGroupBoxes inside the first one, with align = alBottom and align = alClient But visually it looks just fine for me. Can you provide some more info on ex...
How to draw delphi group boxes to have transparent backgrounds I'm trying to get something very subtle to work, it looks pretty awful right now. I'm trying to paint the background of a TGroupBox which I have overloaded the paint function of so that the corners are show through to their parent object. I've got a bunch o...
TITLE: How to draw delphi group boxes to have transparent backgrounds QUESTION: I'm trying to get something very subtle to work, it looks pretty awful right now. I'm trying to paint the background of a TGroupBox which I have overloaded the paint function of so that the corners are show through to their parent object. ...
[ "winforms", "delphi", "transparency", "vcl" ]
3
1
3,922
4
0
2008-09-30T18:43:02.790000
2008-09-30T19:02:02.167000
154,396
154,436
.NET Framework platform support tradition
From the first days the.NET framework came out there was a minimum OS support:.NET 1.0 - Windows NT or higher (Windows 98/ME are also supported).NET 2.0 - Windows 2000 or higher (Windows 98/ME are also supported).NET 3.0 - Windows XP or higher.NET 3.5 - Windows XP or higher This minimum OS support made possible to igno...
Microsoft is obviously pushing towards a Vista-centric development environment. It's not just because of the obvious 'we need to make money' reason, but also because Vista is where the cool new APIs are sprouting. To be fair, it's been always been like that with the Windows API, and it will probably be like that with.N...
.NET Framework platform support tradition From the first days the.NET framework came out there was a minimum OS support:.NET 1.0 - Windows NT or higher (Windows 98/ME are also supported).NET 2.0 - Windows 2000 or higher (Windows 98/ME are also supported).NET 3.0 - Windows XP or higher.NET 3.5 - Windows XP or higher Thi...
TITLE: .NET Framework platform support tradition QUESTION: From the first days the.NET framework came out there was a minimum OS support:.NET 1.0 - Windows NT or higher (Windows 98/ME are also supported).NET 2.0 - Windows 2000 or higher (Windows 98/ME are also supported).NET 3.0 - Windows XP or higher.NET 3.5 - Window...
[ ".net", ".net-3.5", "compatibility" ]
2
1
830
6
0
2008-09-30T18:44:33.113000
2008-09-30T18:54:32.450000
154,408
154,917
Visio VBA function to see if there's a shape in front of/behind a shape
Is there a way in Visio VBA to see if there is a shape in front of or behind a shape in Visio? I imagine I could write something that checks the bounding box of each shape in a page to see if it occupies the same space as my shape. I'd rather use something built-in since checking each shape could take a long time as a ...
The Shape.SpatialRelation property will tell you if two shapes touch. The Shape.Index property will tell you which is in front or behind in the z-order. Here is a simple example: Public Sub DoShapesIntersect(ByRef shape1 As Visio.Shape, ByRef shape2 As Visio.Shape) '// do they touch? If (shape1.SpatialRelation(shape2,...
Visio VBA function to see if there's a shape in front of/behind a shape Is there a way in Visio VBA to see if there is a shape in front of or behind a shape in Visio? I imagine I could write something that checks the bounding box of each shape in a page to see if it occupies the same space as my shape. I'd rather use s...
TITLE: Visio VBA function to see if there's a shape in front of/behind a shape QUESTION: Is there a way in Visio VBA to see if there is a shape in front of or behind a shape in Visio? I imagine I could write something that checks the bounding box of each shape in a page to see if it occupies the same space as my shape...
[ "vba", "visio", "shapes" ]
4
4
2,824
1
0
2008-09-30T18:47:23.730000
2008-09-30T20:30:03.657000
154,411
157,129
How do I get Team Build to run MbUnit tests?
I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:......... But I have yet to get the tests to run.
Above suggestion didn't help me a lot, but I found some documentation for Team Build and adjusted my build script to override the AfterCompile target: (EDIT: Now that I have a better understanding of Team Build, I have added some more to the test runner. It will now update the Build Explorer/Build monitor with build st...
How do I get Team Build to run MbUnit tests? I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:......... But I have yet to get the tests to run.
TITLE: How do I get Team Build to run MbUnit tests? QUESTION: I am having trouble getting Team Build to execute my MbUnit unit tests. I have tried to edit TFSBuild.proj and added the following parts:......... But I have yet to get the tests to run. ANSWER: Above suggestion didn't help me a lot, but I found some docum...
[ "tfs", "msbuild", "mbunit", "tfsbuild" ]
0
1
1,519
3
0
2008-09-30T18:47:30.767000
2008-10-01T11:06:38.400000
154,427
234,380
JQuery Datepicker returned Date object type
What's the object type returned by Datepicker? Supposing I have the following: $("#txtbox").datepicker({ onClose: function(date){ //something } }); What is date? I'm interested in reading the date object from another Datepicker for comparison, something like: function(date){ oDate = $("#oDP").datepicker("getDate"); if(...
I just downloaded the source from here and noticed (ex line 600) the author is using.getTime() to compare dates, have you tried that? if (oDate.getTime() > date.getTime()) {... } Also this is tangential but you mention you tried oDate.toString() while I noticed in the examples the author is using.asString()
JQuery Datepicker returned Date object type What's the object type returned by Datepicker? Supposing I have the following: $("#txtbox").datepicker({ onClose: function(date){ //something } }); What is date? I'm interested in reading the date object from another Datepicker for comparison, something like: function(date){ ...
TITLE: JQuery Datepicker returned Date object type QUESTION: What's the object type returned by Datepicker? Supposing I have the following: $("#txtbox").datepicker({ onClose: function(date){ //something } }); What is date? I'm interested in reading the date object from another Datepicker for comparison, something like...
[ "jquery", "datepicker" ]
4
7
36,111
4
0
2008-09-30T18:52:47.400000
2008-10-24T16:58:06.443000
154,430
154,687
Persistent storage of encrypted data using .Net
I need to store encrypted data (few small strings) between application runs. I do not want the user to provide a passphrase every time (s)he launches the application. I.e. after all it goes down to storing securely the encryption key(s). I was looking into RSACryptoServiceProvider and using PersistentKeyInCsp, but I'm ...
The Data Protection API (DPAPI) does exactly what you want. It provides symmetric encryption of arbitrary data, using the credentials of the machine or (better) the user, as the encryption key. You don't have to worry about managing the keys; Windows takes care of that for you. If the user changes his password, Windows...
Persistent storage of encrypted data using .Net I need to store encrypted data (few small strings) between application runs. I do not want the user to provide a passphrase every time (s)he launches the application. I.e. after all it goes down to storing securely the encryption key(s). I was looking into RSACryptoServic...
TITLE: Persistent storage of encrypted data using .Net QUESTION: I need to store encrypted data (few small strings) between application runs. I do not want the user to provide a passphrase every time (s)he launches the application. I.e. after all it goes down to storing securely the encryption key(s). I was looking in...
[ "c#", "encryption", "dns", "roaming" ]
19
38
9,226
2
0
2008-09-30T18:53:59.283000
2008-09-30T19:53:41.763000
154,434
154,439
Getting Excel to refresh data on sheet from within VBA
How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?
The following lines will do the trick: ActiveSheet.EnableCalculation = False ActiveSheet.EnableCalculation = True Edit: The.Calculate() method will not work for all functions. I tested it on a sheet with add-in array functions. The production sheet I'm using is complex enough that I don't want to test the.CalculateFull...
Getting Excel to refresh data on sheet from within VBA How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value?
TITLE: Getting Excel to refresh data on sheet from within VBA QUESTION: How do you get spreadsheet data in Excel to recalculate itself from within VBA, without the kluge of just changing a cell value? ANSWER: The following lines will do the trick: ActiveSheet.EnableCalculation = False ActiveSheet.EnableCalculation = ...
[ "vba", "excel" ]
52
65
501,654
6
0
2008-09-30T18:54:25.290000
2008-09-30T18:54:58.970000
154,441
154,641
Set up an HTTP proxy to insert a header
I need to test some HTTP interaction with a client I'd rather not modify. What I need to test is the behavior of the server when the client's requests include a certain, static header. I'm thinking the easiest way to run this test is to set up an HTTP proxy that inserts the header on every request. What would be the si...
I do something like this in my development environment by configuring Apache on port 80 as a proxy for my application server on port 8080, with the following Apache config: NameVirtualHost * Allow from all ProxyPass http://127.0.0.1:8080/myapp ProxyPassReverse http://127.0.0.1:8080/myapp Header add myheader "myvalue" R...
Set up an HTTP proxy to insert a header I need to test some HTTP interaction with a client I'd rather not modify. What I need to test is the behavior of the server when the client's requests include a certain, static header. I'm thinking the easiest way to run this test is to set up an HTTP proxy that inserts the heade...
TITLE: Set up an HTTP proxy to insert a header QUESTION: I need to test some HTTP interaction with a client I'd rather not modify. What I need to test is the behavior of the server when the client's requests include a certain, static header. I'm thinking the easiest way to run this test is to set up an HTTP proxy that...
[ "apache", "proxy", "http-headers", "proxypass" ]
61
89
139,534
7
0
2008-09-30T18:55:33.663000
2008-09-30T19:44:08.773000
154,443
154,617
How to avoid .pyc files?
Can I run the python interpreter without generating the compiled.pyc files?
From "What’s New in Python 2.6 - Interpreter Changes": Python can now be prevented from writing.pyc or.pyo files by supplying the -B switch to the Python interpreter, or by setting the PYTHONDONTWRITEBYTECODE environment variable before running the interpreter. This setting is available to Python programs as the sys.do...
How to avoid .pyc files? Can I run the python interpreter without generating the compiled.pyc files?
TITLE: How to avoid .pyc files? QUESTION: Can I run the python interpreter without generating the compiled.pyc files? ANSWER: From "What’s New in Python 2.6 - Interpreter Changes": Python can now be prevented from writing.pyc or.pyo files by supplying the -B switch to the Python interpreter, or by setting the PYTHOND...
[ "python" ]
299
315
152,624
10
0
2008-09-30T18:55:59.263000
2008-09-30T19:38:02.283000
154,446
154,461
Help someone new to C# variables
I am trying to save data to a database on a button push, but the variables seem to be private by the nature of where they are defined. I have tried to move where they are defined, but this seems to produce other errors. Given a fix, why was it fixed that way? The code follows. namespace enable { public partial class Fo...
You're declaring dTable and adapter in the constructor, so it goes out of scope as soon as the constructor is completed. You want to move the variable declarations out into the main class, like: public partial class Form1: Form { private DataTable dTable; private OleDbDataAdapter adapter; Public Form1() {... your setu...
Help someone new to C# variables I am trying to save data to a database on a button push, but the variables seem to be private by the nature of where they are defined. I have tried to move where they are defined, but this seems to produce other errors. Given a fix, why was it fixed that way? The code follows. namespace...
TITLE: Help someone new to C# variables QUESTION: I am trying to save data to a database on a button push, but the variables seem to be private by the nature of where they are defined. I have tried to move where they are defined, but this seems to produce other errors. Given a fix, why was it fixed that way? The code ...
[ "c#", "variables" ]
2
10
1,018
5
0
2008-09-30T18:57:25.283000
2008-09-30T19:01:04.073000
154,469
154,482
Why should you prefer unnamed namespaces over static functions?
A feature of C++ is the ability to create unnamed (anonymous) namespaces, like so: namespace { int cannotAccessOutsideThisFile() {... } } // namespace You would think that such a feature would be useless -- since you can't specify the name of the namespace, it's impossible to access anything within it from outside. But...
The C++ Standard reads in section 7.3.1.1 Unnamed namespaces, paragraph 2: The use of the static keyword is deprecated when declaring objects in a namespace scope, the unnamed-namespace provides a superior alternative. Static only applies to names of objects, functions, and anonymous unions, not to type declarations. E...
Why should you prefer unnamed namespaces over static functions? A feature of C++ is the ability to create unnamed (anonymous) namespaces, like so: namespace { int cannotAccessOutsideThisFile() {... } } // namespace You would think that such a feature would be useless -- since you can't specify the name of the namespace...
TITLE: Why should you prefer unnamed namespaces over static functions? QUESTION: A feature of C++ is the ability to create unnamed (anonymous) namespaces, like so: namespace { int cannotAccessOutsideThisFile() {... } } // namespace You would think that such a feature would be useless -- since you can't specify the nam...
[ "c++", "static", "namespaces", "unnamed-namespace" ]
682
430
331,820
11
0
2008-09-30T19:02:00.437000
2008-09-30T19:06:19.613000
154,485
155,104
How to test SqlServer connection without opening a database
The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class has a 'Open' member which tries to open the database you'd set in the Database p...
Connect to temp db. Everybody has accecss to tempdb so you will be able to authenticate yourself for access. Later when you know the actual database, you can change this property to connect to the db you want.
How to test SqlServer connection without opening a database The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class has a 'Open' member ...
TITLE: How to test SqlServer connection without opening a database QUESTION: The title pretty much says it all. I want to create a SqlConnection and then check that connection without opening a database, cause at that point I don't know yet where will I connect to. Is it possible to do that? The SqlConnection class ha...
[ ".net", "sql", "sql-server", "sqlconnection" ]
6
11
18,684
5
0
2008-09-30T19:08:02.807000
2008-09-30T21:09:04.420000
154,489
154,524
Are static indexers not supported in C#?
I've been trying this a few different ways, but I'm reaching the conclusion that it can't be done. It's a language feature I've enjoyed from other languages in the past. Is it just something I should just write off?
No, static indexers aren't supported in C#. Unlike other answers, however, I see how there could easily be point in having them. Consider: Encoding x = Encoding[28591]; // Equivalent to Encoding.GetEncoding(28591) Encoding y = Encoding["Foo"]; // Equivalent to Encoding.GetEncoding("Foo") It would be relatively rarely u...
Are static indexers not supported in C#? I've been trying this a few different ways, but I'm reaching the conclusion that it can't be done. It's a language feature I've enjoyed from other languages in the past. Is it just something I should just write off?
TITLE: Are static indexers not supported in C#? QUESTION: I've been trying this a few different ways, but I'm reaching the conclusion that it can't be done. It's a language feature I've enjoyed from other languages in the past. Is it just something I should just write off? ANSWER: No, static indexers aren't supported...
[ "c#", ".net", "clr" ]
36
60
8,772
3
0
2008-09-30T19:09:55.127000
2008-09-30T19:18:52.563000
154,502
154,512
Color differences between images and html
I'm having issues with color matching css background colors with colors in images on the same html page. What gives?
I'm guessing that you use a PNG image? This is a gamma correction “feature”. Mark Ransom has posted a useful text about this. Notice that the pngcrush solution listed somewhere hasn't worked for me.
Color differences between images and html I'm having issues with color matching css background colors with colors in images on the same html page. What gives?
TITLE: Color differences between images and html QUESTION: I'm having issues with color matching css background colors with colors in images on the same html page. What gives? ANSWER: I'm guessing that you use a PNG image? This is a gamma correction “feature”. Mark Ransom has posted a useful text about this. Notice t...
[ "html", "css", "png", "cross-browser", "color-management" ]
5
8
3,635
6
0
2008-09-30T19:12:27.320000
2008-09-30T19:15:07.610000
154,504
1,060,238
Is timsort general-purpose or Python-specific?
Timsort is an adaptive, stable, natural mergesort. It has supernatural performance on many kinds of partially ordered arrays (less than lg(N!) comparisons needed, and as few as N-1), yet as fast as Python's previous highly tuned samplesort hybrid on random arrays. Have you seen timsort used outside of CPython? Does it ...
Yes, it makes quite a bit of sense to use timsort outside of CPython, in specific, or Python, in general. There is currently an effort underway to replace Java's "modified merge sort" with timsort, and the initial results are quite positive.
Is timsort general-purpose or Python-specific? Timsort is an adaptive, stable, natural mergesort. It has supernatural performance on many kinds of partially ordered arrays (less than lg(N!) comparisons needed, and as few as N-1), yet as fast as Python's previous highly tuned samplesort hybrid on random arrays. Have you...
TITLE: Is timsort general-purpose or Python-specific? QUESTION: Timsort is an adaptive, stable, natural mergesort. It has supernatural performance on many kinds of partially ordered arrays (less than lg(N!) comparisons needed, and as few as N-1), yet as fast as Python's previous highly tuned samplesort hybrid on rando...
[ "python", "algorithm", "sorting" ]
33
32
8,666
7
0
2008-09-30T19:12:46.680000
2009-06-29T20:09:52.003000
154,533
263,956
Best way to bind WPF properties to ApplicationSettings in C#?
What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Application? Similar to this question, how (and is it possible to) do you do the same thing in WPF?
You can directly bind to the static object created by Visual Studio. In your windows declaration add: xmlns:p="clr-namespace:UserSettings.Properties" where UserSettings is the application namespace. Then you can add a binding to the correct setting: Now you can save the settings, per example when you close your applica...
Best way to bind WPF properties to ApplicationSettings in C#? What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Application? Similar to this question, how (and is it possible to) do you do the same thing in WPF?
TITLE: Best way to bind WPF properties to ApplicationSettings in C#? QUESTION: What is the best way to bind WPF properties to ApplicationSettings in C#? Is there an automatic way like in a Windows Forms Application? Similar to this question, how (and is it possible to) do you do the same thing in WPF? ANSWER: You can...
[ "c#", ".net", "wpf", "visual-studio" ]
51
108
37,467
7
0
2008-09-30T19:20:29.080000
2008-11-05T00:08:07.227000
154,535
163,699
How do I ensure Visual Studio 2005 displays the tables and images correctly?
I have used Photoshop CS2's "Save for Web" feature to create a table of images for my site layout. This HTML appears fine in a web browser, however when imported into Visual Studio and viewed in the site designer, the metrics are wrong and there are horizontal gaps between images (table cells). The output from Photosho...
Personally i have never trusted and rarely use the design view in Visual studio and generally have it set to the code view for all pages. I tend to keep working versions of files open in IE and Firefox to enable me to see their layout however this can cause issues when trying to view multi-step forms etc. In these case...
How do I ensure Visual Studio 2005 displays the tables and images correctly? I have used Photoshop CS2's "Save for Web" feature to create a table of images for my site layout. This HTML appears fine in a web browser, however when imported into Visual Studio and viewed in the site designer, the metrics are wrong and the...
TITLE: How do I ensure Visual Studio 2005 displays the tables and images correctly? QUESTION: I have used Photoshop CS2's "Save for Web" feature to create a table of images for my site layout. This HTML appears fine in a web browser, however when imported into Visual Studio and viewed in the site designer, the metrics...
[ "asp.net", "html", "visual-studio", "designer", "photoshop" ]
0
0
515
3
0
2008-09-30T19:21:17.970000
2008-10-02T17:57:09.560000
154,538
155,055
How can I disable copy / paste in Flex Text controls?
Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Text control? Thanks.
You could use the Text control and set the selectable property to false...
How can I disable copy / paste in Flex Text controls? Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Text control? Thanks.
TITLE: How can I disable copy / paste in Flex Text controls? QUESTION: Long story short, I need to put some text in my Flex application and I don't want users to be able to copy. I was going to use a label, but apparently labels do not support text wrapping. Can I make it so that users cannot select text in a Flex Tex...
[ "apache-flex", "actionscript-3" ]
3
6
4,527
3
0
2008-09-30T19:21:46.643000
2008-09-30T20:54:20.447000
154,542
154,560
How important is it to make your website layout fit on low-res displays?
How important is it to make a website layout fit on 640 x 480 and 800 x 600 displays? For some time I have been designing with the assumption of at least 1024 x 768, but I haven't been doing it professionally (just on my site which is just a blog that only 10-15 friends read). Does anyone have any non-anecdotal statist...
I think the general assumption these days is that 1024x768 is acceptable, thats certainly the route I take. A good benchmark is to look at big sites like the BBC, they recently switched to a 1024x768 design. Thats not to say every site has to be that, for smaller sites I often stick to 800x600 just so the content doesn...
How important is it to make your website layout fit on low-res displays? How important is it to make a website layout fit on 640 x 480 and 800 x 600 displays? For some time I have been designing with the assumption of at least 1024 x 768, but I haven't been doing it professionally (just on my site which is just a blog ...
TITLE: How important is it to make your website layout fit on low-res displays? QUESTION: How important is it to make a website layout fit on 640 x 480 and 800 x 600 displays? For some time I have been designing with the assumption of at least 1024 x 768, but I haven't been doing it professionally (just on my site whi...
[ "user-interface" ]
11
9
1,443
18
0
2008-09-30T19:23:00.883000
2008-09-30T19:26:41.920000
154,543
2,356,477
Panel.Dock Fill ignoring other Panel.Dock setting
If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing.
Docking layout depends on the order of sibling controls. Controls are docked "bottom up", so the last control in the collection is docked first. A docked control only take the layout of previously docked siblings into account. Hence the control with Dock=Fill should be first (top) in the sibling order, if you want it t...
Panel.Dock Fill ignoring other Panel.Dock setting If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing.
TITLE: Panel.Dock Fill ignoring other Panel.Dock setting QUESTION: If you create a panel on a form and set it to Dock=Top and drop another panel and set its Dock=Fill, it may fill the entire form, ignoring the first panel. Changing the tab order does nothing. ANSWER: Docking layout depends on the order of sibling con...
[ "c#", ".net", "winforms", "visual-studio-2005" ]
174
383
110,520
10
0
2008-09-30T19:23:17.483000
2010-03-01T14:36:56.907000
154,547
156,115
Control for getting hotkeys like tab and space
I have a dialog box that allows users to set hotkeys for use in a 3d program on windows. I'm using CHotKeyCtrl, which is pretty good, but doesn't handle some keys that the users would like to use - specifically, tab and space. The hotkey handling is smart enough to be able to fire on those keys, I just need a UI to let...
One workarounds option would be to use a stock standard edit control with a message hook function. This would allow you to trap the keyboard WM_KEYDOWN messages sent to that edit control. The hook function would look something like this: LRESULT CALLBACK MessageHook(int code, WPARAM wParam, LPMSG lpMsg) { LRESULT lResu...
Control for getting hotkeys like tab and space I have a dialog box that allows users to set hotkeys for use in a 3d program on windows. I'm using CHotKeyCtrl, which is pretty good, but doesn't handle some keys that the users would like to use - specifically, tab and space. The hotkey handling is smart enough to be able...
TITLE: Control for getting hotkeys like tab and space QUESTION: I have a dialog box that allows users to set hotkeys for use in a 3d program on windows. I'm using CHotKeyCtrl, which is pretty good, but doesn't handle some keys that the users would like to use - specifically, tab and space. The hotkey handling is smart...
[ "c++", "mfc", "user-interface", "hotkeys" ]
1
1
726
1
0
2008-09-30T19:24:16.997000
2008-10-01T03:23:42.243000
154,549
154,579
Migrate SQL2000 Database to SQL2005 on another machine
I've been beating myself over the head with this app migration for a few days now. What I have is an old MSSQL Server 2000-backed application that is being upgraded to a Windows 2003 Server running SMSQL Server 2005. I know little about SQL Server but obviously not enough. I tried backing up the database on the old ser...
The backup file has the "hard" location of the data files stored in it. You just need to update them: When you restore in 2005, before you click the final "ok" to restore (after you have selected the.bak file), go to the options tab. This will have the mdf and ldf locations that were in the backup file. Change these to...
Migrate SQL2000 Database to SQL2005 on another machine I've been beating myself over the head with this app migration for a few days now. What I have is an old MSSQL Server 2000-backed application that is being upgraded to a Windows 2003 Server running SMSQL Server 2005. I know little about SQL Server but obviously not...
TITLE: Migrate SQL2000 Database to SQL2005 on another machine QUESTION: I've been beating myself over the head with this app migration for a few days now. What I have is an old MSSQL Server 2000-backed application that is being upgraded to a Windows 2003 Server running SMSQL Server 2005. I know little about SQL Server...
[ "sql-server", "database-migration" ]
2
5
9,633
4
0
2008-09-30T19:24:54.797000
2008-09-30T19:29:19.947000
154,551
154,803
Volatile vs. Interlocked vs. lock
Let's say that a class has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, which approach should be used, and why? lock(this.locker) this.counter++;, Interlocked.Increment(ref this.counter);, Change the access modifier of counter to ...
Worst (won't actually work) Change the access modifier of counter to public volatile As other people have mentioned, this on its own isn't actually safe at all. The point of volatile is that multiple threads running on multiple CPUs can and will cache data and re-order instructions. If it is not volatile, and CPU A inc...
Volatile vs. Interlocked vs. lock Let's say that a class has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, which approach should be used, and why? lock(this.locker) this.counter++;, Interlocked.Increment(ref this.counter);, Change ...
TITLE: Volatile vs. Interlocked vs. lock QUESTION: Let's say that a class has a public int counter field that is accessed by multiple threads. This int is only incremented or decremented. To increment this field, which approach should be used, and why? lock(this.locker) this.counter++;, Interlocked.Increment(ref this....
[ "c#", "multithreading", "locking", "volatile", "interlocked" ]
781
994
170,130
10
0
2008-09-30T19:25:06.760000
2008-09-30T20:13:08.237000
154,563
154,580
splitting files for P2P application
I have to implement a middleware system for file sharing, and it has to split the files not unlike what happens on bittorrent, where it sends and receives separate pieces simultaneously from varios sources. How do i do that? Is it a library or i have to implement the file splitting myself?
Split the files into blocks let's say of 100KB each. Then calculate a SHA hash (or some other hashing algorithm) on each of the blocks. so if the file is 905KB, you would have 10 such hashes calculated. The server would contain a hash definition file for each file that it serves. This hash definition file would contain...
splitting files for P2P application I have to implement a middleware system for file sharing, and it has to split the files not unlike what happens on bittorrent, where it sends and receives separate pieces simultaneously from varios sources. How do i do that? Is it a library or i have to implement the file splitting m...
TITLE: splitting files for P2P application QUESTION: I have to implement a middleware system for file sharing, and it has to split the files not unlike what happens on bittorrent, where it sends and receives separate pieces simultaneously from varios sources. How do i do that? Is it a library or i have to implement th...
[ "file", "p2p", "split" ]
2
4
505
4
0
2008-09-30T19:27:00.640000
2008-09-30T19:29:27.530000
154,577
154,939
Polymorphism vs Overriding vs Overloading
In terms of Java, when someone asks: what is polymorphism? Would overloading or overriding be an acceptable answer? I think there is a bit more to it than that. IF you had a abstract base class that defined a method with no implementation, and you defined that method in the sub class, is that still overridding? I think...
The clearest way to express polymorphism is via an abstract base class (or interface) public abstract class Human{... public abstract void goPee(); } This class is abstract because the goPee() method is not definable for Humans. It is only definable for the subclasses Male and Female. Also, Human is an abstract concept...
Polymorphism vs Overriding vs Overloading In terms of Java, when someone asks: what is polymorphism? Would overloading or overriding be an acceptable answer? I think there is a bit more to it than that. IF you had a abstract base class that defined a method with no implementation, and you defined that method in the sub...
TITLE: Polymorphism vs Overriding vs Overloading QUESTION: In terms of Java, when someone asks: what is polymorphism? Would overloading or overriding be an acceptable answer? I think there is a bit more to it than that. IF you had a abstract base class that defined a method with no implementation, and you defined that...
[ "java", "oop", "polymorphism", "overloading", "overriding" ]
377
950
311,512
21
0
2008-09-30T19:29:02.460000
2008-09-30T20:33:51.040000
154,591
154,614
How to alter a column and a computed column
In SQL SERVER DB, I need to alter a column baseColumn and a computed column upperBaseColumn. The upperBaseColumn has index on it. This is how the table looks create table testTable (baseColumn varchar(10), upperBaseColumn AS (upper(baseColumn)) create index idxUpperBaseColumn ON testTable (upperBaseColumn) Now I need ...
I suggest you drop the index, then drop the computed column. Alter the size, then re-add the computed column and the index. Using your example.... create table testTable (baseColumn varchar(10), upperBaseColumn AS (upper(baseColumn))) create index idxUpperBaseColumn ON testTable (upperBaseColumn) Drop Index TestTable....
How to alter a column and a computed column In SQL SERVER DB, I need to alter a column baseColumn and a computed column upperBaseColumn. The upperBaseColumn has index on it. This is how the table looks create table testTable (baseColumn varchar(10), upperBaseColumn AS (upper(baseColumn)) create index idxUpperBaseColum...
TITLE: How to alter a column and a computed column QUESTION: In SQL SERVER DB, I need to alter a column baseColumn and a computed column upperBaseColumn. The upperBaseColumn has index on it. This is how the table looks create table testTable (baseColumn varchar(10), upperBaseColumn AS (upper(baseColumn)) create index...
[ "sql", "sql-server" ]
5
8
7,434
1
0
2008-09-30T19:32:54.057000
2008-09-30T19:37:41.737000
154,592
155,184
Python module for wiki markup
Is there a Python module for converting wiki markup to other languages (e.g. HTML )? A similar question was asked here, What's the easiest way to convert wiki markup to html, but no Python modules are mentioned. Just curious.:) Cheers.
Django uses the following libraries for markup: Markdown Textile reStructuredText You can see how they're used in Django.
Python module for wiki markup Is there a Python module for converting wiki markup to other languages (e.g. HTML )? A similar question was asked here, What's the easiest way to convert wiki markup to html, but no Python modules are mentioned. Just curious.:) Cheers.
TITLE: Python module for wiki markup QUESTION: Is there a Python module for converting wiki markup to other languages (e.g. HTML )? A similar question was asked here, What's the easiest way to convert wiki markup to html, but no Python modules are mentioned. Just curious.:) Cheers. ANSWER: Django uses the following l...
[ "python", "wiki", "markup" ]
30
9
16,361
4
0
2008-09-30T19:32:59.800000
2008-09-30T21:31:36.770000
154,597
154,792
Is there a way to define an action for unhandled exceptions in a WinForms .NET 3.5 app?
Note, I realize that this has been addressed here. That post discusses exception handling in.NET 1.1 while implying that there is a better solution for >.NET 2.0 so this question is specifically about the more recent.NET versions. I have a windows forms application which is expected to frequently and unexpectedly lose ...
For Windows Forms threads (which call Application.Run()), assign a ThreadException handler at the beginning of Main(). Also, I found it was necessary to call SetUnhandledExceptionMode: Application.SetUnhandledExceptionMode(UnhandledExceptionMode.Automatic); Application.ThreadException += ShowUnhandledException; Applica...
Is there a way to define an action for unhandled exceptions in a WinForms .NET 3.5 app? Note, I realize that this has been addressed here. That post discusses exception handling in.NET 1.1 while implying that there is a better solution for >.NET 2.0 so this question is specifically about the more recent.NET versions. I...
TITLE: Is there a way to define an action for unhandled exceptions in a WinForms .NET 3.5 app? QUESTION: Note, I realize that this has been addressed here. That post discusses exception handling in.NET 1.1 while implying that there is a better solution for >.NET 2.0 so this question is specifically about the more rece...
[ "c#", ".net", "exception" ]
2
0
694
5
0
2008-09-30T19:33:34.930000
2008-09-30T20:11:45.727000
154,598
155,403
Implementing a replacement for Ruby's IO.popen() and system()
IO.popen() and system() in Ruby is sorely lacking several useful features, such as: obtaining the return value of the function capturing both stdout and stderr (seperately and merged) running without spawning an extra cmd.exe or /bin/sh process Python has a module "subprocess" which I was thinking about using as inspir...
Take a look at the standard Ruby library open3. This will give you access to stdin, stdout and stderr. There is also an external project called open4, which allows you to get the exit status without using a magic variable name.
Implementing a replacement for Ruby's IO.popen() and system() IO.popen() and system() in Ruby is sorely lacking several useful features, such as: obtaining the return value of the function capturing both stdout and stderr (seperately and merged) running without spawning an extra cmd.exe or /bin/sh process Python has a ...
TITLE: Implementing a replacement for Ruby's IO.popen() and system() QUESTION: IO.popen() and system() in Ruby is sorely lacking several useful features, such as: obtaining the return value of the function capturing both stdout and stderr (seperately and merged) running without spawning an extra cmd.exe or /bin/sh pro...
[ "ruby" ]
12
9
4,277
3
0
2008-09-30T19:34:20.607000
2008-09-30T22:36:23.353000
154,625
155,044
${1:+"$@"} in /bin/sh
I've noticed that sometimes wrapper scripts will use ${1:+"$@"} for the parameters rather than just "$@". For example, http://svn.macosforge.org/repository/macports/trunk/dports/editors/vim-app/files/gvim.sh uses exec "$binary" $opts ${1:+"$@"} Can anyone break ${1:+"$@"} down into English and explain why it would be a...
'Hysterical Raisins', aka Historical Reasons. The explanation from JesperE (or the Bash man page on shell parameter expansion ) is accurate for what it does: If $1 exists and is not an empty string, then substitute the quoted list of arguments. Once upon 20 or so years ago, some broken minor variants of the Bourne Shel...
${1:+"$@"} in /bin/sh I've noticed that sometimes wrapper scripts will use ${1:+"$@"} for the parameters rather than just "$@". For example, http://svn.macosforge.org/repository/macports/trunk/dports/editors/vim-app/files/gvim.sh uses exec "$binary" $opts ${1:+"$@"} Can anyone break ${1:+"$@"} down into English and exp...
TITLE: ${1:+"$@"} in /bin/sh QUESTION: I've noticed that sometimes wrapper scripts will use ${1:+"$@"} for the parameters rather than just "$@". For example, http://svn.macosforge.org/repository/macports/trunk/dports/editors/vim-app/files/gvim.sh uses exec "$binary" $opts ${1:+"$@"} Can anyone break ${1:+"$@"} down in...
[ "shell" ]
32
30
14,555
4
0
2008-09-30T19:41:08.390000
2008-09-30T20:50:37.663000
154,636
155,237
Embedding the Java h2 database programmatically
At the moment we use HSQLDB as an embedded database, but we search for a database with less memory footprint as the data volume grows. Derby / JavaDB is not an option at the moment because it stores properties globally in the system properties. So we thought of h2. While we used HSQLDB we created a Server-object, set t...
From the download, I see that the file tutorial.html has this import org.h2.tools.Server;... // start the TCP Server Server server = Server.createTcpServer(args).start();... // stop the TCP Server server.stop();
Embedding the Java h2 database programmatically At the moment we use HSQLDB as an embedded database, but we search for a database with less memory footprint as the data volume grows. Derby / JavaDB is not an option at the moment because it stores properties globally in the system properties. So we thought of h2. While ...
TITLE: Embedding the Java h2 database programmatically QUESTION: At the moment we use HSQLDB as an embedded database, but we search for a database with less memory footprint as the data volume grows. Derby / JavaDB is not an option at the moment because it stores properties globally in the system properties. So we tho...
[ "java", "database", "embedding", "h2" ]
33
25
69,203
3
0
2008-09-30T19:43:26.840000
2008-09-30T21:46:58.883000
154,652
155,555
Tips/Tricks for DataFlex
Is anyone out there still using DataFlex? If so, what are you favorite tips and tricks for this venerable 4GL?
It all depends on the version of DF you're using, but here's a couple: Do not use "While" when traversing record sets. Always use repeat. (see example at bottom) The dataflex newsgroups (news.dataaccess.com) is the best place to ask questions. Other useful sites include http://sture.dk/wasp and http://www.vdf-guidance....
Tips/Tricks for DataFlex Is anyone out there still using DataFlex? If so, what are you favorite tips and tricks for this venerable 4GL?
TITLE: Tips/Tricks for DataFlex QUESTION: Is anyone out there still using DataFlex? If so, what are you favorite tips and tricks for this venerable 4GL? ANSWER: It all depends on the version of DF you're using, but here's a couple: Do not use "While" when traversing record sets. Always use repeat. (see example at bot...
[ "dataflex" ]
1
4
3,741
7
0
2008-09-30T19:46:18.160000
2008-09-30T23:20:36.570000
154,655
154,684
Question about XMLTextWriters and Streams
We have a VXML project that a 3rd party parses to provide us with a phone navigation system. We require them to enter an id code to leave a message, which is later reviewed by our company. We currently have this working as follows: Response.Cache.SetCacheability(HttpCacheability.NoCache); Stream m = new MemoryStream();...
Yes, just write directly to the Response Output (IO.StreamWriter) or OutputStream (IO.Stream): XmlTextWriter XML_Writer = new XmlTextWriter(HttpContext.Current.Response.OutputStream, HttpContext.Current.Response.Encoding); //... XML_Writer.Flush();
Question about XMLTextWriters and Streams We have a VXML project that a 3rd party parses to provide us with a phone navigation system. We require them to enter an id code to leave a message, which is later reviewed by our company. We currently have this working as follows: Response.Cache.SetCacheability(HttpCacheabilit...
TITLE: Question about XMLTextWriters and Streams QUESTION: We have a VXML project that a 3rd party parses to provide us with a phone navigation system. We require them to enter an id code to leave a message, which is later reviewed by our company. We currently have this working as follows: Response.Cache.SetCacheabili...
[ "asp.net", "stream", "xmltextwriter" ]
1
1
1,745
3
0
2008-09-30T19:46:54.460000
2008-09-30T19:53:27.707000
154,680
154,710
LINQ query with multiple aggregates
How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type = "In" THEN p.PunchTime ELSE NULL END ) AS EarliestIn, MAX(CASE WHEN p.type = "Out" THEN p.PunchTime ELSE NULL END ) AS LatestOUt FROM Punches p
You can't efficiently select multiple aggregates in vanilla LINQ to Objects. You can perform multiple queries, of course, but that may well be inefficient depending on your data source. I have a framework which copes with this which I call "Push LINQ" - it's only a hobby (for me and Marc Gravell) but we believe it work...
LINQ query with multiple aggregates How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type = "In" THEN p.PunchTime ELSE NULL END ) AS EarliestIn, MAX(CASE WHEN p.type = "Out" THEN p.PunchTime ELSE NULL END ) AS LatestOUt FROM Punches p
TITLE: LINQ query with multiple aggregates QUESTION: How would I create the equivalent Linq To Objects query? SELECT MIN(CASE WHEN p.type = "In" THEN p.PunchTime ELSE NULL END ) AS EarliestIn, MAX(CASE WHEN p.type = "Out" THEN p.PunchTime ELSE NULL END ) AS LatestOUt FROM Punches p ANSWER: You can't efficiently selec...
[ "linq", ".net-3.5", "linq-to-objects" ]
6
2
2,980
3
0
2008-09-30T19:52:28.987000
2008-09-30T19:59:40.467000
154,686
154,796
Specify remote port to use for mail via exim4
I've got a stock Debian Etch system, using Exim4. The domains are mostly local but there are some that are remote. To handle the delivery of remote mail I use the Debian configuration file: /etc/exim4/hubbed_hosts This file lists the domain names, and remote MX machines to deliver to. For example: example.org: mx.examp...
I was hoping for something a little more dynamic - and this solution works: port = ${if exists{/etc/exim4/ports.list}\ {${lookup{$domain}lsearch{/etc/exim4/ports.list}\ {$value}{25}}}{25}} Then a simple file may have a list of ports on a per-domain basis: example.org: 2525 example.com: 26
Specify remote port to use for mail via exim4 I've got a stock Debian Etch system, using Exim4. The domains are mostly local but there are some that are remote. To handle the delivery of remote mail I use the Debian configuration file: /etc/exim4/hubbed_hosts This file lists the domain names, and remote MX machines to ...
TITLE: Specify remote port to use for mail via exim4 QUESTION: I've got a stock Debian Etch system, using Exim4. The domains are mostly local but there are some that are remote. To handle the delivery of remote mail I use the Debian configuration file: /etc/exim4/hubbed_hosts This file lists the domain names, and remo...
[ "debian", "ports", "mx-record", "exim4" ]
3
3
3,740
4
0
2008-09-30T19:53:39.780000
2008-09-30T20:12:45.693000
154,698
154,699
How can I keep a class from being inherited in C#?
In java, I could do this with the 'final' keyword. I don't see 'final' in C#. Is there a substitute?
You're looking for the sealed keyword. It does exactly what the final keyword in Java does. Attempts to inherit will result in a compilation error.
How can I keep a class from being inherited in C#? In java, I could do this with the 'final' keyword. I don't see 'final' in C#. Is there a substitute?
TITLE: How can I keep a class from being inherited in C#? QUESTION: In java, I could do this with the 'final' keyword. I don't see 'final' in C#. Is there a substitute? ANSWER: You're looking for the sealed keyword. It does exactly what the final keyword in Java does. Attempts to inherit will result in a compilation ...
[ "c#", ".net", "inheritance" ]
7
35
2,091
5
0
2008-09-30T19:57:00.507000
2008-09-30T19:57:12.220000
154,702
421,235
CrystalReportViewer Buttons Broken using MVC Framework
We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work. If I'm working with the report 'HoursSummary'. If I hover over any of the buttons on the report viewer in IE the displayed link at the bott...
We were able to get the report viewer to work and have been using it for the past few months in production without any issues. We have a reports controller that lists links to the reports we want to run Clicking on one of the links will make an ajax call to the back end and return a partial page where we can fill in al...
CrystalReportViewer Buttons Broken using MVC Framework We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work. If I'm working with the report 'HoursSummary'. If I hover over any of the buttons on...
TITLE: CrystalReportViewer Buttons Broken using MVC Framework QUESTION: We are using the MVC framework (release 5) and the CrystalReportViewer control to show our reports. I cannot get any of the buttons at the top of the report viewer control to work. If I'm working with the report 'HoursSummary'. If I hover over any...
[ "asp.net-mvc", "crystal-reports" ]
5
3
4,132
2
0
2008-09-30T19:57:43.203000
2009-01-07T17:34:14.757000
154,706
154,723
Can I split a string in c# VB6-style without referencing Microsoft.VisualBasic?
Unfortunately, there seems to be no string.Split(string separator), only string.Split(char speparator). I want to break up my string based on a multi-character separator, a la VB6. Is there an easy (that is, not by referencing Microsoft.VisualBasic or having to learn RegExes) way to do this in c#? EDIT: Using.NET Frame...
String.Split() has other overloads. Some of them take string[] arguments. string original = "first;&second&third"; string[] splitResults = original.Split( new string[] { ";&" }, StringSplitOptions.None );
Can I split a string in c# VB6-style without referencing Microsoft.VisualBasic? Unfortunately, there seems to be no string.Split(string separator), only string.Split(char speparator). I want to break up my string based on a multi-character separator, a la VB6. Is there an easy (that is, not by referencing Microsoft.Vis...
TITLE: Can I split a string in c# VB6-style without referencing Microsoft.VisualBasic? QUESTION: Unfortunately, there seems to be no string.Split(string separator), only string.Split(char speparator). I want to break up my string based on a multi-character separator, a la VB6. Is there an easy (that is, not by referen...
[ ".net", ".net-3.5", "c#-3.0" ]
2
8
1,691
6
0
2008-09-30T19:58:15.683000
2008-09-30T20:01:44.893000
154,707
154,789
What is the best way to store media files on a database?
I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way. I also thought on the possibility to have "links" to those files, but maybe this will carry more problems than solutions. Any experience in this directi...
Every system I know of that stores large numbers of big files stores them externally to the database. You store all of the queryable data for the file (title, artist, length, etc) in the database, along with a partial path to the file. When it's time to retrieve the file, you extract the file's path, prepend some file ...
What is the best way to store media files on a database? I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way. I also thought on the possibility to have "links" to those files, but maybe this will carry mor...
TITLE: What is the best way to store media files on a database? QUESTION: I want to store a large number of sound files in a database, but I don't know if it is a good practice. I would like to know the pros and cons of doing it in this way. I also thought on the possibility to have "links" to those files, but maybe t...
[ "mysql", "database", "audio", "multimedia" ]
66
112
110,353
10
0
2008-09-30T19:58:30.517000
2008-09-30T20:11:41.127000
154,708
162,194
Multi-Line group and search with Regex
Ok, Regex wizards. I want to be able to search through my logfile and find any sessions with the word 'error' in it and then return the entire session log entry. I know I can do this with a string/array but I'd like to learn how to do it with Regex but here's the question. If I decide to do this with Regex do I have on...
What I did was to run the entire log into a string then went through line by line and added each line to a third variable until the line contained "--End of Session--". I then added that line to the 3rd var as well and then searched that 3rd var for the word "error". If it contained it, I added the 3rd var to a forth a...
Multi-Line group and search with Regex Ok, Regex wizards. I want to be able to search through my logfile and find any sessions with the word 'error' in it and then return the entire session log entry. I know I can do this with a string/array but I'd like to learn how to do it with Regex but here's the question. If I de...
TITLE: Multi-Line group and search with Regex QUESTION: Ok, Regex wizards. I want to be able to search through my logfile and find any sessions with the word 'error' in it and then return the entire session log entry. I know I can do this with a string/array but I'd like to learn how to do it with Regex but here's the...
[ "regex" ]
2
0
4,189
8
0
2008-09-30T19:58:43.030000
2008-10-02T13:14:33.357000
154,718
154,794
Precedence: header in email
My web application sends email fairly often, and it sends 3 kinds of emails: initiated by user, in response to an event in the system, and in automatic response to an email received by the application. I would like to make sure that the third type of email does not get stuck in an endless loop of auto-responders talkin...
RFC 2076 discourages the use of the precedence header. as you have noted, many clients will just filter that off (especially the precedence: junk variety). it may be better to use a null path to avoid auto responder wars: Return-Path: <> Ultimately you could use priority to try to get around this, but this seems like g...
Precedence: header in email My web application sends email fairly often, and it sends 3 kinds of emails: initiated by user, in response to an event in the system, and in automatic response to an email received by the application. I would like to make sure that the third type of email does not get stuck in an endless lo...
TITLE: Precedence: header in email QUESTION: My web application sends email fairly often, and it sends 3 kinds of emails: initiated by user, in response to an event in the system, and in automatic response to an email received by the application. I would like to make sure that the third type of email does not get stuc...
[ "email", "header" ]
40
18
41,226
5
0
2008-09-30T20:01:11.900000
2008-09-30T20:12:07.723000
154,722
155,408
Can anyone explain how the oracle "hash group" works?
I've recently come across a feature of doing a large query in oracle, where changing one thing resulted in a query that used to take 10 minutes taking 3 hours. To briefly summarise, I store a lot of coordinates in the database, with each coordinate having a probability. I then want to 'bin' these coordinates into 50 me...
Hash group (and hash joins, as well as other operations such as sorts etc.) can use either optimal (i.e. in-memory), one-pass or multi-pass methods. The last two methods use TEMP storage and is thus much slower. By increasing the number of possible items you might have exceeded the number of items that will fit in memo...
Can anyone explain how the oracle "hash group" works? I've recently come across a feature of doing a large query in oracle, where changing one thing resulted in a query that used to take 10 minutes taking 3 hours. To briefly summarise, I store a lot of coordinates in the database, with each coordinate having a probabil...
TITLE: Can anyone explain how the oracle "hash group" works? QUESTION: I've recently come across a feature of doing a large query in oracle, where changing one thing resulted in a query that used to take 10 minutes taking 3 hours. To briefly summarise, I store a lot of coordinates in the database, with each coordinate...
[ "performance", "oracle" ]
2
3
11,737
3
0
2008-09-30T20:01:43.723000
2008-09-30T22:38:12.943000
154,724
154,771
When would you use a WeakHashMap or a WeakReference?
The use of weak references is something that I've never seen an implementation of so I'm trying to figure out what the use case for them is and how the implementation would work. When have you needed to use a WeakHashMap or WeakReference and how was it used?
One problem with strong references is caching, particular with very large structures like images. Suppose you have an application which has to work with user-supplied images, like the web site design tool I work on. Naturally you want to cache these images, because loading them from disk is very expensive and you want ...
When would you use a WeakHashMap or a WeakReference? The use of weak references is something that I've never seen an implementation of so I'm trying to figure out what the use case for them is and how the implementation would work. When have you needed to use a WeakHashMap or WeakReference and how was it used?
TITLE: When would you use a WeakHashMap or a WeakReference? QUESTION: The use of weak references is something that I've never seen an implementation of so I'm trying to figure out what the use case for them is and how the implementation would work. When have you needed to use a WeakHashMap or WeakReference and how was...
[ "java", "weak-references" ]
170
97
61,810
10
0
2008-09-30T20:01:55.393000
2008-09-30T20:09:11.647000
154,728
155,450
How do I use ResourceBundle to avoid hardcoded config paths in Java apps?
I'd like to eliminate dependencies on hardcoded paths for configuration data in my Java apps, I understand that using ResourceBundle will help me use the classloader to find resources. Can someone tell me how I would replace a hardcoded path to a resource (say a.properties configuration data file required by a class) w...
Prior to Java 6, ResourceBundle typically allowed: Strings from a group of localised properties files, using PropertyResourceBundle Objects from a group of localised classes, using ListResourceBundle Java 6 comes with the ResourceBundle.Control class which opens the door to other sources of ResourceBundles, for example...
How do I use ResourceBundle to avoid hardcoded config paths in Java apps? I'd like to eliminate dependencies on hardcoded paths for configuration data in my Java apps, I understand that using ResourceBundle will help me use the classloader to find resources. Can someone tell me how I would replace a hardcoded path to a...
TITLE: How do I use ResourceBundle to avoid hardcoded config paths in Java apps? QUESTION: I'd like to eliminate dependencies on hardcoded paths for configuration data in my Java apps, I understand that using ResourceBundle will help me use the classloader to find resources. Can someone tell me how I would replace a h...
[ "java", "config", "resourcebundle" ]
3
2
5,162
4
0
2008-09-30T20:02:47.543000
2008-09-30T22:47:39.473000
154,730
154,809
Capturing video out of an OpenGL window in Windows
I am supposed to provide my users a really simple way of capturing video clips out of my OpenGL application's main window. I am thinking of adding buttons and/or keyboard shortcuts for starting and stopping the capture; when starting, I could ask for a filename and other options, if any. It has to run in Windows (XP/Vi...
There are two different questions here - how to grab frames from an OpenGL application, and how to turn them into a movie file. The first question is easy enough; you just grab each frame with glReadPixels() (via a PBO if you need the performance). The second question is a little harder since the cross-platform solutio...
Capturing video out of an OpenGL window in Windows I am supposed to provide my users a really simple way of capturing video clips out of my OpenGL application's main window. I am thinking of adding buttons and/or keyboard shortcuts for starting and stopping the capture; when starting, I could ask for a filename and oth...
TITLE: Capturing video out of an OpenGL window in Windows QUESTION: I am supposed to provide my users a really simple way of capturing video clips out of my OpenGL application's main window. I am thinking of adding buttons and/or keyboard shortcuts for starting and stopping the capture; when starting, I could ask for ...
[ "c++", "opengl", "video", "screenshot", "video-capture" ]
11
9
11,333
4
0
2008-09-30T20:03:16.137000
2008-09-30T20:14:45.470000
154,735
154,947
Understanding IIS6 permissions, ACL, and identity--how can I restrict access?
When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to understand what access to grant/revoke. I thought the most relevant user is probably the identity...
what user account is relevant for [..] file read/write/execute access As a rule: Always the user account the application/page runs under. The IWAM account is pretty limited. I don't think it has permissions to start an external process. File access rights are irrelevant at this point. If a user account (Network Service...
Understanding IIS6 permissions, ACL, and identity--how can I restrict access? When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to understand what acc...
TITLE: Understanding IIS6 permissions, ACL, and identity--how can I restrict access? QUESTION: When an ASP.NET application is running under IIS6.0 in Windows 2003 Server with impersonation, what user account is relevant for deciding file read/write/execute access privileges? I have two scenarios where I am trying to u...
[ "iis-6", "windows-server-2003", "ntfs" ]
0
1
3,105
2
0
2008-09-30T20:04:21.440000
2008-09-30T20:34:46.967000
154,749
459,528
Communicating with a flash server using rtmp without Flash
I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java. I was looking at Red5 but their client API seems to be a bit wobbly. Does anyone have any other ideas?
"RTMP: Flash video streaming protocol" discusses libraries and applications for communicating with RTMP servers. The main protocol code from the RTMPDump utility for downloading RTMP video streams is now available in its own library, librtmp (used by FFmpeg, MPlayer, and XBMC media center). Note: the RTMPDump utility w...
Communicating with a flash server using rtmp without Flash I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java. I was looking at Red5 but their client API seems to be a bit wobbly. Does anyone have any other ideas?
TITLE: Communicating with a flash server using rtmp without Flash QUESTION: I want to talk to a flash server which uses RTMP, but I don't want to use Flash, but rather c# or java. I was looking at Red5 but their client API seems to be a bit wobbly. Does anyone have any other ideas? ANSWER: "RTMP: Flash video streamin...
[ "flash", "rtmp" ]
15
6
16,003
6
0
2008-09-30T20:06:34.697000
2009-01-19T22:56:01.667000
154,754
168,452
Can I test a floppy drive using WMI & System.Management namespace?
I would find out the floppy inserted state: no floppy inserted unformatted floppy inserted formatted floppy inserted Can this determined using "WMI" in the System.Management namespace? If so, can I generate events when the floppy inserted state changes?
Using Bob Kings idea I wrote the following method. It works great on CD's, removable drives, regular drives. However for a floppy it always return "Not Available". public static void TestFloppy( char driveLetter ) { using( var searcher = new ManagementObjectSearcher( @"SELECT * FROM Win32_LogicalDisk WHERE DeviceID = '...
Can I test a floppy drive using WMI & System.Management namespace? I would find out the floppy inserted state: no floppy inserted unformatted floppy inserted formatted floppy inserted Can this determined using "WMI" in the System.Management namespace? If so, can I generate events when the floppy inserted state changes?
TITLE: Can I test a floppy drive using WMI & System.Management namespace? QUESTION: I would find out the floppy inserted state: no floppy inserted unformatted floppy inserted formatted floppy inserted Can this determined using "WMI" in the System.Management namespace? If so, can I generate events when the floppy inser...
[ ".net", "wmi" ]
3
1
560
2
0
2008-09-30T20:07:17.673000
2008-10-03T19:18:44.917000
154,757
154,795
How to stop Eclipse from hanging on a long autocompletion list?
I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now I just installed the Javadoc for JOGL, because it's nice to have the parameter names if you can't remember the order. However, with this Javadoc installed, it takes about half a minute to show the autocompletion list whenever I type GL...
Preferences -> Java -> Editor -> Content Assist Try some different settings in the "Auto-Activation" frame.
How to stop Eclipse from hanging on a long autocompletion list? I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now I just installed the Javadoc for JOGL, because it's nice to have the parameter names if you can't remember the order. However, with this Javadoc installed, it takes about ...
TITLE: How to stop Eclipse from hanging on a long autocompletion list? QUESTION: I'm using the GL class from JOGL, which basically contains all OpenGL functions. Now I just installed the Javadoc for JOGL, because it's nice to have the parameter names if you can't remember the order. However, with this Javadoc installe...
[ "java", "eclipse" ]
1
2
2,936
1
0
2008-09-30T20:07:41.433000
2008-09-30T20:12:20.377000
154,762
155,010
How can I create XML from Perl?
I need to create XML in Perl. From what I read, XML::LibXML is great for parsing and using XML that comes from somewhere else. Does anyone have any suggestions for an XML Writer? Is XML::Writer still maintained? Does anyone like/use it? In addition to feature-completeness, I am interested an easy-to-use syntax, so plea...
XML::Writer is still maintained (at least, as of February of this year), and it's indeed one of the favorite Perl XML writers out there. As for describing the syntax, one is better to look at the module's documentation (the link is already in the question). To wit: use XML::Writer; my $writer = new XML::Writer(); # wi...
How can I create XML from Perl? I need to create XML in Perl. From what I read, XML::LibXML is great for parsing and using XML that comes from somewhere else. Does anyone have any suggestions for an XML Writer? Is XML::Writer still maintained? Does anyone like/use it? In addition to feature-completeness, I am intereste...
TITLE: How can I create XML from Perl? QUESTION: I need to create XML in Perl. From what I read, XML::LibXML is great for parsing and using XML that comes from somewhere else. Does anyone have any suggestions for an XML Writer? Is XML::Writer still maintained? Does anyone like/use it? In addition to feature-completene...
[ "xml", "perl" ]
29
22
38,613
6
0
2008-09-30T20:08:30.243000
2008-09-30T20:44:26.913000
154,768
154,819
How do you manage growing eclipse configurations?
I use eclipse for quite a lot of work, including: multiple "utility" projects that include code that most of my java work makes use of various plugin-related projects that I sync and use periodically (eg: the Git plugin) plugin projects I'm actually developing the occasional pydev / non-java project etc... It is becomi...
It isn't quite clear to me what your need is. But have you tried using working sets in the Package Explorer? Open the Package Explorer view, open its menu, and Select Working Set. That lets you give a name to a subset of all the projects loaded in your workspace. Switch working sets using the package Explorer menu. Use...
How do you manage growing eclipse configurations? I use eclipse for quite a lot of work, including: multiple "utility" projects that include code that most of my java work makes use of various plugin-related projects that I sync and use periodically (eg: the Git plugin) plugin projects I'm actually developing the occas...
TITLE: How do you manage growing eclipse configurations? QUESTION: I use eclipse for quite a lot of work, including: multiple "utility" projects that include code that most of my java work makes use of various plugin-related projects that I sync and use periodically (eg: the Git plugin) plugin projects I'm actually de...
[ "eclipse", "ide", "development-environment" ]
2
3
796
4
0
2008-09-30T20:08:50.447000
2008-09-30T20:16:05.267000
154,780
154,833
Is there a way to handle a variable number of parameters in a template class?
I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can handle a variable number of arguments?? Ultimately I would love to have each p...
Not yet in the language itself but C++0x will have support for variadic templates.
Is there a way to handle a variable number of parameters in a template class? I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one instance than can ...
TITLE: Is there a way to handle a variable number of parameters in a template class? QUESTION: I have a set of callback classes that I use for handling callbacks with variable numbers of parameters. Right now I have about 6 different instances of it to handle differing numbers of arguments. Is there a way to make one ...
[ "c++", "parameters", "templates", "arguments" ]
5
5
2,045
4
0
2008-09-30T20:10:38.727000
2008-09-30T20:18:38.223000
154,791
159,358
Java TreeNode: How to prevent getChildCount from doing expensive operation?
I'm writing a Java Tree in which tree nodes could have children that take a long time to compute (in this case, it's a file system, where there may be network timeouts that prevent getting a list of files from an attached drive). The problem I'm finding is this: getChildCount() is called before the user specifically re...
There are a few parts to the solution: Like Lorenzo Boccaccia said, use the TreeWillExpandListener Also, need to call nodesWereInserted on the tree, so the proper number of nodes will be displayed. See this code I have determined that if you don't know the child count, TreeNode.getChildCount() needs to return at least ...
Java TreeNode: How to prevent getChildCount from doing expensive operation? I'm writing a Java Tree in which tree nodes could have children that take a long time to compute (in this case, it's a file system, where there may be network timeouts that prevent getting a list of files from an attached drive). The problem I'...
TITLE: Java TreeNode: How to prevent getChildCount from doing expensive operation? QUESTION: I'm writing a Java Tree in which tree nodes could have children that take a long time to compute (in this case, it's a file system, where there may be network timeouts that prevent getting a list of files from an attached driv...
[ "java", "swing", "jtree" ]
5
0
1,800
4
0
2008-09-30T20:11:43.637000
2008-10-01T19:42:11.187000
154,808
154,889
What's The Best Option For Rendering Complex Fonts?
I'm working on a game (using Ruby) and planning to have it available in several languages. I was wondering what's the best option for rendering text. In particular, whatever I use should be able to render complex fonts (Arabic and Persian in particular). I've been looking around and have stumbled upon freetype, graphit...
If you're looking for a way to rasterise fonts into bitmaps, both Freetype and the Windows API will handle this nicely. If you're looking for a way to draw text onscreen, go with Window's native APIs if you can; bidirectional text and accents and all that stuff are quite difficult and time-consuming to get right, so yo...
What's The Best Option For Rendering Complex Fonts? I'm working on a game (using Ruby) and planning to have it available in several languages. I was wondering what's the best option for rendering text. In particular, whatever I use should be able to render complex fonts (Arabic and Persian in particular). I've been loo...
TITLE: What's The Best Option For Rendering Complex Fonts? QUESTION: I'm working on a game (using Ruby) and planning to have it available in several languages. I was wondering what's the best option for rendering text. In particular, whatever I use should be able to render complex fonts (Arabic and Persian in particul...
[ "fonts", "rendering", "arabic", "persian" ]
0
1
527
3
0
2008-09-30T20:14:19.403000
2008-09-30T20:25:48.987000
154,826
154,977
LinqtoSQL filter and order by syntax
My Techie Bretheren (and Sisteren, of course!), I have a LinqToSql data model that has the following entities: data model http://danimal.acsysinteractive.com/images/advisor.jpg I need to retrieve all advisors for a specific office, ordered by their sequence within the office. I've got the first part working with a join...
from adv in _context.Advisors where adv.OfficeAdvisor.Any(off => off.OfficeId == officeID) order adv by adv.OfficeAdvisor.First(off => off.OfficeId = officeID).Sequence select adv;
LinqtoSQL filter and order by syntax My Techie Bretheren (and Sisteren, of course!), I have a LinqToSql data model that has the following entities: data model http://danimal.acsysinteractive.com/images/advisor.jpg I need to retrieve all advisors for a specific office, ordered by their sequence within the office. I've g...
TITLE: LinqtoSQL filter and order by syntax QUESTION: My Techie Bretheren (and Sisteren, of course!), I have a LinqToSql data model that has the following entities: data model http://danimal.acsysinteractive.com/images/advisor.jpg I need to retrieve all advisors for a specific office, ordered by their sequence within ...
[ "linq", "linq-to-sql", "sql-order-by" ]
2
0
777
3
0
2008-09-30T20:16:48.727000
2008-09-30T20:38:46.723000
154,837
154,974
App.config for dll
We have an "engine" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection. We now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll directory. But for some reason my Workflows jus...
If your code sample for reading the AppSettings is in your DLL, then it will attempt to read the config file for the application and not the config file for the DLL. This is because you're using Reflection to execute the code.
App.config for dll We have an "engine" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection. We now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll directory. But for some reas...
TITLE: App.config for dll QUESTION: We have an "engine" that loads dlls dynamically (whatever is located in a certain directory) and calls Workflow classes from them by way of reflection. We now have some new Workflows that require access to a database, so I figured that I would put a config file in the dll directory....
[ "c#", "dll", "app-config" ]
11
7
16,650
6
0
2008-09-30T20:19:26.660000
2008-09-30T20:38:12.233000
154,844
154,884
Secure communication between Flash and PHP script
I have little knowledge of Flash but for a little Flash game I have to store score and successful tries of users in a database using PHP. Now the Flash runs locally on the users computer and connects to a remote server. How can I secure against manipulation of game scores. Is there any best practice for this use case?
You might want to check these other questions: Q46415 Passing untampered data from Flash app to server? Q73947 What is the best way to stop people hacking the PHP-based highscore table of a Flash game. Q25999 Secure Online Highscore Lists for Non-Web Games
Secure communication between Flash and PHP script I have little knowledge of Flash but for a little Flash game I have to store score and successful tries of users in a database using PHP. Now the Flash runs locally on the users computer and connects to a remote server. How can I secure against manipulation of game scor...
TITLE: Secure communication between Flash and PHP script QUESTION: I have little knowledge of Flash but for a little Flash game I have to store score and successful tries of users in a database using PHP. Now the Flash runs locally on the users computer and connects to a remote server. How can I secure against manipul...
[ "php", "flash", "security" ]
6
7
4,802
5
0
2008-09-30T20:20:19.483000
2008-09-30T20:25:14.727000
154,845
154,857
Simple way to trim Dollar Sign if present in C#
I have a DataRow and I am getting one of the elements which is a Amount with a dollar sign. I am calling a toString on it. Is there another method I can call on it to remove the dollar sign if present. So something like: dr.ToString.Substring(1, dr.ToString.Length); But more conditionally in case the dollar sign ever m...
Convert.ToString(dr(columnName)).Replace("$", String.Empty) -- If you are working with a data table, then you have to unbox the value (by default its Object) to a string, so you are already creating a string, and then another with the replacement. There is really no other way to get around it, but you will only see per...
Simple way to trim Dollar Sign if present in C# I have a DataRow and I am getting one of the elements which is a Amount with a dollar sign. I am calling a toString on it. Is there another method I can call on it to remove the dollar sign if present. So something like: dr.ToString.Substring(1, dr.ToString.Length); But m...
TITLE: Simple way to trim Dollar Sign if present in C# QUESTION: I have a DataRow and I am getting one of the elements which is a Amount with a dollar sign. I am calling a toString on it. Is there another method I can call on it to remove the dollar sign if present. So something like: dr.ToString.Substring(1, dr.ToStr...
[ "c#" ]
4
18
17,001
6
0
2008-09-30T20:20:20.560000
2008-09-30T20:22:11.257000
154,853
154,912
How do you remove Subversion control for a folder?
I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files? I know I could simply delete the.svn folder, but there are a lot of sub-folders in many layers.
Also, if you are using TortoiseSVN, just export to the current working copy location and it will remove the.svn folders and files. http://tortoisesvn.net/docs/release/TortoiseSVN_en/tsvn-dug-export.html#tsvn-dug-export-unversion Updated Answer for Subversion 1.7: In Subversion 1.7 the working copy has been revised exte...
How do you remove Subversion control for a folder? I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files? I know I could simply delete the.svn folder, bu...
TITLE: How do you remove Subversion control for a folder? QUESTION: I have a folder, c:\websites\test, and it contains folders and files that were checked out from a repository that no longer exists. How do I get Subversion to stop tracking that folder and any of the subfolders and files? I know I could simply delete ...
[ "svn" ]
268
262
332,139
29
0
2008-09-30T20:21:32.740000
2008-09-30T20:29:27.667000
154,862
154,891
Convert JavaScript String to be all lowercase
How can I convert a JavaScript string value to be in all lowercase letters? Example: "Your Name" to "your name"
const lowerCaseName = "Your Name".toLowerCase(); // your name
Convert JavaScript String to be all lowercase How can I convert a JavaScript string value to be in all lowercase letters? Example: "Your Name" to "your name"
TITLE: Convert JavaScript String to be all lowercase QUESTION: How can I convert a JavaScript string value to be in all lowercase letters? Example: "Your Name" to "your name" ANSWER: const lowerCaseName = "Your Name".toLowerCase(); // your name
[ "javascript", "string" ]
1,418
1,825
537,667
16
0
2008-09-30T20:22:35.093000
2008-09-30T20:26:19.703000
154,885
155,679
Validating and reparing xml
Is there a way to get more useful information on validation error? XmlSchemaException provides the line number and position of the error which makes little sense to me. Xml document after all is not about its transient textual representation. I'd like to get an enumerated error (or an error code) specifying what when w...
You can accomplish this, sort of, by setting up an XmlReader whose XmlReaderSettings contain the schema and then using it to read through the input stream node by node. You can keep track of the last node read and have a pretty good idea of where you are in the document when a validation error happens. I think that if ...
Validating and reparing xml Is there a way to get more useful information on validation error? XmlSchemaException provides the line number and position of the error which makes little sense to me. Xml document after all is not about its transient textual representation. I'd like to get an enumerated error (or an error ...
TITLE: Validating and reparing xml QUESTION: Is there a way to get more useful information on validation error? XmlSchemaException provides the line number and position of the error which makes little sense to me. Xml document after all is not about its transient textual representation. I'd like to get an enumerated e...
[ "c#", "xml", "xsd" ]
2
0
310
5
0
2008-09-30T20:25:22.747000
2008-10-01T00:11:59.893000
154,897
154,921
What do you do if you cannot resolve a bug?
Did you ever had a bug in your code, you could not resolve? I hope I'm not the only one out there, who made this experience... There exist some classes of bugs, that are very hard to track down: timing-related bugs (that occur during inter-process-communication for example) memory-related bugs (most of you know appropr...
Some things that help: 1) Take a break, approach the bug from a different angle. 2) Get more aggressive with tracing and logging. 3) Have another pair of eyes look at it. 4) A usual last resort is to figure out a way to make the bug irrelevant by changing the fundamental conditions in which it occurs 5) Smash and break...
What do you do if you cannot resolve a bug? Did you ever had a bug in your code, you could not resolve? I hope I'm not the only one out there, who made this experience... There exist some classes of bugs, that are very hard to track down: timing-related bugs (that occur during inter-process-communication for example) m...
TITLE: What do you do if you cannot resolve a bug? QUESTION: Did you ever had a bug in your code, you could not resolve? I hope I'm not the only one out there, who made this experience... There exist some classes of bugs, that are very hard to track down: timing-related bugs (that occur during inter-process-communicat...
[ "debugging" ]
34
41
11,911
32
0
2008-09-30T20:26:59.967000
2008-09-30T20:30:35.403000