instruction
stringlengths
0
30k
What platform? On Mac OS X I have installed [msmtp][1] and created a post-commit script under hooks in the repository. A .msmtprc file needs to be setup for the svn (or www) user. REPOS="`echo $1 | sed 's/\/{root of repository}//g'` " REV="$2" MSG=`/usr/local/bin/svn log -v -r HEAD https://localhost...
|python|sql|optimization|olap|aggregate|
I need a real DBA's opinion here, my SQL aggregate query is conspicuously slow. Using Postgres 8.3 I've built a table with 350,000 rows (responses to a survey): CREATE TABLE tuples (id integer primary key, a integer, b integer, c integer, d integer); \copy tuples from 'responses.csv' delimiter as ',' ...
I need a real DBA's opinion. Postgres 8.3 takes 200 ms to execute this query on my Macbook Pro while Java and Python perform the same calculation in under 20 ms (350,000 rows): SELECT count(id), avg(a), avg(b), avg(c), avg(d) FROM tuples; Is this normal behaviour when using a SQL database? The schema (the ...
I create a the [stackoverflow tag feeds pipe](http://pipes.yahoo.com/pipes/pipe.info?_id=uP22vN923RG_c71O1ZzWFw). You can list your tags of choice into the text box and it will combine them into a single feed with all the unique posts. It escapes `'#'` and `'+'` characters for you. Alternatively, you can use the pip...
I create a the [stackoverflow tag feeds pipe](http://pipes.yahoo.com/pipes/pipe.info?_id=uP22vN923RG_c71O1ZzWFw). You can list your tags of choice into the text box and it will combine them into a single feed with all the unique posts. It escapes `'#'` and `'+'` characters for you. Alternatively, you can use the pip...
The best thing I could recommend is the [Internet Explorer Developer Toolbar][1] which allow you to view changes in the DOM. [1]: http://www.microsoft.com/downloads/details.aspx?FamilyId=E59C3964-672D-4511-BB3E-2D5E1DB91038&displaylang=en
I'm guessing your question is about arranging the system so you don't have to work as: 1. Select all the top level comments 2. Select all comments whose parents were found in the step prior 3. Select all comments whose parents were found in the step prior 4. ... repeat until no comments found I would sugge...
How do I Send Email from the Command Line?
|email|command-line|
I would like to quickly send email from the command line. I realize there are probably a number of different ways to do this. I'm looking for a simple way to do this from a linux terminal (likely a bash shell but anything should do) and an alternative way to do this on Windows. I want to be able to whip up an emai...
Detect DOM modification in Internet Explorer BHO
|internet-explorer|internet-explorer-7|bho|
Use aspnet_setreg.exe http://support.microsoft.com/kb/329290
How would I allow a user to stream video to a web application for storage?
|java|flash|web-applications|applet|
I'd like to add some functionality to a site that would allow users to record video using their webcam and easily store it online. I don't even know if this is possible right now, but I think flash has access to local webcams running through the browser. Do you have any suggestions or resources to get me started on ...
Linq to SQL - Accessing System Databases/Tables?
|c#|sql-server|linq|linq-to-sql|
Right now I have an SSIS package that runs every morning and gives me a report on the number of packages that failed or succeeded from the day before. The information for these packages is contained partly within the <code>sysjobs</code> table (a system table) within the <code>msdb</code> database (a system database) ...
You must synchronize, but on certain architectures there are efficient ways to do it. Best is to use subroutines (perhaps masked behind macros) so that you can conditionally replace implementations with platform-specific ones. The Linux kernel already has some of this code.
Encrypting appSettings in web.config
|encryption|security|settings|
I am developing a web app which requires a username and password to be stored in the web.Config, it also refers to some URLs which will be requested by the web app itself and never the client. I know the .Net framework will not allow a web.config file to be served, however I still think its bad practice to leave thi...
|security|encryption|settings|
MS SQL FTI - searching on "n*" returns numbers
|sql-server|
This seems like odd behaviour from SQL's full-text-index. FTI stores number in its index with an "NN" prefix, so "123" is saved as "NN123". Now when a user searches for words beginning with N (i.e. contains "n*" ) they also get all numbers. So: select [TextField] from [MyTable] where contains...
|sql-server|full-text-search|
This seems like odd behaviour from SQL's full-text-index. FTI stores number in its index with an "NN" prefix, so "123" is saved as "NN123". Now when a user searches for words beginning with N (i.e. contains "n*" ) they also get all numbers. So: select [TextField] from [MyTable] where contains...
You don't know where the string literals are stored. It may even be read-only memory, so your code should read: const char* c = "string"; And a *new* char array should be *delete*d just like any other dynamically allocated memory area.
Try [Laconica](http://laconi.ca/): An open source Twitter-like system you could run on your own servers.
They're not the same. Your first example is a constant string, so it's definitely not allocated from the heap. Your second example is a runtime memory allocation of 6 characters, and that comes from the stack. You don't want to delete your first example, but you need to **delete []** your second example.
>I assume when I do char* = "string" its the same thing as char* = new char[6]. No. What the first one does is create a constant. Modifying it is undefined behaviour. But to answer your question; no, you don't have to destroy them. And just a note, always use `std::string` whenever possible.
There is a (large) example written in Perl included in the Subversion source (it can be [viewed here](http://svn.collab.net/repos/svn/trunk/contrib/hook-scripts/commit-email.pl.in)).
You could use this perl command. Perl -lne 's/[,|"]//; print' file.txt > newfile.txt You may need to play around with it a bit, but it should do the trick.
take a look at the syslockinfo and syslocks system tables you can also run the sp_lock proc
aargh, just being an idiot: SELECT name, lockscheme(name) FROM sysobjects WHERE type="U" ORDER BY name
It's been a <i>long</i> time since I've done any GBA programming, but as I recall, the DS supports most (if not all) of the stuff that GBA supports. [This](http://www.coranac.com/tonc/text/gfx.htm) link has a section on how to do alpha blending for GBA (section 13.2). I don't know if there's a DS-specific way of doing ...
I don't think there is. I've tried to solve this problem at my job. Hiding the select control was the best we could come up with (being a corporate shop with a captive audience, user experience doesn't usually factor into the PM's decisions). From what I could gather online when looking for a solution, there's just...
Here's the PHP way: $stripped = str_replace(array(',', '"'), '', $value); [Link to W3Schools page](http://w3schools.com/php/func_string_str_replace.asp)
a) Must look the same b) As standards-compliant as possible, but not so anal that it blocks finishing work In a situation where you have perpetual access to the code, I don't think standards-compliance is all that important, since you can always make changes to the code if something breaks. If you don't have perp...
Have a look at Subversion Notify <http://sourceforge.net/projects/svn-notify/> <http://www.subversionnotify.com/> It can do emailing on commit and also much more!
Have a look at Subversion Notify (Windows only) <http://sourceforge.net/projects/svn-notify/> <http://www.subversionnotify.com/> It can do emailing on commit and also much more!
I think validation is a good litmus test of whether you've done things properly, so if there are only a few minor problems, why not fix them and ensure your site will at least be understood correctly by browsers in the future (even if they do render things differently for other reasons)? OTOH, for most projects, val...
You could run the third party functions in a separate process and close the process when you are done using the library.
First, you have to provide the entrypoints for `malloc()` and `free()` and friends. Because this code is compiled already (right?) you can't depend on `#define` to redirect. Then you can implement these in the obvious way and log that they came from a certain module by linking those routines to those modules. Th...
How to click on an AutoCompleteExtender with Watin
|watin|autocompleteextender|
For my acceptance testing I'm writing text into the auto complete extender and I need to click on the populated list. In order to populate the list I have to use AppendText instead of TypeText, otherwise the textbox looses focus before the list is populated. Now my problem is when I try to click on the populated ...
There are a number of known incompatibilities between TinyMCE and WebKit (the rendering engine used by Chrome). If you're using TinyMCE 2.x, you might want to try the [Safari plug-in to TinyMCE](http://wiki.moxiecode.com/index.php/TinyMCE:Plugins/safari); Safari also uses WebKit. I gather also that [TinyMCE 3.x has b...
Since you're worried about memory leaks and talking about malloc/free, I assume you're in C. I'm also assuming based on your question that you do not have access to the source code of the third party library. The only thing I can think of is to examine memory consumption of your app before & after the call, log err...
The <?xml...?> processing instruction must be the very first thing in the XML content (see [XML comment][1] and [processing instructions][2]). The following should work: <?xml version='1.0' encoding='UTF-8'?> <!-- Queries used: ... --> <dataset> ... </dataset> [1]: http://www.w3.org/...
I am writing a BHO for ie7, and I need to detect DOM modification (i.e. via AJAX). So far I couldn't find any feasible solutions.
I am writing a BHO for ie7, and I need to detect DOM modification (i.e. via AJAX). So far I couldn't find any feasible solution.
|internet-explorer|internet-explorer-7|bho|c++|
Detect DOM modification in Internet Explorer
|c++|internet-explorer|internet-explorer-7|bho|
I am writing a Browser Helper Object for ie7, and I need to detect DOM modification (i.e. via AJAX). So far I couldn't find any feasible solution.
If you are looking to inject code into processes (which is what Input Managers are most commonly used for), the Windows equivalents are: - <code>[AppInit_DLLs][1]</code> to automatically load your DLL into new processes, - <code>[CreateRemoteThread][2]</code> to start a new thread in a particular existing proce...
$ echo "This is the text of the email" | mail -s "This is the subject" manpages@rtfm.com Alternatively: $ cat | mail -s "A few lines off the top of my head" me@here.com This is where my multiline message would go ^D ^D - means press control-D
$ echo "This is the email body" | mail -s "This is the subject" me@email.com Alternatively: $ cat | mail -s "A few lines off the top of my head" me@here.com This is where my multiline message would go ^D ^D - means press control-D
Tools to help a small shop score higher on the "Joel Test"
|joeltest|dailybuilds|sourcecontrol|bugtracking|
Questions #1 through #4 on the [Joel Test][1] in my opinion are all about the development tools being used and the support system in place for developers: 1. Do you use source control? 2. Can you make a build in one step? 3. Do you make daily builds? 4. Do you have a bug database? I'm just curious what fre...
**What are all the different ways of finding primes?**
|language-agnostic|prime|primes|
Alright, so maybe I shouldn't have shrunk this question sooo much... I have seen the post on [the most efficient way to find the first 10000 primes](http://stackoverflow.com/questions/622/most-efficient-code-for-the-first-10000-prime-numbers). I'm looking for **all possible ways**. The goal is to have a one stop shop...
|language-agnostic|primes|
Batch file to "Script" a Database
|sql-server|script|batch-file|
Is it possible to somehow use a .bat file to script the schema and/or content of a SQL Server database? I can do this via the wizard, but would like to streamline the creation of this file for source control purposes. I would like to avoid the use of 3rd party tools - just limiting myself to the tools that come with...
|sql-server|scripting|batch-file|
Automated script to zip IIS logs?
|iis|batch-file|script|logging|zip|
I'd like to write a script/batch that will bunch up my daily IIS logs and zip them up by month. ex080801.log which is in the format of ex*yymmdd*.log ex080801.log - ex080831.log gets zipped up and the log files deleted. The reason we do this is because on a heavy site a log file for one day could be 500mb to 1...
|iis|batch-file|scripting|zip|logging|
Any recommendations for lightweight .net Win Forms HTML renderer controls?
|winforms|.net|control|user-interface|
Trying to avoid the .net WebBrowser control (I don't need to navigate to a url, print rendered html or any of the other inbuilt goodies). Wrapping the IE dll seems a bit heavyweight. I simply require something that can dusplay basic html marked up text - an html equivalent of [RichTextBox][1] in effect. [1]: h...
|.net|winforms|user-interface|control|
Trying to avoid the .net WebBrowser control (I don't need to navigate to a url, print rendered html or any of the other inbuilt goodies). Wrapping the IE dll seems a bit heavyweight. I simply require something that can display basic html marked up text - an html equivalent of [RichTextBox][1] in effect. Anyone hav...
I had a similar problem and used the following code: System.Diagnostics.Process[] procs = System.Diagnostics.Process.GetProcesses(); for (int i = 0; i < procs.Length; i++) { if(procs[i].ProcessName == "EXCEL") { procs[i].Kill(); } } This worked pretty well, but I w...
You can, from 1.6, use JMX to do all sorts of interesting things including finding held locks. You can't get the actual object, but you do get the class and identity hash value (which is not unique). [There's an example in one of my weblogs.][1] [1]: http://www.jroller.com/tackline/entry/detecting_invokeandwa...
Or, the layer above Laconica called [Identi.ca][1] There's a good talk with the founder of Identi.ca about such usage over at [IT Conversations][2]. [1]: http://identi.ca/ [2]: http://itc.conversationsnetwork.org/shows/detail3791.html
You can use SELECT * FROM INFORMATION_SCHEMA.COLUMNS but I suspect you created the destination database from a script of the source database so it is very likely that they columns will be the same. Some comparisons might bring something up though. These sorts of errors sometimes come from trying to insert too muc...
new is always an allocation whereas defining a string inline actually embeds the data in the program itself and cannot be changed (some compilers allow this by a smart trick, don't bother). Some compilers type inline strings so that you cannot modify the buffer. char* const sz1 = "string"; // embedded string,...
No. When you say: const char* c = "Hello World!"; You are assigning c to a "pre-existing" string constant which is NOT the same as: char* c = new char[6]; Only in the latter case are you allocating memory on the heap. So you'd call delete when you're done.
C# doesn't support duck typing. You have 2 choices: interfaces and inheritance, otherwise you can't access similar properties of different types of objects.
Josh Bloch has publicised this recently. It is consistent in that InputStream.read is not guaranteed to read as many bytes as it could. However, it is utterly pointless as an API method. InputStream should probably also have readFully.
The method I've always used is below. It is a pain and a bit ugly, but I haven't found a better one. You have to pass the class type through on construction, as when Generics are compiled class information is lost. public class Test<E> { private Class<E> clazz; public Test(Class<E> clazz) { ...
You could give [this][1] a go. [1]: http://mime-types.rubyforge.org/
I'd think about putting in place some sort of general archiving functionality. How you implement that depends on your specific retrieval needs. For example if you wish just to retrieve emails sent to a particular customer for a certain month then stocking them in an appropriate heirachy on the File System (zip them...
I think this is an area in which you should strive to use the [Robustness principle][1] as far as is practical (which is good advice for any area of coding). Just because something works today doesn't mean it will work tomorrow: if you're relying on a particular HTML/CSS hack or even if you've just been a little lax in...
I love TextMate on OSX. There is a kind of TextMate clone for Windows called simply "E" ([e-texteditor.com][1]). Its author promised that there will be a Linux version soon. Even if you already picked your favourite, TextMate (or E) is worth a look, simply because it is different. I would say that there are main...
You could also group the characters by language. Load each language table as needed, and when you need to switch languages, unload the previous language table and load the new one.
I know this isn't answering your whole question, but it is worth considering that by using completely valid html you can be sure that your website should work properly in **future** web browsers that haven't been released yet.
I would recommend [Companion JS](http://www.my-debugbar.com/wiki/CompanionJS/HomePage). This is the free version of [Debug Bar](http://www.my-debugbar.com/wiki/Doc/HomePage) but I find it easier to use and have the features I need. Great to test little JavaScript snippets in IE the same way I do with Firebug in Fire...
As far as I know there are only two options, the better of which is the mentioned usage of an iframe. The other one is hiding all selects when the overlay is shown, leading to an even weirder user experience.
I think it's only "tech" guys that really care for "100% standard compliance". My usual page consumers (= users) don't care if there's no alt-attribute for a "menu border element". I usually just make sure that I don't see any obvious errors (all tags closed, all lower case, attributes in quotes, ...), but if it loo...