instruction
stringlengths
0
30k
There are a number of examples and libraries out there you can search on - a couple already listed (A List Apart is a must read). I've used the [Yahoo User Interface Library (YUI)][1] on my last couple of sites and really like it. Yahoo completely supports it and it's quick to understand and use. Here is there [CS...
My guess is that MVC is an alternative solution to "classic" Webform programming if you are interested in things like TDD, REST, write your own HTML, and so on. For the moment developers are still fond of D&D development style, because it allows quick development of applications, even then it becomes unmaintainable. ...
Something great to play around with, though not a project, is [The Python Challenge](http://pythonchallenge.com). I've found it quite useful in improving my python skills, and it gives your brain a good workout at the same time.
This is one thing that batch scripting just does not do well. The script **morechilli** linked to will work for some files, but unfortunately it will choke on ones which contain characters such as pipes and ampersands. VBScript is a better built-in tool for this task. See this article for an example: [http://ww...
How can I reimplement external pop-up jQuery code in Prototype?
|javascript|jquery|prototype|pop-ups|
I have this code in jQuery, that I want to reimplement with the prototype library. // make external links open in popups // this will apply a window.open() behaviour to all anchor links // the not() functions filter iteratively filter out http://www.foo.com // and http://foo.com so they don't tri...
You shouldn't for security reasons. Especially if cookies are in play here. It leaves you wide open to cookie-based replay attacks. Either way, you should use Apache control rules to tune it then you can test for HTTPS being enabled and redirect as-needed where needed. You should redirect to the pay page onl...
See the oft-linked [Working Effectively with Legacy Code][1]. See the sections titled "My Application Is All API Calls" and "My Project is Not Object-Oriented. How Do I Make Safe Changes?". In C/C++ world (my experience) the best solution in practice is to use the linker "seam" and link against test doubles for...
As mentioned in other answers, you can use either the ifconfig command or the ip command. ip is a much more robust command, and I prefer to use it. A full script which loops through a full class C subnet adding the IP, doing stuff, then removing it follows. Note that it doesn't use .0 or .255, which are the network ...
The Data Type varchar(MAX) > In SQL Server 2000 and SQL Server 7, a > row cannot exceed 8000 bytes in size > ... To solve this problem, Microsoft > introduced the VARCHAR(MAX), > NVARCHAR(MAX), and VARBINARY(MAX) data > types in SQL Server 2005. These data > types can hold the same amount of data > BLOBs can...
How to implement thread safe reference counting in C++
|c++|multithreading|atomic|reference-counting|
How do you implement an **efficient and thread safe reference counting system** on X86 CPUs in the C++ programming language? I always run into the problem that the **critical operations not atomic**, and the available X86 Interlock operations are not sufficient for implementing the ref counting system. The follo...
Call `IsWow64Process` to find out if your 32-bit process is running in WOW64 on a 64-bit operating system. You can call `GetNativeSystemInfo` to find out exactly what it is: the `wProcessorArchitecture member` of `SYSTEM_INFO` will be `PROCESSOR_ARCHITECTURE_INTEL` for 32-bit, `PROCESSOR_ARCHITECTURE_AMD64` for x64 and...
The storage location of the data will be implementation dependent. However, the meaning of **static** is "internal linkage". Thus, the symbol is *internal* to the compilation unit (foo.c, bar.c) and cannot be referenced outside that compilation unit. So, there can be no name collisions.
It depends on the platform and compiler that you're using. Some compilers store directly in the code segment. Static variables are always only accessible to the current translation unit and the names are not exported thus the reason name collisions never occur.
An easy way to determine if a string is a valid identifier for a class or variable is to call the static method System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string value)
An easy way to determine if a string is a valid identifier for a class or variable is to call the static method System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string value)
Physics of a snooker game
|physics|
Anyone can point me to any info regarding physics of a snooker game, if possible more about the ball colisions? I would like to make a game and I need some help about the physics... thanks!
Its almost 100% the runtime. While it is possible for some basic compilation tricks to make it into the Java compiler itself, I don't believe there are any significant improvements between Java 1.5 and 1.6.
As Any must be referring to Windows API declarations, as it can't be used in variable declarations. You can use overloading: just repeat the declarations for each different data type you wish to pass. VB.NET picks out the one that matches the argument you pass in your call. This is better than As Any was in VB6 bec...
Is there a Problem with JPA Entities, Oracle 10g and Calendar Type properties?
|java|oracle-database|jpa|ejb-3.0|
I'm experiencing the following very annoying behaviour when using JPA entitys in conjunction with Oracle 10g. Suppose you have the following entity. @Entity @Table(name = "T_Order") public class TOrder implements Serializable { private static final long serialVersionUID = 22357423023771735...
How can I cause subversion to check out projects from other repositories?
|tortoisesvn|svn|
I recently was working with a subversion project that checked out code not only from the repository I was working with, but also from a separate repository on a different server. How can I configure my repository to do this? I'm using the subversion client version 1.3.2 on Linux, and I also have access to Tortois...
|tortoisesvn|svnexternal|svn|
Not really a feature, but an amusing trick I discovered recently in some Web page: class Example { public static void main(String[] args) { System.out.println("Hello World!"); http://Phi.Lho.free.fr System.exit(0); } } is a valid Java progr...
SQL Server sys.databases log_reuse_wait question
|sql-server|database|
I was investigating the rapid growth of a SQL Server 2005 transaction log when I found that transaction logs will only truncate correctly - if the sys.databases "log_reuse_wait" column is set to 0 - meaning that nothing is keeping the transaction log from reusing existing space. One day when I was intending to b...
I was investigating the rapid growth of a SQL Server 2005 transaction log when I found that transaction logs will only truncate correctly - if the sys.databases "log_reuse_wait" column is set to 0 - meaning that nothing is keeping the transaction log from reusing existing space. One day when I was intending to b...
|sql-server|database|transactions|
Unfortunately, Eclipse's plugin search doesn't work for referenced plugins. To do these searches I created a workspace that contains all the plugins from my eclipse install as source folders. I just open the workspace and perform my plugin search there. Just open the search dialog and choose plugin.
CSS can take elements _out of the normal flow_ and position them anywhere, in any manner you want. But it cannot _create a new flow_. By this I mean that you could position the last item first and the first item last, but when you do that you can't position them relative to each other. You have to know for your self...
It sounds like you are giving away some read consistency here ie: it will be possible for the contents of your temporary table to be out of sync with the source data, if you have concurrent modification data modification. Without knowing the requirements, nor complexity of what you want to achieve. I would attempt ...
Dependency Injection or Inversion of Control. Alternatively, use the Abstract Factory design pattern for all the objects that you create. When you are in Unit Test mode, inject an Testing Factory which will tell you what are you creating, then include the assertion code in the Testing Factory to check the results (...
As mentioned in other answers, you can use either the ifconfig command or the ip command. ip is a much more robust command, and I prefer to use it. A full script which loops through a full class C subnet adding the IP, doing stuff, then removing it follows. Note that it doesn't use .0 or .255, which are the network ...
Knowing grep and ruby made it possible to narrow down a problem, and verify the fix for, an issue involving tons of java exceptions on some production servers. Because I threw the solution together in ruby, it was done (designed, implemented, tested, run, bug-fixed, re-run, enhanced, results analyzed) in an afternoon i...
for(Iterator<String> i = someList.iterator(); i.hasNext(); ) { String item = i.next(); System.out.println(item); } Note that if you need to use i.remove(); in your loop, or access the actual iterator in some way, you cannot use the for( : ) idiom, since the actual Iterator is merely inferred.
for(Iterator<String> i = someList.iterator(); i.hasNext(); ) { String item = i.next(); System.out.println(item); } Note that if you need to use i.remove(); in your loop, or access the actual iterator in some way, you cannot use the for( : ) idiom, since the actual Iterator is merely inferred. ...
World's First Programming _Language_ ??
|history|language|
OK -- a bit of an undefined question (is the pattern of plugs in an Eniac plugboard a language ??) but contenders include: - Konrad Zuse's PlanKalkul (1940s) - never implemented (generally accepted as the first). - Whatever Ada Lovelace (1840s) programmed in (not Ada) -- if she is the first ...
This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!): [http://www.artima.com/forums/flat.jsp?forum=106&thread=204677][1] > **Testivus On Test Coverage** > > Early one morning, a programmer asked > the great master: > > “I am ready to write some unit tes...
This prose by Alberto Savoia answers precisely that question (in a nicely entertaining manner at that!): [http://www.artima.com/forums/flat.jsp?forum=106&thread=204677][1] > **Testivus On Test Coverage** > > Early one morning, a programmer asked > the great master: > > “I am ready to write some unit tes...
McAfee Secure is not a solution. The service they provide is a joke. See below: http://blogs.zdnet.com/security/?p=1092&tag=rbxccnbzd1<br> http://blogs.zdnet.com/security/?p=1068&tag=rbxccnbzd1<br> http://blogs.zdnet.com/security/?p=1114&tag=rbxccnbzd1
Instead of trying to build using MSBUILD (assumption), build the solution or project using DEVENV.EXE. The command line is something along the lines of: DEVENV MySolutionFile.sln /build DEBUG /project SetupProject.vdproj You can change the DEBUG to RELEASE or any other build configuration you've set up. You can a...
how can you parse an excel (.xls) file stored in a varbinary in MS SQL 2005?
|sql|excel|xls|etl|stored-procedures|
**problem** how to best parse/access/extract "excel file" data stored as binary data in an SQL 2005 field? (so all the data can ultimately be stored in other fields of other tables.) **given** - a standard excel (".xls") file (native format, not comma or tab separated) - file is stored raw in a <code>v...
|sql|excel|stored-procedures|etl|xls|
**problem** how to best parse/access/extract "excel file" data stored as binary data in an SQL 2005 field? (so all the data can ultimately be stored in other fields of other tables.) **background** basically, our customer is requiring a large volume of verbose data from their users. unfortunately, our custo...
I honestly loved the book [Programming Python.][1] It has a large assortment of small projects, most of which can be completed in an evening at a leisurely pace. They get you acquainted with most of the standard library and will likely hold your interest. Most importantly these small projects are actually useful in a...
You may want to look at [CSS Zen Garden][1] for excellent examples of how to do what you want. Plenty of sample layouts via the links on the right to see the various way to move everything using strictly CSS. [1]: http://www.csszengarden.com/
Your connection string should be defined in your Web.Config, and if you move your database to a different server, it's just a matter of modifying the web.config entry. As long as you keep the connection string name the same, the BindingSource object will pick up the new value from the config.
Your connection string should be defined in your Web.Config, and if you move your database to a different server, it's just a matter of modifying the web.config entry. As long as you keep the connection string name the same, the BindingSource object will pick up the new value from the config.<hr>**edit**<br><br> In tr...
MS SQL Server 2005 - How to Auto Increment a field (not primary key)
|sql-server|
I would like to automatically increment a field when a row is updated. Currently I am doing it via the sql update statement. i.e "UPDATE tb_users SET name = @name, incrementID = incrementID + 1 ..... I'm wondering how I can do this automatically. Any help muchos appreciated. Thanks
I would like to automatically increment a field named `incrementID' anytime any field in any row within the table named 'tb_users' is updated. Currently I am doing it via the sql update statement. i.e "UPDATE tb_users SET name = @name, incrementID = incrementID + 1 .....WHERE id = @id; I'm wondering how I can do t...
If you're just looking to tell your users that < and > are not to be used BUT, you don't want the entire form processed/posted back (and lose all the input) before-hand could you not simply put in a validator around the field to screen for those (and maybe other potentially dangerous) characters?
Rails is more mainstream, but less flexible. Grails is still changing rapidly, doesn't have the same developer ecosystem, and has far crappier documentation, but it will work in some situations Rails won't.
Rails is more mainstream, but less flexible. Grails is still changing rapidly, doesn't have the same developer ecosystem, and the documentation isn't nearly as mature, but it will work in some situations Rails won't.
The big number is the standard JS time new Date(1221644506800) Wed Sep 17 2008 19:41:46 GMT+1000 (EST)
You need to set `content-disposition` in the HTTP header. [This Microsoft Knowledge Base entry][1] has more detail on how to do this. [1]: http://support.microsoft.com/kb/260519
It depends on what you are using to create the installer. Most of them have a command line version that you can run, so you would need to add a target (or at least some tasks in an existing target) that execute that command line builder tool. Optionally, if you install the NAntContrib project there are new tasks that l...
The only way to build a Visual Studio setup project is through Visual Studio. You will need to have a copy of VS installed on the build machine and run it as a command line tool (exec devenv.exe) with the appropriate parameters (which should be the build mode (release or debug) and the project name to build, there migh...
Some compilers have different sizes for int on different platforms (not C# specific) Some coding standards (MISRA C) requires that all types used are size specified (i.e. Int32 and not int). It is also good to specify prefixes for different type variables (e.g. b for 8 bit byte, w for 16 bit word, and l for 32 bi...
Some compilers have different sizes for int on different platforms (not C# specific) Some coding standards (MISRA C) requires that all types used are size specified (i.e. Int32 and not int). It is also good to specify prefixes for different type variables (e.g. b for 8 bit byte, w for 16 bit word, and l for 32 bi...
Can't you use the keyword `partial` for splitting the code for a class into many files?
Double postback problem
|asp.net|.net-1.1|
I have a ASP.NET 1.1 application, and I'm trying to find out why when I change a ComboBox which value is used to fill another one (parent-child relation), two postbacks are produced. I have checked and checked the code, and I can't find the cause. Here are both call stacks which end in a page_load First postba...
[Game Maker][1] might be another approach. You can start simple with easy drag and drop development, and then introduce more advanced programming as you go. The book [The Game Maker's Apprentice: Game Development for Beginners][2] has a number of sample games and takes you through the steps required to make them. ...
This is a fairly normal scenario in multi-tenant SAAS applications. Both approaches have their pros and cons. Search on best practices for multi-tenant SAAS (software as a service) and you will find tons of stuff to ponder upon.
I would suggest avoiding anything which involves hacking the YUI files. You need to be able to update external libraries in the future and if your site relies on edited versions there is a good chance it will get cocked up. I think this is general good practice for any 3rd party library you use. So I thought [this](...
State of Registers After Bootup
|hardware|boot|
This is a low level question. For a little bit of context, I'm working on a boot loader on an x86 machine. When the BIOS copies the contents of the MBR to 0x7c00 and jumps to that address, is there a standard meaning to the contents of the registers? Do the registers have standard values? I know that the segment ...
This is an ideal use of Regular Expressions. Check out [this helpful website](http://regular-expressions.info), the [.Net Regular Expressions class](http://msdn.microsoft.com/en-us/library/system.text.regularexpressions.regex.aspx), and this very helpful book [Mastering Regular Expressions](http://books.google.com/book...
One good argument for keeping them in separate databases is that its easier to scale (you can simply have multiple installations of the server, with the client databases distributed across the servers). Another argument is that once you are logged in, you don't need to add an extra where check (for client ID) in eac...
Start here - I actually think it's among the best Software Dev books that I've read. [Expert Spring MVC And Web Flow][1] Learn the new Annotation-based configuration for MVC classes. This is part of Spring 2.5. Using Annotation-based classes is going to make writing Unit tests a heck of a lot easier. Also being a...
A simple example from the book Dive Into Python works ok for me, [this](www.diveintopython.org/download/diveintopython-examples-5.4.zip) is the download link, the example is fileinfo.py. Don't know if it's the best, but it can do the basic job.
A simple example from the book Dive Into Python works ok for me, [this](http://www.diveintopython.org/download/diveintopython-examples-5.4.zip) is the download link, the example is fileinfo.py. Don't know if it's the best, but it can do the basic job.
A simple example from the book Dive Into Python works ok for me, [this](http://www.diveintopython.org/download/diveintopython-examples-5.4.zip) is the download link, the example is fileinfo.py. Don't know if it's the best, but it can do the basic job. The entire book is available online [here](http://www.diveintopyt...
Quality Control / Log Monitoring
|monitoring|logging|
One of the articles I really enjoyed reading recently was [Quality Control by Last.FM][1]. In the spirit of this article, I was wondering if anyone else had favorite monitoring setups for web type applications. Or maybe if you don't believe in Log Monitoring, why? I'm looking for a mix of opinion slash experience here ...
> If you're looking for a way of applying the "static" keyword to a class, like you can in C# for example static classes are just the compiler hand-holding you and stopping you from writing any instance methods/variables. If you just write a normal class without any instance methods/variables, it's the same thing...
The button's onclick should (I think) only fire if the button is actually clicked (or when the focus is on it and the user clicks enter), unless you've added logic to change that. Is the addition of the extra textbox possibly changing the tab order of your elements (perhaps making the button the default control in t...
|history|language|
OK -- a bit of an undefined question (is the pattern of plugs in an Eniac plugboard a language ??) but contenders include: - Konrad Zuse's PlanKalkül (1940s) - never implemented (generally accepted as the first). - Whatever Ada Lovelace (1840s) programmed in (not Ada) -- if she is the first ...
World's First Computer Programming _Language_ ??
|language|history|
How to make Swing scroll with "ensureIndexIsVisible"?