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
130,316
138,064
Cross-model relationships in NSManagedObjectModel from merged models?
Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models? For example, say model 1 defines an entity Foo with relationship (one-to-one) toBar and that model 2 de...
Neither model 1 nor model 2 will be loadable at run time unless they're well-formed — that is, unless the toBar and toFoo relationships have destinations. Furthermore, if model 1 and model 2 have identically-named models, you won't be able to create a merged model from them; they will not be coalesced, they will collid...
Cross-model relationships in NSManagedObjectModel from merged models? Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models? For example, say model 1 defines ...
TITLE: Cross-model relationships in NSManagedObjectModel from merged models? QUESTION: Is it possible to model relationships between entities that are defined in separate NSManagedObjectModels if the entities are always used within an NSManagedObjectModel that is created by merging the relevant models? For example, sa...
[ "cocoa", "macos", "core-data", "nsmanagedobject", "nsmanagedobjectcontext" ]
10
17
2,394
1
0
2008-09-24T22:27:01.080000
2008-09-26T06:47:35.783000
130,317
130,675
Haskell newbie: use layout or not? What are the pro's and con's (use examples)
I cant seem to find much info on haskells layout features, as I understand it is something like pythons formatting requirements except that is optional. How can I choose not to use this option correctly? Would it be a good idea to start without it so that I get a solid feel for the language itself?
See http://en.wikibooks.org/wiki/Programming:Haskell_indentation and http://www.haskell.org/onlinereport/lexemes.html#sect2.7 (both contain examples). Pros: less typing less to read, nicer-looking (if you're comfortable with it) Cons: you might get it wrong, especially if you're not familiar with it. Braces make things...
Haskell newbie: use layout or not? What are the pro's and con's (use examples) I cant seem to find much info on haskells layout features, as I understand it is something like pythons formatting requirements except that is optional. How can I choose not to use this option correctly? Would it be a good idea to start with...
TITLE: Haskell newbie: use layout or not? What are the pro's and con's (use examples) QUESTION: I cant seem to find much info on haskells layout features, as I understand it is something like pythons formatting requirements except that is optional. How can I choose not to use this option correctly? Would it be a good ...
[ "programming-languages", "haskell", "coding-style" ]
0
6
570
2
0
2008-09-24T22:28:23.247000
2008-09-24T23:47:30.107000
130,322
130,528
How do you pass a member function pointer?
I am trying to pass a member function within a class to a function that takes a member function class pointer. The problem I am having is that I am not sure how to properly do this within the class using the this pointer. Does anyone have suggestions? Here is a copy of the class that is passing the member function: cla...
To call a member function by pointer, you need two things: A pointer to the object and a pointer to the function. You need both in MenuButton::SetButton() template void MenuButton::SetButton(int xPos, int yPos, LPCWSTR normalFilePath, LPCWSTR hoverFilePath, LPCWSTR pressedFilePath, int Width, int Height, object *Button...
How do you pass a member function pointer? I am trying to pass a member function within a class to a function that takes a member function class pointer. The problem I am having is that I am not sure how to properly do this within the class using the this pointer. Does anyone have suggestions? Here is a copy of the cla...
TITLE: How do you pass a member function pointer? QUESTION: I am trying to pass a member function within a class to a function that takes a member function class pointer. The problem I am having is that I am not sure how to properly do this within the class using the this pointer. Does anyone have suggestions? Here is...
[ "c++", "class", "function", "pointers", "member" ]
27
33
46,777
6
0
2008-09-24T22:30:12.507000
2008-09-24T23:11:53.577000
130,327
130,407
Linux-based solution for domain management?
Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers, etc). What similar (and widespread) solutions exist for manag...
Not sure if this is what you had in mind, but Linux w/Samba can act as a domain controller for Windows desktops. For example, see SAMBA (Domain Controller) Server For Small Workgroups at HowToForge. This works for file/print sharing etc. For something more akin to Microsoft's Active Directory, you might check out Red H...
Linux-based solution for domain management? Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers, etc). What simila...
TITLE: Linux-based solution for domain management? QUESTION: Using any member of the Windows Server family, I can set up an active directory, and have a single pool of users for a large scale of computers; access can be given / removed for any shared resources in the given domain (including access to client computers,...
[ "linux", "active-directory", "system-administration" ]
3
3
7,824
6
0
2008-09-24T22:31:18.293000
2008-09-24T22:47:03.870000
130,328
130,336
How do I get the caller's IP address in a WebMethod?
How do I get the caller's IP address in a WebMethod? [WebMethod] public void Foo() { // HttpRequest...? - Not giving me any options through intellisense... } using C# and ASP.NET
HttpContext.Current.Request.UserHostAddress is what you want.
How do I get the caller's IP address in a WebMethod? How do I get the caller's IP address in a WebMethod? [WebMethod] public void Foo() { // HttpRequest...? - Not giving me any options through intellisense... } using C# and ASP.NET
TITLE: How do I get the caller's IP address in a WebMethod? QUESTION: How do I get the caller's IP address in a WebMethod? [WebMethod] public void Foo() { // HttpRequest...? - Not giving me any options through intellisense... } using C# and ASP.NET ANSWER: HttpContext.Current.Request.UserHostAddress is what you want.
[ "c#", "asp.net", "web-services" ]
54
86
62,240
6
0
2008-09-24T22:31:35.670000
2008-09-24T22:33:13.297000
130,337
130,366
How do you prevent a user from posting data multiple times on a website
I am working on a web application (J2EE) and I would like to know the options that are available for handling a double post from the browser. The solutions that I have seen and used in the past are all client-side: Disable the submit button as soon as the user clicks it. Follow a POST-Redirect-GET pattern to prevent PO...
Its hard to implement an idiot-proof solution (as they are alway improving the idiots). No matter what you do, the client side can be manipulated or perform incorrectly. Your solution has got to be server side to be reliable and secure. That said, one approach is to review the request and check system/database state or...
How do you prevent a user from posting data multiple times on a website I am working on a web application (J2EE) and I would like to know the options that are available for handling a double post from the browser. The solutions that I have seen and used in the past are all client-side: Disable the submit button as soon...
TITLE: How do you prevent a user from posting data multiple times on a website QUESTION: I am working on a web application (J2EE) and I would like to know the options that are available for handling a double post from the browser. The solutions that I have seen and used in the past are all client-side: Disable the sub...
[ "jakarta-ee", "double-submit-problem" ]
20
11
8,301
7
0
2008-09-24T22:33:13.607000
2008-09-24T22:38:43.640000
130,352
130,444
Webpart feature not adding Description
I am adding a webpart to the webpart gallery as part of a feature within a solution. When the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. I have added a description to everywhere I can think of, including: The webpart itself. myWebpart.webpart my description ...
Check the following blog, it describes the whole process: Adding custom webparts in a Sharepoint Site Definition Specially notice the custom property TextToDisplay (I think you've gone through all the other steps).
Webpart feature not adding Description I am adding a webpart to the webpart gallery as part of a feature within a solution. When the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. I have added a description to everywhere I can think of, including: The webpart it...
TITLE: Webpart feature not adding Description QUESTION: I am adding a webpart to the webpart gallery as part of a feature within a solution. When the webpart is added to the gallery, the webparts Description field is being overwritten by an empty string. I have added a description to everywhere I can think of, includi...
[ "sharepoint", "deployment", "web-parts", "moss" ]
0
2
847
2
0
2008-09-24T22:35:18.393000
2008-09-24T22:53:50.157000
130,396
130,399
Are there constants in JavaScript?
Is there a way to use constants in JavaScript? If not, what's the common practice for specifying variables that are used as constants?
Since ES2015, JavaScript has a notion of const: const MY_CONSTANT = "some-value"; This will work in pretty much all browsers except IE 8, 9 and 10. Some may also need strict mode enabled. You can use var with conventions like ALL_CAPS to show that certain values should not be modified if you need to support older brows...
Are there constants in JavaScript? Is there a way to use constants in JavaScript? If not, what's the common practice for specifying variables that are used as constants?
TITLE: Are there constants in JavaScript? QUESTION: Is there a way to use constants in JavaScript? If not, what's the common practice for specifying variables that are used as constants? ANSWER: Since ES2015, JavaScript has a notion of const: const MY_CONSTANT = "some-value"; This will work in pretty much all browser...
[ "javascript", "constants" ]
1,179
1,037
516,845
33
0
2008-09-24T22:45:05.233000
2008-09-24T22:46:03.687000
130,404
130,504
JavaScript data formatting/pretty printer
I'm trying to find a way to "pretty print" a JavaScript data structure in a human-readable form for debugging. I have a rather big and complicated data structure being stored in JS and I need to write some code to manipulate it. In order to work out what I'm doing and where I'm going wrong, what I really need is to be ...
I wrote a function to dump a JS object in a readable form, although the output isn't indented, but it shouldn't be too hard to add that: I made this function from one I made for Lua (which is much more complex) which handled this indentation issue. Here is the "simple" version: function DumpObject(obj) { var od = new O...
JavaScript data formatting/pretty printer I'm trying to find a way to "pretty print" a JavaScript data structure in a human-readable form for debugging. I have a rather big and complicated data structure being stored in JS and I need to write some code to manipulate it. In order to work out what I'm doing and where I'm...
TITLE: JavaScript data formatting/pretty printer QUESTION: I'm trying to find a way to "pretty print" a JavaScript data structure in a human-readable form for debugging. I have a rather big and complicated data structure being stored in JS and I need to write some code to manipulate it. In order to work out what I'm d...
[ "javascript", "debugging", "json" ]
131
33
98,390
16
0
2008-09-24T22:46:53.637000
2008-09-24T23:06:46.350000
130,427
130,690
Call a certain method before each webservice call
Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a class inheriting from System.Web.Services.WebService. It contains a few methods, which all need to call a method that checks if they're authorized or not. Basically something like this (pardon the architecture, this is purely as an example...
Here is what you need to do to get this to work correctly. It is possible to create your own custom SoapHeader: public class ServiceAuthHeader: SoapHeader { public string SiteKey; public string Password; public ServiceAuthHeader() {} } Then you need a SoapExtensionAttribute: public class AuthenticationSoapExtensionAtt...
Call a certain method before each webservice call Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a class inheriting from System.Web.Services.WebService. It contains a few methods, which all need to call a method that checks if they're authorized or not. Basically something like this (par...
TITLE: Call a certain method before each webservice call QUESTION: Here's the situation. I have a webservice (C# 2.0), which consists of (mainly) a class inheriting from System.Web.Services.WebService. It contains a few methods, which all need to call a method that checks if they're authorized or not. Basically someth...
[ "c#", ".net", "web-services" ]
8
10
5,520
3
0
2008-09-24T22:50:31.133000
2008-09-24T23:52:13.933000
130,431
696,363
Auto-organize Visual Studio Tabs?
Is there any setting in Visual Studio 2008 to group/organize tabs? For example, I'd prefer to have all code-behind files open in a tab next to its.aspx page if that page is open and vice versa. Dragging tabs around really kills my productivity.
Jonathan, Tabs Studio (developed by me) add-in can automatically group.aspx and.aspx.cs windows in one tab.
Auto-organize Visual Studio Tabs? Is there any setting in Visual Studio 2008 to group/organize tabs? For example, I'd prefer to have all code-behind files open in a tab next to its.aspx page if that page is open and vice versa. Dragging tabs around really kills my productivity.
TITLE: Auto-organize Visual Studio Tabs? QUESTION: Is there any setting in Visual Studio 2008 to group/organize tabs? For example, I'd prefer to have all code-behind files open in a tab next to its.aspx page if that page is open and vice versa. Dragging tabs around really kills my productivity. ANSWER: Jonathan, Tabs...
[ ".net", "visual-studio", "visual-studio-2008", "ide" ]
6
7
2,000
3
0
2008-09-24T22:51:03.707000
2009-03-30T08:08:05.870000
130,438
130,495
Do UTF-8, UTF-16, and UTF-32 differ in the number of characters they can store?
Okay. I know this looks like the typical "Why didn't he just Google it or go to www.unicode.org and look it up?" question, but for such a simple question the answer still eludes me after checking both sources. I am pretty sure that all three of these encoding systems support all of the Unicode characters, but I need to...
No, they're simply different encoding methods. They all support encoding the same set of characters. UTF-8 uses anywhere from one to four bytes per character depending on what character you're encoding. Characters within the ASCII range take only one byte while very unusual characters take four. UTF-32 uses four bytes ...
Do UTF-8, UTF-16, and UTF-32 differ in the number of characters they can store? Okay. I know this looks like the typical "Why didn't he just Google it or go to www.unicode.org and look it up?" question, but for such a simple question the answer still eludes me after checking both sources. I am pretty sure that all thre...
TITLE: Do UTF-8, UTF-16, and UTF-32 differ in the number of characters they can store? QUESTION: Okay. I know this looks like the typical "Why didn't he just Google it or go to www.unicode.org and look it up?" question, but for such a simple question the answer still eludes me after checking both sources. I am pretty ...
[ "unicode", "character-encoding", "utf" ]
57
45
15,984
6
0
2008-09-24T22:51:45.530000
2008-09-24T23:04:26.293000
130,447
130,555
Should I store all projects in one repository or multiple?
I am currently using TortoiseSVN to manage a couple of the projects that I have on the go at the moment. When I first moved everything into source control I wasn't really sure how everything should be laid out so I ended up putting each project into its own repository. I was wondering would it be a good idea for me jus...
Depends to an extent what you mean by "project". I have a general local repository containing random bits of stuff that I write (including my website, since it's small). A single-user local SVN repository is not going to suffer noticeable performance issues until you've spent a lot of years typing. By which time SVN wi...
Should I store all projects in one repository or multiple? I am currently using TortoiseSVN to manage a couple of the projects that I have on the go at the moment. When I first moved everything into source control I wasn't really sure how everything should be laid out so I ended up putting each project into its own rep...
TITLE: Should I store all projects in one repository or multiple? QUESTION: I am currently using TortoiseSVN to manage a couple of the projects that I have on the go at the moment. When I first moved everything into source control I wasn't really sure how everything should be laid out so I ended up putting each projec...
[ "svn", "version-control", "tortoisesvn", "repository" ]
38
31
18,952
11
0
2008-09-24T22:54:35.973000
2008-09-24T23:19:36.803000
130,475
131,334
Why is Lisp used for AI?
I've been learning Lisp to expand my horizons because I have heard that it is used in AI programming. After doing some exploring, I have yet to find AI examples or anything in the language that would make it more inclined towards it. Was Lisp used in the past because it was available, or is there something that I'm jus...
Lisp WAS used in AI until the end of the 1980s. In the 80s, though, Common Lisp was oversold to the business world as the "AI language"; the backlash forced most AI programmers to C++ for a few years. These days, prototypes usually are written in a younger dynamic language (Perl, Python, Ruby, etc) and implementations ...
Why is Lisp used for AI? I've been learning Lisp to expand my horizons because I have heard that it is used in AI programming. After doing some exploring, I have yet to find AI examples or anything in the language that would make it more inclined towards it. Was Lisp used in the past because it was available, or is the...
TITLE: Why is Lisp used for AI? QUESTION: I've been learning Lisp to expand my horizons because I have heard that it is used in AI programming. After doing some exploring, I have yet to find AI examples or anything in the language that would make it more inclined towards it. Was Lisp used in the past because it was av...
[ "lisp", "artificial-intelligence" ]
196
133
89,116
10
0
2008-09-24T23:00:17.863000
2008-09-25T03:29:10.887000
130,486
130,516
Does a hash shrink in Perl as you delete elements?
Does a hash shrink in Perl as you delete elements. More specifically I had a perl program that I inherited that would parse a huge file ( 1 GB ) and load up a hash of hashes. it would do that same for another file and then do a comparison of different elements. The memory consumption was huge during this process and ev...
In general, Perl cannot return memory to the operating system. It may be able to reuse memory internally, though, which could reduce the amount of memory needed by a program. See perlfaq3: How can I free an array or hash so my program shrinks? If the memory used by the hashes is excessive (i.e. > physical memory) you c...
Does a hash shrink in Perl as you delete elements? Does a hash shrink in Perl as you delete elements. More specifically I had a perl program that I inherited that would parse a huge file ( 1 GB ) and load up a hash of hashes. it would do that same for another file and then do a comparison of different elements. The mem...
TITLE: Does a hash shrink in Perl as you delete elements? QUESTION: Does a hash shrink in Perl as you delete elements. More specifically I had a perl program that I inherited that would parse a huge file ( 1 GB ) and load up a hash of hashes. it would do that same for another file and then do a comparison of different...
[ "performance", "perl" ]
8
7
3,467
6
0
2008-09-24T23:03:20.417000
2008-09-24T23:09:55.783000
130,492
130,513
In .net, what's the best / safest way to add a "end of line" character to a text file?
I assume there must be a system and language independent way to just stick the "current" EOL character into a text file, but my MSDN-fu seems to be weak today. Bonus points if there is a way to do this in a web application that will put the correct EOL character for the current client's machine's OS, not the web server...
For the bonus point: Check the user-agent of the client machine, for substrings such as Windows, or Linux The System.Environment.NewLine for Windows is 0x13, 0x10; in unix, it's generally 0x10 only; Choose the appropriate newline string, append it to the line, and off you go
In .net, what's the best / safest way to add a "end of line" character to a text file? I assume there must be a system and language independent way to just stick the "current" EOL character into a text file, but my MSDN-fu seems to be weak today. Bonus points if there is a way to do this in a web application that will ...
TITLE: In .net, what's the best / safest way to add a "end of line" character to a text file? QUESTION: I assume there must be a system and language independent way to just stick the "current" EOL character into a text file, but my MSDN-fu seems to be weak today. Bonus points if there is a way to do this in a web appl...
[ ".net", "text-files" ]
1
2
597
5
0
2008-09-24T23:03:45.733000
2008-09-24T23:09:24.863000
130,494
131,013
Is there a source code formatter for Groovy?
I use the commercial version of Jalopy for my Java projects but it doesn't work on Groovy files. IntelliJ has a serviceable formatter but I don't like requiring a particular IDE.
Try "BUSL" 2022-10-26 NOTE: HISTORIC. "BUSL" seems to be dead. Last archived webpage is from 2020. I've found that BUSL works really well on Groovy files. It's standalone too, so you can use it from your text editor or whatever.
Is there a source code formatter for Groovy? I use the commercial version of Jalopy for my Java projects but it doesn't work on Groovy files. IntelliJ has a serviceable formatter but I don't like requiring a particular IDE.
TITLE: Is there a source code formatter for Groovy? QUESTION: I use the commercial version of Jalopy for my Java projects but it doesn't work on Groovy files. IntelliJ has a serviceable formatter but I don't like requiring a particular IDE. ANSWER: Try "BUSL" 2022-10-26 NOTE: HISTORIC. "BUSL" seems to be dead. Last a...
[ "formatting", "groovy" ]
29
9
30,434
8
0
2008-09-24T23:04:20.383000
2008-09-25T01:33:55.017000
130,496
130,571
MFC "Warning: skipping non-radio button in group."
When running an old MFC application in Visual Studio's debugger I've seen a lot of warnings in the Output window like the following: Warning: skipping non-radio button in group. I understand that in MFC you put radio buttons in groups to indicate which sets of radio buttons go together. If I remember correctly you do t...
The warning means that there's some control other than a radio button in the tab order between the first and last radio buttons in the group. A control with the WS_GROUP style set marks the start of a group. To fix this, use the dialog editor to change the tab order and make sure that all the radio buttons are numbered...
MFC "Warning: skipping non-radio button in group." When running an old MFC application in Visual Studio's debugger I've seen a lot of warnings in the Output window like the following: Warning: skipping non-radio button in group. I understand that in MFC you put radio buttons in groups to indicate which sets of radio bu...
TITLE: MFC "Warning: skipping non-radio button in group." QUESTION: When running an old MFC application in Visual Studio's debugger I've seen a lot of warnings in the Output window like the following: Warning: skipping non-radio button in group. I understand that in MFC you put radio buttons in groups to indicate whic...
[ "visual-studio", "mfc", "warnings" ]
11
7
9,169
5
0
2008-09-24T23:04:28.277000
2008-09-24T23:23:37.620000
130,506
131,524
How many threads should I use in my Java program?
I recently inherited a small Java program that takes information from a large database, does some processing and produces a detailed image regarding the information. The original author wrote the code using a single thread, then later modified it to allow it to use multiple threads. In the code he defines a constant; /...
Threads are fine, but as others have noted, you have to be highly aware of your bottlenecks. Your algorithm sounds like it would be susceptible to cache contention between multiple CPUs - this is particularly nasty because it has the potential to hit the performance of all of your threads (normally you think of using m...
How many threads should I use in my Java program? I recently inherited a small Java program that takes information from a large database, does some processing and produces a detailed image regarding the information. The original author wrote the code using a single thread, then later modified it to allow it to use mult...
TITLE: How many threads should I use in my Java program? QUESTION: I recently inherited a small Java program that takes information from a large database, does some processing and produces a detailed image regarding the information. The original author wrote the code using a single thread, then later modified it to al...
[ "java", "multithreading" ]
18
19
22,026
7
0
2008-09-24T23:07:02.623000
2008-09-25T04:48:17.997000
130,507
260,485
How can I use WPF's D3DImage with managed DirectX or XNA?
I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.
If you're looking for a managed way to do Direct3D programming, I would recommend SlimDX. It's an open source.NET wrapper over DirectX. Since managed DirectX is not being supported any longer by Microsoft, this is a good way to use managed code with D3D. It's updated quite frequently and I've had very good luck using i...
How can I use WPF's D3DImage with managed DirectX or XNA? I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project.
TITLE: How can I use WPF's D3DImage with managed DirectX or XNA? QUESTION: I'd really like to get into some D3D coding, but I don't have the time lately to learn C++ for what will amount to a hobby project. ANSWER: If you're looking for a managed way to do Direct3D programming, I would recommend SlimDX. It's an open ...
[ "wpf", "directx", "xna" ]
5
1
6,211
4
0
2008-09-24T23:07:40.763000
2008-11-04T00:54:18.100000
130,546
143,200
In FinalBuilder, how do I use the HTTP Get File action with Windows Authentication?
I have a FinalBuilder project where I deploy an ASP.Net website to a remote folder, configured as a website in IIS. As part of my build script, I want to use the FinalBuilder action HTTP Get File to help determine whether my deployment was succesful. I'm having difficulty, because the website is configured (under IIS 6...
For a definitive answer, I think the Finalbuilder Forum is probably your best bet. My guess, though, is that the HTTP library used by FB doesn't support Windows authentication, and is failing because no common authentication method can be negotiated. Since HTTPS isn't supported either by the 'HTTP Get File action', the...
In FinalBuilder, how do I use the HTTP Get File action with Windows Authentication? I have a FinalBuilder project where I deploy an ASP.Net website to a remote folder, configured as a website in IIS. As part of my build script, I want to use the FinalBuilder action HTTP Get File to help determine whether my deployment ...
TITLE: In FinalBuilder, how do I use the HTTP Get File action with Windows Authentication? QUESTION: I have a FinalBuilder project where I deploy an ASP.Net website to a remote folder, configured as a website in IIS. As part of my build script, I want to use the FinalBuilder action HTTP Get File to help determine whet...
[ "finalbuilder" ]
2
2
904
1
0
2008-09-24T23:17:09.273000
2008-09-27T07:56:45.240000
130,547
153,695
Setting up Rails to work with sqlserver
Ok I followed the steps for setting up ruby and rails on my Vista machine and I am having a problem connecting to the database. Contents of database.yml development: adapter: sqlserver database: APPS_SETUP Host: WindowsVT06\SQLEXPRESS Username: se Password: paswd Run rake db:migrate from myapp directory ---------- rake...
I ran into the same problem yesterday. Apparently 'deprecated' is a gem, so you want to run "gem install deprecated" to grab and install the latest version. Good luck.
Setting up Rails to work with sqlserver Ok I followed the steps for setting up ruby and rails on my Vista machine and I am having a problem connecting to the database. Contents of database.yml development: adapter: sqlserver database: APPS_SETUP Host: WindowsVT06\SQLEXPRESS Username: se Password: paswd Run rake db:migr...
TITLE: Setting up Rails to work with sqlserver QUESTION: Ok I followed the steps for setting up ruby and rails on my Vista machine and I am having a problem connecting to the database. Contents of database.yml development: adapter: sqlserver database: APPS_SETUP Host: WindowsVT06\SQLEXPRESS Username: se Password: pasw...
[ "sql-server", "ruby-on-rails", "windows", "ruby" ]
13
5
16,406
6
0
2008-09-24T23:17:12.927000
2008-09-30T15:56:13.143000
130,561
131,486
update page text using web user control
I am building an application where a page will load user controls (x.ascx) dynamically based on query string. I have a validation summary on the page and want to update it from the User Controls. This will allow me to have multiple controls using one Validation Summary. How can I pass data between controls and pages. I...
Found a way of doing this: Step 1: Create a Base User Control and define Delegates and Events in this control. Step 2: Create a Public function in the base user control to Raise Events defined in Step1. 'SourceCode for Step 1 and Step 2 Public Delegate Sub UpdatePageHeaderHandler(ByVal PageHeading As String) Public Cla...
update page text using web user control I am building an application where a page will load user controls (x.ascx) dynamically based on query string. I have a validation summary on the page and want to update it from the User Controls. This will allow me to have multiple controls using one Validation Summary. How can I...
TITLE: update page text using web user control QUESTION: I am building an application where a page will load user controls (x.ascx) dynamically based on query string. I have a validation summary on the page and want to update it from the User Controls. This will allow me to have multiple controls using one Validation ...
[ "asp.net", "user-controls" ]
0
1
1,199
2
0
2008-09-24T23:20:16.117000
2008-09-25T04:30:50.533000
130,573
3,603,011
Does the windows FILETIME structure include leap seconds?
The FILETIME structure counts from January 1 1601 (presumably the start of that day) according to the Microsoft documentation, but does this include leap seconds?
The question shouldn't be if FILETIME includes leap seconds. It should be: Do the people, functions, and libraries, who interpret a FILETIME (i.e. FileTimeToSystemTime ) include leap seconds when counting the duration? The simple answer is "no". FileTimeToSystemTime returns seconds as 0..59. The simpler answer is: " of...
Does the windows FILETIME structure include leap seconds? The FILETIME structure counts from January 1 1601 (presumably the start of that day) according to the Microsoft documentation, but does this include leap seconds?
TITLE: Does the windows FILETIME structure include leap seconds? QUESTION: The FILETIME structure counts from January 1 1601 (presumably the start of that day) according to the Microsoft documentation, but does this include leap seconds? ANSWER: The question shouldn't be if FILETIME includes leap seconds. It should b...
[ "windows", "datetime", "filetime", "leap-second" ]
20
18
6,282
7
0
2008-09-24T23:24:45.747000
2010-08-30T18:10:49.630000
130,576
132,891
How do you like the new Ribbon Controls in D2009?
How do they compare to the DevXpress ones or the original MSOffice ones. Are they worth investing time in them (for practical usage now, not academic curiosity which I'll do anyway)?
From my experience, the new ribbon control implements the entire specification as laid out by Microsoft. The only issue I noticed was a slight flicker when the form was resized which caused one of the sections to collapse or expand. Worth spending time in? Definitely, as they are lighter weight and its a matter of time...
How do you like the new Ribbon Controls in D2009? How do they compare to the DevXpress ones or the original MSOffice ones. Are they worth investing time in them (for practical usage now, not academic curiosity which I'll do anyway)?
TITLE: How do you like the new Ribbon Controls in D2009? QUESTION: How do they compare to the DevXpress ones or the original MSOffice ones. Are they worth investing time in them (for practical usage now, not academic curiosity which I'll do anyway)? ANSWER: From my experience, the new ribbon control implements the en...
[ "delphi", "ribbon" ]
1
3
1,504
3
0
2008-09-24T23:25:12.827000
2008-09-25T12:05:56.557000
130,585
130,594
Preferred protocols to upload static files to your Apache server?
If you were the administrator of an Apache web server, what protocol(s) would you prefer to provide, for the web developers to upload static files (html/gif/css/...), with the goal of maximum security? If you were the web developer/graphic designer, what protocols would you prefer to be available at the Apache server, ...
SCP is what I'd go with. You can even use Filezilla for it and pretend it's unsecure FTP: http://filezilla-project.org/
Preferred protocols to upload static files to your Apache server? If you were the administrator of an Apache web server, what protocol(s) would you prefer to provide, for the web developers to upload static files (html/gif/css/...), with the goal of maximum security? If you were the web developer/graphic designer, what...
TITLE: Preferred protocols to upload static files to your Apache server? QUESTION: If you were the administrator of an Apache web server, what protocol(s) would you prefer to provide, for the web developers to upload static files (html/gif/css/...), with the goal of maximum security? If you were the web developer/grap...
[ "apache", "security", "administration", "file-management" ]
1
4
317
5
0
2008-09-24T23:28:09.123000
2008-09-24T23:29:54.050000
130,587
4,695,601
How to pass all Visual Studio 2008 "Macros" to Python script?
[NOTE: This questions is similar to but not the same as this one.] Visual Studio defines several dozen "Macros" which are sort of simulated environment variables (completely unrelated to C++ macros) which contain information about the build in progress. Examples: ConfigurationName Release TargetPath D:\work\foo\win\Rel...
As far as I can tell, the method described in the question is the only way to pass build variables to a Python script. Perhaps Visual Studio 2010 has something better?
How to pass all Visual Studio 2008 "Macros" to Python script? [NOTE: This questions is similar to but not the same as this one.] Visual Studio defines several dozen "Macros" which are sort of simulated environment variables (completely unrelated to C++ macros) which contain information about the build in progress. Exam...
TITLE: How to pass all Visual Studio 2008 "Macros" to Python script? QUESTION: [NOTE: This questions is similar to but not the same as this one.] Visual Studio defines several dozen "Macros" which are sort of simulated environment variables (completely unrelated to C++ macros) which contain information about the build...
[ "python", "visual-studio", "visual-studio-2008", "visual-c++", "visual-studio-2005" ]
2
0
3,276
3
0
2008-09-24T23:28:24.037000
2011-01-14T20:28:15.937000
130,592
130,620
Is Continuous Integration important for a solo developer?
I've never used CI tools before, but from what I've read, I'm not sure it would provide any benefit to a solo developer that isn't writing code every day. First - what benefits does CI provide to any project? Second - who should use CI? Does it benefit all developers?
The basic concept of CI is that you have a system that builds the code and runs automated tests everytime someone makes a commit to the version control system. These tests would include unit and functional tests, or even behavior driven tests. The benefit is that you know - immediately - when someone has broken the bui...
Is Continuous Integration important for a solo developer? I've never used CI tools before, but from what I've read, I'm not sure it would provide any benefit to a solo developer that isn't writing code every day. First - what benefits does CI provide to any project? Second - who should use CI? Does it benefit all devel...
TITLE: Is Continuous Integration important for a solo developer? QUESTION: I've never used CI tools before, but from what I've read, I'm not sure it would provide any benefit to a solo developer that isn't writing code every day. First - what benefits does CI provide to any project? Second - who should use CI? Does it...
[ "continuous-integration" ]
70
75
9,568
7
0
2008-09-24T23:29:15.157000
2008-09-24T23:35:17.610000
130,604
130,660
Looking for a .NET Function that sums up number and instead of overflowing simply returns int.MaxValue
I use int.MaxValue as a penalty and sometimes I am computing the penalties together. Is there a function or how would you create one with the most grace and efficiency that does that. ie. 50 + 100 = 150 int.Max + 50 = int.Max and not int.Min + 50
int penaltySum(int a, int b) { return (int.MaxValue - a < b)? int.MaxValue: a + b; } Update: If your penalties can be negative, this would be more appropriate: int penaltySum(int a, int b) { if (a > 0 && b > 0) { return (int.MaxValue - a < b)? int.MaxValue: a + b; } if (a < 0 && b < 0) { return (int.MinValue - a > b)?...
Looking for a .NET Function that sums up number and instead of overflowing simply returns int.MaxValue I use int.MaxValue as a penalty and sometimes I am computing the penalties together. Is there a function or how would you create one with the most grace and efficiency that does that. ie. 50 + 100 = 150 int.Max + 50 =...
TITLE: Looking for a .NET Function that sums up number and instead of overflowing simply returns int.MaxValue QUESTION: I use int.MaxValue as a penalty and sometimes I am computing the penalties together. Is there a function or how would you create one with the most grace and efficiency that does that. ie. 50 + 100 = ...
[ "c#", ".net", "math" ]
1
4
407
3
0
2008-09-24T23:32:21.330000
2008-09-24T23:43:07.607000
130,605
130,691
Can LINQ (to SQL) do bitwise queries?
I have a table of Users that includes a bitmask of roles that the user belongs to. I'd like to select users that belong to one or more of the roles in a bitmask value. For example: select * from [User] where UserRolesBitmask | 22 = 22 This selects all users that have the roles '2', '4' or '16' in their bitmask. Is this...
I think this will work, but I haven't tested it.Substitute the name of your DataContext object. YMMV. from u in DataContext.Users where UserRolesBitmask | 22 == 22 select u
Can LINQ (to SQL) do bitwise queries? I have a table of Users that includes a bitmask of roles that the user belongs to. I'd like to select users that belong to one or more of the roles in a bitmask value. For example: select * from [User] where UserRolesBitmask | 22 = 22 This selects all users that have the roles '2',...
TITLE: Can LINQ (to SQL) do bitwise queries? QUESTION: I have a table of Users that includes a bitmask of roles that the user belongs to. I'd like to select users that belong to one or more of the roles in a bitmask value. For example: select * from [User] where UserRolesBitmask | 22 = 22 This selects all users that h...
[ "c#", "linq-to-sql", "bitmask" ]
5
8
4,680
3
0
2008-09-24T23:32:44.323000
2008-09-24T23:52:21.217000
130,614
130,668
Change cardinality of item in C# dictionary
I've got a dictionary, something like Dictionary fooDict I step through everything in the dictionary, e.g. foreach (Foo foo in fooDict.Keys) MessageBox.show(fooDict[foo]); It does that in the order the foos were added to the dictionary, so the first item added is the first foo returned. How can I change the cardinality...
If you read the documentation on MSDN you'll see this: "The order in which the items are returned is undefined." You can't gaurantee the order, because a Dictionary is not a list or an array. It's meant to look up a value by the key, and any ability to iterate values is just a convenience but the order is not behavior ...
Change cardinality of item in C# dictionary I've got a dictionary, something like Dictionary fooDict I step through everything in the dictionary, e.g. foreach (Foo foo in fooDict.Keys) MessageBox.show(fooDict[foo]); It does that in the order the foos were added to the dictionary, so the first item added is the first fo...
TITLE: Change cardinality of item in C# dictionary QUESTION: I've got a dictionary, something like Dictionary fooDict I step through everything in the dictionary, e.g. foreach (Foo foo in fooDict.Keys) MessageBox.show(fooDict[foo]); It does that in the order the foos were added to the dictionary, so the first item add...
[ "c#", "dictionary", "cardinality" ]
4
8
4,970
5
0
2008-09-24T23:33:56.537000
2008-09-24T23:45:24.697000
130,616
130,849
Starting service as a user with no password
I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error). Am I doing something wrong or is this "by design"? The code to register this service: SC_HANDLE schService = CreateService( schSCManager, strNameNoSpaces, strServ...
It may be due to an OS security requirement or security policy. Check the security policies to see if anything is relevant there.
Starting service as a user with no password I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error). Am I doing something wrong or is this "by design"? The code to register this service: SC_HANDLE schService = CreateSer...
TITLE: Starting service as a user with no password QUESTION: I'm trying to start a service as a user and things work fine, until I try a user that doesn't have a password. Then, it fails to start (due to log-on error). Am I doing something wrong or is this "by design"? The code to register this service: SC_HANDLE schS...
[ "winapi", "mfc", "windows-services", "service" ]
2
2
3,115
4
0
2008-09-24T23:34:03.727000
2008-09-25T00:43:42.513000
130,617
130,641
How do you check for permissions to write to a directory or file?
I got a program that writes some data to a file using a method like the one below. public void ExportToFile(string filename) { using(FileStream fstream = new FileStream(filename,FileMode.Create)) using (TextWriter writer = new StreamWriter(fstream)) { // try catch block for write permissions writer.WriteLine(text); } ...
UPDATE: Modified the code based on this answer to get rid of obsolete methods. You can use the Security namespace to check this: public void ExportToFile(string filename) { var permissionSet = new PermissionSet(PermissionState.None); var writePermission = new FileIOPermission(FileIOPermissionAccess.Write, filename); pe...
How do you check for permissions to write to a directory or file? I got a program that writes some data to a file using a method like the one below. public void ExportToFile(string filename) { using(FileStream fstream = new FileStream(filename,FileMode.Create)) using (TextWriter writer = new StreamWriter(fstream)) { //...
TITLE: How do you check for permissions to write to a directory or file? QUESTION: I got a program that writes some data to a file using a method like the one below. public void ExportToFile(string filename) { using(FileStream fstream = new FileStream(filename,FileMode.Create)) using (TextWriter writer = new StreamWri...
[ "c#", ".net" ]
64
71
113,311
8
0
2008-09-24T23:34:03.773000
2008-09-24T23:39:38.427000
130,618
130,665
Python Date Comparisons
I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to: if (datetime.now() - self.timestamp) > 100 # Where 100 is either seconds or minutes This generates a type error. What is the proper way to do date time comparison in python? I alread...
Use the datetime.timedelta class: >>> from datetime import datetime, timedelta >>> then = datetime.now() - timedelta(hours = 2) >>> now = datetime.now() >>> (now - then) > timedelta(days = 1) False >>> (now - then) > timedelta(hours = 1) True Your example could be written as: if (datetime.now() - self.timestamp) > time...
Python Date Comparisons I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to: if (datetime.now() - self.timestamp) > 100 # Where 100 is either seconds or minutes This generates a type error. What is the proper way to do date time compar...
TITLE: Python Date Comparisons QUESTION: I would like to find out if a particular python datetime object is older than X hours or minutes. I am trying to do something similar to: if (datetime.now() - self.timestamp) > 100 # Where 100 is either seconds or minutes This generates a type error. What is the proper way to d...
[ "python", "datetime" ]
64
111
67,071
7
0
2008-09-24T23:34:31.447000
2008-09-24T23:44:27.837000
130,636
130,752
How to compile Clisp 2.46?
When I try to compile the newest version of Clisp on Ubuntu 8.04 I always get this error after running configure: Configure findings: FFI: no (user requested: default) readline: yes (user requested: yes) libsigsegv: no, consider installing GNU libsigsegv./configure: libsigsegv was not detected, thus some features, such...
Here are my notes from compiling CLISP on Ubuntu in the past, hope this helps: sudo apt-get install libsigsegv-dev libreadline5-dev # as of 7.10, Ubuntu's libffcall1-dev is broken and I had to get it from CVS # and make sure CLISP didn't use Ubuntu's version. sudo apt-get remove libffcall1-dev libffcall1 cvs -z3 -d:ps...
How to compile Clisp 2.46? When I try to compile the newest version of Clisp on Ubuntu 8.04 I always get this error after running configure: Configure findings: FFI: no (user requested: default) readline: yes (user requested: yes) libsigsegv: no, consider installing GNU libsigsegv./configure: libsigsegv was not detecte...
TITLE: How to compile Clisp 2.46? QUESTION: When I try to compile the newest version of Clisp on Ubuntu 8.04 I always get this error after running configure: Configure findings: FFI: no (user requested: default) readline: yes (user requested: yes) libsigsegv: no, consider installing GNU libsigsegv./configure: libsigse...
[ "installation", "lisp", "common-lisp", "configure" ]
4
3
1,860
2
0
2008-09-24T23:38:51.283000
2008-09-25T00:18:23.167000
130,640
223,455
Is there a reasonable way to implement a cd command on VMS?
I would like to be able to say things like cd [.fred] and have my default directory go there, and my prompt change to indicate the full path to my current location.
Here's my setup: You need 2 files (typed below): godir.com and prompt.com in your sys$login You may define a symbole CD == "@sys$login:godir.com" But I suggest you to use something else... (ie SD == "@sys$login:godir.com") I modify the help text. It was in french... You will have to retype the escape caracters into god...
Is there a reasonable way to implement a cd command on VMS? I would like to be able to say things like cd [.fred] and have my default directory go there, and my prompt change to indicate the full path to my current location.
TITLE: Is there a reasonable way to implement a cd command on VMS? QUESTION: I would like to be able to say things like cd [.fred] and have my default directory go there, and my prompt change to indicate the full path to my current location. ANSWER: Here's my setup: You need 2 files (typed below): godir.com and promp...
[ "vms" ]
4
3
1,029
4
0
2008-09-24T23:39:36.163000
2008-10-21T20:49:12.590000
130,664
130,743
Combining two executables
I have a command line executable that alters some bits in a file that i want to use from my program. Is it possible to create my own executable that uses this tool and distribute only one executable? [edit] Clarification: The command line tool takes an offset and some bits and changes the bits at this offset in a given...
It would be easier to roll your own implementation of this program than to write the wrapper; it sounds like it is trivial -- just open the file, seek to the right location, write your bits, close the file, you're done.
Combining two executables I have a command line executable that alters some bits in a file that i want to use from my program. Is it possible to create my own executable that uses this tool and distribute only one executable? [edit] Clarification: The command line tool takes an offset and some bits and changes the bits...
TITLE: Combining two executables QUESTION: I have a command line executable that alters some bits in a file that i want to use from my program. Is it possible to create my own executable that uses this tool and distribute only one executable? [edit] Clarification: The command line tool takes an offset and some bits an...
[ "c++", "command-line", "assembly", "executable" ]
1
7
3,447
8
0
2008-09-24T23:44:21.347000
2008-09-25T00:13:10.077000
130,698
130,726
How do I protect quotes in a batch file?
I want to wrap a Perl one-liner in a batch file. For a (trivial) example, in a Unix shell, I could quote up a command like this: perl -e 'print localtime(). "\n"' But DOS chokes on that with this helpful error message: Can't find string terminator "'" anywhere before EOF at -e line 1. What's the best way to do this wit...
For Perl stuff on Windows, I try to use the generalized quoting as much as possible so I don't get leaning toothpick syndrome. I save the quotes for the stuff that DOS needs: perl -e "print scalar localtime(). qq(\n)" If you just need a newline at the end of the print, you can let the -l switch do that for you: perl -l...
How do I protect quotes in a batch file? I want to wrap a Perl one-liner in a batch file. For a (trivial) example, in a Unix shell, I could quote up a command like this: perl -e 'print localtime(). "\n"' But DOS chokes on that with this helpful error message: Can't find string terminator "'" anywhere before EOF at -e l...
TITLE: How do I protect quotes in a batch file? QUESTION: I want to wrap a Perl one-liner in a batch file. For a (trivial) example, in a Unix shell, I could quote up a command like this: perl -e 'print localtime(). "\n"' But DOS chokes on that with this helpful error message: Can't find string terminator "'" anywhere ...
[ "perl", "batch-file", "quotes" ]
5
13
5,206
5
0
2008-09-24T23:55:23.177000
2008-09-25T00:08:23.833000
130,705
130,972
How do you access Control.ViewState with a dynamically added Control subclass?
We have created a control that needs to persist data via the ViewState property of the Control class. Our class subclasses control strictly to get access to the ViewState property (it's protected on the Page object). We are adding the control to Page.Controls in OnInit, and then attempt to set the ViewState property in...
The issue is adding the control to the Page directly. Unfortunately this is too high up the controls hierarchy to participate in the Forms ViewState Handling. If you add the control onto the actual ASPNet Form's Controls collection somewhere then it will successfully participate in LoadViewStateRecursive and SaveViewSt...
How do you access Control.ViewState with a dynamically added Control subclass? We have created a control that needs to persist data via the ViewState property of the Control class. Our class subclasses control strictly to get access to the ViewState property (it's protected on the Page object). We are adding the contro...
TITLE: How do you access Control.ViewState with a dynamically added Control subclass? QUESTION: We have created a control that needs to persist data via the ViewState property of the Control class. Our class subclasses control strictly to get access to the ViewState property (it's protected on the Page object). We are...
[ "asp.net", "controls", "viewstate" ]
0
1
2,117
3
0
2008-09-24T23:59:43.603000
2008-09-25T01:24:48.313000
130,708
130,712
Expanding a Region will expand children in Visual Studio
I am developing an ASP.NET Ajax form, and decided to make most of the site in one page, because it isn't a very involved site (it's more of a form). In the codebehind, I have been making my code more organized by adding regions to it (inside are the click events of the controls, etc). When I expand a region, all the su...
Try the "key chord": Ctrl+M, Ctrl+O, then use Ctrl+M, Ctrl+M to expand one at a time. Although, I do think regions are evil, and you should do something about the fat code;)
Expanding a Region will expand children in Visual Studio I am developing an ASP.NET Ajax form, and decided to make most of the site in one page, because it isn't a very involved site (it's more of a form). In the codebehind, I have been making my code more organized by adding regions to it (inside are the click events ...
TITLE: Expanding a Region will expand children in Visual Studio QUESTION: I am developing an ASP.NET Ajax form, and decided to make most of the site in one page, because it isn't a very involved site (it's more of a form). In the codebehind, I have been making my code more organized by adding regions to it (inside are...
[ "visual-studio" ]
0
1
915
3
0
2008-09-25T00:00:46.627000
2008-09-25T00:02:33.363000
130,711
131,284
How long would it take to setup a new CI repository?
I wonder how long it would usually take for: Professional Average Beginner to setup and configure CI for a new project?
I have never set up CI before, which puts me squarely in your "Beginner" category. Your question nudged me to try and setup a CI system for my projects; something which I've always avoided, because I thought it would cost me a lot of effort and time. It took me all of 20 minutes. I used a fantastic project called CInAB...
How long would it take to setup a new CI repository? I wonder how long it would usually take for: Professional Average Beginner to setup and configure CI for a new project?
TITLE: How long would it take to setup a new CI repository? QUESTION: I wonder how long it would usually take for: Professional Average Beginner to setup and configure CI for a new project? ANSWER: I have never set up CI before, which puts me squarely in your "Beginner" category. Your question nudged me to try and se...
[ "continuous-integration" ]
3
3
410
4
0
2008-09-25T00:01:36.733000
2008-09-25T03:13:52.123000
130,720
133,032
Flex: Why can't I handle certain events?
In certain cases, I can't seem to get components to receive events. [edit] To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispatch events to and from arbitrary objects. I ended up using p...
Above is correct. You are dispatching the event from btnMenu, but you are not listening for events on btnMenu - you are listening for events on the Application. Either dispatch from Application: dispatchEvent(new Event("stepchild", true)); or listen on the btnMenu btnMenu.addEventListener("stepchild",handleStepChild); ...
Flex: Why can't I handle certain events? In certain cases, I can't seem to get components to receive events. [edit] To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispatch events to and f...
TITLE: Flex: Why can't I handle certain events? QUESTION: In certain cases, I can't seem to get components to receive events. [edit] To clarify, the example code is just for demonstration sake, what I was really asking was if there was a central location that a listener could be added, to which one can reliably dispat...
[ "apache-flex", "events" ]
2
2
1,136
2
0
2008-09-25T00:04:05.120000
2008-09-25T12:34:01.997000
130,721
130,867
Impersonating a User in Asp.Net
My DBA requires all database access to be done through trusted domain account. This can be done if you set the web.config. This requires the user to login or to be on the domain for IE pass the credentials through. I want to impersonate a user by using code. I am using the code found in this knowledgebase article: http...
Impersonation occurs at the level of the thread. Impersonation causes the access token of the thread, which is usually inherited from the process, to be replaced with another. The best practice is to revert the effect of impersonation and thus the token as soon as you are done with the operation(s) for which it was nee...
Impersonating a User in Asp.Net My DBA requires all database access to be done through trusted domain account. This can be done if you set the web.config. This requires the user to login or to be on the domain for IE pass the credentials through. I want to impersonate a user by using code. I am using the code found in ...
TITLE: Impersonating a User in Asp.Net QUESTION: My DBA requires all database access to be done through trusted domain account. This can be done if you set the web.config. This requires the user to login or to be on the domain for IE pass the credentials through. I want to impersonate a user by using code. I am using ...
[ "asp.net", "database-connection" ]
3
3
4,333
2
0
2008-09-25T00:04:56.057000
2008-09-25T00:52:07.097000
130,730
130,735
How to unit test immutable class constructors?
I have an immutable class with some private fields that are set during the constructor execution. I want to unit test this constructor but I'm not sure the "best practice" in this case. Simple Example This class is defined in Assembly1: public class Class2Test { private readonly string _StringProperty; public Class2Te...
Nothing, unless you are using that field. You don't want over-specification via tests. In other words, there is no need to test that the assignment operator works. If you are using that field in a method or something, call that method and assert on that. Edit: assume the constructor has some more complex logic You shou...
How to unit test immutable class constructors? I have an immutable class with some private fields that are set during the constructor execution. I want to unit test this constructor but I'm not sure the "best practice" in this case. Simple Example This class is defined in Assembly1: public class Class2Test { private re...
TITLE: How to unit test immutable class constructors? QUESTION: I have an immutable class with some private fields that are set during the constructor execution. I want to unit test this constructor but I'm not sure the "best practice" in this case. Simple Example This class is defined in Assembly1: public class Class...
[ "c#", "unit-testing" ]
1
8
1,788
3
0
2008-09-25T00:09:13.423000
2008-09-25T00:10:23.983000
130,734
130,741
How can one close HTML tags in Vim quickly?
It's been a while since I've had to do any HTML-like code in Vim, but recently I came across this again. Say I'm writing some simple HTML: This is a title How do I write those closing tags for title, head and html down quickly? I feel like I'm missing some really simple way here that does not involve me going through w...
Check this out.. closetag.vim Functions and mappings to close open HTML/XML tags https://www.vim.org/scripts/script.php?script_id=13 I use something similar.
How can one close HTML tags in Vim quickly? It's been a while since I've had to do any HTML-like code in Vim, but recently I came across this again. Say I'm writing some simple HTML: This is a title How do I write those closing tags for title, head and html down quickly? I feel like I'm missing some really simple way h...
TITLE: How can one close HTML tags in Vim quickly? QUESTION: It's been a while since I've had to do any HTML-like code in Vim, but recently I came across this again. Say I'm writing some simple HTML: This is a title How do I write those closing tags for title, head and html down quickly? I feel like I'm missing some r...
[ "html", "xml", "vim", "autocomplete" ]
127
38
66,780
11
0
2008-09-25T00:10:08.663000
2008-09-25T00:12:02.387000
130,740
130,754
Link error when compiling gcc atomic operation in 32-bit mode
I have the following program: ~/test> cat test.cc int main() { int i = 3; int j = __sync_add_and_fetch(&i, 1); return 0; } I'm compiling this program using GCC 4.2.2 on Linux running on a multi-cpu 64-bit Intel machine: ~/test> uname --all Linux doom 2.6.9-67.ELsmp #1 SMP Wed Nov 7 13:56:44 EST 2007 x86_64 x86_64 x86_6...
From the GCC page on Atomic Builtins: Not all operations are supported by all target processors. If a particular operation cannot be implemented on the target processor, a warning will be generated and a call an external function will be generated. The external function will carry the same name as the builtin, with an ...
Link error when compiling gcc atomic operation in 32-bit mode I have the following program: ~/test> cat test.cc int main() { int i = 3; int j = __sync_add_and_fetch(&i, 1); return 0; } I'm compiling this program using GCC 4.2.2 on Linux running on a multi-cpu 64-bit Intel machine: ~/test> uname --all Linux doom 2.6.9-6...
TITLE: Link error when compiling gcc atomic operation in 32-bit mode QUESTION: I have the following program: ~/test> cat test.cc int main() { int i = 3; int j = __sync_add_and_fetch(&i, 1); return 0; } I'm compiling this program using GCC 4.2.2 on Linux running on a multi-cpu 64-bit Intel machine: ~/test> uname --all ...
[ "gcc", "linker", "atomic" ]
18
15
17,647
2
0
2008-09-25T00:11:59.907000
2008-09-25T00:18:46.130000
130,748
130,805
Best way to swap two .NET controls based on radio buttons
I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user. The way I'm doing this now is just loading both controls and setting up an OnRadioButtonSelectionCha...
Yep, that's pretty much how I do it. I would set the CheckedChanged event of both radio buttons to point at a single event handler and would place the following code to swap out the visible control. private void OnRadioButtonCheckedChanged(object sender, EventArgs e) { Control1.Visible = RadioButton1.Checked; Control2....
Best way to swap two .NET controls based on radio buttons I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user. The way I'm doing this now is just loading...
TITLE: Best way to swap two .NET controls based on radio buttons QUESTION: I've got a form where I have two radio buttons and two interchangeable controls (made up of a ListView and a handful of buttons). Based on which radio button is selected I want to display the proper control to the user. The way I'm doing this n...
[ "c#", ".net", "winforms" ]
0
3
621
2
0
2008-09-25T00:16:19.117000
2008-09-25T00:31:23.683000
130,775
130,810
Is a variable named i unacceptable?
As far as variable naming conventions go, should iterators be named i or something more semantic like count? If you don't use i, why not? If you feel that i is acceptable, are there cases of iteration where it shouldn't be used?
Depends on the context I suppose. If you where looping through a set of Objects in some collection then it should be fairly obvious from the context what you are doing. for(int i = 0; i < 10; i++) { // i is well known here to be the index objectCollection[i].SomeProperty = someValue; } However if it is not immediately ...
Is a variable named i unacceptable? As far as variable naming conventions go, should iterators be named i or something more semantic like count? If you don't use i, why not? If you feel that i is acceptable, are there cases of iteration where it shouldn't be used?
TITLE: Is a variable named i unacceptable? QUESTION: As far as variable naming conventions go, should iterators be named i or something more semantic like count? If you don't use i, why not? If you feel that i is acceptable, are there cases of iteration where it shouldn't be used? ANSWER: Depends on the context I sup...
[ "variables", "coding-style", "iterator", "naming-conventions" ]
16
35
1,471
21
0
2008-09-25T00:24:44.103000
2008-09-25T00:32:27.627000
130,789
132,483
Can you use Decision Tables in Relational Databases
I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well. I was wondering if people today use decision tables within their relational databases?
A decision table is a cluster of conditions and actions. A condition can be simple enough that you can represent it with a simple "match a column against this value" string. Or a condition could be hellishly complex. An action, similarly, could be as simple as "move this value to a column". Or the action could involve ...
Can you use Decision Tables in Relational Databases I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well. I was wondering if people today use decision tables within their relational dat...
TITLE: Can you use Decision Tables in Relational Databases QUESTION: I heard that decision tables in relational database have been researched a lot in academia. I also know that business rules engines use decision tables and that many BPMS use them as well. I was wondering if people today use decision tables within th...
[ "database" ]
2
1
3,631
4
0
2008-09-25T00:27:25.610000
2008-09-25T10:22:16.913000
130,794
130,862
What is dependency injection?
There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However, What is dependency injection and when/why should or shouldn't it be used?
Dependency Injection is passing dependency to other objects or framework ( dependency injector). Dependency injection makes testing easier. The injection can be done through constructor. SomeClass() has its constructor as following: public SomeClass() { myObject = Factory.getObject(); } Problem: If myObject involves co...
What is dependency injection? There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However, What is dependency injection and when/why should or shouldn't it be used?
TITLE: What is dependency injection? QUESTION: There have been several questions already posted with specific questions about dependency injection, such as when to use it and what frameworks are there for it. However, What is dependency injection and when/why should or shouldn't it be used? ANSWER: Dependency Injecti...
[ "design-patterns", "language-agnostic", "dependency-injection", "terminology" ]
3,633
2,167
1,190,639
39
0
2008-09-25T00:28:40.600000
2008-09-25T00:49:32.063000
130,800
130,885
Data visualization in desktop applications
I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated... What I would like to create is something similar to the examples seen here: http://www.visualcompl...
Your post has far too many questions in it to be answered easily in one response, so you might try re-posting with specific questions. Data visualization is a HUGE area of study and it's not significantly different for web applications versus desktop applications. Put simply, it's the display of data in a way that visu...
Data visualization in desktop applications I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated... What I would like to create is something similar to the...
TITLE: Data visualization in desktop applications QUESTION: I would like to create data visualizations in desktop apps, using frameworks, languages and libraries that help with this kind of task. Visualizations should be interactive: clickable, draggable, customizable, animated... What I would like to create is someth...
[ "c#", ".net", "c++", "mfc", "visualization" ]
1
6
2,493
2
0
2008-09-25T00:30:34.527000
2008-09-25T00:59:27.563000
130,801
174,142
How do you create tests for "make check" with GNU autotools
I'm using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type "make check" to have it automatically run these. My project is in C++, although I am still curious about writing automated tests for other languages as well. Is this c...
To make test run when you issue make check, you need to add them to the TESTS variable Assuming you've already built the executable that runs the unit tests, you just add the name of the executable to the TESTS variable like this: TESTS=my-test-executable It should then be automatically run when you make check, and if ...
How do you create tests for "make check" with GNU autotools I'm using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type "make check" to have it automatically run these. My project is in C++, although I am still curious about wr...
TITLE: How do you create tests for "make check" with GNU autotools QUESTION: I'm using GNU autotools for the build system on a particular project. I want to start writing automated tests for verifcation. I would like to just type "make check" to have it automatically run these. My project is in C++, although I am stil...
[ "unit-testing", "language-agnostic", "automated-tests", "autotools" ]
33
32
19,036
5
0
2008-09-25T00:30:36.167000
2008-10-06T12:56:05.437000
130,803
130,866
VB.NET - Application has encountered a user-defined breakpoint
I'm not that up on VB.NET, the application I'm working on was not written by myself. It works fine through the IDE but once I run it from the exe it gives me the above error. Any clues? This is really hacking me off!
Afaik, the only way this could occur if you are compiling under debugging settings. You should be able to fix it by doing the following: Right-click your solution on the solution explorer. Select configuration properties. At the top of the dialog box there should be a combobox, which will most likely say "Active(Debug)...
VB.NET - Application has encountered a user-defined breakpoint I'm not that up on VB.NET, the application I'm working on was not written by myself. It works fine through the IDE but once I run it from the exe it gives me the above error. Any clues? This is really hacking me off!
TITLE: VB.NET - Application has encountered a user-defined breakpoint QUESTION: I'm not that up on VB.NET, the application I'm working on was not written by myself. It works fine through the IDE but once I run it from the exe it gives me the above error. Any clues? This is really hacking me off! ANSWER: Afaik, the on...
[ "vb.net" ]
3
3
10,615
4
0
2008-09-25T00:31:00.173000
2008-09-25T00:51:38.050000
130,814
130,825
Performance penalty on putting classes in aspx and ascx codebehinds
What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to unit test, code is not reusable, etc.), but it does come in very handy when you're deal...
"None." The codebehind classes are compiled into a DLL on the fly, and then that DLL is kept around. So basically the first time you load the page there will be a short delay, but afterwards the speed should be the same as with precompiled classes.
Performance penalty on putting classes in aspx and ascx codebehinds What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to unit test, code is ...
TITLE: Performance penalty on putting classes in aspx and ascx codebehinds QUESTION: What's the performance penalty on defining classes in an aspx/ascx codebehind rather than compiling them into a dll beforehand? I know that this isn't a best practice and that there are numerous problems with this (e.g. difficult to u...
[ "asp.net", "performance" ]
2
8
790
5
0
2008-09-25T00:33:54.020000
2008-09-25T00:36:46.820000
130,819
130,826
Write VB6 on Visual Studio 2008 without .NET support?
I have to continue to support VB6 applications. I've got both VB6 (Visual Studio 6) installed and Visual Studio 2008 as well. Can I read and write to VB6 projects while in Visual Studio 2008? Will it damage or destroy my VB6 application? It would be very cool if I could free up a lot of space and get rid of Visual Stud...
Visual Studio 2008 can't compile VB6 applications. You could use it as a text editor only (though it will offer you the VB.NET IntelliSense, not VB6). However, you need Visual Studio 6 to be able to build your application.
Write VB6 on Visual Studio 2008 without .NET support? I have to continue to support VB6 applications. I've got both VB6 (Visual Studio 6) installed and Visual Studio 2008 as well. Can I read and write to VB6 projects while in Visual Studio 2008? Will it damage or destroy my VB6 application? It would be very cool if I c...
TITLE: Write VB6 on Visual Studio 2008 without .NET support? QUESTION: I have to continue to support VB6 applications. I've got both VB6 (Visual Studio 6) installed and Visual Studio 2008 as well. Can I read and write to VB6 projects while in Visual Studio 2008? Will it damage or destroy my VB6 application? It would b...
[ "vb.net", "visual-studio-2008", "vb6" ]
8
14
12,126
3
0
2008-09-25T00:35:09.617000
2008-09-25T00:36:58.630000
130,829
130,909
3d to 2d Projection Matrix
I have 3 points in a 3D space of which I know the exact locations. Suppose they are: (x0,y0,z0), (x1,y1,z1) and (x2,y2,z2). Also I have a camera that is looking at these 3 points and I know the 2D locations of those three points on camera view plane. So for example (x0,y0,z0) will be (x0',y0'), and (x1,y1,z1) will be (...
This gives you two sets, each of three equations in 3 variables: a*x0+b*y0+c*z0 = x0' a*x1+b*y1+c*z1 = x1' a*x2+b*y2+c*z2 = x2' d*x0+e*y0+f*z0 = y0' d*x1+e*y1+f*z1 = y1' d*x2+e*y2+f*z2 = y2' Just use whatever method of solving simultaneous equations is easiest in your situation (it isn't even hard to solve these "by h...
3d to 2d Projection Matrix I have 3 points in a 3D space of which I know the exact locations. Suppose they are: (x0,y0,z0), (x1,y1,z1) and (x2,y2,z2). Also I have a camera that is looking at these 3 points and I know the 2D locations of those three points on camera view plane. So for example (x0,y0,z0) will be (x0',y0'...
TITLE: 3d to 2d Projection Matrix QUESTION: I have 3 points in a 3D space of which I know the exact locations. Suppose they are: (x0,y0,z0), (x1,y1,z1) and (x2,y2,z2). Also I have a camera that is looking at these 3 points and I know the 2D locations of those three points on camera view plane. So for example (x0,y0,z0...
[ "3d", "geometry", "matrix", "2d", "projection" ]
16
12
22,822
4
0
2008-09-25T00:37:52.887000
2008-09-25T01:07:10.307000
130,837
147,271
What's the (JavaScript) Regular Expression I should use to ensure a string is a valid file name?
I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string: No directories. JUST the file name. File name needs to be all lowercase. Whitespaces need to be replaced with underscores. Shouldn't be hard, but I'm pressed f...
And a simple combination of RegExp and other javascript is what I would recommend: var a = "c:\\some\\path\\to\\a\\file\\with Whitespace.TXT"; a = a.replace(/^.*[\\\/]([^\\\/]*)$/i,"$1"); a = a.replace(/\s/g,"_"); a = a.toLowerCase(); alert(a);
What's the (JavaScript) Regular Expression I should use to ensure a string is a valid file name? I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string: No directories. JUST the file name. File name needs to be all ...
TITLE: What's the (JavaScript) Regular Expression I should use to ensure a string is a valid file name? QUESTION: I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string: No directories. JUST the file name. File nam...
[ "javascript", "regex", "filenames" ]
2
1
2,995
3
0
2008-09-25T00:39:34.490000
2008-09-29T02:02:05.450000
130,843
131,460
How do I add a <table> using Element with Prototype in IE6?
Using Prototype 1.6's "new Element(...)" I am trying to create a element with both a and but nothing happens in IE6. var tableProto = new Element('table').update(' Situation Task Action Result a b c '); I'm then trying to inject copies of it like this: $$('div.question').each(function(o) { Element.insert(o, { after:$(t...
As it turns out, there's nothing wrong with the example code I provided in the question--it works in IE6 just fine. The issue I was facing is that I was also specifying a class for the element in the constructor incorrectly, but omitted that from my example. The "real" code was as follows, and is incorrect: var tablePr...
How do I add a <table> using Element with Prototype in IE6? Using Prototype 1.6's "new Element(...)" I am trying to create a element with both a and but nothing happens in IE6. var tableProto = new Element('table').update(' Situation Task Action Result a b c '); I'm then trying to inject copies of it like this: $$('div...
TITLE: How do I add a <table> using Element with Prototype in IE6? QUESTION: Using Prototype 1.6's "new Element(...)" I am trying to create a element with both a and but nothing happens in IE6. var tableProto = new Element('table').update(' Situation Task Action Result a b c '); I'm then trying to inject copies of it ...
[ "javascript", "dom", "prototypejs" ]
4
5
5,397
2
0
2008-09-25T00:40:36.983000
2008-09-25T04:21:25.347000
130,877
130,879
How do you determine Daylight Savings Time in VBA?
What function will let us know whether a date in VBA is in DST or not?
For non-current dates (DST 2007+): First, you need a function to find the number of specific weekdays in a month: Public Function NDow(Y As Integer, M As Integer, _ N As Integer, DOW As Integer) As Date ' Returns Date of Nth Day of the Week in Month NDow = DateSerial(Y, M, (8 - Weekday(DateSerial(Y, M, 1), _ (DOW + 1...
How do you determine Daylight Savings Time in VBA? What function will let us know whether a date in VBA is in DST or not?
TITLE: How do you determine Daylight Savings Time in VBA? QUESTION: What function will let us know whether a date in VBA is in DST or not? ANSWER: For non-current dates (DST 2007+): First, you need a function to find the number of specific weekdays in a month: Public Function NDow(Y As Integer, M As Integer, _ N As I...
[ "excel", "vba", "function", "code-snippets", "dst" ]
6
5
16,151
4
0
2008-09-25T00:56:22.593000
2008-09-25T00:57:37.880000
130,878
219,599
Global or Singleton for database connection?
What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex. Code with Global $conn = new PDO(...); function getSomething() { global $conn;... } Code with Singleton class DB_Instance { private static $db; publi...
I know this is old, but Dr8k's answer was almost there. When you are considering writing a piece of code, assume it's going to change. That doesn't mean that you're assuming the kinds of changes it will have hoisted upon it at some point in the future, but rather that some form of change will be made. Make it a goal mi...
Global or Singleton for database connection? What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex. Code with Global $conn = new PDO(...); function getSomething() { global $conn;... } Code with Singleton c...
TITLE: Global or Singleton for database connection? QUESTION: What is the benefit of using singleton instead of global for database connections in PHP? I feel using singleton instead of global makes the code unnecessarily complex. Code with Global $conn = new PDO(...); function getSomething() { global $conn;... } Cod...
[ "php", "design-patterns", "singleton" ]
81
105
57,631
9
0
2008-09-25T00:56:27.930000
2008-10-20T19:37:20.160000
130,913
130,926
What is the state of C++ refactor support in Eclipse?
Is it at the state where it is actually useful and can do more than rename classes?
CDT (C/C++ Development Tools - eclipse project) 5.0 has a bunch of new refactorings * Declare Method * Extract Baseclass * Extract Constant * Extract Method * Extract Subclass * Hide Method * Implement Method * Move Field / Method * Replace Number * Separate Class * Generate Getters and Setters There is a CDT refactori...
What is the state of C++ refactor support in Eclipse? Is it at the state where it is actually useful and can do more than rename classes?
TITLE: What is the state of C++ refactor support in Eclipse? QUESTION: Is it at the state where it is actually useful and can do more than rename classes? ANSWER: CDT (C/C++ Development Tools - eclipse project) 5.0 has a bunch of new refactorings * Declare Method * Extract Baseclass * Extract Constant * Extract Metho...
[ "c++", "eclipse", "refactoring" ]
20
22
7,737
5
0
2008-09-25T01:08:34.390000
2008-09-25T01:12:44.380000
130,916
154,076
Keeping a file in the OS block buffer
I need to keep as much as I can of large file in the operating system block cache even though it's bigger than I can fit in ram, and I'm continously reading another very very large file. ATM I'll remove large chunk of large important file from system cache when I stream read form another file.
In a POSIX system like Linux or Solaris, try using posix_fadvise. On the streaming file, do something like this: posix_fadvise(fd, 0, 0, POSIX_FADV_SEQUENTIAL); while( bytes > 0 ) { bytes = pread(fd, buffer, 64 * 1024, current_pos); current_pos += 64 * 1024; posix_fadvise(fd, 0, current_pos, POSIX_FADV_DONTNEED); } And...
Keeping a file in the OS block buffer I need to keep as much as I can of large file in the operating system block cache even though it's bigger than I can fit in ram, and I'm continously reading another very very large file. ATM I'll remove large chunk of large important file from system cache when I stream read form a...
TITLE: Keeping a file in the OS block buffer QUESTION: I need to keep as much as I can of large file in the operating system block cache even though it's bigger than I can fit in ram, and I'm continously reading another very very large file. ATM I'll remove large chunk of large important file from system cache when I ...
[ "optimization", "memory-management", "caching", "filesystems", "performance" ]
2
3
632
6
0
2008-09-25T01:09:41.487000
2008-09-30T17:21:30.007000
130,933
130,992
Design & Coding - top to bottom or bottom to top?
When coding, what in your experience is a better approach? Break the problem down into small enough pieces and then implement each piece. Break the problem down, but then implement using a top-down approach. Any other?
Here's what I do: Understand the domain first. Understand the problem to be solved. Make sure you and the customer (even if that customer is you!) are on the same page as to what problem is to be solved. Then a high level solution is proposed to the problem and from that, the design will turn into bubbles or bullets on...
Design & Coding - top to bottom or bottom to top? When coding, what in your experience is a better approach? Break the problem down into small enough pieces and then implement each piece. Break the problem down, but then implement using a top-down approach. Any other?
TITLE: Design & Coding - top to bottom or bottom to top? QUESTION: When coding, what in your experience is a better approach? Break the problem down into small enough pieces and then implement each piece. Break the problem down, but then implement using a top-down approach. Any other? ANSWER: Here's what I do: Unders...
[ "coding-style" ]
11
13
4,539
13
0
2008-09-25T01:15:37.557000
2008-09-25T01:28:44.543000
130,941
130,963
.Net Multithreading: SQL ConnectionPool
In a VB.Net Windows Service I'm currently pooling units of work with: ThreadPool.QueueUserWorkItem(operation, nextQueueID) In each unit of work (or thread I'll use for ease of understanding), it will make a couple MSSQL operations like so: Using sqlcmd As New SqlCommand("", New SqlConnection(ConnString)) With sqlcmd.Co...
From the MS Docs - "Connections are pooled per process, per application domain, per connection string and when integrated security is used, per Windows identity" http://msdn.microsoft.com/en-us/library/8xx3tyca.aspx Are you experiencing errors such as - Exception Details: System.InvalidOperationException: Timeout expir...
.Net Multithreading: SQL ConnectionPool In a VB.Net Windows Service I'm currently pooling units of work with: ThreadPool.QueueUserWorkItem(operation, nextQueueID) In each unit of work (or thread I'll use for ease of understanding), it will make a couple MSSQL operations like so: Using sqlcmd As New SqlCommand("", New S...
TITLE: .Net Multithreading: SQL ConnectionPool QUESTION: In a VB.Net Windows Service I'm currently pooling units of work with: ThreadPool.QueueUserWorkItem(operation, nextQueueID) In each unit of work (or thread I'll use for ease of understanding), it will make a couple MSSQL operations like so: Using sqlcmd As New Sq...
[ ".net", "multithreading", "connection-pooling" ]
1
4
4,288
4
0
2008-09-25T01:17:13.463000
2008-09-25T01:22:00.613000
130,948
131,001
Read binary file as string in Ruby
I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this: file = File.open("path-to-file.tar.gz") contents = "" file.each {|line| contents << line } I thought that would be enough to convert it to a string, but then when I try to wr...
First, you should open the file as a binary file. Then you can read the entire file in, in one command. file = File.open("path-to-file.tar.gz", "rb") contents = file.read That will get you the entire file in a string. After that, you probably want to file.close. If you don’t do that, file won’t be closed until it is ga...
Read binary file as string in Ruby I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this: file = File.open("path-to-file.tar.gz") contents = "" file.each {|line| contents << line } I thought that would be enough to convert it to ...
TITLE: Read binary file as string in Ruby QUESTION: I need an easy way to take a tar file and convert it into a string (and vice versa). Is there a way to do this in Ruby? My best attempt was this: file = File.open("path-to-file.tar.gz") contents = "" file.each {|line| contents << line } I thought that would be enough...
[ "ruby", "string", "file-io" ]
270
403
224,594
9
0
2008-09-25T01:18:26.347000
2008-09-25T01:30:56.863000
130,968
130,993
Planning to use PostgreSQL with ASP.NET: bad idea?
I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-blown version at this moment and I don't think SQL Server Express will...
Why not start with SQL Server Express and migrate when you have the money? That way you can move toward what you consider ideal and reduce conversion costs.
Planning to use PostgreSQL with ASP.NET: bad idea? I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-blown version at th...
TITLE: Planning to use PostgreSQL with ASP.NET: bad idea? QUESTION: I'm currently planning the infrastructure for my future web project. I want to go the way Joel went with having one DB per client and now thinking which DB engine will be good for me. The best would be of course SQL Server, but I can't afford a full-b...
[ "sql-server", "asp.net-mvc", "database", "linq-to-sql", "postgresql" ]
10
3
8,114
5
0
2008-09-25T01:24:06.147000
2008-09-25T01:29:02.623000
130,986
131,255
An affordable tool for DB modeling
Could you guys recommend some affordable SQL modeling tool which supports SQL Server, PostgreSQL and MySQL? I'm looking into up to $300 per license range. One tool per answer, please! Thanks!
This site has a run down of some of the tools available: http://www.databaseanswers.com/modelling_tools.htm. I tried Dezign by Datanamic, which the site recommended for the individual user. It was pretty easy to use and has lots of features. It supports about 20 different databases to various degrees. It has a free tri...
An affordable tool for DB modeling Could you guys recommend some affordable SQL modeling tool which supports SQL Server, PostgreSQL and MySQL? I'm looking into up to $300 per license range. One tool per answer, please! Thanks!
TITLE: An affordable tool for DB modeling QUESTION: Could you guys recommend some affordable SQL modeling tool which supports SQL Server, PostgreSQL and MySQL? I'm looking into up to $300 per license range. One tool per answer, please! Thanks! ANSWER: This site has a run down of some of the tools available: http://ww...
[ "database-design", "architecture" ]
3
0
689
7
0
2008-09-25T01:27:22.957000
2008-09-25T03:03:24.567000
130,997
131,012
ASP.net MVC HomeController URL
By default the MVC Preview 5 web project comes with a HomeController.vb class. This sets the web URL to http://www.mywebsite.com/home/ by default. If I just wanted this to be http://www.mywebsite.com/ by default, how would I accomplish that?
Answered already so I'm just going to direct you to How do I get rid of Home in ASP.Net MVC?. Users with 10k+ rep can also refer to https://stackoverflow.com/questions/33861/aspnet-mvc-routing-basics-root-route (deleted)
ASP.net MVC HomeController URL By default the MVC Preview 5 web project comes with a HomeController.vb class. This sets the web URL to http://www.mywebsite.com/home/ by default. If I just wanted this to be http://www.mywebsite.com/ by default, how would I accomplish that?
TITLE: ASP.net MVC HomeController URL QUESTION: By default the MVC Preview 5 web project comes with a HomeController.vb class. This sets the web URL to http://www.mywebsite.com/home/ by default. If I just wanted this to be http://www.mywebsite.com/ by default, how would I accomplish that? ANSWER: Answered already so ...
[ "asp.net-mvc" ]
1
4
5,030
2
0
2008-09-25T01:29:54.370000
2008-09-25T01:33:11.943000
131,014
131,036
What's the SQL query to list all rows that have 2 column sub-rows as duplicates?
I have a table that has redundant data and I'm trying to identify all rows that have duplicate sub-rows (for lack of a better word). By sub-rows I mean considering COL1 and COL2 only. So let's say I have something like this: COL1 COL2 COL3 --------------------- aa 111 blah_x aa 111 blah_j aa 112 blah_m ab 111 blah_s bb...
Does this work for you? select t.* from table t left join ( select col1, col2, count(*) as count from table group by col1, col2 ) c on t.col1=c.col1 and t.col2=c.col2 where c.count > 1
What's the SQL query to list all rows that have 2 column sub-rows as duplicates? I have a table that has redundant data and I'm trying to identify all rows that have duplicate sub-rows (for lack of a better word). By sub-rows I mean considering COL1 and COL2 only. So let's say I have something like this: COL1 COL2 COL3...
TITLE: What's the SQL query to list all rows that have 2 column sub-rows as duplicates? QUESTION: I have a table that has redundant data and I'm trying to identify all rows that have duplicate sub-rows (for lack of a better word). By sub-rows I mean considering COL1 and COL2 only. So let's say I have something like th...
[ "sql", "database", "platform-agnostic" ]
4
8
5,120
10
0
2008-09-25T01:33:57.090000
2008-09-25T01:40:43.843000
131,020
131,843
Migrations for Java
I use both ruby on rails and Java. I really enjoy using migrations when I am working on a rails project. so I am wondering is there a migrations like tool for Java? If there is no such tool is it a good idea to use migrations as a tool to control a database used by a Java project?
I've used Hibernate's SchemaUpdate to perform the same function as migrations. It's actually easier than migrations because every time you start up your app, it examines the database structure and syncs it up with your mappings so there's no extra rake:db:migrate step and your app can never be out of sync with the data...
Migrations for Java I use both ruby on rails and Java. I really enjoy using migrations when I am working on a rails project. so I am wondering is there a migrations like tool for Java? If there is no such tool is it a good idea to use migrations as a tool to control a database used by a Java project?
TITLE: Migrations for Java QUESTION: I use both ruby on rails and Java. I really enjoy using migrations when I am working on a rails project. so I am wondering is there a migrations like tool for Java? If there is no such tool is it a good idea to use migrations as a tool to control a database used by a Java project? ...
[ "java", "ruby-on-rails", "migration" ]
86
9
20,257
8
0
2008-09-25T01:37:22.590000
2008-09-25T07:09:49.887000
131,021
131,779
Backgroundrb scheduled task ending
I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes. My background.yml file::schedules::named_worker::task_name::trigger_args: 0 0 12 * * * *:data: input_data I have zero activity on the server when the process is running. (Meaning ...
There's not much information here that allows us to get to the bottom of the problem. Because backgroundrb operates in the background, it can be quite hard to monitor/debug. Here are some ideas I use: Write a unit test to test the worker code itself and make sure there are no problems there Put "puts" statements at mul...
Backgroundrb scheduled task ending I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes. My background.yml file::schedules::named_worker::task_name::trigger_args: 0 0 12 * * * *:data: input_data I have zero activity on the server whe...
TITLE: Backgroundrb scheduled task ending QUESTION: I have a backroundrb scheduled task that takes quite a long time to run. However it seems that the process is ending after only 2.5 minutes. My background.yml file::schedules::named_worker::task_name::trigger_args: 0 0 12 * * * *:data: input_data I have zero activity...
[ "ruby-on-rails", "ruby", "backgroundrb" ]
2
3
522
2
0
2008-09-25T01:37:26.613000
2008-09-25T06:51:51.913000
131,023
131,246
List Comprehension Library for Scheme?
I know there is a list-comprehension library for common lisp ( incf-cl ), I know they're supported natively in various other functional (and some non-functional) languages (F#, Erlang, Haskell and C#) - is there a list comprehension library for Scheme? incf-cl is implemented in CL as a library using macros - shouldn't ...
Swindle is primarily a CLOS emulator library, but it has list comprehensions too. I've used them, they're convenient, but the version I used was buggy and incomplete. (I just needed generic functions.) However, you probably want SRFI-42. I haven't used it, but it HAS to have fewer bugs than the Swindle list comprehensi...
List Comprehension Library for Scheme? I know there is a list-comprehension library for common lisp ( incf-cl ), I know they're supported natively in various other functional (and some non-functional) languages (F#, Erlang, Haskell and C#) - is there a list comprehension library for Scheme? incf-cl is implemented in CL...
TITLE: List Comprehension Library for Scheme? QUESTION: I know there is a list-comprehension library for common lisp ( incf-cl ), I know they're supported natively in various other functional (and some non-functional) languages (F#, Erlang, Haskell and C#) - is there a list comprehension library for Scheme? incf-cl is...
[ "functional-programming", "lisp", "scheme", "common-lisp", "list-comprehension" ]
10
8
1,765
2
0
2008-09-25T01:38:06.753000
2008-09-25T03:00:47.583000
131,040
132,076
Converting string to uint in actionscript / Flex
I am creating a component and want to expose a color property as many flex controls do, lets say I have simple component like this, lets call it foo_label: [Bindable] public var color:uint; and then add the component in another mxml file, something along the lines of: When I compile the compiler complains: cannot parse...
Color is not a property, it is a style. You need to define the style like this: [Style(name="labelColor", type="uint", format="Color" )] (enclose it in tag if you define it directly in MXML). You then need to add some ActionScript to handle this style and apply it to whichever control you need, please refer to http://l...
Converting string to uint in actionscript / Flex I am creating a component and want to expose a color property as many flex controls do, lets say I have simple component like this, lets call it foo_label: [Bindable] public var color:uint; and then add the component in another mxml file, something along the lines of: Wh...
TITLE: Converting string to uint in actionscript / Flex QUESTION: I am creating a component and want to expose a color property as many flex controls do, lets say I have simple component like this, lets call it foo_label: [Bindable] public var color:uint; and then add the component in another mxml file, something alon...
[ "apache-flex", "actionscript-3", "actionscript" ]
3
8
8,553
2
0
2008-09-25T01:41:49.630000
2008-09-25T08:13:52.573000
131,050
132,846
What is the best way to implement a singleton pattern class in Actionscript 3?
Since AS3 does not allow private constructors, it seems the only way to construct a singleton and guarantee the constructor isn't explicitly created via "new" is to pass a single parameter and check it. I've heard two recommendations, one is to check the caller and ensure it's the static getInstance(), and the other is...
A slight adaptation of enobrev's answer is to have instance as a getter. Some would say this is more elegant. Also, enobrev's answer won't enforce a Singleton if you call the constructor before calling getInstance. This may not be perfect, but I have tested this and it works. (There is definitely another good way to do...
What is the best way to implement a singleton pattern class in Actionscript 3? Since AS3 does not allow private constructors, it seems the only way to construct a singleton and guarantee the constructor isn't explicitly created via "new" is to pass a single parameter and check it. I've heard two recommendations, one is...
TITLE: What is the best way to implement a singleton pattern class in Actionscript 3? QUESTION: Since AS3 does not allow private constructors, it seems the only way to construct a singleton and guarantee the constructor isn't explicitly created via "new" is to pass a single parameter and check it. I've heard two recom...
[ "actionscript-3", "design-patterns", "oop", "singleton" ]
4
11
1,973
4
0
2008-09-25T01:45:52.723000
2008-09-25T11:57:55.843000
131,053
131,175
object reference not set to an instance of object
I have been getting an error in VB.Net object reference not set to an instance of object. Can you tell me what are the causes of this error?
sef, If the problem is with Database return results, I presume it is in this scenario: dsData = getSQLData(conn,sql, blah,blah....) dt = dsData.Tables(0) 'Perhaps the obj ref not set is occurring here To fix that: dsData = getSQLData(conn,sql, blah,blah....) If dsData.Tables.Count = 0 Then Exit Sub dt = dsData.Tables(0...
object reference not set to an instance of object I have been getting an error in VB.Net object reference not set to an instance of object. Can you tell me what are the causes of this error?
TITLE: object reference not set to an instance of object QUESTION: I have been getting an error in VB.Net object reference not set to an instance of object. Can you tell me what are the causes of this error? ANSWER: sef, If the problem is with Database return results, I presume it is in this scenario: dsData = getSQL...
[ "vb.net" ]
2
5
120,687
9
0
2008-09-25T01:46:40.397000
2008-09-25T02:32:52.970000
131,056
131,877
Fetch one row per account id from list, part 2
Not sure how to ask a followup on SO, but this is in reference to an earlier question: Fetch one row per account id from list The query I'm working with is: SELECT * FROM scores s1 WHERE accountid NOT IN (SELECT accountid FROM scores s2 WHERE s1.score < s2.score) ORDER BY score DESC This selects the top scores, and lim...
If you're only interested in the accountid and the score, then you can use the simple GROUP BY query given by Paul above. SELECT accountid, MAX(score) FROM scores GROUP BY accountid; If you need other attributes from the scores table, then you can get other attributes from the row with a query like the following: SELEC...
Fetch one row per account id from list, part 2 Not sure how to ask a followup on SO, but this is in reference to an earlier question: Fetch one row per account id from list The query I'm working with is: SELECT * FROM scores s1 WHERE accountid NOT IN (SELECT accountid FROM scores s2 WHERE s1.score < s2.score) ORDER BY ...
TITLE: Fetch one row per account id from list, part 2 QUESTION: Not sure how to ask a followup on SO, but this is in reference to an earlier question: Fetch one row per account id from list The query I'm working with is: SELECT * FROM scores s1 WHERE accountid NOT IN (SELECT accountid FROM scores s2 WHERE s1.score < s...
[ "sql", "mysql", "database" ]
3
2
734
6
0
2008-09-25T01:47:41.317000
2008-09-25T07:16:42.117000
131,061
133,160
Do fancy MVC URLs affect how caching is done?
When reading some answers to aquestion on clearing cache for JS files, somebody pointed to this part of the http spec. It basically says that URLS containing a? should not be pulled from the cache, unless a specific expiry date is given. How do query string absent URLs which are so common with MVC websites (RoR, ASP.Ne...
AFAIK there is no difference on the part of browsers as both Firefox and IE will (incorrectly) cache the response from a url with a querystring, in the same way they cache the response from a url without a querystring. In the case of Safari it respects the spec and doesn't cache urls with querystrings. HTTP proxies ten...
Do fancy MVC URLs affect how caching is done? When reading some answers to aquestion on clearing cache for JS files, somebody pointed to this part of the http spec. It basically says that URLS containing a? should not be pulled from the cache, unless a specific expiry date is given. How do query string absent URLs whic...
TITLE: Do fancy MVC URLs affect how caching is done? QUESTION: When reading some answers to aquestion on clearing cache for JS files, somebody pointed to this part of the http spec. It basically says that URLS containing a? should not be pulled from the cache, unless a specific expiry date is given. How do query strin...
[ "model-view-controller", "browser", "caching" ]
0
1
377
2
0
2008-09-25T01:51:38.047000
2008-09-25T12:55:55.577000
131,085
131,114
What's the quickest way to dump & load a MySQL InnoDB database using mysqldump?
I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1. What are the best parameters (ie: --single-transaction) that will result in the quickest dump and load of the data? As well, when loading the data into the second DB, is it quicker to: ...
Pipe it directly to another instance, to avoid disk overhead. Don't bother with --compress unless you're running over a slow network, since on a fast LAN or loopback the network overhead doesn't matter.
What's the quickest way to dump & load a MySQL InnoDB database using mysqldump? I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1. What are the best parameters (ie: --single-transaction) that will result in the quickest dump and load of...
TITLE: What's the quickest way to dump & load a MySQL InnoDB database using mysqldump? QUESTION: I would like to create a copy of a database with approximately 40 InnoDB tables and around 1.5GB of data with mysqldump and MySQL 5.1. What are the best parameters (ie: --single-transaction) that will result in the quickes...
[ "mysql", "database", "backup", "innodb" ]
13
8
16,113
6
0
2008-09-25T01:58:22.740000
2008-09-25T02:10:17.597000
131,089
131,133
How big of a security risk is checking out an svn project right into production site?
Not that I'm doing something like that, but I am kind of interested how bad a practice like that is.
None as long as your server forbids access to all.svn directories from the web.
How big of a security risk is checking out an svn project right into production site? Not that I'm doing something like that, but I am kind of interested how bad a practice like that is.
TITLE: How big of a security risk is checking out an svn project right into production site? QUESTION: Not that I'm doing something like that, but I am kind of interested how bad a practice like that is. ANSWER: None as long as your server forbids access to all.svn directories from the web.
[ "svn" ]
4
4
1,184
10
0
2008-09-25T02:00:46.340000
2008-09-25T02:14:48.583000
131,091
131,136
OpenID Over SSL with self signed certificate
I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message: The underlying connection was closed: Could not establish trust...
The primary benefit of using SSL for your OpenID URL is that it gives the relying party a mechanism to discover if DNS has been tampered with. It's impossible for the relying party to tell if an OpenID URL with a self-signed certificate has been compromised. There are other benefits you get from using SSL on your provi...
OpenID Over SSL with self signed certificate I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message: The underlying con...
TITLE: OpenID Over SSL with self signed certificate QUESTION: I setup my own open id provider on my personal server, and added a redirect to https in my apache config file. When not using a secure connection (when I disable the redirect) I can log in fine, but with the redirect I can't log in with this error message: ...
[ "ssl", "openid", "ssl-certificate" ]
9
8
6,818
4
0
2008-09-25T02:01:14.683000
2008-09-25T02:16:01.497000
131,110
131,138
Writing a cookie from an ASP.Net HTTPHandler - Page.Response object?
I am creating an HTTP handler that listens for calls to a specific file type, and handles it accordingly. My HTTP Handler listens for.bcn files, then writes a cookie to the user's computer and sends back an image... this will be used in advertising banners so that the user is tagged as seeing the banner, and we can the...
You can access the Response object from the HttpContext object passed to the ProcessRequest method from IHttpHandler. This is the same object exposed by Page.Response.
Writing a cookie from an ASP.Net HTTPHandler - Page.Response object? I am creating an HTTP handler that listens for calls to a specific file type, and handles it accordingly. My HTTP Handler listens for.bcn files, then writes a cookie to the user's computer and sends back an image... this will be used in advertising ba...
TITLE: Writing a cookie from an ASP.Net HTTPHandler - Page.Response object? QUESTION: I am creating an HTTP handler that listens for calls to a specific file type, and handles it accordingly. My HTTP Handler listens for.bcn files, then writes a cookie to the user's computer and sends back an image... this will be used...
[ "c#", "asp.net", "cookies", "asp.net-1.1" ]
2
1
3,946
3
0
2008-09-25T02:09:35.117000
2008-09-25T02:16:53.697000
131,116
131,168
How often do you update statistics in SQL Server 2000?
I'm wondering if updating statistics has helped you before and how did you know to update them?
exec sp_updatestats Yes, updating statistics can be very helpful if you find that your queries are not performing as well as they should. This is evidenced by inspecting the query plan and noticing when, for example, table scans or index scans are being performed instead of index seeks. All of this assumes that you hav...
How often do you update statistics in SQL Server 2000? I'm wondering if updating statistics has helped you before and how did you know to update them?
TITLE: How often do you update statistics in SQL Server 2000? QUESTION: I'm wondering if updating statistics has helped you before and how did you know to update them? ANSWER: exec sp_updatestats Yes, updating statistics can be very helpful if you find that your queries are not performing as well as they should. This...
[ "sql-server", "t-sql" ]
4
4
7,830
4
0
2008-09-25T02:10:49.887000
2008-09-25T02:30:38.233000
131,121
131,155
How do I get a range's address including the worksheet name, but not the workbook name, in Excel VBA?
If I have a Range object--for example, let's say it refers to cell A1 on a worksheet called Book1. So I know that calling Address() will get me a simple local reference: $A$1. I know it can also be called as Address(External:=True) to get a reference including the workbook name and worksheet name: [Book1]Sheet1!$A$1. W...
Only way I can think of is to concatenate the worksheet name with the cell reference, as follows: Dim cell As Range Dim cellAddress As String Set cell = ThisWorkbook.Worksheets(1).Cells(1, 1) cellAddress = cell.Parent.Name & "!" & cell.Address(External:=False) EDIT: Modify last line to: cellAddress = "'" & cell.Parent....
How do I get a range's address including the worksheet name, but not the workbook name, in Excel VBA? If I have a Range object--for example, let's say it refers to cell A1 on a worksheet called Book1. So I know that calling Address() will get me a simple local reference: $A$1. I know it can also be called as Address(Ex...
TITLE: How do I get a range's address including the worksheet name, but not the workbook name, in Excel VBA? QUESTION: If I have a Range object--for example, let's say it refers to cell A1 on a worksheet called Book1. So I know that calling Address() will get me a simple local reference: $A$1. I know it can also be ca...
[ "vba", "excel" ]
43
66
179,874
12
0
2008-09-25T02:11:34.690000
2008-09-25T02:23:32.290000
131,128
131,203
What standard techniques are there for using cpu specific features in DLLs?
Short version: I'm wondering if it's possible, and how best, to utilise CPU specific instructions within a DLL? Slightly longer version: When downloading (32bit) DLLs from, say, Microsoft it seems that one size fits all processors. Does this mean that they are strictly built for the lowest common denominator (ie. the m...
I don't know of any standard technique but if I had to make such a thing, I would write some code in the DllMain() function to detect the CPU type and populate a jump table with function pointers to CPU-optimized versions of each function. There would also need to be a lowest common denominator function for when the CP...
What standard techniques are there for using cpu specific features in DLLs? Short version: I'm wondering if it's possible, and how best, to utilise CPU specific instructions within a DLL? Slightly longer version: When downloading (32bit) DLLs from, say, Microsoft it seems that one size fits all processors. Does this me...
TITLE: What standard techniques are there for using cpu specific features in DLLs? QUESTION: Short version: I'm wondering if it's possible, and how best, to utilise CPU specific instructions within a DLL? Slightly longer version: When downloading (32bit) DLLs from, say, Microsoft it seems that one size fits all proces...
[ "windows", "optimization", "dll" ]
4
6
353
5
0
2008-09-25T02:12:59.883000
2008-09-25T02:42:49.843000
131,164
131,183
Oracle Insert via Select from multiple tables where one table may not have a row
I have a number of code value tables that contain a code and a description with a Long id. I now want to create an entry for an Account Type that references a number of codes, so I have something like this: insert into account_type_standard (account_type_Standard_id, tax_status_id, recipient_id) ( select account_type_s...
Outter joins don't work "as expected" in that case because you have explicitly told Oracle you only want data if that criteria on that table matches. In that scenario, the outter join is rendered useless. A work-around INSERT INTO account_type_standard (account_type_Standard_id, tax_status_id, recipient_id) VALUES( (SE...
Oracle Insert via Select from multiple tables where one table may not have a row I have a number of code value tables that contain a code and a description with a Long id. I now want to create an entry for an Account Type that references a number of codes, so I have something like this: insert into account_type_standar...
TITLE: Oracle Insert via Select from multiple tables where one table may not have a row QUESTION: I have a number of code value tables that contain a code and a description with a Long id. I now want to create an entry for an Account Type that references a number of codes, so I have something like this: insert into ac...
[ "sql", "oracle", "select", "insert" ]
13
25
156,364
6
0
2008-09-25T02:27:12.360000
2008-09-25T02:35:51.467000
131,165
131,222
Evolutionary Algorithms: Optimal Repopulation Breakdowns
It's really all in the title, but here's a breakdown for anyone who is interested in Evolutionary Algorithms: In an EA, the basic premise is that you randomly generate a certain number of organisms (which are really just sets of parameters), run them against a problem, and then let the top performers survive. You then ...
I initially tried to model what I thought organic systems were like. Ultimately decided that was no good, and went more aggressive, with 10% kept, 20% mutated, 60% crossbred, and 10% random. Then I noticed my top 10% were all roughly identical. So I increased the random to 30%. That helped some, but not much. I did try...
Evolutionary Algorithms: Optimal Repopulation Breakdowns It's really all in the title, but here's a breakdown for anyone who is interested in Evolutionary Algorithms: In an EA, the basic premise is that you randomly generate a certain number of organisms (which are really just sets of parameters), run them against a pr...
TITLE: Evolutionary Algorithms: Optimal Repopulation Breakdowns QUESTION: It's really all in the title, but here's a breakdown for anyone who is interested in Evolutionary Algorithms: In an EA, the basic premise is that you randomly generate a certain number of organisms (which are really just sets of parameters), run...
[ "computer-science", "artificial-intelligence", "genetic-algorithm", "genetic-programming", "evolutionary-algorithm" ]
9
6
744
8
0
2008-09-25T02:29:04.603000
2008-09-25T02:49:25.893000
131,176
131,210
Web Log analysis in Java
How to read a web server log file in Java. This file is getting updated all the time. If I open a new FileInputStream, will it read the log real time? Regards
Here is a solution based on RandomAccessFile: http://www.informit.com/guides/content.aspx?g=java&seqNum=226
Web Log analysis in Java How to read a web server log file in Java. This file is getting updated all the time. If I open a new FileInputStream, will it read the log real time? Regards
TITLE: Web Log analysis in Java QUESTION: How to read a web server log file in Java. This file is getting updated all the time. If I open a new FileInputStream, will it read the log real time? Regards ANSWER: Here is a solution based on RandomAccessFile: http://www.informit.com/guides/content.aspx?g=java&seqNum=226
[ "java", "file-io", "log-analysis" ]
3
4
2,534
1
0
2008-09-25T02:33:42.283000
2008-09-25T02:46:04.233000
131,179
149,490
error installing RMagick from gem
Trying to install the RMagick gem is failing with an error about being unable to find ImageMagick libraries, even though I'm sure they are installed. The pertinent output from gem install rmagick is: checking for InitializeMagick() in -lMagick... no checking for InitializeMagick() in -lMagickCore... no checking for Ini...
problem solved. RMagick was unable to find ImageMagick because I neglected to build the shared objects (there were no.so files installed as you can see from the "ls" in the original question). The solution was to add --with-shared to my configure options. This however caused other problems. Most notably, make failing w...
error installing RMagick from gem Trying to install the RMagick gem is failing with an error about being unable to find ImageMagick libraries, even though I'm sure they are installed. The pertinent output from gem install rmagick is: checking for InitializeMagick() in -lMagick... no checking for InitializeMagick() in -...
TITLE: error installing RMagick from gem QUESTION: Trying to install the RMagick gem is failing with an error about being unable to find ImageMagick libraries, even though I'm sure they are installed. The pertinent output from gem install rmagick is: checking for InitializeMagick() in -lMagick... no checking for Initi...
[ "ruby", "solaris", "imagemagick", "rubygems", "rmagick" ]
0
2
4,590
3
0
2008-09-25T02:35:10.203000
2008-09-29T16:30:19.980000
131,181
131,202
What is a .snk for?
What is a.snk file for? I know it stands for Strongly Named Key, but all explanations of what it is and how it works goes over my head. Is there any simple explanation on how a strongly named key is used and how it works?
The.snk file is used to apply a strong name to a.NET assembly. such a strong name consists of a simple text name, version number, and culture information (if provided)—plus a public key and a digital signature. The SNK contains a unique key pair - a private and public key that can be used to ensure that you have a uniq...
What is a .snk for? What is a.snk file for? I know it stands for Strongly Named Key, but all explanations of what it is and how it works goes over my head. Is there any simple explanation on how a strongly named key is used and how it works?
TITLE: What is a .snk for? QUESTION: What is a.snk file for? I know it stands for Strongly Named Key, but all explanations of what it is and how it works goes over my head. Is there any simple explanation on how a strongly named key is used and how it works? ANSWER: The.snk file is used to apply a strong name to a.NE...
[ ".net", "strongname", "snk" ]
172
228
107,348
5
0
2008-09-25T02:35:21.107000
2008-09-25T02:42:34.943000
131,196
131,382
Convert console exe to dll in C
I am interested in calling SoX, an open source console application, from another Windows GUI program (written in Delphi naturally). Instead of dealing with scraping and hiding the console window, I would like to just convert the application to a DLL that I can call from my application. Before I start down this path I a...
For the specific topic of turning a console executable into a library by modifying the C source code, it depends on how the command-line application is factored. If it's written in such a way that I/O is funneled through a small set of functions or even better function pointers, then obviously it will be trivial. If it...
Convert console exe to dll in C I am interested in calling SoX, an open source console application, from another Windows GUI program (written in Delphi naturally). Instead of dealing with scraping and hiding the console window, I would like to just convert the application to a DLL that I can call from my application. B...
TITLE: Convert console exe to dll in C QUESTION: I am interested in calling SoX, an open source console application, from another Windows GUI program (written in Delphi naturally). Instead of dealing with scraping and hiding the console window, I would like to just convert the application to a DLL that I can call from...
[ "c", "delphi", "dll", "exe" ]
4
6
6,213
7
0
2008-09-25T02:40:29.147000
2008-09-25T03:43:29.353000
131,217
131,233
Can you Catch an Exception after the main application unit has ended?
In one of our application im getting an exception that i can not seem to find or trap.... Application.CreateForm(TFrmMain, FrmMain); outputdebugstring(pansichar('Application Run')); //this is printed Application.Run; outputdebugstring(pansichar('Application Run After')); //this is printed end. <--- The Exception seems ...
Try installing MadExcept - it should catch the exception and give you a stack-trace. It helped me when I had a similar issue.
Can you Catch an Exception after the main application unit has ended? In one of our application im getting an exception that i can not seem to find or trap.... Application.CreateForm(TFrmMain, FrmMain); outputdebugstring(pansichar('Application Run')); //this is printed Application.Run; outputdebugstring(pansichar('Appl...
TITLE: Can you Catch an Exception after the main application unit has ended? QUESTION: In one of our application im getting an exception that i can not seem to find or trap.... Application.CreateForm(TFrmMain, FrmMain); outputdebugstring(pansichar('Application Run')); //this is printed Application.Run; outputdebugstri...
[ "delphi", "exception" ]
4
5
924
4
0
2008-09-25T02:47:48.613000
2008-09-25T02:54:34.620000
131,238
131,999
In sharepoint designer's workflow editor how do I get the workflow initiators username?
In Sharepoint designer's workflow editor I wish to retrieve the username/name of the work flow initiator (i.e. who kicked it off or triggered the workflow) - this is relatively easy to do using 3rd party products such as Nintex Workflow 2007 (where I would use something like {Common:Initiator}) - but I can't seem to fi...
I don't think this is possible to do in SharePoint Designer out of the box. You could probably write a custom action to get the originator, but I don't believe it is exposed through the SPD workflow interface at all. The best you could probably do is get the user who created or modified the item in the list, but this w...
In sharepoint designer's workflow editor how do I get the workflow initiators username? In Sharepoint designer's workflow editor I wish to retrieve the username/name of the work flow initiator (i.e. who kicked it off or triggered the workflow) - this is relatively easy to do using 3rd party products such as Nintex Work...
TITLE: In sharepoint designer's workflow editor how do I get the workflow initiators username? QUESTION: In Sharepoint designer's workflow editor I wish to retrieve the username/name of the work flow initiator (i.e. who kicked it off or triggered the workflow) - this is relatively easy to do using 3rd party products s...
[ "sharepoint", "workflow", "workflow-foundation", "sharepoint-designer", "workflow-activity" ]
6
2
14,025
4
0
2008-09-25T02:56:51.557000
2008-09-25T07:46:50.360000
131,241
131,271
Why use iterators instead of array indices?
Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: for (some_iterator = some_vector.begin(); some_iterator!= some_vector.end(); some_iterator++) { //do stuff } I'm told that the second way is preferred. Why exactly is this?
The first form is efficient only if vector.size() is a fast operation. This is true for vectors, but not for lists, for example. Also, what are you planning to do within the body of the loop? If you plan on accessing the elements as in T elem = some_vector[i]; then you're making the assumption that the container has op...
Why use iterators instead of array indices? Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: for (some_iterator = some_vector.begin(); some_iterator!= some_vector.end(); some_iterator++) { //do stuff } I'm told that the second way is preferred. Why exactly is t...
TITLE: Why use iterators instead of array indices? QUESTION: Take the following two lines of code: for (int i = 0; i < some_vector.size(); i++) { //do stuff } And this: for (some_iterator = some_vector.begin(); some_iterator!= some_vector.end(); some_iterator++) { //do stuff } I'm told that the second way is preferred...
[ "c++", "for-loop", "stl", "iterator", "containers" ]
282
245
87,236
27
0
2008-09-25T02:58:08.823000
2008-09-25T03:10:27.047000
131,303
131,346
How can I measure the actual memory usage of an application or process?
How do you measure the memory usage of an application or process in Linux? From the blog article of Understanding memory usage on Linux, ps is not an accurate tool to use for this intent. Why ps is "wrong" Depending on how you look at it, ps is not reporting the real memory usage of processes. What it is really doing i...
With ps or similar tools you will only get the amount of memory pages allocated by that process. This number is correct, but: does not reflect the actual amount of memory used by the application, only the amount of memory reserved for it can be misleading if pages are shared, for example by several threads or by using ...
How can I measure the actual memory usage of an application or process? How do you measure the memory usage of an application or process in Linux? From the blog article of Understanding memory usage on Linux, ps is not an accurate tool to use for this intent. Why ps is "wrong" Depending on how you look at it, ps is not...
TITLE: How can I measure the actual memory usage of an application or process? QUESTION: How do you measure the memory usage of an application or process in Linux? From the blog article of Understanding memory usage on Linux, ps is not an accurate tool to use for this intent. Why ps is "wrong" Depending on how you loo...
[ "linux", "memory", "process" ]
905
436
1,488,908
32
0
2008-09-25T03:19:17.337000
2008-09-25T03:33:27.753000
131,327
136,399
Style - When to serialize a Django model Instance: signals vs model's save method
I plan to serialize a Django model to XML when it's saved or updated. (The XML's going to be imported into a flash movie). Is it better to listen for a post_save() or pre_save() signal and then perform the serialization, or to just handle it in the model's save() methon
If it's core functionality for saving the model you'll want it as part of the save method. However, if you already have a functioning model and you want to extend it for other purposes then signals are your best bet since they allow for properly decoupled modules. A good example might be that you want to add event logg...
Style - When to serialize a Django model Instance: signals vs model's save method I plan to serialize a Django model to XML when it's saved or updated. (The XML's going to be imported into a flash movie). Is it better to listen for a post_save() or pre_save() signal and then perform the serialization, or to just handle...
TITLE: Style - When to serialize a Django model Instance: signals vs model's save method QUESTION: I plan to serialize a Django model to XML when it's saved or updated. (The XML's going to be imported into a flash movie). Is it better to listen for a post_save() or pre_save() signal and then perform the serialization,...
[ "python", "django" ]
1
2
1,317
2
0
2008-09-25T03:25:52.157000
2008-09-25T21:49:44.517000
131,335
131,379
What is the best way to measure "spare" CPU time on a Linux based system
For some of the customers that we develop software for, we are required to "guarantee" a certain amount of spare resources (memory, disk space, CPU). Memory and disk space are simple, but CPU is a bit more difficult. One technique that we have used is to create a process that consumes a guaranteed amount of CPU time (s...
So this may not be exactly the answer you're looking for, but if all you want to do is make sure your application doesn't exceed certain limits on resource consumption and you're running on linux you can customize /etc/security/limits.con (may be different file on your distro of choice) to force the limits on a particu...
What is the best way to measure "spare" CPU time on a Linux based system For some of the customers that we develop software for, we are required to "guarantee" a certain amount of spare resources (memory, disk space, CPU). Memory and disk space are simple, but CPU is a bit more difficult. One technique that we have use...
TITLE: What is the best way to measure "spare" CPU time on a Linux based system QUESTION: For some of the customers that we develop software for, we are required to "guarantee" a certain amount of spare resources (memory, disk space, CPU). Memory and disk space are simple, but CPU is a bit more difficult. One techniqu...
[ "cpu", "performance" ]
4
2
572
4
0
2008-09-25T03:29:15.627000
2008-09-25T03:42:55.267000
131,337
131,612
How do you organize and keep track of multiple (many) projects
As a contractor, out-sourcer and shareware author,I have about 5-10 projects going on at any one time. Each project has a todo list, requirements need to be communicated to other outsources and employees, status needs to be given to clients, and developer's questions need to be answered. Sometimes it is too much... but...
You should have a look at No Kahuna Easy to use; Free and Pay versions; active, responsive development team.
How do you organize and keep track of multiple (many) projects As a contractor, out-sourcer and shareware author,I have about 5-10 projects going on at any one time. Each project has a todo list, requirements need to be communicated to other outsources and employees, status needs to be given to clients, and developer's...
TITLE: How do you organize and keep track of multiple (many) projects QUESTION: As a contractor, out-sourcer and shareware author,I have about 5-10 projects going on at any one time. Each project has a todo list, requirements need to be communicated to other outsources and employees, status needs to be given to client...
[ "project-management", "projects", "project-planning" ]
16
3
68,404
10
0
2008-09-25T03:29:36.330000
2008-09-25T05:34:17.637000
131,358
151,996
Strange VB6 build problems (related to nlog)
This I think is related to my use of the nlog C++ API (and my question on the nlog forum is here ); the purpose of my asking this question here is to get a wider audience to my problem and perhaps to also get some more general ideas behind the VB6 IDE's failure to build in my particular scenario. Briefly, the problem t...
Got around the problem by using NLog's COM interface (NLog.ComInterop.DLL) from my unmanaged C++ code. Not as easy to do as the C\C++ API but at least it doesn't crash my VB6 components.
Strange VB6 build problems (related to nlog) This I think is related to my use of the nlog C++ API (and my question on the nlog forum is here ); the purpose of my asking this question here is to get a wider audience to my problem and perhaps to also get some more general ideas behind the VB6 IDE's failure to build in m...
TITLE: Strange VB6 build problems (related to nlog) QUESTION: This I think is related to my use of the nlog C++ API (and my question on the nlog forum is here ); the purpose of my asking this question here is to get a wider audience to my problem and perhaps to also get some more general ideas behind the VB6 IDE's fai...
[ "vb6", "build", "nlog" ]
0
2
1,271
6
0
2008-09-25T03:37:55.810000
2008-09-30T06:47:08.003000
131,362
131,380
Deploying Perl to a share nothing cluster
Anyone have suggestions for deployment methods for Perl modules to a share nothing cluster? Our current method is very manual. Take down half the cluster Copy Perl modules ( CPAN style modules ) to downed cluster members ssh to each member and run perl Makefile.pl; make; make install on each module to be installed Conf...
Take one node offline, install Perl, and then use it to reimage the other nodes. At least, that's how I imagine you'd want to install software in a shared-nothing cluster. Perl is just the application you happen to be installing.
Deploying Perl to a share nothing cluster Anyone have suggestions for deployment methods for Perl modules to a share nothing cluster? Our current method is very manual. Take down half the cluster Copy Perl modules ( CPAN style modules ) to downed cluster members ssh to each member and run perl Makefile.pl; make; make i...
TITLE: Deploying Perl to a share nothing cluster QUESTION: Anyone have suggestions for deployment methods for Perl modules to a share nothing cluster? Our current method is very manual. Take down half the cluster Copy Perl modules ( CPAN style modules ) to downed cluster members ssh to each member and run perl Makefil...
[ "perl", "deployment" ]
5
4
405
7
0
2008-09-25T03:38:29.177000
2008-09-25T03:43:05.330000
131,367
131,372
SVN installation
I am going to install SVN for my personal projects. Is it better to install it on a spare machine(Win XP) or will I save myself grief if I install it on the machine I use for development(Vista).
Installing your repository on a separate machine is probably a better idea, since at a minimum, it will allow your source code to survive a hard drive crash on your development machine. If you're new to SVN, you can't beat the free e-book from Red-Bean and O'Reilly... Check out "Version Control with Subversion" here: h...
SVN installation I am going to install SVN for my personal projects. Is it better to install it on a spare machine(Win XP) or will I save myself grief if I install it on the machine I use for development(Vista).
TITLE: SVN installation QUESTION: I am going to install SVN for my personal projects. Is it better to install it on a spare machine(Win XP) or will I save myself grief if I install it on the machine I use for development(Vista). ANSWER: Installing your repository on a separate machine is probably a better idea, since...
[ "svn" ]
7
9
798
14
0
2008-09-25T03:39:04.840000
2008-09-25T03:40:50.717000