instruction
stringlengths
0
30k
|c++|
I've been wondering, what is the point of clog? As near as I can tell, clog is the same as cerr but with buffering so it is more efficient. Usually stderr is the same as stdout, so clog is the same as cout. This seems pretty lame to me, so I figure I must be misunderstanding it. If I have log messages going out to the ...
@paulmorriss Maybe... the problem with that is that there are limitations as to how much data a single sheet can contain... I'm thinking option 2, unless someone tells me it is not a good idea in regards to performance
Simple & basic form spam reduction: checking for Javascript?
|spam|
I'm trying to reduce the form spam on our website. (It's actually pretty recent). I seem to remember reading somewhere that the spammers aren't executing the Javascript on the site. Is that true? And if so, then could you simply check for javascript being disabled and then figure it's *likely* that it's spam? ...
|javascript|user-input|
Have you tried adding smtp.UseDefaultCredentials = True before the send? Also, what happens if you try changing: mailMessage.From = New System.Net.Mail.MailAddress(from) mailMessage.To.Add(New System.Net.Mail.MailAddress(recipent)) to this: mailMessage.From = New System.Net.Mail.Mai...
I doubt you want to do it programmatically unless you just want to do it once and store it for future use. It's a costly thing to do. There's no sizeof() operator in Java, and even if there was, it would only count the cost of the references to other objects and the size of the primitives. One way you could do it ...
We have a simple delete statement that looks like this: DELETE FROM tablename WHERE pk = 12345 This just hangs, no timeout, no nothing. We've looked at the execution plan, and it consists of many lookups on related tables to ensure no foreign keys would trip up the delete, but we've verified that none of t...
|sql|delete|hang|sql-server-2005|
|sql|delete|sql-server-2005|hang|
|sql|sql-server-2005|delete|hangs|
We have a simple delete statement that looks like this: DELETE FROM tablename WHERE pk = 12345 This just hangs, no timeout, no nothing. We've looked at the execution plan, and it consists of many lookups on related tables to ensure no foreign keys would trip up the delete, but we've verified that none of t...
We have a simple delete statement that looks like this: DELETE FROM tablename WHERE pk = 12345 This just hangs, no timeout, no nothing. We've looked at the execution plan, and it consists of many lookups on related tables to ensure no foreign keys would trip up the delete, but we've verified that none of t...
How to setup a Subversion (SVN) server on GNU/Linux - Ubuntu
|svn|ubuntu|debian|subversion|gnulinux|
I have a laptop running Ubuntu that I would like to act as a Subversion server. Both for myself to commit to locally, and for others remotely. What are the steps required to get this working? Please include steps to: * get and configure Apache, and necessary modules (I know there are other ways to create a SVN serve...
|svn|ubuntu|debian|gnulinux|
|linux|svn|ubuntu|debian|
A corruption in an index is not nearly as bad as a corruption in the base table as an index can be rebuilt. Compare the table and index definitions between the source and destination databases. Check the version of both servers as well. (was the backup automatically upgraded when restored to your server) Drop an...
Seems to me like GIT might also serve your needs, as you mention being disconnected or over a crappy connection. GIT also has very nice SVN support so the two are complementary and you'll end up with a nice versioned file system.
[This][1] is a good article on the subject, by one of the people who worked on the 64 bit JIT. Basically, unless you absolutely need the address space that 64 bit can offer, or need to do 64 bit math, you will likely lose performance. As pointers are larger, cache is effectively halved, for example. [1]: http://...
Mac OS X: What is the best way to estimate the code & static data size of program?
|c++|c|macos|
I want to be able to get an estimate of how much code & static data is used by my C++ program? Is there a way to find this out by looking at the executable or object files? Or perhaps something I can do at runtime? Will otool help?
|macos|mach-o|
Your mode may support this already. In C mode and Makefile mode, at least, M-q (fill-paragraph) will insert line continuations in the fill-column and wrap your lines. What mode are you editing this in?
Rhino Mocks: How do I return numbers from a sequence
|c#|.net|rhino-mocks|
I have an Enumerable array int meas[] = new double[] {3, 6, 9, 12, 15, 18}; On each successive call to the mock's method that I'm testing I want to return a value from that array. using(_mocks.Record()) { Expect.Call(mocked_class.GetValue()).Return(meas); } using(_mocks.Playback()) { ...
I think you mean "many to one" when it comes to users and companies - unless you plan on having a unique company for each user. To answer your question, go with the first approach. One less table to store reduces space and will make your queries use less JOIN commands. Also, and more importantly, it correctly matche...
Web Service Namespace Dynamic Naming
|c#|web-services|
I have a webservice that I will be deploying to dev, staging and production. Along with this will be an ASP.net application that will be deploying separately but also in those three stages. What is the most pragmatic way to change the following line in the webservice to match the current environment? [WebSer...
The two schemas cannot be compared, as they have different relationships, you should proablly look at what the spec is for the tables and then work out which one fits the relationship needed. The first one implies that a User can only be a member of *one* company (a belongs_to relationship). Whereas the second schem...
>"Are there any VC++ settings I should know about" Make sure you turn off Frame pointer ommision. Larry osterman's blog has the historical details and the issues it causes: [http://blogs.msdn.com/ > Symbols are loaded successfully. It shows the callstack, but double clicking on an entry doesn't bring me to the s...
.NET version
|.net|
What are the different ways (programatically & otherwise) to determine what versions of .NET are running on a system?
How can you determine what version(s) of .NET are running on a system?
C# switch limitations
|c#|switch-statement|
This question is kind of an add-on to this [question][1] [1]: http://stackoverflow.com/questions/44905/c-switch-statement-limitations-why In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month total for the selected mon...
|c#|switch-statement|duplicate|
|c#|switch-statement|
C# switch: case not falling through to other cases limitation
This question is kind of an add-on to this [question][1] [1]: http://stackoverflow.com/questions/44905/c-switch-statement-limitations-why In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month total for the selected mon...
For discrete math, [here][1] is an awesome set of 20 lectures from Arsdigita University. Each is about an hour and twenty minutes long. [1]: http://video.google.com/videoplay?docid=-2965569821331370765&ei=Ua3GSODbC5Gk-wH328G6Dg&q=arsdigita+discrete
> Is it possible to redirect clog, cerr, cout, stdin, stdout, and/or stderr? Yes. You want the [`rdbuf`](http://www.cplusplus.com/reference/iostream/ios/rdbuf.html) function. ofstream ofs("logfile"); cout.rdbuf(ofs.rdbuf()); cout << "Goes to file." << endl; > Is the only difference between clog a...
**Note, I will clean up the question once it has been solved** We have a simple delete statement that looks like this: DELETE FROM tablename WHERE pk = 12345 This just hangs, no timeout, no nothing. We've looked at the execution plan, and it consists of many lookups on related tables to ensure no foreig...
**Edit**: Solved, there was a trigger with a loop on the table (read my own answer further below). --- We have a simple delete statement that looks like this: DELETE FROM tablename WHERE pk = 12345 This just hangs, no timeout, no nothing. We've looked at the execution plan, and it consists of many look...
>"Are there any VC++ settings I should know about" Make sure you turn off Frame pointer ommision. Larry osterman's blog has [the historical details][1] about fpo and the issues it causes with debugging. > Symbols are loaded successfully. It shows the callstack, but double clicking on an entry doesn't bring me to...
SQL - how to store and navigate hierarchies
|sql|sql-server|
What are the ways that you use to model and retrieve hierarchical info in a database?
well that's a bit of an open ended question and depends on your business rules. The first option you have only allows one company to be mapped to one user. you're defining a one-to-one relationship. The second schema defines a many-to-many relationship which allows multiple users to be mapped to multiple companies. ...
well that's a bit of an open ended question and depends on your business rules. The first option you have only allows one company to be mapped to one user. you're defining a many-to-one relationship. The second schema defines a many-to-many relationship which allows multiple users to be mapped to multiple companies....
PHP sleep() silently hogs CPU
|php|performance|hang|sleep|
I'm running Apache on Linux within VMWare. One of the PHP pages I'm requesting does a sleep(), and I find that if I attempt to request a second page whilst the first page is sleep()'ing, the second page hangs, waiting for the sleep() from the first page to finish. Has anyone else seen this behaviour? I know that PHP...
|php|performance|sleep|hangs|
Are there any tools to visualize template/class methods and their usage?
|visualization|
I have taken over a large code base and would like to get an overview how and where certain classes and their methods are used. Is there any good tool that can somehow visualize the dependencies and draw a nice call tree or something similar? The code is in C++ in Visual Studio if that helps narrow down any selec...
|visualization|
This site explains how it's done in the physical world: <a href="http://www.wendycarlos.com/other/Eltro-1967/index.html">http://www.wendycarlos.com/other/Eltro-1967/index.html</a> I don't know how you would emulate that in software though... I'll keep looking
Another option to to use a dictionary with values you don't care about. E.g., <pre><code> poor_man_set = {} poor_man_set[1] = None poor_man_set[2] = None poor_man_set[3] = None ... </code></pre> You can treat the keys as a set except that they're just an array: <pre><code> keys = poor_man_set.keys() p...
Another option is to use a dictionary with values you don't care about. E.g., <pre><code> poor_man_set = {} poor_man_set[1] = None poor_man_set[2] = None poor_man_set[3] = None ... </code></pre> You can treat the keys as a set except that they're just an array: <pre><code> keys = poor_man_set.keys() p...
Well, I've already set AutoPage and AllowPaging to true. I've confirmed that RetrieveTotalRowCount is set to true by checking its value in debug mode (couldn't find where to change its value). And it still returns -1. The only thing missing is: > -1 if the LinqDataSourceStatusEventArgs object was created duri...
Database compare tools
|database|diff|
My company has a number of relatively small Access databases (2-5MB) that control our user assisted design tools. Naturally these databases evolve over time as data bugs are found and fixed and as the schema changes to support new features in the tools. Can anyone recommend a database diff tool to compare both the da...
You need to specify the full path to the assembly argument I think... <exec program="${output.dir}SpecUnit.Report.exe" verbose="true"> <arg value="${output.dir}\${acceptance.tests.assembly}" /> </exec>
You need to specify the full path to the assembly argument I think... <exec program="${output.dir}SpecUnit.Report.exe" verbose="true"> <arg value="${output.dir}${acceptance.tests.assembly}" /> </exec>
Try this: ---------- select p.* from wp_posts p, wp_terms t, wp_term_taxonomy tt, wp_term_relationship tr wp_terms t2, wp_term_taxonomy tt2, wp_term_relationship tr2 where p.id = tr.object_id and t.term_id = tt.term_id and tr.term_taxonomy_id = tt.term_taxonomy_id and p.id = tr2.object_id and t2.te...
[Miles Burke][1] has compiled a list of the colors used in the majority of the big names in this Web 2.0 world. He also gives a [PNG][2] or a [JPG][3] as a color cheatsheet. I am sure I can give you an idea from what color to chose for your application. [1]: http://www.milesburke.com.au/blog/2007/06/29/th...
We never actually purchased it as we ended up using SQL Server 2005, but DBDiff seemed to do the trick: http://www.dkgas.com/downdbdiff.cgi It works with any ODBC compatible DB.
Follow [this link][1] to read what DB_DO is. In a nutshell, it doesn't implement a specific pattern, it just aims to provide a common interface. The idea is to not rebuild the same basic code in each project. As for an ORM, I'd recommend [Doctrine][2]. It implements ActiveRecord. [1]: http://pear.php.net/manu...
FYI: SQL Server 2008 introduces a new [HierarchyID][1] data type for this sort of situation. Gives you control over where in the "tree" your row sits, horizontally as well as vertically. [1]: http://msdn.microsoft.com/en-us/library/bb677290.aspx
If you're using SQL Server 2005 then [this link][1] explains how to retrieve hierarchical data. Common Table Expressions (CTEs) can be your friends once you get comfortable using them. [1]: https://web.archive.org/web/20210927200924/http://www.4guysfromrolla.com/webtech/071906-1.shtml
Graeme's suggestion of custom malloc/free is a good idea. See if you can characterize some pattern about the corruption to give you a handle to leverage. For example, if it is always in a block of the same size (say 64 bytes) then change your malloc/free pair to always allocate 64 byte chunks in their own page. Whe...
**Oracle: SELECT ... START WITH ... CONNECT BY** Oracle has an extension to SELECT that allows easy tree-based retrieval. This query will traverse a table where the nesting relationship is stored in **parent** and **child** columns. select * from my_table start with parent = :TOP connect ...
**Oracle: SELECT ... START WITH ... CONNECT BY** Oracle has an extension to SELECT that allows easy tree-based retrieval. Perhaps SQL Server has some similar extension? This query will traverse a table where the nesting relationship is stored in **parent** and **child** columns. select * from my_table ...
>To me, a catch (Exception) clause should've captured any exception whatsoever. Is there any reason why it wouldn't? The only possibility I can think of is that something else is catching it before you and handling it in a way that appears to be an uncaught exception (e.g. exiting the process). > my try/catch blo...
I find that LINQ to SQL is much, much faster when I'm prototyping code. It just blows away any other method when I need something now. But there is a cost. Compared to hand-rolled stored procs, LINQ is slow. Especially if you aren't very careful as seemingly minor changes can suddenly make a single turn into 1+N que...
Can I convert the following code to use generics?
|java|generics|comparison|
I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1&lt;o2, 0 if o1==o2, 1 if o1&gt;o2 */ protected static int nullCompare(Comparable ...
I'm converting an application to use Java 1.5 and have found the following method: /** * Compare two Comparables, treat nulls as -infinity. * @param o1 * @param o2 * @return -1 if o1&lt;o2, 0 if o1==o2, 1 if o1&gt;o2 */ protected static int nullCompare(Comparable ...
We just finished plopping a brand new CRM system on our users, and let me tell you it was a TERRIBLE idea to do it that way: It was extremely painful for my team and for our customers. I'd go through every possible mean to do gradual releases, even if it means doing more work. You'll be grateful because you won't ha...
I use [soundstretch][1] to speed up podcasts which is works quite well, haven't tried it on music though. [1]: http://www.iki.fi/oparviai/soundtouch
Wow, 120 user controls, some of which only contain a single TextBox? This sounds like a lot of code. When you change a library project, all projects that depend on that library project then need to be recompiled, and also every project that depends on them, etc, all the way up the stack. *You* know you've only made ...
A plugin for GSview for viewing encrypted PDFs is [here][1]. If this works for you, you may be able to look at the source. [1]: http://www.cs.cmu.edu/~dst/Adobe/Gallery/Keating/
Yes, the .ToString(string) methods. For instance, int number = 32; string formatted = number.ToString("D4"); Console.WriteLine(formatted); // Shows 0032 Note that in C# you don't use a number to specify a format, but you use a character or a sequence of characters. Formatting numbers and dates in C# takes so...
Use something like [SQLite][1] to store data offline until a connection is available. Update: I believe SQLite is the back end for [Google Gears][2], which from my understanding does what you're looking for in web apps... though I don't know if it can be used in a non web context. [1]: http://www.sqlite.org/ ...
Based on [this guide for Mercurial][1] my .gitignore includes: .DS_Store *.swp *~.nib build *.pbxuser *.perspective *.perspectivev3 I've also chosen to include: *.mode1v3 *.mode2v3 which, according to [this Apple mailing list post][2], are "user-specific projec...
This probably won't be a popular answer, but you almost certainly do not want to do this. If you want a copy that's a merge, then use copy (or [deepcopy][1], depending on what you want) and then update. The two lines of code are much more readable - more Pythonic - than the single line creation with .items() + .items...
Directly from the source. [How to detect the installed version of the .NET framework][1] [1]: http://support.microsoft.com/kb/315291 "How to detect the installed version of the .NET framework"
I would go with the fields that Landon stated: > Discrete Math, Linear Algebra, > Combinatorics, Probability and > Statistics, Graph Theory and add mathematical logic. This would give you a grip on most fields of CS. If you want to go into special fields, you have to dive into some areas especially: C...