instruction
stringlengths
0
30k
Just to check, if you use **just** this part you get an error? <?php include("../includes/connect.php"); $query = "SELECT * from story"; $result = mysql_query($query) or die(mysql_error()); If so, do you still get an error if you copy and paste one of those Inserts into this page, I...
[Sonic File Finder](http://jens-schaller.de/sonictools/sonicfilefinder/) for when you have loads of files in your solutions and searching for them in the solution explorer becomes a pain in the wrist. You might also find [DPack](http://www.usysware.com/dpack/) interesting. Several tools and enhancements rolled into ...
Does the apache user require a password to connect to the database? If so, then the fact that it says "using password: NO" would lead me to believe that the code is trying to connect without a password. If, however, the apache user doesn't require a password, a double-check of the permissions may be a good idea (wh...
Try this, Chris: SELECT AccountNumber as [clientId] FROM Location.Location WHERE LocationId = 'long-guid-here' FOR XML AUTO, ELEMENTS, ROOT('root')
Try this, Chris: SELECT AccountNumber as [clientId] FROM Location.Location root WHERE LocationId = 'long-guid-here' FOR XML AUTO, ELEMENTS TERRIBLY SORRY! I mixed up what you were asking for. I prefer the XML AUTO just for ease of maintainance, but I believe ...
If indeed you are able to insert using the same connection calls, your problem most likely lies in the user "apache" not having SELECT permissions on the database. If you have phpMyAdmin installed you can look at the permissions for the user in the Privileges pane. phpMyAdmin also makes it very easy to modify the permi...
What is the argument for printf that formats a long?
|c|
The <code>printf</code> function takes an argument type, such as %d or %i for a signed int. However, I don't see anything for a long value.
@DrPizza: > OK, I'm still a bit unclear about how > you wish the priorities to work. If > the pool is currently running a task > of type A with maximal concurrency of > 1 and low priority, and it gets given > a new task also of type A (and maximal > concurrency 1), but this time with a > high priority, what s...
Distributed caching with .NET 2.0+ ?
|caching|asp.net|
What is the best approach to implement distributed caching with .NET?
|asp.net|caching|
What is the best approach to implement distributed caching with .NET? Edit: I was looking for a general caching schema for internal and external applications
Inner Joins require that a record with a related ID exist in the joined table. Outer Joins will return records for the left side even if nothing exists for the right side. For instance you have a Orders and a OrderDetails table. They are related by an "OrderID" Orders - OrderID - CustomerName Order...
%ld see [http://www.cplusplus.com/reference/clibrary/cstdio/printf.html][1] [1]: http://www.cplusplus.com/reference/clibrary/cstdio/printf.html
Here are a few sites on blogspot that may help. They have RSS feeds that will hopefully be easier to consume than paging through PDFs. - [http://descriptor-tips.blogspot.com/][1] - [http://descriptors.blogspot.com/][2] [1]: http://descriptor-tips.blogspot.com/ [2]: http://descriptors.blogspot.com/
Names -- you can try yourselves or ask friends/customers about what they are thinking about when listen/use your product (I don't know correct English word for that -- if two things have something in common they are associated?). Or, depends on what kind of product is it, ask someone with unlimited imagination -- ki...
What's a good way to encapsulate data access with PHP/MySQL?
|php|mysql|database|lamp|
Most of my experience is on the MSFT stack, but I am now working on a side project, helping someone with a personal site with cheap hosting that is built on the LAMP stack. My options for installing extras are limited, so I'm wondering about how to write my data access code without embedding raw queries in the .php fi...
|php|database|mysql|lamp|
Most of my experience is on the MSFT stack, but I am now working on a side project, helping someone with a personal site with cheap hosting that is built on the LAMP stack. My options for installing extras are limited, so I'm wondering about how to write my data access code without embedding raw queries in the .php fi...
Unless it's a business requirement, I suggest you move the connection string from the command line to the package and use a package configuration to define the path to the Excel file (in order not to hard-code it). 1. Define a variable *@ExcelPath*. 2. Use connection's *Expression* property to construct a connectio...
Unless it's a business requirement, I suggest you move the connection string from the command line to the package and use a package configuration to define the path to the Excel file (in order not to hard-code it). This will make it easier to maintain. 1. Define a variable *@ExcelPath*. 2. Use connection's *Express...
The approach I favour is the following setup (Actually assuming you are in a .NET project): - CruiseControl.NET. - NANT tasks for each individual step. Nant.Contrib for alternative CC templates. - NUnit to run unit tests. - NCover to perform code coverage. - FXCop for static analysis reports. - Subv...
Consolas all the way.
You're doing it wrong if you are generating pixmaps inside any of the delegate methods (paint, draw...). Try to generate the thumbnails only once (on worker thread or maybe not even at runtime, if possible) and have the delegate just display them for the appropriate role. If you do it at runtime display a default...
regex formats
|regex|
I've seen a lot of commonality in regex capabilities of different regex-enabled tools/languages (e.g. perl, sed, java, vim, etc), but I've also many differences. Is there a *standard* subset of regex capabilities that all regex-enabled tools/languages will support? How do regex capabilities vary between tools/langua...
|language-agnostic|regex|
Include an example of how making Java code more groovy takes away soooo much code. Wait for them to pick their jaws up off of the floor before continuing. Scott Davis has a simple example at the beginning of Groovy Recipes that takes 35 lines of Java or 3 lines of Groovy.
<http://en.wikipedia.org/wiki/Comparison_of_regular_expression_engines> Even more detailed: <http://www.regular-expressions.info/refflavors.html>
If you do an alert of `arrow` what does it return? Does it return the exact string that you're matching against? If you are getting the actual characters `'⇓'` and `'⇑'` you may have to match it against `"\u21D1"` and `"\u21D3"`. Also, you may want to try `&#8657;` and `&#8659;` since not all browsers support those ...
If you use javascript to open the popup you can use something like this. var newWin = window.open(url); if(!newWin || newWin.closed || typeof newWin.closed=='undefined') { //POPUP BLOCKED }
You should look into DBUnit, or try to find a PHP equivalent (there must be one out there). You can use it to prepare the database with a specific set of data which represents your test data, and thus each test will no longer depend on the database and some existing state. This way, each test is self contained and wi...
I have the exact same problem with my work and I find that the best idea is to have a PHP script to re-create the database and then a separate script where I throw crazy data at it to see if it breaks it. I have not ever used any Unit testing or suchlike so cannot say if it works or not sorry.
From [Mark Harrison][1] >And here's what works... >curl -s --cookie soba=. http://stackoverflow.com/users And for wget: wget --no-cookies --header "Cookie: soba=(LookItUpYourself)" http://stackoverflow.com/users/30/myProfile.html [1]: http://stackoverflow.com/questions/2815/#2878
If you can setup the database with a known quantity prior to running the tests and tear down at the end, then you'll know what data you are working with. Then you can use something like Selenium to easily test from your UI (assuming web-based here, but there are a lot of UI testing tools out there for other UI-flavo...
Don't overlook the compiler itself. Read the compiler's documentation and find all the warnings and errors it can provide, and then enable as many as make sense for you. Also make sure to tell your compiler to treat warnings like errors so you're forced to fix them right away. ("-Werror" on gcc) Also: "-Wall"...
A quick hack you can consider is doing a chmod on the file you're editing, save with vim, and then chmod back to what the file was originally. ls -l test.file (to see the permissions of the file) chmod 777 test.file [This is where you save in vim] chmod xxx test.file (restore the permissions you f...
Emacs is a wonderful text editor. It has huge power once you become a power user. You can access a shell, have as many files open as you want in as many sub-windows and an extremely powerful scripting support that lets you add all kinds of neat features. I have been using a ruby-mode which adds syntax highlighting...
Another option is running the appropriate `vars` batch file from a regular command prompt. The name and location varies from version to version. For VS2003, I believe it's `C:\Program Files\Microsoft Visual Studio.NET 2003\Vc7\bin\vcvars32.bat`
looping and average in c++
|c++|
Programming Student here...trying to work on a project but I'm stuck. The project is trying to find the miles per gallon per trip then at the end outputting total miles and total gallons used and averaging miles per gallon How do I loop back up to the first question after the first set of questions has been aske...
You will have to tell us the type of data you are given. As per your last question: remember that an average can be calculated in real time by either storing the sum and the number of data points (two numbers), or the current average and the number of data points (again, two numbers). For instance: class A...
I'd drop the '-l' If all you plan to run the the system is this build I *think* the -j 4 does what you want. Based on my memory, if you have anything else running (crond?), that can push the load average over 4. [GNU make ref][1] [1]: http://sunsite.ualberta.ca/Documentation/Gnu/make-3.79/html_chapter/m...
Here's my really naive solution. Your mileage may vary. Keep a sign bit, which is `sign(dividend) ^ sign(divisor)`. (Or `*`, or `/`, as you please. Basically, negative if either one is negative, positive if none or both are negative.) Then, call the unsigned division function on the absolute values of both. Then ...
Here's my really naive solution. Your mileage may vary. Keep a sign bit, which is `sign(dividend) ^ sign(divisor)`. (Or `*`, or `/`, if you're storing your sign as 1 and -1, as opposed to false and true. Basically, negative if either one is negative, positive if none or both are negative.) Then, call the unsigned...
Here's my really naive solution. Your mileage may vary. Keep a sign bit, which is `sign(dividend) ^ sign(divisor)`. (Or `*`, or `/`, if you're storing your sign as 1 and -1, as opposed to false and true. Basically, negative if either one is negative, positive if none or both are negative.) Then, call the unsigned...
The "<a href="http://wiki.class-dbi.com/wiki/Common_problems">common problems</a>" page on the <a href="http://wiki.class-dbi.com/wiki">Class::DBI wiki</a> has a <a href="http://wiki.class-dbi.com/wiki/Common_problems#Old_data_due_to_object_index">section</a> on this subject. The simplest solution is to disable the li...
Put an 'l' directly before the specifier. unsigned long n; printf("%ld", n);
Common lisp idiom - is there a better way?
|lisp|
I find myself doing this sort of thing all the time. I've been considering writing a macro/function to make this sort of thing easier, but it occurs to me that I'm probably reinventing the wheel. Is there an existing function that will let me accomplish this same sort of thing more succinctly? (defun remov...
Yes, SP1 is required. There are several bits of SP1 that Dynamic Data uses, notably the ASP.NET routing extensions and the new data annotation classes in System.ComponentModel.
Here's a small script I wrote for finding the total numbers of occurrence for different source code elements in ActionScript 3 code (this is written in Python simply because I'm familiar with it, while Perl would probably be better suited for a regex-heavy script like this): #!/usr/bin/python import s...
I really enjoy [IEEE Software][1] because it covers broader issues regarding software engineering. [1]: http://www.computer.org/portal/site/software/
Here's something I cooked up for something similar. It handles the following types of ranges: 1 single number 1-5 range -5 range from (firstpage) up to 5 5- range from 5 up to (lastpage) .. can use .. instead of - ;, can use both semicolon, comma, a...
I'd encapsulate similar fields into an object of its own with its own construction/validation logic. Say for example, if you've got * BusinessPhone * BusinessAddress * HomePhone * HomeAddress I'd make a class that stores phone and address together with a tag specifying wether its a "home" or a "business" ph...
I'd encapsulate similar fields into an object of its own with its own construction/validation logic. Say for example, if you've got * BusinessPhone * BusinessAddress * HomePhone * HomeAddress I'd make a class that stores phone and address together with a tag specifying wether its a "home" or a "business" ph...
Compare Regular Expression Flavors http://www.regular-expressions.info/refflavors.html
//author[contains(., 'Ritchie')]
/books/book/authors/author[contains(., 'Ritchie')] or //author[contains(., 'Ritchie')]
Use a class to signal the current state of the span. The html could look like this <h3 id="headerId"><span class="upArrow">&uArr;</span>Header title</h3> Then in the javascript you do $( '.upArrow, .downArrow' ).click( function( span ) { if ( span.hasClass( 'upArrow' ) ) span.te...
In raw Javascript, the best that you can do is using the few asynchronous calls (xmlhttprequest), but that's not really threading and very limited. [Google Gears][1] adds a number of APIs to the browser, some of which can be used for threading support. [1]: http://gears.google.com/
**Problem:** Insert + or - sign anywhere between the digits 123456789 in such a way that the expression evaluates to 100. The condition is that the order of the digits must not be changed. e.g.: 1 + 2 + 3 - 4 + 5 + 6 + 78 + 9 = 100 **Programming Problem:** Write a program in your favorite language which outputs...
You also might want to allow for whitespace before the "p" in the p tag. Not sure how often you'll run into this, but < p> is perfectly valid HTML.
my boss has. it was a real pain. permissions issues. he used the built in sharepoint backup tool. I can more details tomorrow if need. I'll check back.
my boss has. it was a real pain. permissions issues. he used the built in sharepoint backup tool. I can more details tomorrow if need. I'll check back. I'm back. Here's the steps he used. - install an instance of sql server 2005 on the sql 2000 box (side-by-side) - back up the sharepoint site usin...
my boss has. it was a real pain. permissions issues. he used the built in sharepoint backup tool. I can more details tomorrow if need. I'll check back. I'm back. Here's the steps he used. - install an instance of sql server 2005 on the sql 2000 box (side-by-side) - back up the sharepoint site usin...
Unless it's a business requirement, I suggest you move the connection string from the command line to the package and use a package configuration to define the path to the Excel file (in order not to hard-code it). This will make it easier to maintain. 1. Define a variable *@ExcelPath*. 2. Use connection's *Express...
Unless it's a business requirement, I suggest you move the connection string from the command line to the package and use a package configuration to define the path to the Excel file (in order not to hard-code it). This will make it easier to maintain. 1. Define a variable *@ExcelPath*. 2. Use connection's *Express...
RE @Wilka: Actually, bitsets are supported by C/C++ in a way that doesn't require you to do your own masking. I don't remember the exact syntax, but it's something like this: struct MyBitset { bool firstOption:1; bool secondOption:2; bool thirdOption:3; int fourBitNumber:4; }...
RE @Wilka: Actually, bitsets are supported by C/C++ in a way that doesn't require you to do your own masking. I don't remember the exact syntax, but it's something like this: struct MyBitset { bool firstOption:1; bool secondOption:1; bool thirdOption:1; int fourBitNumber:4; }...
> I have a Powerbook g4 running Leopard and would very much like to do dev on it Not sure what sort of application you are developing, but if you jailbreak your iPhone, you can: - develop applications using Ruby/Python/Java which won't require compiling at all - compile on the phone(!), as there is an GCC/Toolc...
I recommend mixing in a few packages from Debian Unstable feeds. They tend to be pretty stable, despite the name. They're also very up to date.
> What is your static memory manager actually doing? Unless it is doing something unsafe (P/Invoke, unsafe code), the behaviour you are seeing is a bug in your program, and not due to the behaviour of the CLR. I was in fact speaking about unsafe pointers. What I wanted was something like Marshal.AllocHGlobal, though...
onnodb, The PostgreSQL ODBC driver is [actively developed][1] and an Access front-end combined with PostgreSQL server, in my opinion makes a great option on a LAN for rapid development. I have been involved in a reasonably big system (100+ PostgreSQL tables, 200+ Access forms, 1000+ Access queries & reports) and i...
You cannot marshal a Lambda or Proc. This is because both of them are considered closures which means they close around the memory on which they were defined and can reference it. (In order to marshal them you'd have to Marshal all of the memory they could access at the time they were created.) As Gaius pointed out ...
Can you get a real count of the number of files? Does it fall very near a 2^n boundry? Could you simply be running out of RAM to hold all the file names? I know that in windows at least file system performance would drop dramatically as the number of files in the folder went up, but I thought that linux didn't suf...
Personally, I'm hoping it has less of an impact on web developers and more of an impact on browser developers. Some of the features are really nice, and while the process-oriented approach to separation of tabs will probably make it hefty compared to other browsers, I like the ideas behind it. My guess is it's goin...
No. Inode limits are per-filesystem, and decided at filesystem creation time. You could be hitting another limit, or maybe 'ls' just doesn't perform that well. Try this: tune2fs -l /dev/DEVICE | grep -i inode It should tell you all sorts of inode related info.
Perhaps [Runtime#addShutdownHook](http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Runtime.html#addShutdownHook%28java.lang.Thread%29) ?
Regarding the [excerpt from the csharp faq][1]: Most of the problems listed there were solved for VB.Net (specifically the intellisense and xml comments issues), meaning they're really red herrings-- _there is code available to the C# team that will solve the problem._ Another reason has to do with forcing a ...
Regarding the [excerpt from the csharp faq][1]: Most of the problems listed there were solved for VB.Net (specifically the intellisense and xml comments issues), meaning they're really red herrings-- _there is code available to the C# team that will solve the problem._ Another reason has to do with forcing a ...
Emacs is a wonderful text editor. It has huge power once you become a power user. You can access a shell, have as many files open as you want in as many sub-windows and an extremely powerful scripting support that lets you add all kinds of neat features. I have been using a ruby-mode which adds syntax highlighting...
Emacs is a wonderful text editor. It has huge power once you become a power user. You can access a shell, have as many files open as you want in as many sub-windows and an extremely powerful scripting support that lets you add all kinds of neat features. I have been using a ruby-mode which adds syntax highlighting...
**Using attributes, child config sections and constraints** There is also the possibility to use attributes which automatically takes care of the plumbing, as well as providing the ability to easily add constraints. I here present an example from code I use myself in one of my sites. With a constraint I dictate t...
Your code is testing for the down arrow and then setting it to the down arrow. It's never an up arrow. (And .text() would be more appropriate.) Edit: Also, maybe you're not getting an exact match because the browser is lower-casing the entity or something. Try using a carat (^) and lower-case "v" just for testing...
Maybe you're not getting an exact match because the browser is lower-casing the entity or something. Try using a carat (^) and lower-case "v" just for testing. Edited - My first theory was plain wrong.
Quite a few online sites for competitive programming are full of sample questions/challenges, sorted by 'difficulty'. Quite often, the simpler categories in the 'algorithms' questions would suit you I think. For example, check out [TopCoder][1] (algorithms section)! Apart from that, 2 samples: 1. You are give...
There's no true threading in JavaScript. JavaScript being the malleable language that it is, does allow you to emulate some of it. Here's an example I came across the other day. http://www.neilmix.com/2007/02/07/threading-in-javascript-17/
I've been working on [http://projecteuler.net/][1] [1]: http://projecteuler.net/
G'day, I think if you took the grep regexp grammar, not the egrep one, or the sed regexp grammar and used that you would be using a safe subset across many platforms and tools. About the only thing that may bite you then is when you go shift between regexp implementations using finite decision automata and non-fi...
You can put the Foo instances in a list and compare the objects with what you read: var arrFoos = new Foos[]{...}; // what you expect var expectedFoos = new List<Foo>(arrFoos); // make a list from the hardcoded array of expected Foos var readerResult = ReadEntireList(reader); // read everything from ...
If you are using asp.net you can use the [defaultButton][1] attribute on the form. [1]: http://msdn.microsoft.com/en-us/library/system.web.ui.htmlcontrols.htmlform.defaultbutton(VS.80).aspx