instruction
stringlengths
0
30k
I would say that threading for something this simple is overkill. You're better off using some form of asynchronous programming. Here is an example using [Twisted][1]: from twisted.internet import reactor from twisted.web import resource, server class MyResource(resource.Resource): isL...
For me neither is better or worse, but Subversive is the default SVN plugin in Eclipse Ganymede platform, so there's a chance that it's better integrated with Eclipse.
Proxy use can be configured in the web.config. The system.net/defaultProxy element will let you specify whether a proxy is used by default or provide a bypass list. For more info see: <a href="http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx">http://msdn.microsoft.com/en-us/library/kd3cf2ex.aspx</a>
Microsoft's [Enterprise Library][1] can be also helpful. >This release of Enterprise Library includes application blocks for Caching, Cryptography, Data Access, Exception Handling, Logging, Policy Injection, Security and Validation. [1]: http://www.microsoft.com/downloads/details.aspx?familyid=4C557C63-708F-4280-8F...
Python distutils - does anyone know how to use it?
|python|installation|linux|distutils|
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
|python|linux|installation|distutils|
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
|python|linux|installation|distutils|debian|
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
This: http://www.codeproject.com/KB/edit/dateparser.aspx Is fairly close to what you are trying to accomplish. Not the most elegant solution, but certainly might save you some work.
Your question assumes that mail clients follow the RFC standards for MIME encoding, which they don't. I'd advise you collect a bunch of mail from sources and try and process it as-it-exists. The problem you are facing is extremely difficult (perhaps impossible) to solve 100%.
We just put the EntLib 3.1 binaries in the global assembly cache and add references in our projects. We typically only use the logging framework, though.
A google search turns up the [parsedatetime][1] library (associated with the [Chandler project][2]), which is designed to do exactly this. It's open source (Apache License) and written in Python. It seems to be quite sophisticated -- from the homepage: > parsedatetime is able to parse, for > example, the following:...
Generally, it's better to have one SELECT statement. One of the main reasons to have databases is that they are fast at processing information, particularly if it is in the format of query. If there is any drawback to this approach, it's that there are some kinds of analysis that you can't do with one big SELECT sta...
I would say 1 query with the join. This way you need to hit the server only once. And if your tables are joined with indexes, it should be fast.
You should run a profiling tool if you're truly worried cause it depends on many things and it can vary but as a rule its better to have fewer queries being compiled and fewer round trips to the database. Make sure you filter things as well as you can using your where and join on clauses. But honestly, it usually...
The microsoft p&p team has recommended some [strategies][1] that answers this. Basically they recommend something like the project by project approach you mention. Of course, they're assuming a neatly architected application that has no nasty, dark corners from which late nights of coding and copious amounts of coffee ...
* **HttpContent.Current** will always give you access to the current context's Request/Response/etc., even when you don't have access to the Page's properties (e.g., from a loosely-coupled helper class). * You can continue executing code on the same page after redirecting the user to another one by calling **Respons...
* **HttpContent.Current** will always give you access to the current context's Request/Response/etc., even when you don't have access to the Page's properties (e.g., from a loosely-coupled helper class). * You can continue executing code on the same page after redirecting the user to another one by calling **Respons...
* **HttpContent.Current** will always give you access to the current context's Request/Response/etc., even when you don't have access to the Page's properties (e.g., from a loosely-coupled helper class). * You can continue executing code on the same page after redirecting the user to another one by calling **Respons...
* **HttpContext.Current** will always give you access to the current context's Request/Response/etc., even when you don't have access to the Page's properties (e.g., from a loosely-coupled helper class). * You can continue executing code on the same page after redirecting the user to another one by calling **Respons...
When I run this: select 'test"columnname"' from dual Oracle returns this (notice the Oracle-generated column name): 'TESTCOLUMNNAME' -------------------------------- test"columnname The fact that Oracle's column name doesn't include my double-quote tells me that Oracle probably cannot re...
I don't know about .Net, but in win32, the easy way is to call IsUserAnAdmin(). If you need more control, you can open the process token and check with CheckTokenMembership for each group you need to check
One big SQL Select statement or several small ones (Performance)?
|mysql|php|performance|
I'm building a PHP page with data sent from MySQL. Is it better to have 1 SELECT query with 4 table joins, or 4 small SELECT queries. Which is faster and what is the pro/con of each method? PS. I only need one row from each tables.
I'm building a PHP page with data sent from MySQL. Is it better to have 1 SELECT query with 4 table joins, or 4 small SELECT queries with no table join (I do select from an ID). Which is faster and what is the pro/con of each method? PS. I only need one row from each tables.
|php|mysql|performance|optimization|
It sounds like you are trying to do several different things all at once:<br> 1. Migrate your code to building in a newer version of visual studio.<br> 2. Migrate your use of technology to a newer technology (ActiveX to .net)<br> 3. Migrate your language (c++ to c#).<br> If you have a small codebase you are proba...
I have had problems with firebug on some web forms, something to do with the network analyser can screw with postbacks.
This is likely not all that helpful since you're talking c# but since no one's mentioned it yet you can try to take a look at php's excellent and utterly insane native [strtotime][1] function [1]: http://us2.php.net/strtotime
HelpInsight documentation in Delphi 2007
|documentation|delphi|ndoc|
I am using D2007 and am trying to document my source code, using the HelpInsight feature (provided since D2005). I am mainly interested in getting the HelpInsight tool-tips working. From various Web-surfing and experimentation I have found the following: 1. Using the triple slash (///) comment style works more of...
Often times when you see the noise from a huge switch statement or many if statements that might fall into more than one block, you're trying to suppress a bad design. Instead, what if you implemented the Specification pattern to see if something matched, and then act on it? foreach(MonthSpecification spec in...
Tablet PC SDK (1.7) Merge Module + VS2008 + Windows Vista?
|visual-studio|windows-vista|windows-xp|sdk|tablet-pc|
I have a VS2005 deployment & setup project, that makes use of the Tablet PC SDK 1.7 Merge Module, so users of Windows XP can make use of the managed Microsoft.Ink.DLL library. Now that we've moved over to Vista/VS2008, do I still need to install the TPC SDK (to get the merge module) or can I make use of something that ...
Silverlight programatic access to Sony RZ30N Video Feed
|silverlight|video|webcam|streaming|
I would like to bypass the web-server functionality of a **Sony SNC-RZ30N** network attached web cam and display the video feed in a Silverlight application. I can't seem to find any examples of interfacing with the camera programatically. Any leads would be much appreciated. Thx.
|silverlight|video|streaming|webcam|
I would like to bypass the web-server functionality of a **Sony SNC-RZ30N** network attached web cam and display the video feed in a Silverlight application. I can't seem to find any examples of interfacing with the camera programatically. Any leads would be much appreciated. Thx. Update 09/09/2008: Found a g...
I'm not an expert in language implementations (so take this with a grain of salt), but I think one of the biggest costs is unwinding the stack and storing it for the stack trace. I suspect this happens only when the exception is thrown (but I don't know), and if so, this would be decently sized hidden cost every time ...
Are you adding constants? If so, maybe something like this would work(C syntax): const int addToTotals[] = {123, 456, ..., 789}; for(i=month;i<12;i++) totals += addToTotals[i]; You can do a similar thing with variable or function pointers if you need more complex statements than add consta...
I don't know about .Net, but in win32, the easy way is to call IsUserAnAdmin(). If you need more control, you can open the process token and check with CheckTokenMembership for each group you need to check **Edit:** See [pinvoke.net][1] for .NET sample code (Thanks chopeen) [1]: http://www.pinvoke.net/default...
I agree with Mendelt Siebenga when he says you should keep entire sentences or phrases in your language resource files. Differences in grammar will always prevent you from doing single word replacement across languages. This will still lead to less repetitive code than your first example because you only need to chec...
Loader lock error
|c#|loaderlock|
I am building on C++ dll, by writing code in C#. I get an error, saying > LoaderLock was detected Message: > Attempting managed execution inside OS > Loader lock. Do not attempt to run > managed code inside a DllMain or image > initialization function since doing so > can cause the application to hang. I...
How to match linux device path to windows drive name?
|c++|linux|drive|
|c++|linux|drives|
I'm writing an application that on some stage performs low-level disk operations in Linux environment. The app actually consists of 2 parts, one runs on Windows and interacts with a user and another is a linux part that runs from a LiveCD. User makes a choice of Windows drive letters and then a linux part performs acti...
|delphi|documentation|ndoc|
I am using D2007 and am trying to document my source code, using the HelpInsight feature (provided since D2005). I am mainly interested in getting the HelpInsight tool-tips working. From various Web-surfing and experimentation I have found the following: 1. Using the triple slash (///) comment style works more of...
When built-in enums aren't enough, you can do it the old fashion way and craft your own. For example, if you wanted to add an additional property, for example, a description field, you could do it as follows: public class Action { public string Name {get;} public string Description {get;} ...
Find the settings JNDI is using for error reporting.
|java|jndi|
I've got a J2SE application that I am maintaining uses JNDI. (It uses JNDI to find it's J2EE application server.) It has pretty poor error reporting of failure to find the JNDI server. I've been looking around fora way to display which server the InitialContext is trying to talk to. Has anyone got a neat way ...
When I had to convert a VB6 app to VS2003 several years ago, I ran the converter and it produced something that basically compiled, but wasn't very good at all. I ended up having to modify a big chunk of the code it generated. I would start with a clean solution, then run the converter on a project and copy over onl...
Where do search engines start crawling?
|search-engine|
What do search engine bots use as a starting point? Is it DNS look-up or do they start with some fixed list of well-know sites? Any guesses or suggestions?
I am also unsure what you mean by pure In C++ we use class Foo { void Write(const char* pMsg, ...); }; void Foo::Write( const char* pMsg, ...) { char buffer[4096]; std::va_list arg; va_start(arg, pMsg); std::vsnprintf(buffer, 4096, pM...
The problem you have is that you need to terminate the RegEx pattern so it knows when one message ends and then next starts. When you were running in default mode the newline was working as an implicit terminator. The problem is if you go into multiline mode there's no terminator so the pattern will gobble up the...
How do you implement a "Did you mean"?
|google|
Suppose you have a search system already in your website. How can you implement the "Did you mean: <spell_checked_word>" like Google does in some [search queries][1]? [1]: http://www.google.com/search?hl=en&q=spellling&btnG=Search
You obviously need that "messages lines" can be distinguished from "log lines"; if you allow the message part to start with date/time after a new line, then there is simply no way to determine what is part of a message and what not. So, instead of using the dot, you need an expression that allows anything that does not...
This will only work if the log message doesn't contain a date at the beginning of the line, but you could try adding a negative look-ahead assertion for a date in the "message" group: (?<date>\d{2}/\d{2}/\d{2})\s(?<time>\d{2}:\d{2}:\d{2},\d{3})\s(?<message>(.(?!^\d{2}/\d{2}/ \d{2}))+) Note that this requ...
Although I realize this may not be an option yet, [Google Chrome](http://www.google.com/chrome) seems to have some features that have been added specifically to allow that. Again, maybe not usable, yet, but certainly very interesting! (See also [the Chrome presentation](http://www.youtube.com/watch?v=1d1_ool4r7s&fea...
Soundex is good for phonetic matches, but works best with peoples' names (it was originally developed for census data) Also check out Full-Text-Indexing, the syntax is different from Google logic, but it's very quick and can deal with similar language elements.
|python|linux|installation|debian|distutils|
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
I wrote a quick program in python to add a gtk GUI to a cli program. I was wondering how I can create an installer using distutils. Since it's just a GUI frontend for a command line app it only works in *nix anyway so I'm not worried about it being cross platform. my main goal is to create a .deb package for debian/...
Proc is older, but the semantics of return are highly counterintuitive to me (at least when I was learning the language) because: 1) if you are using proc, you are most likely using some kind of functional paradigm 2) proc can return out of the enclosing scope (see previous responses), which is a goto basically, a...
In addition to escaping the windows directory separator also make sure that all paths that you type in should be with correct capitalisation, Windows is not case sensitive but case presrving, while Ant is case sensitive.
There's a program for Windows called XKeymacs that allows you to specify emacs keybindings for different programs. It should work with IDLE. http://www.cam.hi-ho.ne.jp/oishi/indexen.html -Mark
The PHP Smarty template engine (<http://www.smarty.net>) includes a fairly advanced caching system. You can find details in the caching section of the Smarty manual: <http://www.smarty.net/manual/en/caching.php>
Step 1: [Check the MSI error log files](http://stackoverflow.com/questions/15109/visual-studio-2005-setup-project-install-crashes-over-terminal-server#15286) I'm suspicious that your problem is due to running as LocalSystem. The Local System account is not the same as a normal user account which happens to have ...
Definitely, use subversion to keep current, work-in-progress, and stable snapshot copies of source code. This includes C++, Java etc for homegrown software tools, and quickie scripts for one-off processing. With the strong leaning in science and applied engineering toward "lone cowboy" development methodology, t...
Have you read Aho, Sethi, Ullman: "Compilers: Principles, Techniques, and Tools"? It is a classical language reference book. /Allan
Personally, I've been using [fink][1] to install [xemacs][2]. It requires X but I've been using xemacs for so long that I need what it has. Additionally, I have installed [gnu emacs][3]. It's nice because it is a completely integrated mac os x application with a dock icon and everything. I find it useful when ...
Silverlight is a stripped down version of WPF so it should have fewer things to learn inside. On the other hand, the two platforms have different targets (web & rich client) so I guess it depends on what app you're going to build. If you just want to learn for yourself (no app in the close future) I'd pick Silverlig...
Is there a way to insert assembly code into C?
|c|asm|
I remember back in the day with the old borland DOS compiler you could do something like this: asm { mov ax,ex etc etc... } Is there a semi-platform independent way to do this now? I have a need to make a BIOS call, so if there was a way to do this without asm code, that would be equally usef...
A good start would be reading this article which talk about inline assembly in C/C++: <http://www.codeproject.com/KB/cpp/edujini_inline_asm.aspx> Example from the article: #include <stdio.h> int main() { /* Add 10 and 20 and store result into register %eax */ __asm__ ( "m...
I would start by learning XAML, by reading a few tutorials and playing around with XAMLPad. This will give you a feel for the basics before actually building an app.
Threads or asynch ?
|multithreading|
How do you make your application multithreaded ? Do you use asynch functions ? or do you spawn a new thread ? I think that asynch functions are already spawning a thread so if your job is doing just some file reading, being lazy and just spawning your job on a thread would just "waste" ressources... So is there som...
|language-agnostic|multithreading|
@Mendelt Siebenga Strings are corner-stone objects in programming languages. Different languages implement strings differently. An implementation of `join()` strongly depends on underlying implementation of strings. Pseudocode doesn't reflect underlying implementation. Consider `join()` in Python. It can be easil...
I'm not sure if it does everything you want, but have you seen [WireShark][1] and the [Microsoft Network Monitor][2]? [1]: http://www.wireshark.org/ [2]: http://www.microsoft.com/downloads/details.aspx?familyid=18b1d59d-f4d8-4213-8d17-2f6dde7d7aac&displaylang=en
[Wireshark]( http://www.wireshark.org/) (previously Ethereal) > Wireshark is an award-winning network protocol analyzer developed by an international team of networking experts.