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
37,374
37,587
How do you implement caching in Linq to SQL?
We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't have that. I'm wondering if anyone has come up ...
A quick answer: Use the Repository pattern (see Domain Driven Design by Evans) to fetch your entities. Each repository will cache the things it will hold, ideally by letting each instance of the repository access a singleton cache (each thread/request will instantiate a new repository but there can be only one cache). ...
How do you implement caching in Linq to SQL? We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, but now we don't ha...
TITLE: How do you implement caching in Linq to SQL? QUESTION: We've just started using LINQ to SQL at work for our DAL & we haven't really come up with a standard for out caching model. Previously we had being using a base 'DAL' class that implemented a cache manager property that all our DAL classes inherited from, b...
[ ".net", "sql", "linq-to-sql", "iis", "caching" ]
33
10
18,524
6
0
2008-09-01T02:13:07.163000
2008-09-01T07:55:00.320000
37,375
37,387
How do I unit test a WCF service?
We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a little unsure on how to write unit tests that only test the WCF service layer. Should I just write unit tests for the DLLs, ...
The consumer of your service doesn't care what's underneath your service. To really test your service layer, I think your layer needs to go down to DLLs and the database and write at least CRUD test.
How do I unit test a WCF service? We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a little unsure on how to write unit tests that only test the WCF service layer. Should I ju...
TITLE: How do I unit test a WCF service? QUESTION: We have a whole bunch of DLLs that give us access to our database and other applications and services. We've wrapped these DLLs with a thin WCF service layer which our clients then consume. I'm a little unsure on how to write unit tests that only test the WCF service ...
[ "wcf", "unit-testing" ]
18
4
15,050
3
0
2008-09-01T02:13:52.090000
2008-09-01T02:27:57.143000
37,378
37,406
How to convince my co-workers not to use datasets for enterprise development (.NET 2.0+)
Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise?
If you are working on legacy code (e.g., apps ported from.NET 1.x to 2.0 or 3.5) then it would be a bad idea to depart from datasets. Why change something that already works? If you are, however, creating a new apps, there a few things that you can cite: Appeal to experiencing pain in maintaining apps that stick with D...
How to convince my co-workers not to use datasets for enterprise development (.NET 2.0+) Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise?
TITLE: How to convince my co-workers not to use datasets for enterprise development (.NET 2.0+) QUESTION: Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise? ANSWER: If you ar...
[ "oop" ]
13
10
1,847
16
0
2008-09-01T02:16:17.623000
2008-09-01T03:09:06.450000
37,381
37,408
What's a good way to write a Cocoa front-end to an Erlang application?
I'm exploring the possibility of writing an application in Erlang, but it would need to have a portion written in Cocoa (presumably Objective-C). I'd like the front-end and back-end to be able to communicate easily. How can this best be done? I can think of using C ports and connected processes, but I think I'd like a ...
One way would be to have the Erlang core of the application be a daemon that the Cocoa front-end communicates with over a Unix-domain socket using some simple protocol you devise. The use of a Unix-domain socket means that the Erlang daemon could be launched on-demand by launchd and the Cocoa front-end could find the p...
What's a good way to write a Cocoa front-end to an Erlang application? I'm exploring the possibility of writing an application in Erlang, but it would need to have a portion written in Cocoa (presumably Objective-C). I'd like the front-end and back-end to be able to communicate easily. How can this best be done? I can ...
TITLE: What's a good way to write a Cocoa front-end to an Erlang application? QUESTION: I'm exploring the possibility of writing an application in Erlang, but it would need to have a portion written in Cocoa (presumably Objective-C). I'd like the front-end and back-end to be able to communicate easily. How can this be...
[ "objective-c", "cocoa", "macos", "erlang" ]
13
10
2,007
6
0
2008-09-01T02:22:26.423000
2008-09-01T03:11:18.473000
37,391
1,381,855
Arithmetic with Arbitrarily Large Integers in PHP
Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to perform simple arithmetic operations on two of the...
The PHP GMP extension will be better for this. As an added bonus, you can use it to do your decimal-to-binary conversion, like so: gmp_strval(gmp_init($n, 10), 2);
Arithmetic with Arbitrarily Large Integers in PHP Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary number and be able to ...
TITLE: Arithmetic with Arbitrarily Large Integers in PHP QUESTION: Ok, so PHP isn't the best language to be dealing with arbitrarily large integers in, considering that it only natively supports 32-bit signed integers. What I'm trying to do though is create a class that could represent an arbitrarily large binary numb...
[ "php", "integer" ]
8
4
4,916
4
0
2008-09-01T02:37:53.483000
2009-09-04T22:46:54.650000
37,396
37,415
Linux Lightweight Distro and X Windows for Development
I want to build a lightweight linux configuration to use for development. The first idea is to use it inside a Virtual Machine under Windows, or old Laptops with 1Gb RAM top. Maybe even a distributable environment for developers. So the whole idea is to use a LAMP server, Java Application Server (Tomcat or Jetty) and X...
I would recommend Xubuntu. It's based on Ubuntu/Debian and optimized for small footprint with the Xfce desktop environment.
Linux Lightweight Distro and X Windows for Development I want to build a lightweight linux configuration to use for development. The first idea is to use it inside a Virtual Machine under Windows, or old Laptops with 1Gb RAM top. Maybe even a distributable environment for developers. So the whole idea is to use a LAMP ...
TITLE: Linux Lightweight Distro and X Windows for Development QUESTION: I want to build a lightweight linux configuration to use for development. The first idea is to use it inside a Virtual Machine under Windows, or old Laptops with 1Gb RAM top. Maybe even a distributable environment for developers. So the whole idea...
[ "linux", "desktop" ]
4
1
5,768
12
0
2008-09-01T02:44:04.170000
2008-09-01T03:23:54.200000
37,398
37,402
How do I make a fully statically linked .exe with Visual Studio Express 2005?
My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release.exe files to other people with pleasing results. However recently I made the disturbing discovery that the pleasing results were based on more luck that I would like...
For the C-runtime go to the project settings, choose C/C++ then 'Code Generation'. Change the 'runtime library' setting to 'multithreaded' instead of 'multithreaded dll'. If you are using any other libraries you may need to tell the linker to ignore the dynamically linked CRT explicitly.
How do I make a fully statically linked .exe with Visual Studio Express 2005? My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release.exe files to other people with pleasing results. However recently I made the disturbing...
TITLE: How do I make a fully statically linked .exe with Visual Studio Express 2005? QUESTION: My current preferred C++ environment is the free and largely excellent Microsoft Visual Studio 2005 Express edition. From time to time I have sent release.exe files to other people with pleasing results. However recently I m...
[ "c++", "visual-studio", "linker" ]
136
153
169,708
4
0
2008-09-01T02:49:02.053000
2008-09-01T02:55:07.780000
37,425
158,314
What is the best way to interpret Perfmon analysis into application specific observations/data?
Many of us have used Perfmon tool to do performance analysis. Especially with.Net counters, but there are so many variables going on in Perfmon, that it always becomes hard to interpret Perfmon results in to valuable feedback about my application. I want to use perfmon, (not a tool like Ants Profiler etc) but how do I ...
I use the Performance Analysis of Logs (PAL) tool: http://pal.codeplex.com/ It's not an "official" Microsoft tool, but I believe the author works for Microsoft. The project seems to be fairly active. In addition to the canned threshold files provided (which are pretty good), you can write your own thresholds to analyze...
What is the best way to interpret Perfmon analysis into application specific observations/data? Many of us have used Perfmon tool to do performance analysis. Especially with.Net counters, but there are so many variables going on in Perfmon, that it always becomes hard to interpret Perfmon results in to valuable feedbac...
TITLE: What is the best way to interpret Perfmon analysis into application specific observations/data? QUESTION: Many of us have used Perfmon tool to do performance analysis. Especially with.Net counters, but there are so many variables going on in Perfmon, that it always becomes hard to interpret Perfmon results in t...
[ ".net", "performance", "perfmon" ]
3
4
4,912
1
0
2008-09-01T03:39:42.773000
2008-10-01T15:48:44.463000
37,428
37,461
Get back to basics. How do I get back into C++?
I haven't used C++ since college. Even though I've wanted to I haven't needed to do any until I started wanting to write plugins for Launchy. Is there a good book to read to get back into it? My experience since college is mainly C# and recently ruby. I bought some book for C# developers and it ended up being on how to...
The best way to get back into C++ is to jump in. You can't learn a real language without spending any serious time in a country where they speak it. I wouldn't try to learn a programming language without spending time coding in it either. I wouldn't recommend learning C first though. That's a good way to pick up some b...
Get back to basics. How do I get back into C++? I haven't used C++ since college. Even though I've wanted to I haven't needed to do any until I started wanting to write plugins for Launchy. Is there a good book to read to get back into it? My experience since college is mainly C# and recently ruby. I bought some book f...
TITLE: Get back to basics. How do I get back into C++? QUESTION: I haven't used C++ since college. Even though I've wanted to I haven't needed to do any until I started wanting to write plugins for Launchy. Is there a good book to read to get back into it? My experience since college is mainly C# and recently ruby. I ...
[ "c++" ]
9
7
1,397
7
0
2008-09-01T03:47:54.657000
2008-09-01T04:43:12.683000
37,441
37,446
Reasons for SQL differences
Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differences arise?
It's a form of "Stealth lock-in". Joel goes into great detail here: http://www.joelonsoftware.com/articles/fog0000000056.html http://www.joelonsoftware.com/articles/fog0000000052.html Companies end up tying their business functionality to non-standard or weird unsupported functionality in their implementation, this res...
Reasons for SQL differences Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differences arise?
TITLE: Reasons for SQL differences QUESTION: Why are SQL distributions so non-standard despite an ANSI standard existing for SQL? Are there really that many meaningful differences in the way SQL databases work or is it just the two databases with which I have been working: MS-SQL and PostgreSQL? Why do these differenc...
[ "sql", "sql-server", "postgresql" ]
5
5
613
5
0
2008-09-01T04:11:42.790000
2008-09-01T04:17:30.653000
37,449
37,452
Equivalent to StAX for C
I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C?
libxml is a heavily used and documented XML library for C, which provides a SAX API. Expat is another, but in my experience is not as well documented.
Equivalent to StAX for C I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C?
TITLE: Equivalent to StAX for C QUESTION: I've used the StAX API in Java quite a bit, and find it quite a clean way of dealing with XML files. Is there any equivalent library I could use for performing similar processing in C? ANSWER: libxml is a heavily used and documented XML library for C, which provides a SAX API...
[ "java", "c", "xml" ]
4
0
510
4
0
2008-09-01T04:18:59.153000
2008-09-01T04:22:00.707000
37,464
37,522
iPhone App Minus App Store?
If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store? It doesn't matter if the iPhone has to be jailbroken, as long as I can still run an application created using the official SDK. For reasons I won't get into, I can't have this program going throu...
Official Developer Program For a standard iPhone you'll need to pay the US$99/yr to be a member of the developer program. You can then use the adhoc system to install your application onto up to 100 devices. The developer program has the details but it involves adding UUIDs for each of the devices to your application p...
iPhone App Minus App Store? If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store? It doesn't matter if the iPhone has to be jailbroken, as long as I can still run an application created using the official SDK. For reasons I won't get into, I can't h...
TITLE: iPhone App Minus App Store? QUESTION: If I create an application on my Mac, is there any way I can get it to run on an iPhone without going through the app store? It doesn't matter if the iPhone has to be jailbroken, as long as I can still run an application created using the official SDK. For reasons I won't g...
[ "ios", "iphone" ]
201
187
110,759
9
0
2008-09-01T04:55:58.813000
2008-09-01T06:21:23.133000
37,468
37,498
How to Determine the Installed ASP.NET Version of Host from a Web Page
I have a site running in a Windows shared hosting environment. In their control panel for the shared hosting account I have it set to use ASP.NET version 3.0 but it doesn't say 3.5 SP1 specifically. How can I view the installed version running on the server where my website is hosted in an asp.net page?
Thanks! I just dropped <%=Environment.Version%> on a page and got 2.0.50727.3053
How to Determine the Installed ASP.NET Version of Host from a Web Page I have a site running in a Windows shared hosting environment. In their control panel for the shared hosting account I have it set to use ASP.NET version 3.0 but it doesn't say 3.5 SP1 specifically. How can I view the installed version running on th...
TITLE: How to Determine the Installed ASP.NET Version of Host from a Web Page QUESTION: I have a site running in a Windows shared hosting environment. In their control panel for the shared hosting account I have it set to use ASP.NET version 3.0 but it doesn't say 3.5 SP1 specifically. How can I view the installed ver...
[ ".net", "asp.net" ]
5
5
13,048
4
0
2008-09-01T05:05:54.440000
2008-09-01T05:41:46.990000
37,473
37,474
How can I assert() without using abort()?
If I use assert() and the assertion fails then assert() will call abort(), ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle them gracefully?
Yes, as a matter of fact there is. You will need to write a custom assert function yourself, as C++'s assert() is exactly C's assert(), with the abort() "feature" bundled in. Fortunately, this is surprisingly straightforward. Assert.hh template inline void Assert(A assertion) { if(!assertion ) throw X(); } The above fu...
How can I assert() without using abort()? If I use assert() and the assertion fails then assert() will call abort(), ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle them gracefully?
TITLE: How can I assert() without using abort()? QUESTION: If I use assert() and the assertion fails then assert() will call abort(), ending the running program abruptly. I can't afford that in my production code. Is there a way to assert in runtime yet be able to catch failed assertions so I have the chance to handle...
[ "c++", "exception", "assert" ]
27
29
26,159
6
0
2008-09-01T05:15:05.790000
2008-09-01T05:15:18.800000
37,479
37,571
How can I simply inherit methods from an existing instance?
Below I have a very simple example of what I'm trying to do. I want to be able to use HTMLDecorator with any other class. Ignore the fact it's called decorator, it's just a name. import cgi class ClassX(object): pass #... with own __repr__ class ClassY(object): pass #... with own __repr__ inst_x=ClassX() inst_y=Cla...
Very close, but then I lose everything from ClassX. Below is something a collegue gave me that does do the trick, but it's hideous. There has to be a better way. Looks like you're trying to set up some sort of proxy object scheme. That's doable, and there are better solutions than your colleague's, but first consider w...
How can I simply inherit methods from an existing instance? Below I have a very simple example of what I'm trying to do. I want to be able to use HTMLDecorator with any other class. Ignore the fact it's called decorator, it's just a name. import cgi class ClassX(object): pass #... with own __repr__ class ClassY(objec...
TITLE: How can I simply inherit methods from an existing instance? QUESTION: Below I have a very simple example of what I'm trying to do. I want to be able to use HTMLDecorator with any other class. Ignore the fact it's called decorator, it's just a name. import cgi class ClassX(object): pass #... with own __repr__ ...
[ "python", "oop", "inheritance", "object" ]
1
2
538
6
0
2008-09-01T05:17:35.190000
2008-09-01T07:33:45.487000
37,483
37,485
Calculate Video Duration
I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds.
Looks like the numbers are in milliseconds. So to convert to seconds, divide by 1000, then divide by 60 to find minutes etc.
Calculate Video Duration I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds.
TITLE: Calculate Video Duration QUESTION: I suck at math. I need to figure out how to calculate a video duration with only a few examples of values. For example, a value of 70966 is displayed as 1:10 minutes. A value of 30533 displays as 30 seconds. A value of 7007 displays as 7 seconds. ANSWER: Looks like the number...
[ "math", "video", "duration" ]
0
2
5,099
4
0
2008-09-01T05:20:41.330000
2008-09-01T05:23:53.490000
37,486
37,512
Filter out HTML tags and resolve entities in python
Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python.
Use lxml which is the best xml/html library for python. import lxml.html t = lxml.html.fromstring("...") t.text_content() And if you just want to sanitize the html look at the lxml.html.clean module
Filter out HTML tags and resolve entities in python Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python.
TITLE: Filter out HTML tags and resolve entities in python QUESTION: Because regular expressions scare me, I'm trying to find a way to remove all HTML tags and resolve HTML entities from a string in Python. ANSWER: Use lxml which is the best xml/html library for python. import lxml.html t = lxml.html.fromstring("..."...
[ "python", "html" ]
18
39
27,265
8
0
2008-09-01T05:25:01.990000
2008-09-01T06:07:01.467000
37,516
37,548
Recursion in production-quality VC++ Code
When writing production-quality VC++ code, is the use of recursion acceptable? Why or why not?
Is there a way to determine at what point I would encounter a stack overflow? Not really. A stack overflow happens when you exhaust the stack space - however... The initial stack size can be changed programatically and may default to different amounts depending on your OS/compiler/etc How much of it is already used up ...
Recursion in production-quality VC++ Code When writing production-quality VC++ code, is the use of recursion acceptable? Why or why not?
TITLE: Recursion in production-quality VC++ Code QUESTION: When writing production-quality VC++ code, is the use of recursion acceptable? Why or why not? ANSWER: Is there a way to determine at what point I would encounter a stack overflow? Not really. A stack overflow happens when you exhaust the stack space - howeve...
[ "visual-c++", "recursion" ]
1
6
346
5
0
2008-09-01T06:13:41.857000
2008-09-01T06:58:57.333000
37,519
37,578
Add XML Comments to class properties generated by the LINQ to SQL designer
I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next time the dbml file is refreshed. How can this be done?
I believe it's not possible to keep xml comments in sync with autogenerated code automatically. However, xml comments can leave in separate file (just set "XML documentation file" option on "Project properties"->"Build" tab). You can create initial version of XML documentation file and update in manually if necessary
Add XML Comments to class properties generated by the LINQ to SQL designer I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next time the dbml file i...
TITLE: Add XML Comments to class properties generated by the LINQ to SQL designer QUESTION: I used the LINQ to SQL designer in Visual Studio to create an object model of a database. Now, I want to add XML comments to each generated property but I can't figure out how to do it without erasing the properties the next ti...
[ "xml", "linq", "xml-comments" ]
9
1
1,254
2
0
2008-09-01T06:15:44.880000
2008-09-01T07:46:12.180000
37,525
37,527
What steps can I give a windows user to make a given file writeable
Imagine we have a program trying to write to a particular file, but failing. On the Windows platform, what are the possible things which might be causing the file to be un-writable, and what steps could be suggested to an end user/administrator to fix it. Please include steps which might require administrator permissio...
Some suggestions: No write permission (get permission through Security tab on file Properties window; you must be the file owner or an Administrator) File is locked (close any program that may have the file open, then reboot if that doesn't help) File has the read-only DOS attribute set (unset it from file Properties w...
What steps can I give a windows user to make a given file writeable Imagine we have a program trying to write to a particular file, but failing. On the Windows platform, what are the possible things which might be causing the file to be un-writable, and what steps could be suggested to an end user/administrator to fix ...
TITLE: What steps can I give a windows user to make a given file writeable QUESTION: Imagine we have a program trying to write to a particular file, but failing. On the Windows platform, what are the possible things which might be causing the file to be un-writable, and what steps could be suggested to an end user/adm...
[ "windows", "filesystems" ]
2
3
228
4
0
2008-09-01T06:25:36.790000
2008-09-01T06:28:56.453000
37,529
37,784
Simple audio input API on a Mac?
I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you). What's a good fit for this? Writing an AudioUnit that j...
I think portaudio is what you need. Reading from the mike from a console app is a 10 line C file (see patests in the portaudio distrib).
Simple audio input API on a Mac? I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you). What's a good fit for ...
TITLE: Simple audio input API on a Mac? QUESTION: I'd like to pull a stream of PCM samples from a Mac's line-in or built-in mic and do a little live analysis (the exact nature doesn't pertain to this question, but it could be an FFT every so often, or some basic statistics on the sample levels, or what have you). What...
[ "macos", "audio" ]
11
5
10,653
3
0
2008-09-01T06:31:32.953000
2008-09-01T11:33:42.400000
37,535
37,553
What's the easiest way to read a FoxPro DBF file from Python?
I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.py and it works nicely. One gotcha: The memo file name extension must be lower c...
You can try this recipe on Active State. There is also a DBFReader module which you can try. For support for memo fields.
What's the easiest way to read a FoxPro DBF file from Python? I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf.py and it works ni...
TITLE: What's the easiest way to read a FoxPro DBF file from Python? QUESTION: I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. Update: Thanks @cnu, I used Yusdi Santoso's dbf....
[ "python", "foxpro", "dbf", "visual-foxpro" ]
25
8
30,334
6
0
2008-09-01T06:45:40.063000
2008-09-01T07:02:10.853000
37,538
37,539
How do I determine the size of my array in C?
How do I determine the size of my array in C? That is, the number of elements the array can hold?
Executive summary: int a[17]; size_t n = sizeof(a)/sizeof(a[0]); Full answer: To determine the size of your array in bytes, you can use the sizeof operator: int a[17]; size_t n = sizeof(a); On my computer, ints are 4 bytes long, so n is 68. To determine the number of elements in the array, we can divide the total size ...
How do I determine the size of my array in C? How do I determine the size of my array in C? That is, the number of elements the array can hold?
TITLE: How do I determine the size of my array in C? QUESTION: How do I determine the size of my array in C? That is, the number of elements the array can hold? ANSWER: Executive summary: int a[17]; size_t n = sizeof(a)/sizeof(a[0]); Full answer: To determine the size of your array in bytes, you can use the sizeof op...
[ "arrays", "c" ]
1,401
1,703
3,256,399
25
0
2008-09-01T06:49:22.723000
2008-09-01T06:49:44.203000
37,555
37,916
Adding server-side event to extender control
I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback). What I'd like to do is give the extender control its own server-side eve...
After plenty of reading up on extender controls and JavaScript, I've cobbled together a solution that seems to be working so far. The main trick was getting the necessary postback code from server-side to the client-side behavior script. I did this by using an ExtenderControlProperty (which is set in the control's OnPr...
Adding server-side event to extender control I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback). What I'd like to do is give...
TITLE: Adding server-side event to extender control QUESTION: I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged gets raised when the textbox loses focus, which causes problems (because of the postback). What I'd ...
[ "asp.net", ".net-3.5" ]
5
5
1,000
1
0
2008-09-01T07:04:07.760000
2008-09-01T13:12:19.590000
37,564
5,651,141
What exactly is Appdomain recycling
I am trying to figure out what exactly is Appdomain recycling? When a aspx page is requested for the first time from a DotNet application, i understand that an appdomain for that app is created, and required assemblies are loaded into that appdomain, and the request will be served. Now, if the web.config file or the co...
Well, I think the thread was getting smoothly to a final conclusion, but in the end, it was otherwise. I'll try to answer the question based on my understanding and leveraging what i've just read about in other web sites. First of all, I myself try to avoid the term recycle other than for Application Pools since this m...
What exactly is Appdomain recycling I am trying to figure out what exactly is Appdomain recycling? When a aspx page is requested for the first time from a DotNet application, i understand that an appdomain for that app is created, and required assemblies are loaded into that appdomain, and the request will be served. N...
TITLE: What exactly is Appdomain recycling QUESTION: I am trying to figure out what exactly is Appdomain recycling? When a aspx page is requested for the first time from a DotNet application, i understand that an appdomain for that app is created, and required assemblies are loaded into that appdomain, and the request...
[ "asp.net" ]
46
69
33,363
4
0
2008-09-01T07:24:22.857000
2011-04-13T14:46:51.173000
37,568
37,641
find duplicate addresses in database, stop users entering them early?
How do I find duplicate addresses in a database, or better stop people already when filling in the form? I guess the earlier the better? Is there any good way of abstracting street, postal code etc so that typos and simple attempts to get 2 registrations can be detected? like: Quellenstrasse 66/11 Quellenstr. 66a-11 I'...
Johannes: @PConroy: This was my initial thougt also. the interesting part on this is to find good transformation rules for the different parts of the address! Any good suggestions? When we were working on this type of project before, our approach was to take our existing corpus of addresses (150k or so), then apply the...
find duplicate addresses in database, stop users entering them early? How do I find duplicate addresses in a database, or better stop people already when filling in the form? I guess the earlier the better? Is there any good way of abstracting street, postal code etc so that typos and simple attempts to get 2 registrat...
TITLE: find duplicate addresses in database, stop users entering them early? QUESTION: How do I find duplicate addresses in a database, or better stop people already when filling in the form? I guess the earlier the better? Is there any good way of abstracting street, postal code etc so that typos and simple attempts ...
[ "database", "sanitization", "street-address" ]
17
4
6,719
15
0
2008-09-01T07:30:48.367000
2008-09-01T09:05:24.770000
37,573
38,104
Integrating InstantRails with Aptana or any other IDE
So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails?
Here's a tutorial: http://ruby.meetup.com/73/boards/view/viewthread?thread=2203432 (I don't know if it's any good.) And here's one with InstantRails+Netbeans: https://web.archive.org/web/20100505044104/http://weblogs.java.net/blog/bleonard/archive/2007/03/instant_rails_w.html
Integrating InstantRails with Aptana or any other IDE So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with InstantRails?
TITLE: Integrating InstantRails with Aptana or any other IDE QUESTION: So I've been using InstantRails to check out Ruby on rails. I've been using Notepad++ for the editing. Now I don't want to install Ruby or Rails on my machine. Is there any walk through/tutorial on how to integrate Radrails or Netbeans with Instant...
[ "ruby-on-rails", "ruby", "ide", "aptana", "radrails" ]
1
1
738
2
0
2008-09-01T07:41:10.603000
2008-09-01T16:18:02.123000
37,579
390,982
Queue alternatives to MSMQ on Windows?
If you want to use a queuing product for durable messaging under Windows, running.NET 2.0 and above, which alternatives to MSMQ exist today? I know of ActiveMQ ( http://activemq.apache.org/ ), and I've seen references to WSMQ (pointing to http://wsmq.net ), but the site seems to be down. Are there any other alternative...
I can't begin to say enough good things about Tibco EMS - an implementation of the Java JMS messaging spec. Tibco EMS has superb support for.NET clients - including Compact Framework.NET on WinCE. (They also have C client libraries too.) So if you're building a heterogeneous distributed application involving messaging ...
Queue alternatives to MSMQ on Windows? If you want to use a queuing product for durable messaging under Windows, running.NET 2.0 and above, which alternatives to MSMQ exist today? I know of ActiveMQ ( http://activemq.apache.org/ ), and I've seen references to WSMQ (pointing to http://wsmq.net ), but the site seems to b...
TITLE: Queue alternatives to MSMQ on Windows? QUESTION: If you want to use a queuing product for durable messaging under Windows, running.NET 2.0 and above, which alternatives to MSMQ exist today? I know of ActiveMQ ( http://activemq.apache.org/ ), and I've seen references to WSMQ (pointing to http://wsmq.net ), but t...
[ ".net", "msmq", "soa", "messaging" ]
33
11
25,463
8
0
2008-09-01T07:46:43.867000
2008-12-24T07:44:53.203000
37,584
46,000
InfoPath 2003 and the xs:any type
I am implementing exception handling for our BizTalk services, and have run into a fairly major stumbling block. In order to make the exception processing as generic as possible, and therefore to allow us to use it for any BizTalk application, our XML error schema includes an xs:any node, into which we can place a vari...
Unfortunately, things have moved on, and we have (almost) made the decision not to use InfoPath for this requirement. It's only partially to do with the xs:any issue, but more to do with (external) audit trails, calls to custom code and web services, and a couple of other factors.
InfoPath 2003 and the xs:any type I am implementing exception handling for our BizTalk services, and have run into a fairly major stumbling block. In order to make the exception processing as generic as possible, and therefore to allow us to use it for any BizTalk application, our XML error schema includes an xs:any no...
TITLE: InfoPath 2003 and the xs:any type QUESTION: I am implementing exception handling for our BizTalk services, and have run into a fairly major stumbling block. In order to make the exception processing as generic as possible, and therefore to allow us to use it for any BizTalk application, our XML error schema inc...
[ "xml", "forms", "infopath" ]
4
1
292
2
0
2008-09-01T07:52:00.450000
2008-09-05T15:10:43.917000
37,586
67,977
Consuming web services from Oracle PL/SQL
Our application is interfacing with a lot of web services these days. We have our own package that someone wrote a few years back using UTL_HTTP and it generally works, but needs some hard-coding of the SOAP envelope to work with certain systems. I would like to make it more generic, but lack experience to know how man...
I have used UTL_HTTP which is simple and works. If you face a challenge with your own package, you can probably find a solution in one of the many wrapper packages around UTL_HTTP on the net (Google "consuming web services from pl/sql", leading you to e.g. http://www.oracle-base.com/articles/9i/ConsumingWebServices9i.p...
Consuming web services from Oracle PL/SQL Our application is interfacing with a lot of web services these days. We have our own package that someone wrote a few years back using UTL_HTTP and it generally works, but needs some hard-coding of the SOAP envelope to work with certain systems. I would like to make it more ge...
TITLE: Consuming web services from Oracle PL/SQL QUESTION: Our application is interfacing with a lot of web services these days. We have our own package that someone wrote a few years back using UTL_HTTP and it generally works, but needs some hard-coding of the SOAP envelope to work with certain systems. I would like ...
[ "sql", "oracle", "web-services", "plsql" ]
10
6
15,893
4
0
2008-09-01T07:54:44.610000
2008-09-15T23:38:17.513000
37,591
37,631
Displaying XML data in a Winforms control
I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job. The error data contains all of the sever variables at the time that the error occurred. These have been formatted into an XML document that looks something to the effect of: I would...
You can transform your XML data using XSLT Another option is to use XLinq. If you want concrete code example provide us with sample data EDIT: here is a sample XSLT transform for your XML file: Server variables:: Query string items:: You can apply this transform using XslCompiledTransform class. It should give output l...
Displaying XML data in a Winforms control I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job. The error data contains all of the sever variables at the time that the error occurred. These have been formatted into an XML document that...
TITLE: Displaying XML data in a Winforms control QUESTION: I would like to display details of an xml error log to a user in a winforms application and am looking for the best control to do the job. The error data contains all of the sever variables at the time that the error occurred. These have been formatted into an...
[ "c#", "xml", "winforms", "formatting" ]
3
1
3,947
4
0
2008-09-01T08:03:52.047000
2008-09-01T08:42:23.827000
37,593
37,596
Where can I get free Vista style developer graphics?
What is the best source of free Vista style graphics for application development? I want 32x32 and 16x16 that I can use in a Winforms application.
If you're using Visual Studio Professional or above, you've got a zip file of icons in your VS path under Common7\VS2008ImageLibrary. Some of the images use the Vista style.
Where can I get free Vista style developer graphics? What is the best source of free Vista style graphics for application development? I want 32x32 and 16x16 that I can use in a Winforms application.
TITLE: Where can I get free Vista style developer graphics? QUESTION: What is the best source of free Vista style graphics for application development? I want 32x32 and 16x16 that I can use in a Winforms application. ANSWER: If you're using Visual Studio Professional or above, you've got a zip file of icons in your V...
[ "winforms", "graphics" ]
1
3
297
3
0
2008-09-01T08:04:39.937000
2008-09-01T08:07:11.477000
37,597
37,609
Why does TreeNodeCollection not implenent IEnumerable<TreeNode>?
TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?
Yes, there are many.NET Framework collection, that does not implement generic IEnumerable. I think that's because after 2.0 there was no (at least not so match) development of the core part of FW. Meanwhile I suggest you to make use of following workaround: using System.Linq;... var nodes = GetTreeNodeCollection().OfTy...
Why does TreeNodeCollection not implenent IEnumerable<TreeNode>? TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics?
TITLE: Why does TreeNodeCollection not implenent IEnumerable<TreeNode>? QUESTION: TreeNodeCollection, like some of the other control collections in System.Windows.Forms, implements IEnumerable. Is there any design reason behind this or is it just a hangover from the days before generics? ANSWER: Yes, there are many.N...
[ ".net", "winforms" ]
5
7
995
2
0
2008-09-01T08:08:16.527000
2008-09-01T08:17:21.467000
37,614
37,626
Connecting Team Explorer to Codeplex anonymously
I was using Codeplex and tried connecting to their source control using Team Explorer, with no joy. I also tried connecting with HTTPS or HTTP, using the server name and the project name. As I do not have a user account on Codeplex I could not login. I am just trying to check out some code without changing it. My quest...
I think you have to use the CodePlex Source Control Client. In includes cpc.exe which supports the anonymous access features of CodePlex TFS servers for non-coordinator/developer access. But according to the site: The CodePlex Client is not currently being maintained. The focus of the CodePlex team now is on the SvnBri...
Connecting Team Explorer to Codeplex anonymously I was using Codeplex and tried connecting to their source control using Team Explorer, with no joy. I also tried connecting with HTTPS or HTTP, using the server name and the project name. As I do not have a user account on Codeplex I could not login. I am just trying to ...
TITLE: Connecting Team Explorer to Codeplex anonymously QUESTION: I was using Codeplex and tried connecting to their source control using Team Explorer, with no joy. I also tried connecting with HTTPS or HTTP, using the server name and the project name. As I do not have a user account on Codeplex I could not login. I ...
[ "version-control", "tfs", "codeplex" ]
1
2
539
4
0
2008-09-01T08:23:52.013000
2008-09-01T08:36:47.800000
37,628
37,632
What is reflection and why is it useful?
What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language.
The name reflection is used to describe code which is able to inspect other code in the same system (or itself). For example, say you have an object of an unknown type in Java, and you would like to call a 'doSomething' method on it if one exists. Java's static typing system isn't really designed to support this unless...
What is reflection and why is it useful? What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language.
TITLE: What is reflection and why is it useful? QUESTION: What is reflection, and why is it useful? I'm particularly interested in Java, but I assume the principles are the same in any language. ANSWER: The name reflection is used to describe code which is able to inspect other code in the same system (or itself). Fo...
[ "java", "reflection", "terminology" ]
2,546
2,016
1,037,611
25
0
2008-09-01T08:39:21.633000
2008-09-01T08:44:58.657000
37,644
37,655
Examining Berkeley DB files from the CLI
I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to be able to take a look inside without having to start writin...
Check out the db-utils package. If you use apt, you can install it with the following: apt-get install db-util (or apt-get install db4.8-util or whatever version you have or prefer.) Additional links: http://rpmfind.net/linux/rpm2html/search.php?query=db-utils https://packages.ubuntu.com/search?suite=default&section=al...
Examining Berkeley DB files from the CLI I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to be able to take a l...
TITLE: Examining Berkeley DB files from the CLI QUESTION: I have a set of Berkeley DB files on my Linux file system that I'd like to examine. What useful tools exist for getting a quick overview of the contents? I can write Perl scripts that use BDB modules for examining them, but I'm looking for some CLI utility to b...
[ "linux", "command-line-interface", "berkeley-db" ]
63
28
75,749
9
0
2008-09-01T09:10:27.487000
2008-09-01T09:24:51.850000
37,649
559,291
Swapping column values in MySQL
I have a MySQL table with coordinates; the column names are X and Y. Now I want to swap the column values in this table, so that X becomes Y and Y becomes X. The most apparent solution would be renaming the columns, but I don't want to make structure changes since I don't necessarily have permissions to do that. Is thi...
I just had to deal with the same and I'll summarize my findings. The UPDATE table SET X=Y, Y=X approach obviously doesn't work, as it'll just set both values to Y. Here's a method that uses a temporary variable. Thanks to Antony from the comments of http://beerpla.net/2009/02/17/swapping-column-values-in-mysql/ for the...
Swapping column values in MySQL I have a MySQL table with coordinates; the column names are X and Y. Now I want to swap the column values in this table, so that X becomes Y and Y becomes X. The most apparent solution would be renaming the columns, but I don't want to make structure changes since I don't necessarily hav...
TITLE: Swapping column values in MySQL QUESTION: I have a MySQL table with coordinates; the column names are X and Y. Now I want to swap the column values in this table, so that X becomes Y and Y becomes X. The most apparent solution would be renaming the columns, but I don't want to make structure changes since I don...
[ "mysql", "database" ]
160
252
123,832
23
0
2008-09-01T09:19:56.560000
2009-02-18T00:01:51.797000
37,650
37,656
How to implement a file download in asp.net
What is the best way to implement, from a web page a download action using asp.net 2.0? Log files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the log file from the IIS server to the users local pc.
Does this help: http://www.west-wind.com/weblog/posts/76293.aspx Response.ContentType = "application/octet-stream"; Response.AppendHeader("Content-Disposition","attachment; filename=logfile.txt"); Response.TransmitFile( Server.MapPath("~/logfile.txt") ); Response.End(); Response.TransmitFile is the accepted way of send...
How to implement a file download in asp.net What is the best way to implement, from a web page a download action using asp.net 2.0? Log files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the log file from the I...
TITLE: How to implement a file download in asp.net QUESTION: What is the best way to implement, from a web page a download action using asp.net 2.0? Log files for a action are created in a directory called [Application Root]/Logs. I have the full path and want to provide a button, that when clicked will download the l...
[ "asp.net", "file", "download" ]
25
38
74,492
2
0
2008-09-01T09:21:14.637000
2008-09-01T09:25:28.073000
37,662
38,278
Is there an n-ary tree implementation in Perl?
I'm writing a Perl script and would like to use a n-ary tree data structure. Is there a good implementation that is available as source code (rather than part of a Perl library)?
Adding to what Matthew already said, it looks like the following modules would be suitable: Tree::Nary Tree::Simple Tree
Is there an n-ary tree implementation in Perl? I'm writing a Perl script and would like to use a n-ary tree data structure. Is there a good implementation that is available as source code (rather than part of a Perl library)?
TITLE: Is there an n-ary tree implementation in Perl? QUESTION: I'm writing a Perl script and would like to use a n-ary tree data structure. Is there a good implementation that is available as source code (rather than part of a Perl library)? ANSWER: Adding to what Matthew already said, it looks like the following mo...
[ "perl", "algorithm", "tree" ]
1
6
6,594
3
0
2008-09-01T09:34:37.880000
2008-09-01T18:47:02.310000
37,666
37,675
What tool to use for automatic nightly builds?
I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable files (including installers, documentation, etc.),...
At my work we use CCNET, but with builds on check-in more than nightly - although it's easily configured for either or both. You can very easily set up unit testing to run on every checkin as well, FXCop testing, and a slew of other products. I would also advise checking out Team City as an option, because it has a fre...
What tool to use for automatic nightly builds? I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriate downloadable fil...
TITLE: What tool to use for automatic nightly builds? QUESTION: I have a few Visual Studio Solutions/Projects that are being worked on in my company, which now require a scheme for automatic nightly builds. Such a scheme needs to be able to check the latest versions from SVN, build the solutions, create the appropriat...
[ "visual-studio", "build-process" ]
19
14
7,786
8
0
2008-09-01T09:41:14.777000
2008-09-01T09:50:26.143000
37,692
39,989
Eclipse Plugin Dev: How do I get the paths for the currently selected project?
I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers. The plugin works like this: Whenever I open a source file I let the plugin parse the source's corresponding build file (this could be further developed with caching the parse r...
You should take a look at ICProject, especially the getOutputEntries and getAllSourceRoots operations. This tutorial has some brief examples too. I work with JDT so thats pretty much what I can do. Hope it helps:)
Eclipse Plugin Dev: How do I get the paths for the currently selected project? I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers. The plugin works like this: Whenever I open a source file I let the plugin parse the source's cor...
TITLE: Eclipse Plugin Dev: How do I get the paths for the currently selected project? QUESTION: I'm writing a plugin that will parse a bunch of files in a project. But for the moment I'm stuck searching through the Eclipse API for answers. The plugin works like this: Whenever I open a source file I let the plugin pars...
[ "java", "eclipse", "eclipse-api" ]
6
1
4,065
1
0
2008-09-01T10:06:42.407000
2008-09-02T16:38:17.777000
37,696
37,761
Concatenate several fields into one with SQL
I have three tables tag, page, pagetag With the data below page ID NAME 1 page 1 2 page 2 3 page 3 4 page 4 tag ID NAME 1 tag 1 2 tag 2 3 tag 3 4 tag 4 pagetag ID PAGEID TAGID 1 2 1 2 2 3 3 3 4 4 1 1 5 1 2 6 1 3 I would like to get a string containing the correspondent tag names for each page with SQL in a single query...
Sergio del Amo: However, I am not getting the pages without tags. I guess i need to write my query with left outer joins. SELECT pagetag.id, page.name, group_concat(tag.name) FROM ( page LEFT JOIN pagetag ON page.id = pagetag.pageid ) LEFT JOIN tag ON pagetag.tagid = tag.id GROUP BY page.id; Not a very pretty query, bu...
Concatenate several fields into one with SQL I have three tables tag, page, pagetag With the data below page ID NAME 1 page 1 2 page 2 3 page 3 4 page 4 tag ID NAME 1 tag 1 2 tag 2 3 tag 3 4 tag 4 pagetag ID PAGEID TAGID 1 2 1 2 2 3 3 3 4 4 1 1 5 1 2 6 1 3 I would like to get a string containing the correspondent tag n...
TITLE: Concatenate several fields into one with SQL QUESTION: I have three tables tag, page, pagetag With the data below page ID NAME 1 page 1 2 page 2 3 page 3 4 page 4 tag ID NAME 1 tag 1 2 tag 2 3 tag 3 4 tag 4 pagetag ID PAGEID TAGID 1 2 1 2 2 3 3 3 4 4 1 1 5 1 2 6 1 3 I would like to get a string containing the c...
[ "sql", "mysql" ]
5
3
6,039
6
0
2008-09-01T10:16:45.003000
2008-09-01T11:17:34.483000
37,702
37,707
True random number generator
Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article?
I believe that was on thedailywtf.com - ie. not something that you want to do. It is not possible to get a truly random number from pseudorandom numbers, no matter how many times you call randomize(). You can get "true" random numbers from special hardware. You could also collect entropy from mouse movements and things...
True random number generator Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article?
TITLE: True random number generator QUESTION: Sorry for this not being a "real" question, but Sometime back i remember seeing a post here about randomizing a randomizer randomly to generate truly random numbers, not just pseudo random. I dont see it if i search for it. Does anybody know about that article? ANSWER: I ...
[ "algorithm", "language-agnostic", "random", "prng" ]
25
17
25,265
11
0
2008-09-01T10:25:46.090000
2008-09-01T10:30:54.780000
37,731
37,768
To use views or not to use views
I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this: $draw = new Draw; $nav = $draw->wideHeaderBox(). $draw->left(). $draw->image(). Image::get($image,60,array('id'=>'header_image')). $draw->im...
HTML time-savers are useful, but they're only useful when they're intuitive and easy-to-understand. Having to instantiate a new Draw just doesn't sound very natural. Furthermore, wideHeaderBox and left will only have significance to someone who intimately knows the system. And what if there is a redesign, like your co-...
To use views or not to use views I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this: $draw = new Draw; $nav = $draw->wideHeaderBox(). $draw->left(). $draw->image(). Image::get($image,60,array(...
TITLE: To use views or not to use views QUESTION: I seem right now to be embroiled in a debate with another programmer on this project who thinks that views have no merits. He proposes a system that PHP looks something like this: $draw = new Draw; $nav = $draw->wideHeaderBox(). $draw->left(). $draw->image(). Image::ge...
[ "php", "model-view-controller" ]
5
5
440
5
0
2008-09-01T10:55:18
2008-09-01T11:23:44.920000
37,732
37,767
What is the regex pattern for datetime (2008-09-01 12:35:45 )?
What is the RegEx pattern for DateTime (2008-09-01 12:35:45 )? I get this error: No ending delimiter '^' found Using: preg_match('(?n:^(?=\d)((? 31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][048]|[3579][26])00))|0?[1-9]|1\d|2[0-8])(? [/.-])(? 0?[1-9]|1[012...
@Espo: I just have to say that regex is incredible. I'd hate to have to write the code that did something useful with the matches, such as if you wanted to actually find out what date and time the user typed. It seems like Tom's solution would be more tenable, as it is about a zillion times simpler and with the additio...
What is the regex pattern for datetime (2008-09-01 12:35:45 )? What is the RegEx pattern for DateTime (2008-09-01 12:35:45 )? I get this error: No ending delimiter '^' found Using: preg_match('(?n:^(?=\d)((? 31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][26])|(16|[2468][04...
TITLE: What is the regex pattern for datetime (2008-09-01 12:35:45 )? QUESTION: What is the RegEx pattern for DateTime (2008-09-01 12:35:45 )? I get this error: No ending delimiter '^' found Using: preg_match('(?n:^(?=\d)((? 31(?!(.0?[2469]|11))|30(?!.0?2)|29(?(.0?2)(?=.{3,4}(1[6-9]|[2-9]\d)(0[48]|[2468][048]|[13579][...
[ "php", "regex", "datetime" ]
71
91
185,336
14
0
2008-09-01T10:58:24.607000
2008-09-01T11:23:07.433000
37,743
37,750
SQL query to get the top "n" scores out of a list
I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. I'm making an example to clarify. Let's say that this is the Users table, with the points ear...
Untested, but should work: select * from users where points in (select distinct top 3 points from users order by points desc)
SQL query to get the top "n" scores out of a list I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. I'm making an example to clarify. Let's say...
TITLE: SQL query to get the top "n" scores out of a list QUESTION: I'd like to find the different ways to solve a real life problem I had: imagine to have a contest, or a game, during which the users collect points. You have to build a query to show the list of users with the best "n" scores. I'm making an example to ...
[ "sql", "sql-server", "puzzle" ]
7
11
24,223
11
0
2008-09-01T11:03:34.907000
2008-09-01T11:07:41.993000
37,759
37,762
How do you prevent the IIS default site web.config file being inherited by virtual directories?
I have the following code in a web.config file of the default IIS site. Then when I setup and browse to a virtual directory I get this error Could not load file or assembly 'Charts' or one of its dependencies. The system cannot find the file specified. The virtual directory is inheriting the modules from the default we...
I've found the answer. Wrap the HttpModule section in location tags and set the inheritInChildApplications attribute to false. Now any virtual directories will not inherit the settings in this location section. @GateKiller This isn't another website, its a virtual directory so inheritance does occur. @petrich I've had ...
How do you prevent the IIS default site web.config file being inherited by virtual directories? I have the following code in a web.config file of the default IIS site. Then when I setup and browse to a virtual directory I get this error Could not load file or assembly 'Charts' or one of its dependencies. The system can...
TITLE: How do you prevent the IIS default site web.config file being inherited by virtual directories? QUESTION: I have the following code in a web.config file of the default IIS site. Then when I setup and browse to a virtual directory I get this error Could not load file or assembly 'Charts' or one of its dependenci...
[ ".net", "asp.net", "configuration", "configuration-files" ]
17
20
7,761
3
0
2008-09-01T11:15:11.557000
2008-09-01T11:19:03.607000
37,783
83,332
Are there any guidelines for designing user interface for mobile devices?
I am creating an application for a Windows Mobile computer. The catch is that the device ( Motorola MC17 ) does not have a touch screen or universal keys - there are only six programmable hardware keys. Fitt's law is not applicable here, most Microsoft guidelines are also moot. For now I'm mimicking Nokia's S60 keyboar...
Microsoft has an official set of Guidelines for getting the "Designed for Windows Mobile" logo. These are a reasonable start as they not only cover one-handed (no touchscreen) operation, they also help your app to maintain familiarity for users. Some other resources discussing the topic: The WinMo team blog entry on on...
Are there any guidelines for designing user interface for mobile devices? I am creating an application for a Windows Mobile computer. The catch is that the device ( Motorola MC17 ) does not have a touch screen or universal keys - there are only six programmable hardware keys. Fitt's law is not applicable here, most Mic...
TITLE: Are there any guidelines for designing user interface for mobile devices? QUESTION: I am creating an application for a Windows Mobile computer. The catch is that the device ( Motorola MC17 ) does not have a touch screen or universal keys - there are only six programmable hardware keys. Fitt's law is not applica...
[ "user-interface", "windows-mobile", "usability" ]
2
3
1,583
2
0
2008-09-01T11:33:31.120000
2008-09-17T13:41:18.183000
37,785
38,825
Can a fixture be changed dynamically between test methods in CakePHP?
Is it possible to have a fixture change between test methods? If so, how can I do this? My syntax for this problem: In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to work in the same way that adding the "created" and "modified" fields will ...
I'm not familiar specifically with CakePHP, but this kind of thing seems to happen anywhere with fixtures. There is no built in way in rails at least for this to happen, and I imagine not in cakePHP or anywhere else either because the whole idea of a fixture, is that it is fixed There are 2 'decent' workarounds I'm awa...
Can a fixture be changed dynamically between test methods in CakePHP? Is it possible to have a fixture change between test methods? If so, how can I do this? My syntax for this problem: In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to work...
TITLE: Can a fixture be changed dynamically between test methods in CakePHP? QUESTION: Is it possible to have a fixture change between test methods? If so, how can I do this? My syntax for this problem: In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This i...
[ "unit-testing", "cakephp", "fixture" ]
2
0
1,120
2
0
2008-09-01T11:33:49.343000
2008-09-02T04:38:23.357000
37,791
89,454
How do you manage SQL Queries
At the moment my code (PHP) has too many SQL queries in it. eg... // not a real example, but you get the idea... $results = $db->GetResults("SELECT * FROM sometable WHERE iUser=$userid"); if ($results) { // Do something } I am looking into using stored procedures to reduce this and make things a little more robust, but...
The best course of action for you will depend on how you are approaching your data access. There are three approaches you can take: Use stored procedures Keep the queries in the code (but put all your queries into functions and fix everything to use PDO for parameters, as mentioned earlier) Use an ORM tool If you want ...
How do you manage SQL Queries At the moment my code (PHP) has too many SQL queries in it. eg... // not a real example, but you get the idea... $results = $db->GetResults("SELECT * FROM sometable WHERE iUser=$userid"); if ($results) { // Do something } I am looking into using stored procedures to reduce this and make th...
TITLE: How do you manage SQL Queries QUESTION: At the moment my code (PHP) has too many SQL queries in it. eg... // not a real example, but you get the idea... $results = $db->GetResults("SELECT * FROM sometable WHERE iUser=$userid"); if ($results) { // Do something } I am looking into using stored procedures to reduc...
[ "php", "sql", "mysql" ]
16
31
7,490
10
0
2008-09-01T11:38:36.773000
2008-09-18T02:23:58.567000
37,799
38,317
GCOV for multi-threaded apps
Is it possible to use gcov for coverage testing of multi-threaded applications? I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible oprofile), ideally with some good document...
We've certainly used gcov to get coverage information on our multi-threaded application. You want to compile with gcc 4.3 which can do coverage on dynamic code. You compile with the -fprofile-arcs -ftest-coverage options, and the code will generate.gcda files which gcov can then process. We do a separate build of our p...
GCOV for multi-threaded apps Is it possible to use gcov for coverage testing of multi-threaded applications? I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (possible oprofile), id...
TITLE: GCOV for multi-threaded apps QUESTION: Is it possible to use gcov for coverage testing of multi-threaded applications? I've set some trivial tests of our code-base up, but it would be nice to have some idea of the coverage we're achieving. If gcov isn't appropriate can anyone recommend an alternative tool (poss...
[ "c++", "testing", "code-coverage" ]
6
8
4,230
3
0
2008-09-01T11:44:09.113000
2008-09-01T19:19:56.383000
37,804
38,359
Link to samba shares in html
First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc. I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable. Currently there are a few op...
Hmm, protocol handlers look interesting. As Mark said, in Windows protocol handlers can be dealt with at the OS level Protocol handlers can also be done at the browser level (which is preferred, as it is cross platform and doesn't involve installing anything). Summary of how it works in Firefox Summary of how it works ...
Link to samba shares in html First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc. I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into something more manageable....
TITLE: Link to samba shares in html QUESTION: First off if you're unaware, samba or smb == Windows file sharing, \\computer\share etc. I have a bunch of different files on a bunch of different computers. It's mostly media and there is quite a bit of it. I'm looking into various ways of consolidating this into somethin...
[ "html", "samba", "smb" ]
18
6
37,796
3
0
2008-09-01T11:49:00.570000
2008-09-01T20:06:51.463000
37,805
37,810
Filter linq list on property value
I have a List and a List. The customObject class has an ID property. How can I get a List containing only the objects where the ID property is in the List using LINQ? Edit: I accepted Konrads answer because it is easier/more intuitive to read.
var result = from o in objList where intList.Contains(o.ID) select o
Filter linq list on property value I have a List and a List. The customObject class has an ID property. How can I get a List containing only the objects where the ID property is in the List using LINQ? Edit: I accepted Konrads answer because it is easier/more intuitive to read.
TITLE: Filter linq list on property value QUESTION: I have a List and a List. The customObject class has an ID property. How can I get a List containing only the objects where the ID property is in the List using LINQ? Edit: I accepted Konrads answer because it is easier/more intuitive to read. ANSWER: var result = f...
[ ".net", "linq", "linq-to-objects" ]
20
17
43,693
6
0
2008-09-01T11:49:07.620000
2008-09-01T11:56:21.190000
37,808
37,824
Examples of using semantic web technologies in real world applications
Are you working on a (probably commercial) product which uses RDF/OWL/SPARQL technologies? If so, can you please describe your product?
O'Reilly's Practical RDF has a chatper titled Commercial Uses of RDF/XML. The table at the left lists the subsections: Chandler, RDF Gateway, Seamark, and Adobe's XMP stuff.
Examples of using semantic web technologies in real world applications Are you working on a (probably commercial) product which uses RDF/OWL/SPARQL technologies? If so, can you please describe your product?
TITLE: Examples of using semantic web technologies in real world applications QUESTION: Are you working on a (probably commercial) product which uses RDF/OWL/SPARQL technologies? If so, can you please describe your product? ANSWER: O'Reilly's Practical RDF has a chatper titled Commercial Uses of RDF/XML. The table at...
[ "rdf", "semantic-web" ]
23
6
8,383
11
0
2008-09-01T11:55:27.560000
2008-09-01T12:05:56.893000
37,809
37,880
How do I generate a Friendly URL in C#?
How can I go about generating a Friendly URL in C#? Currently I simple replace spaces with an underscore, but how would I go about generating URL's like Stack Overflow? For example how can I convert: How do I generate a Friendly URL in C#? Into how-do-i-generate-a-friendly-url-in-C
There are several things that could be improved in Jeff's solution, though. if (String.IsNullOrEmpty(title)) return ""; IMHO, not the place to test this. If the function gets passed an empty string, something went seriously wrong anyway. Throw an error or don't react at all. // remove any leading or trailing spaces lef...
How do I generate a Friendly URL in C#? How can I go about generating a Friendly URL in C#? Currently I simple replace spaces with an underscore, but how would I go about generating URL's like Stack Overflow? For example how can I convert: How do I generate a Friendly URL in C#? Into how-do-i-generate-a-friendly-url-in...
TITLE: How do I generate a Friendly URL in C#? QUESTION: How can I go about generating a Friendly URL in C#? Currently I simple replace spaces with an underscore, but how would I go about generating URL's like Stack Overflow? For example how can I convert: How do I generate a Friendly URL in C#? Into how-do-i-generate...
[ "c#", "friendly-url" ]
29
47
17,473
4
0
2008-09-01T11:55:57.620000
2008-09-01T12:35:51.173000
37,812
37,891
MSMQ monitoring
Is there anything which can help with msmq monitoring? I'd like to get some event/monit when a message appears in queue and the same on leave.
Check out the Windows Management Performance counters. If you look in your Administrative Tools and find "Performance Counters", you will be able to dig through there and find detailed metrics on what is happening on each message queue. This can also work for remote servers. Should you wish to create some sort of autom...
MSMQ monitoring Is there anything which can help with msmq monitoring? I'd like to get some event/monit when a message appears in queue and the same on leave.
TITLE: MSMQ monitoring QUESTION: Is there anything which can help with msmq monitoring? I'd like to get some event/monit when a message appears in queue and the same on leave. ANSWER: Check out the Windows Management Performance counters. If you look in your Administrative Tools and find "Performance Counters", you w...
[ "monitoring", "msmq" ]
5
6
7,587
2
0
2008-09-01T11:59:03.587000
2008-09-01T12:58:28.267000
37,821
38,114
Viewing event log via a web interface
I'd like to be able to view the event log for a series of asp.net websites running on IIS. Can I do this externally, for example, through a web interface?
No, but there are two solutions I would recommend: Adiscon EventLogger is a third-party product that will send your Windows EventLog to a SQL database. You can either send all events or create filters. Of course, once the events are in a SQL database, you can use any of the usual tools to create a web interface. You ca...
Viewing event log via a web interface I'd like to be able to view the event log for a series of asp.net websites running on IIS. Can I do this externally, for example, through a web interface?
TITLE: Viewing event log via a web interface QUESTION: I'd like to be able to view the event log for a series of asp.net websites running on IIS. Can I do this externally, for example, through a web interface? ANSWER: No, but there are two solutions I would recommend: Adiscon EventLogger is a third-party product that...
[ "asp.net", "iis", "logging", "monitoring" ]
4
2
2,556
2
0
2008-09-01T12:05:22.887000
2008-09-01T16:23:29.333000
37,823
37,852
Good reasons NOT to use a relational database?
Can you please point to alternative data storage tools and give good reasons to use them instead of good-old relational databases? In my opinion, most applications rarely use the full power of SQL--it would be interesting to see how to build an SQL-free application.
Plain text files in a filesystem Very simple to create and edit Easy for users to manipulate with simple tools (i.e. text editors, grep etc) Efficient storage of binary documents XML or JSON files on disk As above, but with a bit more ability to validate the structure. Spreadsheet / CSV file Very easy model for busines...
Good reasons NOT to use a relational database? Can you please point to alternative data storage tools and give good reasons to use them instead of good-old relational databases? In my opinion, most applications rarely use the full power of SQL--it would be interesting to see how to build an SQL-free application.
TITLE: Good reasons NOT to use a relational database? QUESTION: Can you please point to alternative data storage tools and give good reasons to use them instead of good-old relational databases? In my opinion, most applications rarely use the full power of SQL--it would be interesting to see how to build an SQL-free a...
[ "sql", "database", "nosql" ]
139
147
21,914
21
0
2008-09-01T12:05:52.010000
2008-09-01T12:19:14.193000
37,830
37,878
How do I implement a chromeless window with WPF?
I want to show a chromeless modal window with a close button in the upper right corner. Is this possible?
You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like this: That will still have a resize border. If you want to make the window non-resizable then add ResizeMode="NoResize" to the declaration.
How do I implement a chromeless window with WPF? I want to show a chromeless modal window with a close button in the upper right corner. Is this possible?
TITLE: How do I implement a chromeless window with WPF? QUESTION: I want to show a chromeless modal window with a close button in the upper right corner. Is this possible? ANSWER: You'll pretty much have to roll your own Close button, but you can hide the window chrome completely using the WindowStyle attribute, like...
[ "wpf", "user-interface" ]
25
34
15,259
3
0
2008-09-01T12:07:38.903000
2008-09-01T12:34:31.363000
37,832
37,853
UI and event testing
So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. The real thing is, I'm struggling to get my head around how to unit-test the UI and more generally objects that generate events: user...
the thing to remember is that unit testing is about testing the units of code you write. Your unit tests shouldn't test that clicking a button raises an event, but that the code being executed by that click event does as it's supposed to. What you're really wanting to do is test the underlying code does what it should ...
UI and event testing So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. The real thing is, I'm struggling to get my head around how to unit-test the UI and more generally objects that ...
TITLE: UI and event testing QUESTION: So I know that unit testing is a must. I get the idea that TDD is the way to go when adding new modules. Even if, in practice, I don't actually do it. A bit like commenting code, really. The real thing is, I'm struggling to get my head around how to unit-test the UI and more gener...
[ "visual-studio", "unit-testing", "user-interface", "tdd" ]
2
2
455
4
0
2008-09-01T12:09:10.553000
2008-09-01T12:19:14.367000
37,843
37,870
What exactly is WPF?
I have seen lots of questions recently about WPF... What is it? What does it stand for? How can I begin programming WPF?
WPF is a new technology that will supersede Windows Forms. WPF stands for Windows Presentation Foundation Here are some useful topics on SO: What WPF books would you recommend What real world WPF applications are out there From my practice I can say that WPF is a truly amazing technology however it takes some time to g...
What exactly is WPF? I have seen lots of questions recently about WPF... What is it? What does it stand for? How can I begin programming WPF?
TITLE: What exactly is WPF? QUESTION: I have seen lots of questions recently about WPF... What is it? What does it stand for? How can I begin programming WPF? ANSWER: WPF is a new technology that will supersede Windows Forms. WPF stands for Windows Presentation Foundation Here are some useful topics on SO: What WPF b...
[ "wpf", "windows" ]
17
10
9,191
8
0
2008-09-01T12:15:14.687000
2008-09-01T12:31:39.610000
37,851
37,884
Application Control Scripts on Unix
I'm looking for some software that allows me to control a server based application, that is, there are bunch of interdependent processes that I'd like to be able to start up, shut down and monitor in a controller manner. I've come across programs like Autosys, but that's expensive and very much over the top for what I ...
Try Supervise, which is what qmail uses to keep track of it's services/startup applications: http://cr.yp.to/daemontools/supervise.html
Application Control Scripts on Unix I'm looking for some software that allows me to control a server based application, that is, there are bunch of interdependent processes that I'd like to be able to start up, shut down and monitor in a controller manner. I've come across programs like Autosys, but that's expensive an...
TITLE: Application Control Scripts on Unix QUESTION: I'm looking for some software that allows me to control a server based application, that is, there are bunch of interdependent processes that I'd like to be able to start up, shut down and monitor in a controller manner. I've come across programs like Autosys, but t...
[ "linux", "unix", "solaris", "scripting" ]
1
1
1,359
4
0
2008-09-01T12:19:13.943000
2008-09-01T12:53:37.793000
37,882
38,259
How can you easily reorder columns in LINQ to SQL designer?
When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you need to cut and paste properties about, or delete them and re-...
Using Linq-to-Sql, you can have columns in the DataGridView appear different than in the original table by: In your Linq query, extract the columns that you want, in the order than you want, and store them in a var. Then the autogenerate columns should show them in that order in the DataGridView Use Template columns in...
How can you easily reorder columns in LINQ to SQL designer? When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly difficult; you ne...
TITLE: How can you easily reorder columns in LINQ to SQL designer? QUESTION: When designing LINQ classes using the LINQ to SQL designer I've sometimes needed to reorder the classes for the purposes of having the resultant columns in a DataGridView appear in a different order. Unfortunately this seems to be exceedingly...
[ "c#", "linq", "linq-to-sql" ]
0
1
1,540
3
0
2008-09-01T12:37:30.500000
2008-09-01T18:34:08.193000
37,929
37,934
How to test java application for performance bottlenecks?
I am reviewing a big java application to see if there are any performance bottlenecks. The real problem is that I cannot pinpoint the performance issues to any single module. The whole application is slow as such. Is there some tool/technique I can use to help me out in this?
Try using a profiler on your running code. It should help you identify the bottlenecks. Try jprofiler or Netbeans profiler
How to test java application for performance bottlenecks? I am reviewing a big java application to see if there are any performance bottlenecks. The real problem is that I cannot pinpoint the performance issues to any single module. The whole application is slow as such. Is there some tool/technique I can use to help m...
TITLE: How to test java application for performance bottlenecks? QUESTION: I am reviewing a big java application to see if there are any performance bottlenecks. The real problem is that I cannot pinpoint the performance issues to any single module. The whole application is slow as such. Is there some tool/technique I...
[ "java", "performance" ]
11
8
19,539
6
0
2008-09-01T13:22:19.033000
2008-09-01T13:25:22.100000
37,936
37,951
Handling XSD Dataset ConstraintExceptions
Does anyone have any tips for dealing with ConstraintExceptions thrown by XSD datasets? This is the exception with the cryptic message: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints.
A couple of tips that I've found lately. It's much better to use the TableAdapter FillByDataXXXX() methods instead of GetDataByXXXX() methods because the DataTable passed into the fill method can be interrogated for clues: DataTable.GetErrors() returns an array of DataRow instances in error DataRow.RowError contains a ...
Handling XSD Dataset ConstraintExceptions Does anyone have any tips for dealing with ConstraintExceptions thrown by XSD datasets? This is the exception with the cryptic message: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key cons...
TITLE: Handling XSD Dataset ConstraintExceptions QUESTION: Does anyone have any tips for dealing with ConstraintExceptions thrown by XSD datasets? This is the exception with the cryptic message: System.Data.ConstraintException: Failed to enable constraints. One or more rows contain values violating non-null, unique, o...
[ "xsd", "dataset", "constraintexception" ]
7
20
4,523
1
0
2008-09-01T13:27:08.633000
2008-09-01T13:34:35.777000
37,944
37,963
How popular is WPF as a technology?
I had a discussion with some colleagues mentioning that there are not too many projects that we do which make use of WPF for creating UI for a windows application (we almost always use Windows Forms instead). Are your experiences the same - i.e. there is not too much adoption of this technology? Why do you think that i...
Have a look at this survey it was done by a Windows Forms Contol Vendor in Australia. Personally I have worked on two commercial projects in the last year that were using WPF to varying degrees. The adoption of WPF is on the rise. Microsoft I believe is putting all their eggs into the WPF basket.
How popular is WPF as a technology? I had a discussion with some colleagues mentioning that there are not too many projects that we do which make use of WPF for creating UI for a windows application (we almost always use Windows Forms instead). Are your experiences the same - i.e. there is not too much adoption of this...
TITLE: How popular is WPF as a technology? QUESTION: I had a discussion with some colleagues mentioning that there are not too many projects that we do which make use of WPF for creating UI for a windows application (we almost always use Windows Forms instead). Are your experiences the same - i.e. there is not too muc...
[ "wpf" ]
20
10
5,852
9
0
2008-09-01T13:32:22.927000
2008-09-01T13:39:49.383000
37,956
38,017
C++ : What's the easiest library to open video file
I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter (using this sample http://msdn.microsoft.com/en-us/library/ms787867...
Currently these are the most popular video frameworks available on Win32 platforms: Video for Windows: old windows framework coming from the age of Win95 but still widely used because it is very simple to use. Unfortunately it supports only AVI files for which the proper VFW codec has been installed. DirectShow: standa...
C++ : What's the easiest library to open video file I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filter (using this sam...
TITLE: C++ : What's the easiest library to open video file QUESTION: I would like to open a small video file and map every frames in memory (to apply some custom filter). I don't want to handle the video codec, I would rather let the library handle that for me. I've tried to use Direct Show with the SampleGrabber filt...
[ "c++", "windows", "video" ]
28
29
55,956
8
0
2008-09-01T13:35:41.937000
2008-09-01T14:53:38.503000
37,969
41,164
Tool for posting test messages onto a JMS queue?
Can anyone recommend a tool for quickly posting test messages onto a JMS queue? Description: The tool should allow the user to enter some data, perhaps an XML payload, and then submit it to a queue. I should be able to test consumer without producer.
This answer doesn't apply to all JMS brokers, but if you happen to be using Apache ActiveMQ, the web-based admin console (by default at http://localhost:8161/admin ) allows you to manually send text messages to topics or queues. It's handy for debugging.
Tool for posting test messages onto a JMS queue? Can anyone recommend a tool for quickly posting test messages onto a JMS queue? Description: The tool should allow the user to enter some data, perhaps an XML payload, and then submit it to a queue. I should be able to test consumer without producer.
TITLE: Tool for posting test messages onto a JMS queue? QUESTION: Can anyone recommend a tool for quickly posting test messages onto a JMS queue? Description: The tool should allow the user to enter some data, perhaps an XML payload, and then submit it to a queue. I should be able to test consumer without producer. A...
[ "jms", "messaging", "tooling" ]
23
19
80,580
12
0
2008-09-01T13:46:41.113000
2008-09-03T04:19:36.640000
37,976
38,224
How do I change XML indentation in IntelliJ IDEA?
By default IntelliJ IDEA 7.0.4 seems to use 4 spaces for indentation in XML files. The project I'm working on uses 2 spaces as indentation in all it's XML. Is there a way to configure the indentation in IntelliJ's editor?
Sure there is. This is all you need to do: Go to File -> Settings -> Global Code Style -> General Disable the checkbox next to 'Use same settings for all file types' The 'XML' tab should become enabled. Click it and set the 'tab' (and probably 'indent') size to 2.
How do I change XML indentation in IntelliJ IDEA? By default IntelliJ IDEA 7.0.4 seems to use 4 spaces for indentation in XML files. The project I'm working on uses 2 spaces as indentation in all it's XML. Is there a way to configure the indentation in IntelliJ's editor?
TITLE: How do I change XML indentation in IntelliJ IDEA? QUESTION: By default IntelliJ IDEA 7.0.4 seems to use 4 spaces for indentation in XML files. The project I'm working on uses 2 spaces as indentation in all it's XML. Is there a way to configure the indentation in IntelliJ's editor? ANSWER: Sure there is. This i...
[ "java", "xml", "ide", "intellij-idea" ]
12
19
13,065
3
0
2008-09-01T13:52:35.700000
2008-09-01T17:59:26.997000
37,979
38,077
Recommendations for implementations of ActiveRecord
Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using CBL ActiveRecord, but I was wondering if there were any viable alternatives.
Depends!;) For example there is ADODB's Active Record implementation, then there is Zend_Db_DataTable and Doctrine. Those are the ones I know of, I am sure there are more implementations. Out of those three I'd recommend Doctrine. Last time I checked Adodb carried a lot of extra weight for PHP4 and Zend_Db_* is general...
Recommendations for implementations of ActiveRecord Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using CBL ActiveRecord, but I was wondering if there were any viable alternatives.
TITLE: Recommendations for implementations of ActiveRecord QUESTION: Does anyone have any recommendations for implementations of ActiveRecord in PHP? I've been using CBL ActiveRecord, but I was wondering if there were any viable alternatives. ANSWER: Depends!;) For example there is ADODB's Active Record implementatio...
[ "php" ]
2
1
994
5
0
2008-09-01T13:58:49.650000
2008-09-01T15:53:57.050000
37,991
38,587
Using MS Access & ODBC to connect to a remote PostgreSQL
I currently have an MS Access application that connects to a PostgreSQL database via ODBC. This successfully runs on a LAN with 20 users (each running their own version of Access). Now I am thinking through some disaster recovery scenarios, and it seems that a quick and easy method of protecting the data is to use log ...
onnodb, The PostgreSQL ODBC driver is actively developed and an Access front-end combined with PostgreSQL server, in my opinion makes a great option on a LAN for rapid development. I have been involved in a reasonably big system (100+ PostgreSQL tables, 200+ Access forms, 1000+ Access queries & reports) and it has run ...
Using MS Access & ODBC to connect to a remote PostgreSQL I currently have an MS Access application that connects to a PostgreSQL database via ODBC. This successfully runs on a LAN with 20 users (each running their own version of Access). Now I am thinking through some disaster recovery scenarios, and it seems that a qu...
TITLE: Using MS Access & ODBC to connect to a remote PostgreSQL QUESTION: I currently have an MS Access application that connects to a PostgreSQL database via ODBC. This successfully runs on a LAN with 20 users (each running their own version of Access). Now I am thinking through some disaster recovery scenarios, and ...
[ "ms-access", "postgresql", "odbc" ]
8
11
15,468
4
0
2008-09-01T14:14:53.417000
2008-09-01T23:09:50.183000
38,002
38,041
How to get your network support team behind click-once?
I'm trying to make the case for click-once and smart client development but my network support team wants to keep with web development for everything. What is the best way to convince them that click-once and smart client development have a place in the business?
We use ClickOnce where I work; in terms of comparison to a web release I would base the case around the need for providing users with a rich client app, otherwise it might well actually be better to use web applications. In terms of releasing a rich client app ClickOnce is fantastic; you can set it up to enforce update...
How to get your network support team behind click-once? I'm trying to make the case for click-once and smart client development but my network support team wants to keep with web development for everything. What is the best way to convince them that click-once and smart client development have a place in the business?
TITLE: How to get your network support team behind click-once? QUESTION: I'm trying to make the case for click-once and smart client development but my network support team wants to keep with web development for everything. What is the best way to convince them that click-once and smart client development have a place...
[ "smartclient" ]
3
1
186
5
0
2008-09-01T14:33:43.340000
2008-09-01T15:11:26.137000
38,005
38,716
How to use LINQ To SQL in an N-Tier Solution?
Now that LINQ to SQL is a little more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me.
LINQ to SQL doesn't really have a n-tier story that I've seen, since the objects that it creates are created in the class with the rest of it, you don't really have an assembly that you can nicely reference through something like Web Services, etc. The only way I'd really consider it is using the datacontext to fetch d...
How to use LINQ To SQL in an N-Tier Solution? Now that LINQ to SQL is a little more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me.
TITLE: How to use LINQ To SQL in an N-Tier Solution? QUESTION: Now that LINQ to SQL is a little more mature, I'd like to know of any techniques people are using to create an n-tiered solution using the technology, because it does not seem that obvious to me. ANSWER: LINQ to SQL doesn't really have a n-tier story that...
[ "linq-to-sql", "n-tier-architecture" ]
15
1
4,480
7
0
2008-09-01T14:37:40.163000
2008-09-02T02:30:49.857000
38,010
38,011
C# string concatenation and string interning
When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder will insert new string instances into the intern pool? http://comm...
If you create new strings, they will not automatically be put into the intern pool, unless you concatenate constants compile-time, in which case the compiler will create one string result and intern that as part of the JIT process.
C# string concatenation and string interning When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder will insert new strin...
TITLE: C# string concatenation and string interning QUESTION: When performing string concatentation of an existing string in the intern pool, is a new string entered into the intern pool or is a reference returned to the existing string in the intern pool? According to this article, String.Concat and StringBuilder wil...
[ "c#", ".net", "string" ]
4
4
1,478
2
0
2008-09-01T14:41:59.797000
2008-09-01T14:44:11.210000
38,014
38,050
Referencing same table name in different schemas
I am facing problem with an Oracle Query in a.net 2.0 based windows application. I am using System.Data.OracleClient to connect to oracle database. Name of database is myDB. Below the the connection string I am using: Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (PROTOCOL = TCP) (HOST = 172.16.0.24)(PORT = 1522)...
This looks like an issue with name resolution, try creating a public synonym on the table: CREATE PUBLIC SYNONYM MyTempTable for MyTempTable; Also, what exactly do you mean by wrong result, incorrect data, error message? Edit: What is the name of the schema that the required table belongs to? It sounds like the table t...
Referencing same table name in different schemas I am facing problem with an Oracle Query in a.net 2.0 based windows application. I am using System.Data.OracleClient to connect to oracle database. Name of database is myDB. Below the the connection string I am using: Data Source=(DESCRIPTION =(ADDRESS_LIST =(ADDRESS = (...
TITLE: Referencing same table name in different schemas QUESTION: I am facing problem with an Oracle Query in a.net 2.0 based windows application. I am using System.Data.OracleClient to connect to oracle database. Name of database is myDB. Below the the connection string I am using: Data Source=(DESCRIPTION =(ADDRESS_...
[ ".net", "sql", "oracle" ]
3
2
1,729
5
0
2008-09-01T14:51:30.693000
2008-09-01T15:18:49.380000
38,019
48,001
What's the best approach to naming classes?
Coming up with good, precise names for classes is notoriously difficult. Done right, it makes code more self-documenting and provides a vocabulary for reasoning about code at a higher level of abstraction. Classes which implement a particular design pattern might be given a name based on the well known pattern name (e....
I'll cite some passages from Implementation Patterns by Kent Beck: Simple Superclass Name "[...] The names should be short and punchy. However, to make the names precise sometimes seems to require several words. A way out of this dilemma is picking a strong metaphor for the computation. With a metaphor in mind, even si...
What's the best approach to naming classes? Coming up with good, precise names for classes is notoriously difficult. Done right, it makes code more self-documenting and provides a vocabulary for reasoning about code at a higher level of abstraction. Classes which implement a particular design pattern might be given a n...
TITLE: What's the best approach to naming classes? QUESTION: Coming up with good, precise names for classes is notoriously difficult. Done right, it makes code more self-documenting and provides a vocabulary for reasoning about code at a higher level of abstraction. Classes which implement a particular design pattern ...
[ "naming" ]
103
67
61,733
6
0
2008-09-01T14:55:47.453000
2008-09-07T01:05:59.813000
38,021
38,028
How do I find the authoritative name-server for a domain name?
How can I find the origins of conflicting DNS records?
You'll want the SOA (Start of Authority) record for a given domain name, and this is how you accomplish it using the universally available nslookup command line tool: command line> nslookup > set querytype=soa > stackoverflow.com Server: 217.30.180.230 Address: 217.30.180.230#53 Non-authoritative answer: stackoverflow...
How do I find the authoritative name-server for a domain name? How can I find the origins of conflicting DNS records?
TITLE: How do I find the authoritative name-server for a domain name? QUESTION: How can I find the origins of conflicting DNS records? ANSWER: You'll want the SOA (Start of Authority) record for a given domain name, and this is how you accomplish it using the universally available nslookup command line tool: command ...
[ "dns" ]
363
468
551,858
12
0
2008-09-01T14:57:16.967000
2008-09-01T15:04:19.757000
38,026
38,129
How can I improve my support of Novell networks when I don't have a Novell network?
I work for a.NET/MSSQL shop that has trouble supporting customers running Novell, partially because we don't have Novell (or the money for it) and partially because we have no one with Novell experience. This question could easily be expanded to "How can we improve our support of technology X when we don't have technol...
There is a 60 day evaluation trial of Open Enterprise Server 2 available (requires free registration). If you install it in a VM, there's nothing stopping you from reinstalling it after 60 days (well except licence). But you will need someone good with Linux to handle this (and preferably good with this precise technol...
How can I improve my support of Novell networks when I don't have a Novell network? I work for a.NET/MSSQL shop that has trouble supporting customers running Novell, partially because we don't have Novell (or the money for it) and partially because we have no one with Novell experience. This question could easily be ex...
TITLE: How can I improve my support of Novell networks when I don't have a Novell network? QUESTION: I work for a.NET/MSSQL shop that has trouble supporting customers running Novell, partially because we don't have Novell (or the money for it) and partially because we have no one with Novell experience. This question ...
[ ".net", "sql-server", "vmware", "novell" ]
2
2
463
3
0
2008-09-01T15:01:39.327000
2008-09-01T16:29:57.023000
38,027
38,033
Why does Splint (the C code checker) give an error when comparing a float to an int?
Both are mathematical values, however the float does have more precision. Is that the only reason for the error - the difference in precision? Or is there another potential (and more serious) problem?
It's because the set of integer values does not equal the set of float values for the 'int' and 'float' types. For example, the float value 0.5 has no equal in the integer set and the integer value 4519245367 might not exist in the set of values a float can store. So, the checker flags this as an issue to be checked by...
Why does Splint (the C code checker) give an error when comparing a float to an int? Both are mathematical values, however the float does have more precision. Is that the only reason for the error - the difference in precision? Or is there another potential (and more serious) problem?
TITLE: Why does Splint (the C code checker) give an error when comparing a float to an int? QUESTION: Both are mathematical values, however the float does have more precision. Is that the only reason for the error - the difference in precision? Or is there another potential (and more serious) problem? ANSWER: It's be...
[ "c", "lint", "splint" ]
4
8
502
6
0
2008-09-01T15:02:39.900000
2008-09-01T15:06:30.377000
38,035
2,509,444
Selecting X words from a text field in MySQL
I'm building a basic search functionality, using LIKE (I'd be using fulltext but can't at the moment) and I'm wondering if MySQL can, on searching for a keyword (e.g. WHERE field LIKE '%word%') return 20 words either side of the keyword, as well?
You can do it all in the query using SUBSTRING_INDEX CONCAT_WS( ' ', -- 20 words before TRIM( SUBSTRING_INDEX( SUBSTRING(field, 1, INSTR(field, 'word') - 1 ), ' ', -20 ) ), -- your word 'word', -- 20 words after TRIM( SUBSTRING_INDEX( SUBSTRING(field, INSTR(field, 'word') + LENGTH('word') ), ' ', 20 ) ) )
Selecting X words from a text field in MySQL I'm building a basic search functionality, using LIKE (I'd be using fulltext but can't at the moment) and I'm wondering if MySQL can, on searching for a keyword (e.g. WHERE field LIKE '%word%') return 20 words either side of the keyword, as well?
TITLE: Selecting X words from a text field in MySQL QUESTION: I'm building a basic search functionality, using LIKE (I'd be using fulltext but can't at the moment) and I'm wondering if MySQL can, on searching for a keyword (e.g. WHERE field LIKE '%word%') return 20 words either side of the keyword, as well? ANSWER: Y...
[ "mysql" ]
1
2
3,845
4
0
2008-09-01T15:08:13.070000
2010-03-24T16:28:03.290000
38,037
38,413
C++: How to extract a string from RapidXml
In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string ). RapidXml has been recommended to me, but I can't see how to retrieve the XML back as a text string. (I could iterate over the nodes and attributes and build it myself, but surely there's a...
Althoug the documentation is poor on this topic, I managed to get some working code by looking at the source. Although it is missing the xml header which normally contains important information. Here is a small example program that does what you are looking for using rapidxml: #include #include #include "rapidxml/rapid...
C++: How to extract a string from RapidXml In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string ). RapidXml has been recommended to me, but I can't see how to retrieve the XML back as a text string. (I could iterate over the nodes and attribute...
TITLE: C++: How to extract a string from RapidXml QUESTION: In my C++ program I want to parse a small piece of XML, insert some nodes, then extract the new XML (preferably as a std::string ). RapidXml has been recommended to me, but I can't see how to retrieve the XML back as a text string. (I could iterate over the n...
[ "c++", "xml", "rapidxml" ]
15
11
18,250
8
0
2008-09-01T15:10:13.800000
2008-09-01T20:52:45.223000
38,039
38,064
How can I get the DateTime for the start of the week?
How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#? Something like: DateTime.Now.StartWeek(Monday);
Use an extension method: public static class DateTimeExtensions { public static DateTime StartOfWeek(this DateTime dt, DayOfWeek startOfWeek) { int diff = (7 + (dt.DayOfWeek - startOfWeek)) % 7; return dt.AddDays(-1 * diff).Date; } } Which can be used as follows: DateTime dt = DateTime.Now.StartOfWeek(DayOfWeek.Monday)...
How can I get the DateTime for the start of the week? How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#? Something like: DateTime.Now.StartWeek(Monday);
TITLE: How can I get the DateTime for the start of the week? QUESTION: How do I find the start of the week (both Sunday and Monday) knowing just the current time in C#? Something like: DateTime.Now.StartWeek(Monday); ANSWER: Use an extension method: public static class DateTimeExtensions { public static DateTime Star...
[ "c#", "datetime" ]
585
942
386,101
33
0
2008-09-01T15:10:38.527000
2008-09-01T15:45:54.697000
38,056
38,230
How to check if a process is still running using Python on Linux?
The only nice way I've found is: import sys import os try: os.kill(int(sys.argv[1]), 0) print "Running" except: print "Not running" ( Source ) But is this reliable? Does it work with every process and every distribution?
Mark's answer is the way to go, after all, that's why the /proc file system is there. For something a little more copy/pasteable: >>> import os.path >>> os.path.exists("/proc/0") False >>> os.path.exists("/proc/12") True
How to check if a process is still running using Python on Linux? The only nice way I've found is: import sys import os try: os.kill(int(sys.argv[1]), 0) print "Running" except: print "Not running" ( Source ) But is this reliable? Does it work with every process and every distribution?
TITLE: How to check if a process is still running using Python on Linux? QUESTION: The only nice way I've found is: import sys import os try: os.kill(int(sys.argv[1]), 0) print "Running" except: print "Not running" ( Source ) But is this reliable? Does it work with every process and every distribution? ANSWER: Mark'...
[ "python", "linux", "unix", "process" ]
39
56
104,961
9
0
2008-09-01T15:20:52.277000
2008-09-01T18:06:42.690000
38,057
53,448
Why @OneToMany does not work with inheritance in Hibernate
@Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Problem { @ManyToOne private Person person; } @Entity @DiscriminatorValue("UP") public class UglyProblem extends Problem {} @Entity public class Person { @OneToMany(mappedBy="person") private List< UglyProblem > problems; } I think it is prett...
I think it's a wise decision made by the Hibernate team. They could be less arrogante and make it clear why it was implemented this way, but that's just how Emmanuel, Chris and Gavin works.:) Let's try to understand the problem. I think your concepts are "lying". First you say that many Problem s are associated to Peop...
Why @OneToMany does not work with inheritance in Hibernate @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Problem { @ManyToOne private Person person; } @Entity @DiscriminatorValue("UP") public class UglyProblem extends Problem {} @Entity public class Person { @OneToMany(mappedBy="person") ...
TITLE: Why @OneToMany does not work with inheritance in Hibernate QUESTION: @Entity @Inheritance(strategy = InheritanceType.SINGLE_TABLE) public class Problem { @ManyToOne private Person person; } @Entity @DiscriminatorValue("UP") public class UglyProblem extends Problem {} @Entity public class Person { @OneToMany(m...
[ "java", "hibernate", "inheritance", "orm" ]
11
8
30,830
6
0
2008-09-01T15:21:01.310000
2008-09-10T05:06:10.240000
38,068
38,102
Generics in Java
Is there any shorthand way of defining and using generic definitions without having to keep repeating a particular generic description such that if there is a change I don't have to change all definitions/usages though out the codebase for example is something like this possible: Typedef myGenDef = < Object1, Object2 >...
There's the pseudo-typedef antipattern... class StringList extends ArrayList { } Good stuff, drink up!;-) As the article notes, this technique has some serious issues, primarily that this "typedef" is actually a separate class and thus cannot be used interchangeably with either the type it extends or other similarly de...
Generics in Java Is there any shorthand way of defining and using generic definitions without having to keep repeating a particular generic description such that if there is a change I don't have to change all definitions/usages though out the codebase for example is something like this possible: Typedef myGenDef = < O...
TITLE: Generics in Java QUESTION: Is there any shorthand way of defining and using generic definitions without having to keep repeating a particular generic description such that if there is a change I don't have to change all definitions/usages though out the codebase for example is something like this possible: Type...
[ "java", "generics" ]
10
12
2,576
5
0
2008-09-01T15:49:48.713000
2008-09-01T16:17:14.823000
38,074
40,159
Best way to handle LOBs in Oracle distributed databases
If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you can do stuff like: select column_a, column_b from data_user.sample_table@TES...
Yeah, it is messy, I can't think of a way to avoid it though. You could hide some of the messiness from the client by putting the temporary table creation in a stored procedure (and using "execute immediate" to create they table) One thing you will need to watch out for is left over temporary tables (should something f...
Best way to handle LOBs in Oracle distributed databases If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you can do stuff like: s...
TITLE: Best way to handle LOBs in Oracle distributed databases QUESTION: If you create an Oracle dblink you cannot directly access LOB columns in the target tables. For instance, you create a dblink with: create database link TEST_LINK connect to TARGETUSER IDENTIFIED BY password using 'DATABASESID'; After this you ca...
[ "sql", "oracle", "distributed-transactions", "dblink" ]
14
5
52,370
6
0
2008-09-01T15:52:32.277000
2008-09-02T17:53:52.493000
38,081
38,087
How to implement mouse dragging in Visual Basic?
I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mouse movement outside of the rectangle of the control. I use a Label...
You need the control to handle three events: Mouse Down, Mouse Move and Mouse Up. On the Mouse Down event, you will need to capture the mouse. This means the mouse messages are sent to the control that has the capture. In the mouse move event, if the input is captured then update the displayed image depending on the am...
How to implement mouse dragging in Visual Basic? I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mouse movement outsi...
TITLE: How to implement mouse dragging in Visual Basic? QUESTION: I need to create a quick-n-dirty knob control in Visual Basic 2005 Express, the value of which is incremented/decremented by "grabbing" it with the mouse and moving the cursor up/down. Because the knob itself doesn't move, I need to keep tracking the mo...
[ "vb.net", "user-controls", "drag-and-drop" ]
0
0
1,748
2
0
2008-09-01T15:54:46.873000
2008-09-01T16:01:22.070000
38,090
39,031
How to prevent Write Ahead Logging on just one table in PostgreSQL?
I am considering log-shipping of Write Ahead Logs (WAL) in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about protecting the data in it. To reduce the amount of WALs produced I was wondering, is ther...
Unfortunately, I don't believe there is. The WAL logging operates on the page level, which is much lower than the table level and doesn't even know which page holds data from which table. In fact, the WAL files don't even know which pages belong to which database. You might consider moving your high activity table to a...
How to prevent Write Ahead Logging on just one table in PostgreSQL? I am considering log-shipping of Write Ahead Logs (WAL) in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about protecting the data i...
TITLE: How to prevent Write Ahead Logging on just one table in PostgreSQL? QUESTION: I am considering log-shipping of Write Ahead Logs (WAL) in PostgreSQL to create a warm-standby database. However I have one table in the database that receives a huge amount of INSERT/DELETEs each day, but which I don't care about pro...
[ "postgresql" ]
8
6
4,013
4
0
2008-09-01T16:03:55.463000
2008-09-02T08:34:37.220000
38,107
38,128
Cross Page Postback doesn't work for client-side enabled button
I am using a cross page postback for Page A to pass data to Page B. The button that causes the postback has its postbackurl set but is disabled until the user selects a value from a DDL at which point the button is enable using javascript. However this prevents the cross page postback from occurring, Page A just postba...
It looks like when the button is disabled.Net doesn't bother adding the necessary bits to handle the cross page postback on the client, so they will be missing when the button is enable client-side. I guess one solution would be to have the button enabled to start with (so that.Net adds the cross page postback controls...
Cross Page Postback doesn't work for client-side enabled button I am using a cross page postback for Page A to pass data to Page B. The button that causes the postback has its postbackurl set but is disabled until the user selects a value from a DDL at which point the button is enable using javascript. However this pre...
TITLE: Cross Page Postback doesn't work for client-side enabled button QUESTION: I am using a cross page postback for Page A to pass data to Page B. The button that causes the postback has its postbackurl set but is disabled until the user selects a value from a DDL at which point the button is enable using javascript...
[ "asp.net", "postback" ]
3
2
951
1
0
2008-09-01T16:20:44.550000
2008-09-01T16:29:49.630000
38,125
38,189
Strategies for keeping a Lucene Index up to date with domain model changes
Was looking to get peoples thoughts on keeping a Lucene index up to date as changes are made to the domain model objects of an application. The application in question is a Java/J2EE based web app that uses Hibernate. The way I currently have things working is that the Hibernate mapped model objects all implement a com...
Change the message: just provide the primary key and the current date, not the key/value pairs. Your mdb fetches the entity by primary key and calls index(). After indexing you set a value "updated" in your index to the message date. You update your index only if the message date is after the "updated" field of the ind...
Strategies for keeping a Lucene Index up to date with domain model changes Was looking to get peoples thoughts on keeping a Lucene index up to date as changes are made to the domain model objects of an application. The application in question is a Java/J2EE based web app that uses Hibernate. The way I currently have th...
TITLE: Strategies for keeping a Lucene Index up to date with domain model changes QUESTION: Was looking to get peoples thoughts on keeping a Lucene index up to date as changes are made to the domain model objects of an application. The application in question is a Java/J2EE based web app that uses Hibernate. The way I...
[ "indexing", "lucene" ]
6
4
1,165
2
0
2008-09-01T16:29:10.520000
2008-09-01T17:26:13.630000
38,158
38,179
What is a good maintainability index using Visual Studio 2008 code analysis?
My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric "maintainability index". Is anyone using this metric for code reviews/checkins/etc? If so, what is an acceptable index for developers to work toward?
The maintainability index is not as much a fixed value you look at, it's more of an indication that code is hard to understand, test and/or debug. I usually try to keep high-level code (basically anything except for the real plumbing code) above 80, where 90+ would be good. It adds a competitive element to programming ...
What is a good maintainability index using Visual Studio 2008 code analysis? My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric "maintainability index". Is anyone using this metric for code reviews/checkins/etc? If so...
TITLE: What is a good maintainability index using Visual Studio 2008 code analysis? QUESTION: My company recently purchased TFS and I have started looking into the code analysis tools to help drive up code quality and noticed a good looking metric "maintainability index". Is anyone using this metric for code reviews/c...
[ "visual-studio", "code-analysis" ]
16
22
7,020
1
0
2008-09-01T16:46:46.500000
2008-09-01T17:04:33.837000
38,160
881,450
Parallelize Bash script with maximum number of processes
Lets say I have a loop in Bash: for foo in `some-command` do do-something $foo done do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something 's at once. The naive approach seems to be: for foo in `some-command` do do-something $foo & done This will run all do-s...
Depending on what you want to do xargs also can help (here: converting documents with pdf2ps): cpus=$( ls -d /sys/devices/system/cpu/cpu[[:digit:]]* | wc -w ) find. -name \*.pdf | xargs --max-args=1 --max-procs=$cpus pdf2ps From the docs: --max-procs=max-procs -P max-procs Run up to max-procs processes at a time; the ...
Parallelize Bash script with maximum number of processes Lets say I have a loop in Bash: for foo in `some-command` do do-something $foo done do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something 's at once. The naive approach seems to be: for foo in `some-co...
TITLE: Parallelize Bash script with maximum number of processes QUESTION: Lets say I have a loop in Bash: for foo in `some-command` do do-something $foo done do-something is cpu bound and I have a nice shiny 4 core processor. I'd like to be able to run up to 4 do-something 's at once. The naive approach seems to be: f...
[ "bash" ]
102
71
53,491
16
0
2008-09-01T16:47:53.377000
2009-05-19T07:50:04.573000
38,181
38,256
When should I mock?
I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario here.
A unit test should test a single codepath through a single method. When the execution of a method passes outside of that method, into another object, and back again, you have a dependency. When you test that code path with the actual dependency, you are not unit testing; you are integration testing. While that's good a...
When should I mock? I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario here.
TITLE: When should I mock? QUESTION: I have a basic understanding of mock and fake objects, but I'm not sure I have a feeling about when/where to use mocking - especially as it would apply to this scenario here. ANSWER: A unit test should test a single codepath through a single method. When the execution of a method ...
[ "unit-testing", "language-agnostic", "mocking" ]
184
168
85,800
6
0
2008-09-01T17:07:24.440000
2008-09-01T18:27:57.177000
38,190
38,213
How do I read a disk directly with .NET?
Is it possible to read a disk directly with.NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way "\Device\Ide\IdeDeviceP2T0L0-1" for example. If I can't open the device with a.NET API, knowing which Win32 API to use would be helpful.
CreateFile has support for direct disk access. Read the notes under "Physical Disks and Volumes". You should be able to P/Invoke the call. Note that Vista and Server 2008 have severely restricted this.
How do I read a disk directly with .NET? Is it possible to read a disk directly with.NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way "\Device\Ide\IdeDeviceP2T0L0-1" for example. If I can't open the device with a.NET API, knowing which Win32...
TITLE: How do I read a disk directly with .NET? QUESTION: Is it possible to read a disk directly with.NET? By directly, I mean via the device bypassing the file system. I think I would go about this by opening the device some way "\Device\Ide\IdeDeviceP2T0L0-1" for example. If I can't open the device with a.NET API, k...
[ ".net", "winapi", "disk" ]
15
6
14,070
4
0
2008-09-01T17:27:43.843000
2008-09-01T17:53:24.187000
38,193
38,209
Determine if a ruby script is already running
Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still running and then stop the execution of the second script. Any i...
The ps is a really poor way of doing that and probably open to race conditions. The traditional Unix/Linux way would be to write the PID to a file (typically in /var/run) and check to see if that file exists on startup. e.g. the pidfile being located at /var/run/myscript.pid then you'd check to see if that exists befor...
Determine if a ruby script is already running Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still running and then ...
TITLE: Determine if a ruby script is already running QUESTION: Is there an easy way to tell if a ruby script is already running and then handle it appropriately? For example: I have a script called really_long_script.rb. I have it cronned to run every 5 minutes. When it runs, I want to see if the previous run is still...
[ "ruby" ]
6
9
3,027
4
0
2008-09-01T17:34:06.590000
2008-09-01T17:52:38.153000
38,197
38,222
Why is the subprocess.Popen class not named Subprocess?
The primary class in the subprocess module is name Popen, and represents a subprocess. Popen sounds like someone was trying to force the name to follow some function naming format, rather than chosing a name that actually represents what the object is. Does anyone know why it was chosen over something simple like, say,...
Now, I'm not saying that this is the greatest name in the world, but here was the idea as I understand it. Originally, the popen family was in the os module and was an implementation of the venerable posix popen. The movement to the subprocess module would have been an opportune time to rename them, but I guess that ke...
Why is the subprocess.Popen class not named Subprocess? The primary class in the subprocess module is name Popen, and represents a subprocess. Popen sounds like someone was trying to force the name to follow some function naming format, rather than chosing a name that actually represents what the object is. Does anyone...
TITLE: Why is the subprocess.Popen class not named Subprocess? QUESTION: The primary class in the subprocess module is name Popen, and represents a subprocess. Popen sounds like someone was trying to force the name to follow some function naming format, rather than chosing a name that actually represents what the obje...
[ "python", "subprocess" ]
4
8
721
3
0
2008-09-01T17:40:52.220000
2008-09-01T17:57:42.633000
38,198
38,207
Why does this C code produce a double instead of a float?
celsius = (5.0/9.0) * (fahr-32.0); Is it just a development choice that the C developers decided upon or is there a reason to this? I believe a float is smaller than a double, so it might be to prevent overflows caused by not knowing what decimal format to use. Is that the reason, or am I overlooking something?
I think the reason is to ensure that any result can be encompassed. so the natural choice is double as it is the largest data type.
Why does this C code produce a double instead of a float? celsius = (5.0/9.0) * (fahr-32.0); Is it just a development choice that the C developers decided upon or is there a reason to this? I believe a float is smaller than a double, so it might be to prevent overflows caused by not knowing what decimal format to use. ...
TITLE: Why does this C code produce a double instead of a float? QUESTION: celsius = (5.0/9.0) * (fahr-32.0); Is it just a development choice that the C developers decided upon or is there a reason to this? I believe a float is smaller than a double, so it might be to prevent overflows caused by not knowing what decim...
[ "c", "types" ]
5
3
907
5
0
2008-09-01T17:43:49.717000
2008-09-01T17:51:13.553000
38,235
38,384
IronRuby performance?
While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance? If so, what are the results, and how did you go about measuring the performance (which benchmarks etc)? Edit: The IronRub...
According to this article http://www.iunknown.com/2008/05/ironruby-and-rails.html. In may performance was nowhere near where they expected it to be. I heard in http://altnetpodcast.com/episodes/9-state-of-ironruby (3 days ago) that they're still working on performance. I guess they put compatability first and are now t...
IronRuby performance? While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance? If so, what are the results, and how did you go about measuring the performance (which benchmarks e...
TITLE: IronRuby performance? QUESTION: While I know IronRuby isn't quite ready for the world to use it, I was wondering if anyone here tried it and tested how well it faired against the other Rubies out there in terms of raw performance? If so, what are the results, and how did you go about measuring the performance (...
[ ".net", "ruby", "performance", "ironruby" ]
3
2
2,185
4
0
2008-09-01T18:15:21.123000
2008-09-01T20:27:03.680000
38,238
38,276
What is the purpose of class methods?
I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but now I'm not sure when I would use them. All the advice...
Class methods are for when you need to have methods that aren't specific to any particular instance, but still involve the class in some way. The most interesting thing about them is that they can be overridden by subclasses, something that's simply not possible in Java's static methods or Python's module-level functio...
What is the purpose of class methods? I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, but now I'm not sure...
TITLE: What is the purpose of class methods? QUESTION: I'm teaching myself Python and my most recent lesson was that Python is not Java, and so I've just spent a while turning all my Class methods into functions. I now realise that I don't need to use Class methods for what I would done with static methods in Java, bu...
[ "python", "class-method" ]
295
208
158,121
18
0
2008-09-01T18:16:41.107000
2008-09-01T18:45:56.807000
38,280
38,298
Best browser for web application
I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so: What is a good browser that I can use as a client to a web application? General functionalities I would like ...
Mozilla Prism seems ideal for your purposes. It shares code with Firefox but is designed to run web applications without the usual Browser interface to make them appear more like desktop applications. So no back button or address bar to worry about. Edit: Google Chrome has Application Shortcuts so that may now be a bet...
Best browser for web application I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so: What is a good browser that I can use as a client to a web application? Gene...
TITLE: Best browser for web application QUESTION: I am in a position where I can choose the client browser for my web app. The app is being used internally, and we are installing each client "manually".I would like to find a better solution for the browser,so: What is a good browser that I can use as a client to a web...
[ "browser", "web-applications" ]
1
7
4,783
9
0
2008-09-01T18:48:22.433000
2008-09-01T19:03:56.453000