instruction
stringlengths
0
30k
Again you may need to fix for your database, but if you want the top 2nd value in a dataset that potentially has the value duplicated, you'll want to do a group as well: SELECT column FROM table WHERE column IS NOT NULL GROUP BY column ORDER BY column DESC LIMIT 5 OFFSET 2; Would skip the first two, and then get ...
Abstract means that you can't provide a default implementation. This in turn means that all subclasses must provide an implementation of the abstract method in order to be instantiable (concrete). I'm not sure what you mean by 'limitations', so can't answer that point. Properties can be declared virtual, but you ...
Can you reference the DNS name instead? You can override the IP address for a DNS name in your hosts file (C:\windows\system32\drivers\etc\hosts).
A member should be declared virtual if there is a base implementation, but there is a possibility of that functionality being overridden in a child class. Virtual can also be used instead of abstract to allow a method implementation to be optional (ie. the base implementation is an empty method) There is no limitati...
[Disclaimer: I am primarily a Perl programmer, which may be colouring my judgement. However, I am not a particularly tribal one, and I think on this particular question my argument is reasonably objective.] Perl was designed to blend seamlessly into the Unix landscape, and that is why it feels so alien to people wit...
In general, yes. A protected method is usually better. In use, there is a level of simplicity given by using a protected **final** variable for an object that is shared by all the children of a class. I'd always advise against using it with primitives or collections since the contracts are impossible to define for...
Another great use of using is when instantiating a modal dialog. Using frm as new Form1 Form1.ShowDialog ' do stuff here" End Using"
When you copy & paste a textbox, Excel will place the new textbox over whichever cell is currently selected. So you can achieve this very easily by simply using the VBA copy & paste commands. This can be particularly useful if you are going to be using a lot of very similar textboxes, as you are effectively creating ...
Rather than storing the position information in a hidden field, store it in a cookie. The information is small, so it will have minimal effect on the page load performance.
Assuming that the points are indeed part of a rectangle, I'm giving a generic idea : Find two points with max inter-distance: these most probably define a diagonal (exception: special cases where the rectangle is almost paralell to the YZ plane, left for the student). Call them A, C. Calculate the BAD, BCD angles. T...
A word of warning about generic types and using IsAssignableFrom()... Say you have the following: public class MyListBase<T> : IEnumerable<T> where T : ItemBase { } public class MyItem : ItemBase { } public class MyDerivedList : MyListBase<MyItem> ...
you should be able to do it using the route command. Route add (ip address) (netmask) (gateway) metric 1
Lots of recommendation for CPAN.pm, which is great, but if you're using Perl 5.10 then you've also got access to CPANPLUS.pm which is like CPAN.pm but better. And, of course, it's available on CPAN for people still using older versions of Perl. Why not try: $ cpan CPANPLUS
##Create 2 databases * DB1 contains static tables, and represents the "real" state of the data. * DB2 is free for users to do with as they wish - they (or you) will have to write code to populate their odd-shaped tables from DB1.
I've never tried using it (it's been on my todo list for a good few months now), but there is the "marge" project on java.net: [https://marge.dev.java.net/][1] This should let you connect to bluetooth devices (although I don't think it is 100% feature complete, there is demo code on there), and then the ClientDev...
You can't **rmdir** a directory with files in it. You must first **rm** all files and subdirectories. Many times, the easiest solution is: $ rm -rf old_directory It's entirely possible that some of the files or subdirectories have permission limitations that might prevent them from being removed. Occasiona...
It's hack-ish, but if you're using vb.net and when you're running from within visual studio _My.Application.Deployment.CurrentDeployment_ will be Nothing, because you haven't deployed it yet. I'm not sure how to check the equivalent value in C#.
I've used Thinking Sphinx and it seems pretty good, but I haven't had the time to evaluate all of the options.
I'll accept the answer even though it's not really documented: does it or does it not have such a method? You actually didn't answer to this, just passed the question back to me. Meanwhile found the same hack-ish solution with forcing the focus to some other control (not very elegant but works), even though it's a b...
Some CSV files have double quotes around the values along with a comma. Therefore sometimes you can split on this string literal: ","
Yes, if you are reading from a spot in memory that, say, a completely separate process may write to.. I used to work with dual-port ram in a multiprocessor system in straight C. We used a hw managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did this: void waitForSemaphor...
[Disclaimer: I am primarily a Perl programmer, which may be colouring my judgement. However, I am not a particularly tribal one, and I think on this particular question my argument is reasonably objective.] Perl was designed to blend seamlessly into the Unix landscape, and that is why it feels so alien to people wit...
There are a few things which dominate the successfulness of code. All of these must be achieved for the slightest chance of adoption. <ul> <li>Market - There must be a market for your open source project. If your project is a orange juicer in space, I doubt that you'll be very successful. You must make sure your pr...
Printing Flex components in FireFox 3
|apache-flex|actionscript-3|firefox|
Thanks to FireFox's buggy implementation of ActiveX components (it really should take an image of them when printing) Flex components (in our case charts) don't print in FX. They print fine in IE7, even IE6. We need these charts to print, but they also have dynamic content. I don't really want to draw them again...
What do you mean by that the data tier should not be aware of the business logic tier? How would you fill an business object with data? I often do this: namespace Data { public class BusinessObjectDataManager { public void SaveObject(BusinessObject object) { ...
As for pure online solutions, make sure you do some back-of-the-envelope calculations first. For example, if you have 2TB of churn a month, you are going to saturate a 1Mb Internet connection just for your backup traffic!
You can buy external eSATA RAID boxes in the 8TB capacity range [for $2600][1]. I'm not saying that particular product is the right choice, but that's the kind of box that will do 6TB in RAID5 and still be portable enough to buy a couple of them and rotate them through the bank, like Stu says. Obviously if you have...
Your question was also partially answered by [this thread](http://stackoverflow.com/questions/8223/connection-pooling-in-netmssql). A search would have revealed this.. The definition of Connection Pooling, of which a [Google](http://www.google.com/search?q=connection+pooling) would have answered with the first hit bein...
A word of warning about generic types and using IsAssignableFrom()... Say you have the following: public class MyListBase<T> : IEnumerable<T> where T : ItemBase { } public class MyItem : ItemBase { } public class MyDerivedList : MyListBase<MyItem> ...
A word of warning about generic types and using IsAssignableFrom()... Say you have the following: public class MyListBase<T> : IEnumerable<T> where T : ItemBase { } public class MyItem : ItemBase { } public class MyDerivedList : MyListBase<MyItem> ...
A word of warning about generic types and using IsAssignableFrom()... Say you have the following: public class MyListBase<T> : IEnumerable<T> where T : ItemBase { } public class MyItem : ItemBase { } public class MyDerivedList : MyListBase<MyItem> ...
There are a several things which dominate the successfulness of code. All of these must be achieved for the slightest chance of adoption. <ul> <li>Market - There must be a market for your open source project. If your project is a orange juicer in space, I doubt that you'll be very successful. You must make sure you...
Local image manipulation in JavaScript should be possible - have a look at [Defender of the Favicon][1]. ;-) The question is how to get the original image from the file system into your page (I don't know of any other way than doing a HTTP upload to the server first). [1]: http://www.p01.org/releases/DHTML_conte...
Is there a more efficient text spooler than TextWriter/StringBuilder
|c#|data-structures|performance|dotnet|string|
For a situation like capturing text incrementally, for example if you were receiving all of the output.write calls when a page was rendering, and those were being appended into a textwriter over a stringbuilder. Is there a more efficient way to do this? Something that exists in dotnet already preferably? Especially ...
|c#|.net|performance|string|data-structures|
I'm not sure that's possible at all. What you could do would be to reference a DNS name instead. You can change the IP the DNS name points to using your [hosts file][1]. [1]: http://en.wikipedia.org/wiki/Hosts_file
Not really an addon inside VS, but one every VS use needs: [Code Preview Handler](http://timheuer.com/blog/archive/2006/12/13/13945.aspx) Provides a preview handler with syntax highlighting for source files. The handler works in the Explorer preview pane and in the preview tab for attachments in Outlook.
yes, check out here http://weblogs.asp.net/scottgu/archive/2005/12/10/432851.aspx
Scott Meyers says *don't* use protected attributes in Effective C++ (3rd ed.): > Item 22: Declare data members private. The reason is the same you give: it breaks encapsulations. The consequence is that otherwise local changes to the layout of the class might break dependent types and result in changes in many ot...
you really should be looking at a more appropriate way of doing this. i'm going to guess that you're trying to run mysql queries via a shell script. you should instead be using something like PERL or PHP.
How/When to abandon the use of Arrays in c#.net?
|arrays|c#|theory|.net|
I've always been told that adding an element to an array happens like this: > An empty copy of the array+1element is > created and then the data from the > original array is copied into it then > the new data for the new element is > then loaded If this is true, then using an array within a scenario that requ...
|c#|.net|arrays|theory|
I've always been told that adding an element to an array happens like this: > An empty copy of the array+1element is > created and then the data from the > original array is copied into it then > the new data for the new element is > then loaded If this is true, then using an array within a scenario that requ...
How about [Reversi][1]? It has a pretty nice space of heuristics based on number of pieces, number of edge pieces, and number of corner pieces. [1]: http://en.wikipedia.org/wiki/Reversi
I've always had to make a second call using query after the insert. You could use an ORM like hibernate. I think it does this stuff for you.
.NET has a BigInteger class, but it is internal, unfortunately. However, several places have their own. You can grab an implementation from IronPython, or the one from CodeProject, or from Visual J#. I have to say, I've not tried these myself, so I don't know which one is the best. http://www.codeplex.com/IronPython...
Family Website CMS
|plugins|content-management-system|
I am looking for a CMS that would be incredibly user-friendly and would have the following features: - really simple message board (no login required) - family tree - story telling area - photo section - news section Is there anything out there like this that is really easily configurable? I've already messed...
Chipping in on the philosophical pros of unit testing and TDD here are a few of they key "lightbulb" observations which struck me on my tentative first steps on the road to TDD enlightenment (none original or necessarily news)... 1. TDD does NOT mean writing twice the amount of code. Test code is typically fairly q...
Yes, if you are reading from a spot in memory that, say, a completely separate process/device/whatever may write to.. I used to work with dual-port ram in a multiprocessor system in straight C. We used a hw managed 16 bit value as a semaphore to know when the other guy was done. Essentially we did this: void...
<asp:Label id="lID" runat="server"><%= MyProperty %></asp:Label> since asp.net tags do not allow <% %> constructs, you cannot use Text="<%= MyProperty %>".
Going on what mos said, the following worked did the trick: CButton* pButton = (CButton*)GetDlgItem(IDC_RADIOBUTTON); pButton->SetCheck(true);
You may have some sucess by adding a local account to the administrators group and joining the server to the new domain. Then manualy updateing all of the AD accounts that are used in the server. I sould note that all of your users will then have new accounts that are not related to the old ones. You sould ask your ...
List<int> list = new List<int>() { 1, 2, 3, 4, }; IQueryable<int> query = list.AsQueryable();
Use the AsQueryable<T>() extension method.
Just so you know, [GoDaddy as a company has a somewhat dubious reputation][1]. I personally have never had any problems with them but I have only a few low-profile sites and have never done anything even remotely complicated with the DNS. [1]: http://nodaddy.com/
You check the DesignMode property of your control: if (!DesginMode) { //Do production runtime stuff } Note that this won't work in your constructor because the components haven't been initialized yet.
Both headers and content are encrypted.
I recommend Thinking Sphinx. It is the fastest option in my opinion.
SSL..or rather HTTPS (HTTP over SSL) sends all HTTP content over SSL, and as HTTP content and headers are in fact the same thing, this means the headers are encrypted as well. Seeing as GET and POST data is sent via HTTP headers, then it only makes sense then when sending data securely you wouldn't just want the respo...
As long as you're communicating in the SSL tunnel, everything sent between the server and the client will be encrypted. The encryption is done before any data is sent or received.
Wildcard filename in schema.ini?
|.net|microsofttextdriver|schema.ini|
If I understand your question correctly you could do something similar to: select recordID from tablewithrecords as a left join ( select count(recordID) as recordcount from tblwithrecords where re...
We are just wrapping up a project in which myself and 4 others developed a rather successful, distributed enterprise app. We started using Win32 and then switched to WPF after the first iteration to meet the demands of our usability expert. Here is my experience. WPF has some really, really great features. In gen...
Date::Manip is supposed to be self-contained. It has a list of all its time zones in its own source, following "$zonesrfc=".
http://www.sql-server-performance.com/articles/dba/delete_duplicates_p1.aspx will get you going. Also, http://en.allexperts.com/q/MS-SQL-1450/2008/8/SQL-query-fetch-duplicate.htm I found these by searching Google for 'sql duplicate data'. You'll see this isn't an unusual problem.
GetExitCodeProcess will return STILL_ACTIVE if the process was running when the function was called.
I think this is what you are looking for. <body onload="onloadHandler();"> <script type="text/javascript"> function onloadHandler() { if (document.createElement && document.getElementsByTagName) { var script = document.createElement('script'); script.type = 'text/javascript'; script.src = './test...
Scala is the absolute king of languages which have adopted significant academic features. Higher kinds, self types, polymorphic pattern matching, etc. All of these are bleeding-edge (or near to it) academic research topics that have been incorporated into Scala as fundamental features. Arguably, this has been to the...
The best is to log the queries to a file and them use SQL Profiler to time them and tweak the indexes for the queries.
How about starting your Dots and Boxes game with random lines already added. This can get you into the action quickly. Just need to make sure you don't start the game with any boxes.
One big issue is that WCF serialization doesn't support xs:Date. This is a big problem as if all you want is a date, you shouldn't be forced to be concerned about time zones. The following connect issue discusses some of the problems: http://connect.microsoft.com/wcf/feedback/ViewFeedback.aspx?FeedbackID=349215 If...
Drupal shines with these two mudules : - [CCK][1] : add custom fields to nodes - [Views][2] : control how lists of content are presented. This tool is essentially a smart query builder. [1]: http://drupal.org/project/cck [2]: http://drupal.org/project/views
> you can't have java.lang.Enum as > annotation param, I think you are wrong on that. I have recently used on a project something like this : public @interface MyAnnotation { MyEnum value(); }
@Ice^^Heat: >What do you mean by that the data tier should not be aware of the business logic tier? How would you fill an business object with data? The UI asks the ServiceClass in the business tier for a service, namely getting a list of objects filtered by an object with the needed parameter data. Then the S...
Do you use [IOCompletionPorts][1] under Windows? Windows via C++ has an in-depth chapter on this subject and as luck would have it, [it is also available on MSDN][2]. [1]: http://msdn.microsoft.com/en-us/library/aa363862(VS.85).aspx [2]: http://msdn.microsoft.com/en-us/library/cc500399.aspx
turns out the problem was in the { debug : true } option for the JQuery.Validate initializer. **With this removed, things work fine in Opera.** Thanks to Jörn Zaefferer for helping us figure this out! Oh, and the $50 will be donated to the JQuery project. :)
I agree with the other comments here.. There is a reference, in plain text _somewhere_ ! I have had similar problems in the past where searching through the project files returned nothing, turns out it was in some other file that wasn't automatically picked up in the search. I don't think that creating a new projec...
Finding untracked files in a Perforce tree
|version-control|perforce|
Anybody have a script or alias to find untracked (really: unadded) files in a Perforce tree?
I'm not up on .NET but I'm guessing YSOD implies uncaught errors, if that's the case then isn't relying on client-side validation alone a little risky? If not then errors that are caught can be converted to something useful for the Opera crowd - even if it is just a Screen Of Death painted white with validation grumble...
>You said "... you can't have java.lang.Enum as" > annotation param ..." I think you are wrong on that. I have recently used on a project something like this : public @interface MyAnnotation { MyEnum value(); }
I love CopySourceAsToHTML as a cool little addin. It's great if you want to copy code blocks for blogging and the like while maintaining your syntax formatting. I think this is still the url.. you have to do some manual work to set it up with 08. [http://www.jtleigh.com/people/colin/software/CopySourceAsHtml/][1] ...
Writing device drivers in .net makes no sense for current versions of windows. &lt;speculation&gt; Rumors are that MS is investing a lot of money in bringing Singularity to the next level. Just look for [Midori][1]. But that's 2015+ &lt;/speculation&gt; [1]: http://en.wikipedia.org/wiki/Midori_(operatin...
Shell out to pskill from http://sysinternals.com/ Commandline: pskill -u user_1 attachemate.exe
Bring with you some Perl code that: - demonstrates a programming style that you can be proud of, - does something significant and useful, and - is object-oriented (for good reasons, not just to demonstrate that you can regurgitate syntax)
Another game choice could be [Reversi][1] aka Othello. A naive heuristic would be to simply count the number of tiles gained by each valid move and choose the greatest. From there you can factor in board position and minimizing vulnerably to the opponent. [1]: http://en.wikipedia.org/wiki/Reversi
[Source Monitor](http://www.ddj.com/articles/2000/0003/0003toc.htm) code analysis tool [Direct download link](http://www.ddj.com/ftp/2000/2000_03/sourcemonitor.zip)
First step: Look at the Query Execution Plan!<br/> TableScan -> bad<br/> NestedLoop -> meh warning<br/> TableScan behind a NestedLoop -> DOOM!<br/> SET STATISTICS IO ON<br/> SET STATISTICS TIME ON
Open Java *.Class Files
|java|windows|applet|class|