instruction
stringlengths
0
30k
Accessing html parameter in PHP
|php|
I'm trying to do a simple test php script for sessions. Basically it increments a counter (stored in $_SESSION) every time you refresh that page. That works, but I'm trying to have a link to destroy the session which reloads the page with the ?destroy=1 parameter. I've tried a couple of if statements to see if that par...
@ Burton: I think he meant the other way, at least from the example on the linked page: Chronic.parse('tomorrow') #=> Mon Aug 28 12:00:00 PDT 2006 Chronic.parse('monday', :context => :past) #=> Mon Aug 21 12:00:00 PDT 2006 Chronic.parse('this tuesday 5:00') ...
[Dependency Walker][1] is super useful for finding out which dll is missing from the installer. Once you know the dll, you can find what merge module it is in using the [Merge Module Finder][2]. [1]: http://www.dependencywalker.com/ [2]: http://www.installsite.org/pages/en/msi/msm.htm
What is the "best" simple instal system for XP/Vista?
|windows|installation|
Heavy emphasis on simple. I've never made an installer and I'd rather not have to learn much. A system that I could hand a pile of files to and it would make some smart guesses about where to put them would be ideal. Go ahead and answer the general question. However In my cases I'm stuck with some extra constrain...
What is the "best" simple install system for XP/Vista?
How I hide empty Velocity variable names ?
|java|templates|struts|velocity|
I am using Struts + Velocity in a Java application, but after I submit a form, the confirmation page (Velocity template) shows the variable names instead an empty label, like the Age in following example: > **Name**: Fernando > **Age**: {person.age} > **Sex**: Male I would like to know how to hide it!
Eric Z Beard: > the activity date is meant to indicate the local time zone, but not a specific one Okay - back to the drawing board. Try this: where t.TheDateINeedToCheck BETWEEN ( dateadd(hh, (tz.Offset + ISNULL(ds.LocalTimeZone, 0)) * -1, @ActivityDate) AND dateadd(hh, (tz.Offs...
[InnoSetup][1] or [NSIS][2], whichever seems easier to you. [ISTool][3] is a nice GUI tool for InnoSetup which makes creating setup scripts even easier. [1]: http://www.jrsoftware.org/ [2]: http://nsis.sourceforge.net/ [3]: http://www.istool.org
As long as a MySQL dump file doesn't exceed the [SQLite](http://www.sqlite.org/lang.html) query language, you should be able to migrate fairly easily: tgl@moto~$ mysqldump old-database > old-database-dump.sql tgl@moto~$ sqlite3 -init old-database-dump.sql new-database I haven't tried this myself...
As long as a MySQL dump file doesn't exceed the [SQLite](http://www.sqlite.org/lang.html) query language, you should be able to migrate fairly easily: tgl@moto~$ mysqldump old-database > old-database-dump.sql tgl@moto~$ sqlite3 -init old-database-dump.sql new-database I haven't tried this myself. _U...
I thin the only real problem is that it makes the XML harder to read. e.g. <Something> <Contains> <An> <Address>15 Sample St Example Bay Some Country</Address> </An> </Contains> </Something> If pretty XML isn't a concern, I'd probabl...
I think the only real problem is that it makes the XML harder to read. e.g. <Something> <Contains> <An> <Address>15 Sample St Example Bay Some Country</Address> </An> </Contains> </Something> If pretty XML isn't a concern, I'd probab...
First of all, [here's a great article with tips on unit testing][1]. Secondly, I found a great way to avoid making tons of changes in old code is to just refactor it a little until you can test it. One easy way to do this is to make private members protected, and then override the protected field. For example, let...
Large File Download
|java|browser|flash|silverlight|
Internet Explorer has a file download limit of 4GB (2 GB on IE6) (More info here: [http://support.microsoft.com/kb/298618][1]) I am working on a site that will allow the user to download very large files (up to and exceeding 100GB) What is the best way to do this ***without using FTP***. I don't think Flash or...
|java|flash|browser|silverlight|
Internet Explorer has a file download limit of 4GB (2 GB on IE6). Firefox does not have this problem (haven't tested safari yet) (More info here: [http://support.microsoft.com/kb/298618][1]) I am working on a site that will allow the user to download very large files (up to and exceeding 100GB) What is the best...
|java|flash|silverlight|browser|
Internet Explorer has a file download limit of 4GB (2 GB on IE6). Firefox does not have this problem (haven't tested safari yet) (More info here: [http://support.microsoft.com/kb/298618][1]) I am working on a site that will allow the user to download very large files (up to and exceeding 100GB) What is the best...
Yup, SVN for preference unless you really need git's particular features. SVN is hard enough; It sounds like git is more complicated to live with. You can get hosted svn from people like [Beanstalk](http://www.beanstalkapp.com/) - unless you have in-house Linux people, I'd really recommend it. Things can go wrong horri...
Try this: CREATE function [SplitWordList] ( @list varchar(8000) ) returns @t table ( Word varchar(50) not null, Position int identity(1,1) not null ) as begin declare @pos int, @lpos int, @item varchar(100), @ignore varc...
I don't believe SQL Server has a built-in split function, so other than a UDF, the only other answer I know is to hijack the PARSENAME function: SELECT PARSENAME(REPLACE('Hello John Smith', ' ', '.'), 2) PARSENAME takes a string and splits it on the period character. It takes a number as it's second argumen...
Which language are using? It seems like pretty much all of them have built-in SQL escape functions that would be better to use. For example, PHP has [mysql_real_escape_string](http://us2.php.net/manual/en/function.mysql-real-escape-string.php) and [addslashes](http://us2.php.net/manual/en/function.addslashes.php).
I would also escape comments (double dash) --
You're better off using prepared statements with placeholders. Are you using PHP, .NET...either way, prepared statements will provide more security, but I could provide a sample.
I've looked at WorldPay and SecPay in the past; you need to know your onions to use them competently, I think - if you want really nice integration, at any rate.
No, unfortunately, and if you think about it, that information would be worthless anyway since the file could become locked the very next second (read: short timespan). Why specifically do you need to know if the file is locked anyway? Knowing that might give us some other way of giving you good advice.
Rockbox audio format
|c|audio|rockbox|
How do you specify a callback for rb->pcm_play_data()?
I was just listening to a Podcast from Scott Hanselman this morning, where he talks about internationalization, especially the really tricky things, like Turkish (with it's four i's) and Thai: [http://www.hanselminutes.com/default.aspx?showID=135][1] Also, Jeff Atwood had a post: [http://www.codinghorror.com/b...
The problem with a generic tool is that it is very difficult to come up with a set of rules that will only match against a genuine attack. SQL keywords are all English words and don't forget that the string DROP TABLE users; is perfectly valid in a form field that, for example, contains an answer to a pro...
You might be able to get some implementation ideas from the [Ruby/ProgressBar library][1], which generates text progress bars. I stumbled across it a couple of months back but haven't made any use of it. [1]: http://0xcc.net/ruby-progressbar/ "Ruby/ProgressBar"
Not sure if that helps (i found the ccnet Documentation somewhat unhelpful at times): [Using CruiseControl.NET with MSTest][1] [1]: http://confluence.public.thoughtworks.org/display/CCNET/Using+CruiseControl.NET+with+MSTest
In my opinion it is more a question of personal preference. nAnt is a great framework and MSBuild is almost as capable. With the ability to easily develop custom tasks (in both frameworks) you can accomplish almost anything that you need to do. I cannot answer the "still supported" portion of your questions, but I...
The easiest *distance* would of course be to just consider the colors as 3d vectors originating from the same origin, and taking the distance between their end points. If you need to consider such factors that green is more prominent in judging intensity, you can weigh the values. [ImageMagic](http://www.imagemag...
Well, since you can not have one part OSGi and one part non-OSGi you'll need to make your entire app OSGi. In its simplest form you make a single OSGi bundle out of your entire application. Clearly this is not a best practice but it can be useful to get a feel for deploying a bundle in an OSGi container (Equinox, Felix...
I think you put $_POST['destroy'] Instead of $_GET['destroy'] You need to use a form if you'd like to use a $\_POST variable. $\_GET variables are stored in the URL.
After the advice here, I have devised the following function in VB which creates passable, although not always perfect (if a company name and a suite line are given, it combines the suite and city) usable data. Please feel free to comment/refactor/yell at me for breaking one of my own rules, etc.: Public Fu...
I've had to do similar things a few times. The easiest approach for me has been to write a script that pulls from one data source and produces an output for the new data source. Just do a `SELECT *` query for each table in your current database, and then dump all the rows into an `INSERT INTO` query for your new data...
Microsoft loosened it's constraint on the Testing Platform by including it in Visual Studio 2008 Professional and allowing for the tests to be run from the command line with Framework 3.5 installed. We did a crossover for a client recently and so far they have been able to run all the tests without the need for NUnit.
What you really should be doing is converting your XML to a format that preserves white-space. So rather than seek to replace \n with &lt;br /&gt; you should wrap the whole block in a &lt;pre&gt; That way, your address is functionally preserved (whether you include line breaks or not) and the XSTL can choose whet...
Silverlight is the answer and Moonlight will be the linux equivalent and available shortly. We have done some beta testing on moonlight and found it fairly stable at with most of the Silverlight work we do.
The SharePoint team is currently working on MOSS extensions for VS 2008 which will allow this type of functionality. This was available in VS 2005 with MOSS extensions, but has to be run off Windows Server with a full MOSS installation and the correct permissions set.
Here's what I would do: - First time out... "we're going to do this project jointly. I'm going to write the tests and you're going to write the code. Pay attention to how I write the tests, coz that's how we do things around here and that's what I'll expect of you." - Following that... "You're done? Great! F...
In your algorithm using the list from 2 to the root of the integer, you can improve performance by only testing odd numbers after 2. That is, your list only needs to contain 2 and all odd numbers from 3 to the square root of the integer. This cuts the number of times you loop in half without introducing any more comp...
Here's the briefest explanation: A Turing Complete system means a system in which a program can be written that will find an answer (although with no guarantees regarding runtime or memory). So, if somebody says "my new thing is Turing Complete" that means in principle (although often not in practice) it could be...
Using .Equals is also a lot easier to *read*.
Direct connections.
|ip|private-ips|p2p|
From a [Joel's post on Copilot][1]: > Direct Connect! We’ve always done > everything we can to make sure that > Fog Creek Copilot can connect in any > networking situation, no matter what > firewalls or NATs are in place. To > make this happen, both parties make > outbound connections to our server, > whic...
Direct TCP/IP connections in P2P apps
|ip|p2p|private-ips|
What are the best keyboard macros for programming in windows?
|keyboard|macros|performance|
I like putting shortcuts of the form "g - google.lnk" in my start menu so google is two keystrokes away. Win, g. My eight or so most frequent applications go there. I also make links to my solution files I am always opening "x - Popular Project.lnk" Are there any better ways to automate opening frequently used...
What I usually do in these situations is to add a separate field called DisplayOrder or something similar. Everything defaults to, say, 1... You then sort by DisplayOrder and then the Name. If you want something higher or lower on the list, you can tweak the display order accordingly while keeping your normal IDs as...
Iterate over subclasses of a given class in a given module
|python|oop|
In Python, given a module X and a class Y, how can I iterate or generate a list of all subclasses of Y that exist in module X?
For shortcuts I use **Launchy** For macros I use **AutoHotKey** Others will suggest **SlickRun** for shortcuts also.
There are lots and lots of classic peak detection methods, any of which might work. You'll have to see what, in particular, bounds the quality of your data. Here are basic descriptions: 1. Between any two points in your data, (x(0),y(0)) and (x(n),y(n)), add up y(i+1)-y(i) for 0 <= i < n and call this T ("travel"...
I am not sure if MySql supports parameterized queries, if so, you should make an effort to go this route. This will ensure the users input can't do anything malicious. Otherwise some "bad" characters in addition to what you mentioned would be semicolon (;) and comments (-- and /* */).
Here is a UDF which will do it. It will return a table of the delimited values, haven't tried all scenarios on it but your example works fine. <pre><code> CREATE FUNCTION SplitString ( -- Add the parameters for the function here @myString varchar(500), @deliminator varchar(2) ) RETURNS @ReturnTable TAB...
Here is a UDF which will do it. It will return a table of the delimited values, haven't tried all scenarios on it but your example works fine. <pre><code> CREATE FUNCTION SplitString ( -- Add the parameters for the function here @myString varchar(500), @deliminator varchar(10) ) RETURNS @ReturnTable TA...
While semi-related to your question, it does not entirely fit the Powershell NetCmdlets motif. But I wanted to post it anyhow as I use it daily and it may help others. Simply making shift-control-c key combo into displaying the visual studio command prompt.
> PDF has the disadvantage of requiring the Adobe Reader I use [Foxit Reader][1] on Windows at home and at work. A lot smaller and very quick to open. Very handy when you are wondering what exactly a80000326.pdf is and why it is clogging up your documents folder. [1]: http://www.foxitsoftware.com/pdf/rd_intro.p...
How can I improve the edit-compile-test loop when developing a SharePoint workflow?
|sharepoint|workflows|
Recently I had to develop a SharePoint workflow, and I found the experience quite honestly the most painful programming task I've ever had to tackle. One big problem I had was the problems I encountered when I had to step through it in the debugger. There's an article on how to debug a SharePoint workflow [here][1] ...
|sharepoint|workflow|
For me, the concept of Haskell's algebraic data types always looked like polymorphism in OO-languages like C#. Look at the example from [http://en.wikipedia.org/wiki/Algebraic_data_types][1]: data Tree = Empty | Leaf Int | Node Tree Tree This could be implemented in C# as a ...
Yeah, you're going to want to do if( $_GET['destroy'] == 1 ) or if( isset($_GET['destroy']) )
Javascript troubleshooting tools in IE
|javascript|ie|
I use Firebug and the Mozilla JS console like crazy, but every now and then run into an IE-only Javascript bug, which everyone knows are really hard to locate even though you know theyre there (ex: error on line 724, when your source html only has 200 lines!) I would love to have a lightweight JS tool (a la firebug)...
|javascript|internet-explorer|
Structure of Projects in Version Control
I have worked with NSIS and getting past some of its minor complexities its a fantastic system. its free, offers tons of plugin ability and managed to do everything I needed to do.
I don't know the details of the Sony network camera and the server side software. But what do you mean by web-server functionality - is that the UI that get served up to the users in form of a HTML page? Or is it something more, like a server capturing the video stream and transcoding it? I think the direction you n...
One think to remember is the following ASP.NET directive. <%@ MasterType attribute="value" [attribute="value"...] %> [MSDN Reference][1] It will help you when referencing this.Master by creating a strongly typed reference to the master page. You can then reference your ListView without needing to CAST. ...
Of the suggestions so far, I'm partial to Kevin's, but it doesn't need to be absolute. I see a couple different options to use with __autoload. 1. Put all class files into a single directory. Name the file after the class, ie, `classes/User.php` or `classes/User.class.php`. 2. Kevin's idea of putting models int...
For C and Objective-C, you can also use the [LLVM][1] [Clang][2] static analyzer. It's Open Source and under active development. [1] http://LLVM.org [2] http://clang.LLVM.org
For C and Objective-C, you can also use the [LLVM][1]/[Clang][2] [Static Analyzer][3]. It's Open Source and under active development. [1]: http://llvm.org/ "LLVM - Low Level Virtual Machine" [2]: http://clang.llvm.org/ "LLVM Clang C & Objective-C Compiler" [3]: http://clang.llvm.org/StaticAnalysis.html ...
You can mark variables as nullable like this: $!variable If $variable is null, nothing will be rendered. If it is not null, its value will render as it normally would.
HSL and HSV are better for human color perception. According to [Wikipedia][1]: > It is sometimes preferable in working with art materials, digitized images, or other media, to use the HSV or HSL color model over alternative models such as RGB or CMYK, because of differences in the ways the models emulate how humans...
One method that might work for some cases would be to take the sql string that would run if you naively used the form data and pass it to some code that counts the number of statements that would actually be executed. If it is greater than the number expected, then there is a decent chance that an injection was attemp...
One little thing to keep in mind: In some countries (i.e. most of Europe), people do not have static IP Addresses, so blacklisting should not be forever.
You can try [TeraCopy](http://www.codesector.com/teracopy.php) or [RoboCopy](http://en.wikipedia.org/wiki/Robocopy).
It sounds like a backup-style tool may be what you're looking for. I've been using [SyncBack][1] (one of the versions is free). You could also try out [MS SyncToy][2] which tries to make moving, copying, syncing, etc. easy. If you really do copy just random files at random times, you could try [Total Copy][3] whi...
Now that I think about it, a Bayesian filter similar to the ones used to block spam might work decently too. If you got together a set of normal text for each field and a set of sql injections, you might be able to train it to flag injection attacks.
You really need to use a file Sync tool, like [SyncBackSE][1], [MS SyncToy][2], or even something like [WinMerge][3] will do the trick. I prefer SyncBack as it allows you to set up very explicit rules for just about every possible case and conflict, at least more so than the other two. With any of these you won't hav...
The physical database size doesn't matter. The number of records don't matter. In my experience the biggest problem that you are going to run in to is not size, but the number of queries you can handle at a time. Most likely you are going to have to move to a master/slave configuration so that the read queries can...