instruction
stringlengths
0
30k
If you use a static instance field that you initialize in your cpp file, you can get multiple instances (and even worse behavior) if the initialization of some static/global tries to get an instance of your singleton. This is because the order of static initialization across compilation units is undefined.
I had to add the registry file AND re-run "regsvr32 actxprxy.dll" This was a really odd and painful error. It only seemed to come into existence after installing VS SP1 but I really don't see why that would have happened.
Unless you do a major rewrite of code, it is not possible to run Postgres "embedded". Either run it as a separate process or use something else. SQLite is an excellent choice. But there are others. MySQL has an embedded version. See it at http://mysql.com/oem/. Also several java choices, and Mac has Core Data you can w...
@a7an: Ah, I didn't notice the Icon property before. That's a good start. However, specifically I wanted to add an extra 'button' to some MenuItems so I could have a 'Pin' feature (see the recently loaded Documents list in Office 2007 for the feature idea). Since there needs to be code as well, will I probably ne...
The thing that makes a tag cloud really useful (at least a well implemented tag cloud IMO) is the ability to drill into a topic deeper and deeper. For example, I could click "Topic A" and then I can see the items in the tag cloud for all tags within the "Topic A" items. I can then drill into one of those sub topi...
Check out [Lingobit Localizer][1]. Expensive, but well worth it. [1]: http://www.lingobit.com/
I've just tried setting the BackColor on a System.Windows.Forms.ListView, and the color is applied across the control just fine (with and without images). Are you doing any Custom Painting at all?
(Prior to the Edit...) I've just tried setting the BackColor on a System.Windows.Forms.ListView, and the color is applied across the control just fine (with and without images). Are you doing any Custom Painting at all?
I think the Icon property fits your needs. However to answer the original question, it is possible to retain the Accelerator functionality when you compose the content of your menuitem. **If you have nested content in a MenuItem you need to define the AccessText property explicitly** like in the first one below. W...
What are the best practices for using Assembly Attributes?
|.net|
I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific?
|.net|assembly|attributes|
I have a solution with multiple project. I am trying to optimize AssemblyInfo.cs files by linking one solution wide assembly info file. What are the best practices for doing this? Which attributes should be in solution wide file and which are project/assembly specific? ---------- *Edit: If you are interested ther...
I suppose that depends on what you mean by 'raw'. I still find the need to expose COM APIs from .Net class libraries on occasion. Makes the process of migrating from certain platforms to .Net a lot easier since I can replace small pieces via COM.
Transfer of control in a finally block throws away any exception. The following code does not throw RuntimeException -- it is lost. <pre> public static void doSomething() { try { //Normally you would have code that doesn't explicitly appear //to throw exceptions so it would be harder to see the p...
No. If you do array_filter(explode('/', '1/2//3/')) you'll get all values that resolve to "false" filtered out (see http://uk.php.net/manual/en/function.array-filter.php).
Yes, we had the same issue, and we decided not to upgrade either. We haven't seen any problems, so you're OK ignoring the warnings.
The Hotspot JIT can now produce code *faster* than C++. The reason is run-time empirical optimization. For example, it can see that a certain loop takes the "false" branch 99% of the time and reorder the machine code instructions accordingly. There's lots of articles about this. If you want all the details, rea...
Write a wrapper function to strip them function MyExplode($sep, $str) { $arr = explode($sep, $str); foreach($arr as $item) if(item != "") $out[] = $item; return $out; }
System.Web.Mail is not a full .NET native implementation of the SMTP protocol. Instead, it uses the pre-existing COM functionality in CDONTS. System.Net.Mail, in contrast, is a fully managed implementation of an SMTP client. I've had far fewer problems with System.Net.Mail as it avoids COM hell.
Part of the problem is that the Java/C# language and its libraries are based on English words like `if` and `toString()`. I personally would not like to switch between non-English language and English while reading code. However, if your database, UI, business logics (including metaphors) are already in some non-Eng...
It depends: - Does your team conform to any existing standards that require your using ASCII? - Is your code ever going to be feasibly reused or read by someone who doesn't speak your native language? - Do you envision a scenario where you'll need to ask for help online and will therefore not be able to copy...
Java was designed to be cross-platform; C#/.Net wasn't. When in doubt, use the tool that was designed for your purpose.
Java was designed to be cross-platform; C#/.Net wasn't. When in doubt, use the tool that was designed for your purpose. EDIT: in fairness, .NET was designed to work on embedded/PC/Server environments, so that's SORT of cross-platform. But it wasn't designed for Linux.
I would stick to english, simply because you usually never know who is working on that code, and because some third-party tools used in the build/testing/bugtracking progress may have problems. Typing äöüß on a Non-German Keyboard is simply a PITA, and I simply believe that anyone involved in software development shoul...
You shouldn't, and it's very unlikely you need to. If you need to access the property, just use the public property (e.g. this.Age). There's nothing special about the private field backing the public property, using it in preference to the property is just superstition.
[The ADAPTIVE Communication Environment (ACE)][1] is an excellent object oriented framework that provides cross-platform support for all of the low level OS functionality like threading, sockets, mutexes, etc. It runs with a crazy number of compilers and operating systems. [1]: http://www.cse.wustl.edu/~schmidt...
IF you get past [the other prerequisites](http://stackoverflow.com/questions/61615/should-you-use-international-identifiers-in-javac#61620) you then have one extra (IMHO more important) one - How difficult is the symbol to type. On my regular en-us keyboard, the only way I know of to type the letter ç is to hold alt...
Is it possible to select from "show tables" in MySQL?
|mysql|sql|
Well, yes, the title says it all. SELECT * FROM (SHOW TABLES) AS `my_tables` Something along these lines, though the above does not work (on 5.0.51a, at least).
|sql|mysql|metadata|
The easiest way is to use VI. I know that sounds terrible but its simple and already installed on most UNIX environments. The ^M is a new line from Windows/DOS environment. from the command prompt: `$ vi filename` Then press "`:`" to get to command mode. Search and Replace all Globally is `:%s/^M//g` "**Press ...
The few times I ran into this, I found that that the methods and properties were all almost identical- changing the object type was just about all I had to do. There were one or two other little things, but they showed up with the lines and it was obvious what to do with Intellisense. I'd vote for going with the fully ...
I was actually just wondering the same thing earlier today. The following seems to work: #define is_signed(t) ( ((t)-1) < 0 ) I tested with: #include <stdio.h> #define is_signed(t) ( ((t)-1) < 0 ) #define psigned(t) printf( #t " is %s\n", is_signed(t) ? "signed" : "unsigned" ); ...
You could do this better with a template function, less macro nasty business. template <typename T> bool IsSignedType() { // A lot of assumptions on T here T instanceAsOne = 1; if (-instanceAsOne > 0) ...
The obvious names for these classes are ReaderInputStream and WriterOutputStream. Unfortunately these are not included in the Java library. However, google is your friend. I'm not sure that it is going to get around all text encoding problems, which are nightmarish.
The obvious names for these classes are ReaderInputStream and WriterOutputStream. Unfortunately these are not included in the Java library. However, google is your friend. I'm not sure that it is going to get around all text encoding problems, which are nightmarish. [There is an RFE,][1] but it's Closed, will not...
[devguru.com][1] [1]: http://devguru.com
git clean -f If you just want to remove ignored files, run "git clean -f -X". If you want to remove ignored as well as non-ignored files, run "git clean -f -x". Note the case difference on the 'X' for the two latter commands. Unless you specify "-f" and clean.requireForce is set to "true" (the default) in your ...
In our current database development evironment we have automated build procceses check all the sql code out of svn create database scripts and apply them to the various development/qa databases. This is all well and good, and is a tremdous improvement over what we did in the past, but we have a problem with rerunnin...
@Sam your RewriteCond line is wrong. The expansion of the variable is triggered with %, not $. RewriteCond %{HTTP_HOST} ^([^\.]+)\.media\.xnet\.tk$ ^ that should do the trick
SVN and TortoiseSVN work for me. Definitely ensure you have offsite backup. You might want to check out the wiki article [Comparison of revision control software][1]. A (slightly hard-to-read) [comparison tool][2] might help. You might enjoy [If Version Control Systems Were Airlines][3]. [1]: http://en.wikipe...
After playing with the WM_NCACTIVATE message with no luck, I overrode the WM_SETFOCUS message: void CMyWindow::OnSetFocus(CWnd* pOldWnd) { if (pOldWnd != NULL) { pOldWnd->SetFocus(); } } That seems to do the trick. No idea why it works though! Comments welcome on that issue.
if you want to have re-runnability in your scripts, then you can't have them as definitions... what I mean by this is that you need to focus on change scripts rather than here is my Table script. let's say you have a table Customers: create table Customers ( id int identity(1,1) primary key, ...
<script type="text/javascript"> /*********************************************** * Disable Text Selection script- © Dynamic Drive DHTML code library (www.dynamicdrive.com) * This notice MUST stay intact for legal use * Visit Dynamic Drive at http://www.dynamicdrive.com/ for full source code ...
It is a setting for some terminal (windows use background). Check out colorbox including its bdefault. /Allan
Use pure Ruby first, IR isn't quite finished yet. Check out http://poignantguide.net/ruby/ - even though it's quite strange, it's a very good introduction
Ooh, found it. It's along the lines of: set terminal png x222222 xffffff
The term **Flash** can include any of the other terms I define below, and I find that saying "Flash" without specifying exactly what you mean can be confusing and misleading. Case in point: I'm not sure what you specifically mean when you say "Flash" in your question. Is it Flash Player? The authoring tool? Or the whol...
The term **Flash** can include any of the other terms I define below, and I find that saying "Flash" without specifying exactly what you mean can be confusing and misleading. Case in point: I'm not sure what you specifically mean when you say "Flash" in your question. Is it Flash Player? The authoring tool? Or the whol...
Check your path (run 'echo $PATH')
I've used Clearcase a lot. As long as you are doing your merges frequently it can be pretty effortless and it is also possible to have merge jobs running in the background. You are required to intervene if there is a merge conflict. However, it is expensive and it can be hard to find skilled Clearcase administrators...
git - http://git.or.cz/ ( i am quite fond of git, great @ branching and distributed development) - http://github.com/ is a great working example.
[Git][1], Mercurial, Bazaar, Darcs [1]: http://git.or.cz
svn has an "ignore" property you can attach to a filename pattern or a directory. Files and directories that are ignored won't be reported in "svn st" commands and won't go into the repo. Example: you have C source code in .c and .h files, but the compiler creates a bunch of .o files that you don't want subversio...
I suppose you tried using [DllImport("advapi32.dll", SetLastError=true)] public static extern int LogonUser(string pszUsername, string pszDomain, string pszPassword, int dwLogonType, int dwLogonProvider, ref IntPtr phToken); to log in the network share. In my experience it doesn't care about threa...
What does a PHP developer need to know about https / secure socket layer connections?
|php|security|ssl|https|
I know next to nothing when it comes to the how and why of https connections. Obviously, when I'm transmitting secure data like passwords or especially credit card information, https is a critical tool. What do I need to know about it, though? What are the most common mistakes you see developers making when they imp...
Export ChartFX7 to SVG in Java
|chartfx|java|export|
Can anybody give an example for exporting a ChartFX7 chart to SVG? I've tried: <pre> ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_chart.setOutputWriter(new com.softwarefx.chartfx.server.writer.svg.SvgWriter()); m_chart.exportChart(FileFormat.EXTERNAL, baos); </pre> and also: <pre> ...
|java|export|chartfx|
Can anybody give an example for exporting a ChartFX7 chart to SVG? I've tried: <pre> ByteArrayOutputStream baos = new ByteArrayOutputStream(); m_chart.setOutputWriter(new SvgWriter()); m_chart.exportChart(FileFormat.EXTERNAL, baos); </pre> and also: <pre> ByteArrayOutputStream baos = new ByteArra...
The recommendation for HTML expresses it as an application of SGML, which requires that the `DOCTYPE` declaration appear before the HTML element (ignoring HTML comments). Even without the `DOCTYPE`, adding a `SCRIPT` element outside the `HTML` element (either before it or after it) is not valid HTML. Of course, HTML va...
Assuming the characters are present in a text field: update TABLE set COLUMN=REPLACE(convert(varchar(5000), COLUMN), 'searchstring', 'replacestring') (note that this will only work on a text field with no more than 5000 characters, for larger text fields increase the number in the query).
Consider also that you can often replace both with derived tables which may be faster as well. As with all performance tuning, though, only actual tests against your actual data can tell you the best approach for your particular query.
I recommend going through these [JavaScript Video Lectures][1] (15 of them). [1]: http://www.catonmat.net/blog/learning-javascript-programming-language-through-video-lectures/
When using multiple files in vim, I use these commands mostly (with ~350 files open): :b <partial filename><tab> (jump to a buffer) :bw (buffer wipe, remove a buffer) :e <file path> (edit, open a new buffer> pltags - enable jumping to subroutine/method definitions
When using multiple files in vim, I use these commands mostly (with ~350 files open): - :b <partial filename><tab> (jump to a buffer) - :bw (buffer wipe, remove a buffer) - :e <file path> (edit, open a new buffer> - pltags - enable jumping to subroutine/method definitions
http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html Look for fn:substring and its variants. I've used Struts 1, but not 2.
If you are willing to use C++/CLI for your managed code instead of C#, then you can just consume the native C++ interface definition directly via the header file. How easy this will be will depend on exactly what is in your interface - simplest case is something that you could use from C. Take a look at Marcus Heege...
I would create a bundle command to do this. You can take editor selection as input to your script, then replace it with the result of execution. This command, for example, will take a selected number and print the character '#' that number of times. python -c "print '#' * $TM_SELECTED_TEXT" Of course this...
OK since no one seems to have an answer, how about iterating throught the odbc connections by dbsource, I.e. sqlserver or mysql
SQL Server 2005 How Create a Unique Constraint?
|sql|sql-server|constraints|
How do I create a unique constraint on an existing table in SQL Server 2005? I am looking for both the TSQL and how to do it in the Database Diagram.
It should be noted that these queries will produce different results if TblB.a is not unique.
Open source or low cost "log shipping" program
|sql-server|backup|
I have written a log shipping program a number of times. It is a simple program that is used to maintain a warm fail over box for SQL Server. It has two pieces. On the live dB server it: - Does full and transaction backups and removes old files On the backup server it: - Copies the backups from the li...
Just came here from an answer to my own question on the same subject - I mention one other updating solution in my [question][1]. It uses a stub loader, and an xml file to point to the latest executable. [1]: http://stackoverflow.com/questions/49747/autoupdating-net-applications
Just came here from an answer to my own question on the same subject - I mention one other [updating solution][1] in my [question][2]. It uses a stub loader, and an xml file to point to the latest executable. [1]: http://windowsclient.net/articles/appupdater.aspx [2]: http://stackoverflow.com/questions/49747...
I find reflection very useful if the input data (like xml) has a complex structure which is easily mapped to object-instances or i need some kind of "is a" relationship between the instances. As reflection is relatively easy in java, I sometimes use it for simple data (key-value maps) where I have a small fixed set...
[This page on the Python Wiki][1] would be a good place to start. One key difference in Python is significant whitespace. This puts a lot of people off - me too for a long time - but once you get going it seems natural and makes much more sense than `;`s everywhere. From a personal perspective, Python has the f...
One key difference in Python is [significant whitespace][2]. This puts a lot of people off - me too for a long time - but once you get going it seems natural and makes much more sense than `;`s everywhere. From a personal perspective, Python has the following benefits over Java: - No [Checked Exceptions][3] ...
I'm trying to pick up ruby by porting a medium-sized (non-OO) perl program. One of my personal idioms is to set options like this: use Getopt::Std; our $opt_v; # be verbose getopts('v'); # and later ... $opt_v && print "something interesting\n"; In perl, I kind of grit my teeth and let $o...
Keeping CL and Scheme straight in your head
|scheme|lisp|commonlisp|
Depending on my mood I seem to waffle back and forth between wanting a Lisp-1 and a Lisp-2. Unfortunately beyond the obvious name space differences, this leaves all kinds of amusing function name/etc problems you run into. Case in point, trying to write some code tonight I tried to do (map #'function listvar) which, ...
|lisp|scheme|commonlisp|
|lisp|scheme|clisp|
How would you extract data from a MS Project .mpp file?
|vb.net|vb6|c#|perl|project-management|
I need to extract data from a .mpp file on the network and combine it with other data from several different databases. The application can be written in Perl, VB6, VB.net or C# but must be easily scheduled from a Windows based server. What would you recommend to extract the MS Project data with no user intervention...
|c#|vb.net|perl|project-management|vb6|
I need to extract data from a .mpp file on the network and combine it with other data from several different databases. The application can be written in Perl, VB6, VB.net or C# but must be easily scheduled from a Windows based server. What would you recommend to extract the MS Project data with no user intervention...
First off, I would say ask yourself "**What is Serialization?**". The *XmlSerializer* is doing exactly what it is supposed to be doing, persisting the current state of the object to XML. Now, I am not sure why the current behaviour is not "right" for you, since if you have initialized the List, then it *is* initiali...