instruction
stringlengths
0
30k
I resigned from using pylint/pychecker in favor of using pyflakes with Django code - it just tries to import module and reports any problem it finds, like unused imports or uninitialized local names.
The consequences of not disposing your IDisposables can vary from a negligible performance hit to crashing your app. The Brush object in your example will be cleaned up by the GC when it feels like it. But your program won't have had the benefit of that bit of extra memory you would have gained by cleaning it up ear...
The consequences of not disposing your IDisposables can vary from a negligible performance hit to crashing your app. The Brush object in your example will be cleaned up by the GC when it feels like it. But your program won't have had the benefit of that bit of extra memory you would have gained by cleaning it up ear...
From the Terminal (or in a script wrapper): /Applications/TextEdit.app/Contents/MacOS/TextEdit & Something like that should work for you.
The backslash is being eaten by cygwin's bash shell. Try doubling it: sqlcmd -Q "select 'a test'" -S .\\SQLEXPRESS
In fact, [one of the people who created this site][1] made a [post regarding this][2] on his [blog][3] [1]: http://stackoverflow.com/users/1 [2]: http://www.codinghorror.com/blog/archives/000893.html [3]: http://www.codinghorror.com/
How can I add custom markup to TWiki?
|markup|twiki|
At a previous place where I worked a colleague figured out how to configure MediaWiki so that, for example, a string like `#12345` in the wiki markup could be expanded into a hypertext link to ticket 12345 in the ticket system. I would like to do something similar in TWiki. I have not yet figured out how, though. ...
Following up on my own question, I came across [this posting][1] referenced in the answer to another question. Although more of a discussion of the issue than an aswer, it does mention the VM idea. [1]: http://www.conifersystems.com/2008/09/15/machine-independent-builds/
I made an implementation for quick sort where the left and right sides of the partition are sorted concurrently. It was almost twice as fast as the same code using only 1 thread.
Structs are frequently used as representations of the packing order of binary file formats and network protocols. This would break if that were done. In addition, different compilers would optimize things differently and linking code together from both would be impossible. This simply isn't feasible.
So, as you say, just fork()ing will not do the trick. What you must do is fork() and then re-exec(), as this code sample does: #include stdio.h> #include <unistd.h> #include <string.h> #include <CoreFoundation/CoreFoundation.h> int main(int argc, char **argv) { int i, j; ...
No automated tool can tell you whether a website is accessible. There are tools, such as <a href="http://www-01.ibm.com/software/awdtools/tester/policy/accessibility/">Rational Policy Tester</a>, that can identify potential problem areas, but they only work in conjunction with manual checking by a person with a good u...
|c#|.net|asp.net|
*UPDATE: Focus your answers on hardware solutions please.* What hardware/tools/add-in are you using to improve ASP.NET compilation and first execution speed? We are looking at solid state hard drives to speed things up, but the prices are really high right now. I have two 7200rpm harddrives in RAID 0 right now ...
You can do an awful lot with a web-based app, but it is a lot easier to do certain things with a thick client: - Performance: You get simple access to the full power of the client's CPU. - Responsiveness: Interactivity is fast and easy. - Graphics: You can easily use graphics libraries such as DirectX and Op...
A callable is anything that can be called. The buildin callable checks weather something is callable comparing the argument against function types and checking properties that indicate callability. the method named \_\_call\_\_ is overloading the parenthesis operator for calling of an object. Example ------- ...
A callable is anything that can be called. The buildin *callable* checks weather something is callable comparing the argument against function types and checking properties that indicate callability. the method named *\_\_call\_\_* is overloading the parenthesis operator for calling of an object. Example -------...
A callable is anything that can be called. The [buildin *callable* (PyCallable_Check in objects.c)][1] checks if the argument is either: - an instance of a class with a *\_\_call\_\_* method or - is of a type that has a non null *tp_call* (c struct) member which indicates callability otherwise (such as in...
A callable is anything that can be called. The [buildin *callable* (PyCallable_Check in objects.c)][1] checks if the argument is either: - an instance of a class with a *\_\_call\_\_* method or - is of a type that has a non null *tp_call* (c struct) member which indicates callability otherwise (such as in...
ColdFusion Template Request count optimization
|coldfusion|administration|
In ColdFusion, under Request Tuning in the administrator, how do I determine what is an optimal number (or at least a good guess) for the Maximum Number of Simultaneous Template Requests? Environment:<br/> CF8 Standard<br/> IIS 6<br/> Win2k3<br/> SQL2k5 on a separate box
The use of shared resources is wrong in the long run. Because by reusing an existing environment you are creating more and more possibilities. Just review the busy beavers :) The way Erlang goes is the right way to produce fault-tolerant and easily verifiable systems. But transactional memory is essential for many ...
I'd go with Lua since writing bindings is extremely easy, the license is very friendly (MIT) and existing libraries also tend to be under said license. Scheme is also nice and easy to bind which is why it was chosen for the Gimp image editor for example. But Lua is simply great. World of Warcraft uses it, as a very hig...
Setting Page Title from a SWF
|apache-flex|flash|
Is it possible to set the title of a page when it's simply a loaded SWF?
the [URL Tool for Ubiquity][1] does the following: findURLs: function(text) { var urls = []; var matches = text.match(/(\S+\.{1}[^\s\,\.\!]+)/g); if (matches) { for each (var match in matches) { urls.push(match); } } return u...
Great question! A few years ago I looked around forever for something worth using and came up short. I was looking for something that was very lightweight and did not require me to link in some libraries... you know **something I could get up and running in minutes.** However, I persisted and ended up running across...
[^\s.]+\.[^\s.]+(\.[^\s.]+)? BTW what you asked for allows "." and ".."
Forget my previous post, I've got a better idea. sub match_positions { my ($regex, $string) = @_; return if not $string =~ /$regex/; return ($-[0], $+[0]); } sub match_all_positions { my ($regex, $string) = @_; my @ret; while ($string =~ /$regex/g) ...
If you are receiving a gif file for a profile photo as example, you should check that the mime type is gif.<br> And that way you avoid uploading bad files.<br> [Here][1] you have an example using php. [1]: http://www.jellyandcustard.com/2006/01/19/php-mime-types-and-fileinfo/
WPF Validation Not Firing on First LostFocus of the TextBox
|wpf|
I am trying to validate the WPF form against an object. The validation fires when I type something in the textbox lose focus come back to the textbox and then erase whatever I have written. But if I just load the WPF application and tab off the textbox without writing and erasing anything from the textbox then it is no...
[PCI DSS][1] states that you can store PANs (credit card numbers) using a strong one-way hash. They don't even require that it be salted. That said you should salt it with a unique per card value. The expiry date is a good start but perhaps a bit too short. You could add in other pieces of information from the card, su...
While this doesn't address your question directly, I wouldn't recommend running VS 2008 and all of the supporting tools on anything less than 2GB of RAM.
Whatever route you go, charge a fair price, make it easy to activate, give free minor updates and never deactivate their software. If you treat your users with respect they'll reward you for it. Still, no matter what you do some people are going to end up pirating it.
Look into <a href="http://swinglabs.org/docs/components/JXTable/tutorial.jsp">JXTable</a>. JXTable is an extension of JTable that supports multi-column sorting, as well as other functions that JTable doesn't provide. It's freely available from JDNC / SwingLabs.
You may not need any CALs for users depending on how you use the server. Certain functionality requires the purchase of CALs but some doesn't. There's no real good way to answer this question since the requirements are too vague. Does it use domain services? Does it use SQL server? Clustering? There are many vari...
I think the real problem is the duplication of servers on the Network - plus that evil kerberos-keys-getting-out-of-date issue that any offline copy of a Virtual Server can suffer. I'd suggest creating a SysPreped image as the base and then create multiple machines from that. I don't think branching servers would b...
For the most part, what makes XSLT not a 100% functional programming language is it's inability to treat functions as a first-class data type. There may be some others -- but that's the obvious answer. Good luck!
You can sort by multiple columns by specifying more than one sort key when calling `setSortKeys` in the [`RowSorter`](http://java.sun.com/javase/6/docs/api/javax/swing/RowSorter.html) you're using.
How do I determine if I should install Drupal 5.x or 6.x?
|content-management-system|drupal|
I'm planning to install Drupal. Is there any reason not to install the latest 6.x version as opposed to the 5.x branch? Are there any really good modules that are 5.x only?
There are many, many, many protections available. The key is: - Assessing your target audience, and what they're willing to put up with - Understanding your audience's desire to play with no pay - Assessing the amount someone is willing to put forth to break your protection - Applying just enough protect...
From the Terminal (or in a script wrapper): /Applications/TextEdit.app/Contents/MacOS/TextEdit & Something like that should work for you. To do this in Java: String[] cmd = { "/bin/sh", "-c", "[shell commmand goes here]" }; Process p = Runtime.getRuntime().exec (cmd);
I'm not aware of a way you can get this information for existing records. However, going forward you can create an audit table that stores the TableName and RecordCreateDate (or something similar. Then, for the relevant tables you can make an insert trigger: CREATE TRIGGER trigger_RecordInsertDate ON You...
I'm not aware of a way you can get this information for existing records. However, going forward you can create an audit table that stores the TableName and RecordCreateDate (or something similar. Then, for the relevant tables you can make an insert trigger: CREATE TRIGGER trigger_RecordInsertDate ON You...
Using MERGE and COALESCE?
Using MERGE and COALESCE? [Try this link for an example](http://blogs.sun.com/cmar/entry/using_merge_to_do_an) with SET a.Col1 = COALESCE(a.Col1, incoming.Col1) ,a.Col2 = COALESCE(a.Col2, incoming.Col2)
Using MERGE and COALESCE? [Try this link for an example](http://blogs.sun.com/cmar/entry/using_merge_to_do_an) with SET a.Col1 = COALESCE(incoming.Col1, a.Col1) ,a.Col2 = COALESCE(incoming.Col2, a.Col2)
How does including a SQL index hint affect query performance?
|sql|sql-server|indexing|hint|
Say I have a table in a SQL 2005 database with 2,000,000+ records and a few indexes. What advantage is there to using index hints in my queries? Are there ever disadvantages to using index hints in queries?
A quick Google search turns up a couple papers that cover this in some detail: one on [Parallel Combinatorial Search][1], and one on [External-Memory Graph Search][2] General rule of thumb when it comes to algorithmic problems: *someone has likely done it before you, and published their findings*. [1]: http:/...
Whatever you do, as well as sanitising input and checking the return value of your code, make sure you call any external programs with their explicit, full path. e.g. say my $user = `/bin/whoami`; or my $result = `/bin/cp $from $to`; Saying just "whoami" or "cp" runs the risk of accidentally running...
Like in CASE statement no evaluating as expected
A callable is anything that can be called. The [buildin *callable* (PyCallable_Check in objects.c)][1] checks if the argument is either: - an instance of a class with a *\_\_call\_\_* method or - is of a type that has a non null *tp\_call* (c struct) member which indicates callability otherwise (such as i...
Is your MySql version compiled with inno-db support?
Maybe you have inno-db disabled in the global configuration file. On Linux this would be something like /etc/mysql/my.cnf - maybe Windows has a similar global conf-file.
There are plenty of cons: * Speed and responsiveness tend to be significantly worse * Complicated UI widgets (such as tree controls) are harder to do * Rendering graphics of any kind is pretty tricky, 3D graphics is even harder * You have to mess around with logins * A centralised server means clients always nee...
What does %~d0 mean in a Windows batch file?
|windows|batch-file|
I'm looking at a batch file which defines the following variables: set _SCRIPT_DRIVE=%~d0 set set _SCRIPT_PATH=%~p0 Does anybody have any information about what %~d0 or %~p0 actually mean? Is there a set of well-known values for things like current directory, drive, parameters to a script? Are there any ...
Pair programming is based on the idea that the interaction of two programmers adds value. If this is not true, change the pairs... let them choose. Programming should be fun!
What is an invariant?
|language-agnostic|invariants|
The word seems to get used in a number of contexts. The best I can figure is that they mean a variable that can't change. Isn't that what constants/finals (darn you Java!) are for?
What exactly are they having problems with? Do they not get along, not understand each other? Are they at different levels of programming experience? It may help if you have a team member that can act as a "mediator" of sorts. Somebody who's successfully done pair-programming in the past and can help the two through...
Of your examples, I would not recommend #2, because it gives the Employee class too many responsibilities. Although not giving a straight answer, I can cordially recommend Martin Fowler's book [Patterns of Enterprise Application Architecture][1]. It has been a great eye-opener for me personally, and describes severa...
This is indeed disturbing. Here is an array of values that I tested: var x = [undefined, NaN, 'blah', 0/0, null, 0, '0', 1, 1/0, -1/0, Number(5)] It evaluates (in the Firebug console) to: ,NaN,blah,NaN,,0,0,1,Infinity,-Infinity,5 When I call `x.map(isNaN)` (to call isNaN on each value), I get: ...
Microsoft SQL Server has a interface like that, i have used it in SQL Server 2000 but i bet it's in 2005 express too so you can take a look if you want.
Assuming .NET, I'd go with a DataGridView to store each condition and to assign each an ID as it is created and have a textbox that allows you enter the particular query conditions. You could then, once all conditions are written, allow for combining 2 at a time with either an AND or an OR and then displaying the re...
C compilers don't automatically pack structs *precisely because* of alignment issues like you mention. Accesses not on word boundaries (32-bit on most CPUs) carry heavy penalty on x86 and cause fatal traps on RISC architectures.
You can check how MS Access does it. I won't call it intuitive but it is simple.
Pango is a GObject based library. As such, you need to make sure that the glib dynamic type system is initialized before using any of its functionality. This can be done by calling [`g_type_init()`][1] (either directly or indirectly via something like `gtk_init()`). Could this be your problem? [1]: http://lib...
I don't know if GCC has any Atom-specific optimization flags yet, but the Atom core is supposed to be very similar to the original Pentium, with the very significant addition of the MMX/SSE/SSE2/SSE3/SSSE3 instruction sets. Of course, these only make a significant difference if your code is floating-point or DSP-heavy...
in web.config: <system.web> <authentication mode="Windows" /> <identity impersonate="true"/> </system>
See also [this question][1]. JetBrains dotTrace is the best .NET profiler I have found (and I have tried pretty much every one there is), because it is the only one that has low enough overhead to handle a processor-intensive application. It is also simple, accurate and well-designed - highly recommended! [1]: h...
Just checked and found that it pulls text from the website so it wouldn't work online... sorry about that, how about this though: #!/usr/bin/env python import sys import random try: n = int(sys.argv[1]) except: print 'Usage: %s num-words' % sys.argv[0] wor...
At the bottom of the lorem ipsum generator you will find links to the generator for other usage. My understanding is the following can be used offline: - [TeX Package][1] - [Java Class][2] But you may also find the following helpful: - WWW::Lipsum CPAN Module - Firefox Add-on - Dreamweaver Extensi...
It's not an ASP.NET solution, but there's a great Javascript date picker at http://www.frequency-decoder.com/2006/10/02/unobtrusive-date-picker-widgit-update. You implement it by setting a couple of CSS classes on an input field. Have used this many times and think it's great!
Yes, there is a setting in IIS which lets you point a subfolder to a different site. So make the sub folder a virtual directory on your site, and then in the properties of the virtual directory choose the option for 'A redirection to a URL'... in it specify your other site. Of course, this is assuming your are using...
In general, a function call is going to be slightly slower than memory access since it in fact has to do multiple memory accesses to perform the call. For example, multiple pushes and pops of the stack are required for most function calls using __stdcall on x86. But if your memory access is to a page that isn't even ...
Synchronize your writing code to lock on a shared object so that only one thread gets inside the block. Others wait till the current one exits. lock(this) { // perform the write. }
Synchronize your writing code to lock on a shared object so that only one thread gets inside the block. Others wait till the current one exits. lock(this) { // perform the write. } Update: I assumed that you have a shared object. If these are different processes on the same machine, you'd nee...
Check the control template of your TabItem , it might have some default Margin of 10. Just a guess
The thing about star schemas is they are a natural model for the kinds of things most people want to do with a data warehouse. For instance it is easy to produce reports with different levels of granularity (month or day or year for example). It is also efficient to insert typical business data into a star schema, agai...
You may have to customize some things, take a look at IDocHostUIHandler, and then check out some of the other related interfaces. You can have a fair amount of control, even to the point of customizing dialog display/ui (I can't recall which interface does this). I'm pretty sure you can do what you want, but it does re...
As has been pointed out, software protection is never guaranteed to be foolproof. What you intend to use depends largely on your target audience. A game, for instance, is not something you are going to be able to protect forever. A server software, on the other hand, is something far less likely to be distributed on th...
You should be able to set the TableRowSorter and the Comparator associated with it. Example: TableModel myModel = createMyTableModel(); JTable table = new JTable(myModel); TableRowSorter t = new TableRowSorter(myModel); t.setComparator(column that the comparator works against, Comparator<?> comparato...
You should be able to set the TableRowSorter and the Comparator associated with it. Example: TableModel myModel = createMyTableModel(); JTable table = new JTable(myModel); TableRowSorter t = new TableRowSorter(myModel); t.setComparator(column that the comparator works against, Comparator<?> compa...
I ran windows Xp on a mac (AMD 2.4 GHz) and i alloted 1.5GB and it was fairly slow, but it was a file based disk. I agree with the above that you need the ram, especially with vista. I dont think 2GB base is anough for mac and vmware with vista. For the partition, give at least 40 Gb for os + software and whatveer e...
|sql-server|
Given this data: CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH' ELSE 'XXX' END AS newField FROM tmpTable The exp...
Like in CASE statement not evaluating as expected