instruction
stringlengths
0
30k
nvarchar(max) ftw. because over complicating simple things is bad, mmkay?
There are many good answers here, so let me offer another way to look at it... There is no overkill when you are coding. It doesn't cost you anything to type @override, but the savings can be immense if you misspelled a method name or got the signature slightly wrong. Think about it this way: In the time you nav...
Here's a cool diagram by [Xach][1] that sums up the current situation. ![diagram explaining that there are nearly no VIM users that are also Lisp programmers and can also hack it to make it a good Lisp IDE... lousy alt text :)][2] [1]: http://xach.com [2]: http://lh5.ggpht.com/luismbo/SNKf4XeRoVI/AAAAAAAAA...
I can't speak to Mono's OSX support, but it is used for some pretty big projects in Linux, such as [Banshee](http://banshee-project.org) and [F-Spot](http://f-spot.org/). [Monodevelop](http://www.monodevelop.com/) is a pretty decent IDE available for it.
If you haven't seen pointers before, you're surely missing out on this mini-gem: void strcpy(char *dest, char *src) { while(*dest++ = *src++); }
I have done a lot of work with Coherence, which allowed several approaches to implementing a distributed lock. The naive approach was to request to lock the same logical object on all participating nodes. In Coherence terms this was locking a key on a Replicated Cache. This approach doesn't scale that well because the ...
Apply inline CSS to an ASP.NET server control
|asp.net|css|
Based on a simple test I ran, I don't think it's possible to put an inline <style> tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this. Is it possible to do this? I can see it being useful for quick protot...
Based on a simple test I ran, I don't think it's possible to put an inline <style> tag into an ASP.NET server control. The style did not end up rendering to the output HTML. Even if it was possible, I'm sure it is bad practice to do this. Is it possible to do this? I can see it being useful for quick protot...
I think it is very viable to learn C# using mono. I don't have hands-on experience with mono but the platform seems very stable and Mono is used in many [commercial and open source applications][1]. [1]: http://www.mono-project.com/Software
No. The static means that there will be one copy of VAL created for each source file it is included in. But it also means that multiple inclusions will not result in multiple definitions of VAL that will collide at link time. Without the static you would need to insure that only one source file defined VAL while the ...
Here's an Oracle methodology using an analytic function. with data as ( SELECT 1 trip_id, to_date('20080801 13:30:00','YYYYMMDD HH24:mi:ss') dt, 'Initial' step from dual UNION ALL SELECT 1 trip_id, to_date('20080802 13:30:00','YYYYMMDD HH24:mi:ss') dt, 'Work' step from dual UNION ALL SELECT ...
How do I implement the Post Commit Hook with Trac & SVN in a Windows Environment?
|windows|svn|trac|hook|
I'm running in a windows environment with Trac / SVN and I want commits to the repository to integrate to Trac and close the bugs that were noted in the SVN Comment. I know there's some post commit hooks to do that, but there's not much information about how to do it on windows. Anyone done it successfully? And ...
That depends on your definition of "Anywhere". There are several flavors of Java virtual machine and of .Net framework. And most of the time you can't just write code for a desktop vm/framework and expect it to run on a mobile phone one. So. in a sense, even Java is not really pure "Write Once, Run Anywhere". I...
Samba, other non interactive accounts - noshell, nologin, or blank?
|linux|unix|shell|solaris|samba|
Conducting a user account cleanup accross Solaris and Redhat linux systems, many of which have a number of Samba shares. What preference do people have for creating the local unix accounts for non interactive Samba users? In particular, the shell entry: 1. noshell 2. nologin 3. blank And why? JB
Load each competitor into a different AppDomain.
static variables are per-AppDomain, so you could look into using different AppDomains, but I totally don't know what other consequences that may have. Otherwise you could check the classes beforehand using reflection, and reject any classes that have static members.
In the few years that I've been practicing Test Driven Development, I'd have to say the biggest downsides are: ## Selling it to management > TDD is best done in pairs. For one, it's tough to resist the urge to just write the implementation when you **KNOW** how to write an *if/else* statement. But a pair will kee...
You could also use a `skip_before_filter` for the one controller/method you don't want to have the filter apply to.
As a complete all-in one package, Visual Studio 2008 is the best IDE for C++ development with Windows
http PUT a file to S3 presigned URLs using ruby
|ruby|http|amazon-s3|put|httpnet|
Add the following code to your ~/.emacs file. (autoload 'glsl-mode "glsl-mode" nil t) (add-to-list 'auto-mode-alist '("\\.vert\\'" . glsl-mode)) (add-to-list 'auto-mode-alist '("\\.frag\\'" . glsl-mode)) Put the file http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/glsl-mode.el somewhere...
Depends exactly what you mean by create but some other ones are: - Clone method - Deserialization - Reflection (Class.newInstance()) - Reflection (Constructor object)
Try "Launchy". For windows and linux. Awesome util.
It sounds like what you want is to either run as a console app or a windows app based on a commandline switch. If you look at the last message in [this thread][1], Jeffrey Knight posted code to do what you are asking. However, note that many "hybrid" apps actually ship two different executables (look at visual ...
If you need just a hotkey then use `Win+f`.
How do I use JUnitPerf with JWebUnit and JUnit 4?
|java|unit-testing|
I have a series of functional tests against a web application that correctly run, but each require the class level setup and teardown provided with the @BeforeClass and @AfterClass annotations, and hence require JUnit 4.0 or above. Now I want to perform load testing using a small number of these functional tests, wh...
Another thing it does is it makes it more obvious when reading the code that it is changing the behavior of the parent class. Than can help in debugging. Also, in Joshua Block's book Effective Java (2nd edition), item 36 gives more details on the benefits of the annotation.
How to detect whether Vista UAC is enabled?
|windows-vista|uac|
I need my application to behave differently depending on whether Vista UAC is enabled or not. How can my application detect the state of UAC on the user's computer?
Mattwar has a <a href="http://blogs.msdn.com/mattwar/archive/2008/05/04/mocks-nix-an-extensible-linq-to-sql-datacontext.aspx">great article on his blog</a> about mocking up LinqtoSql with reflection -- perhaps you can use that as a starting point?
Building a PHP extension requires a pretty large investment in terms of software. Since I already have the GCC (MinGW) environment installed, I have decided to take the performance hit of launching a process from the PHP script. The source code is below. // Usage: logonuser.exe /user username /password password [...
Building a PHP extension requires a pretty large investment in terms of hard disk space. Since I already have the GCC (MinGW) environment installed, I have decided to take the performance hit of launching a process from the PHP script. The source code is below. // Usage: logonuser.exe /user username /password pas...
*A good hockey player plays where the puck is. A great hockey player plays where the puck is going to be. - Wayne Gretzky* Our industry is always changing. No language can be mainstream forever. To me Java, C++, .Net is where the puck is right now. And python, ruby, perl is where the puck is going to be. Decide for...
I recommend these three lines <pre> log_slow_queries set-variable = long_query_time=1 log-queries-not-using-indexes </pre> The first and second will log any query over a second. As others have pointed out a one second query is pretty far gone if you are a shooting for a high transaction rate on your website, ...
You can use Registry classes to write the dsn info in the registry, under HKLM\Software\ODBC\ODBC.INI\ODBC Data Sources You'll need to check what values are needed for you ODBC driver.
You can modify the code in the xla programmatically from within Excel. You will need a reference to the 'Microsoft Visual Basic for Applications Extensibility..' component. The examples on [Chip Pearson's excellent site][1] should get you started. [1]: http://www.cpearson.com/excel/vbe.aspx
Elapsed time without considering weekends and bank holidays
|time|elapsed|date|stopwatch|
I've implemented a stopwatch that works fine without considering that bank holidays and weekends shouldn't be counted in the total duration. I was looking for some open-source library where I could get the elapsed time, passing a start instant, end instant and a set of bank holidays (weekends aren't counted in). The on...
Elapsed time without considering weekends and bank holidays in Java
|java|time|date|elapsed|stopwatch|
It's better to validate what is **in the request** than validate URL length. Your needs may change in the future, at which point you'll have to remove or change the URL length validation, possibly introducing bugs. If it does end up as a proven security vulnerability, then you can implement it.
If, by VM, you mean a virtual instance of an OS, such as an instance of linux running on Xen, VMWare, or even Amazon EC2, then Jira will run just fine. The only time you need to worry about virtual systems is if you're doing something that depends on hardware, such as running graphical 3D apps, or say something that u...
This is more of a work-around than a true solution. I first posted this work-around on the [Nevrona newsgroup][1] (Group=nevrona.public.rave.developer.delphi.rave; Subject="Are you suffering from the Rave Endless Loop bug?: Work-around announced."; Date=13/11/2006 7:06 PM) So here is my solution. It is more of a wor...
This is more of a work-around than a true solution. I first posted this work-around on the [Nevrona newsgroup][1] (Group=nevrona.public.rave.developer.delphi.rave; Subject="Are you suffering from the Rave Endless Loop bug?: Work-around announced."; Date=13/11/2006 7:06 PM) So here is my solution. It is more of a wor...
Getting started with windows mobile development
|tutorials|windows-mobile|
I have a personal pet project I'd like to start on, targeted at windows mobile 6. I've never done win mobile dev and would like to know what resources are out there, good tools to use, perhaps a jump start tutorial, as well as any gotchas I might want to keep in mind when developing for the platform?
There are three potential solutions: **Hardware Solution**: Use a free output pin on the processor and hook an oscilloscope or logic analyzer to the pin. Initialize the pin to a low state, just before calling the function you want to measure, assert the pin to a high state and just after returning from the funct...
All you need to do is have the code continue on error, then post to the other server and read the status from the post. Something like this: PostURL = homelink & "CustID.aspx?SearchFlag=PO" set xmlhttp = CreateObject("MSXML2.ServerXMLHTTP.3.0") **on error resume next** xmlhttp.open "POST", PostUR...
`ORDER BY foo DESC`?
Blueprint was one of the early appearances in this space, and is considered to be quite mature. http://code.google.com/p/blueprintcss/ Here's a huge list of available frameworks: http://www.cssnolanche.com.br/css-frameworks/ There was a lot of interesting debate in the web dev community about css framewo...
Statistically removing erroneous values
|statistics|
We have a application where users enter prices all day. These prices are recorded in a table with a timestamp and then used for producing charts of how the price has moved... Every now and then the user enters a price wrongly (eg. puts in a zero to many or to few) which somewhat ruins the chart (you get big spikes). We...
We have a application where users enter prices all day. These prices are recorded in a table with a timestamp and then used for producing charts of how the price has moved... Every now and then the user enters a price wrongly (eg. puts in a zero to many or to few) which somewhat ruins the chart (you get big spikes). We...
One thing to add to what people have said above. If you have an assembly containing a readonly value (e.g. readonly MaxFooCount = 4; ), you can change the value that calling assemblies see by shipping a new version of that assembly with a different value (e.g. readonly MaxFooCount = 5;) But with a const, it would b...
##RE: The Accepted Answer I **do not** like the hack given. I have a site that uses a login form called "*login.aspx*" and all works **fine**. I think we should actually find the answer rather than hack. Since all the [presumably] tested sites work. **Do you not think we should actually use StackOverflow to find th...
I ran into a similar problem a while ago, and I remember it was solved by _not naming the login page "login.aspx"_. Just naming it something else (userlogin.aspx, for example) sloved it for me.
I ran into a similar problem a while ago, and I remember it was solved by _not naming the login page "login.aspx"_. Just naming it something else (userLogin.aspx, for example) solved it for me.
Comparing runtimes
|timing|php|python|
I am trying to get some accurate runtime comparisons of PHP vs Python (and potentially any other language that I have to include). Timing within a script is not my problem but timing within a script does not account for everything from the moment the request is made to run the script to output. 1) Is it actually wor...
|timing|php|python|benchmarking|
|python|php|benchmarking|
A fantastic option for DSLs is [Boo][1]. I've been using it for things like setting up my IoC container, defining routes, validation rules. [Ayende Rahien][2] is writing an fantastic book on the subject for Manning called [Building Domain Specific Languages in Boo][3] [1]: http://boo.codehaus.org/ [2]: http...
If your idea is to compare the languages, I'd say anything outside them is not relevant for comparison purposes. Nonetheless you can use the time command to measure everything and can compare it with the timing within a script. Like this: $ time script.php HI! real 0m3.218s user ...
I've found another table that stores every date (it's visitors to the website), so how about this... Declare @FromDate datetime, @ToDate datetime Declare @tmpDates table (StatsDate datetime) Set @FromDate = DateAdd(day,-30,GetDate()) Set @ToDate = GetDate() ...
You might like to consider generating a UUID instead of a random number using the newid function. These are guaranteed to be unique each time generated whereas there is a significant chance that some duplication will occur with a straightforward random number (and depending on what you're using it for could give you a...
You could make an Annotation (e.g. @EnforceAuthor) with @Inherited on the superclass and use compiler annotations (since Java 1.6) to catch up at compile time. Then you have a reference to the subclass and can check if another Annotation (e.g. @Author)) is missing. This would allow to cancel compiling with an error mes...
I guess if you need to offer the ability to store large chunks of text and you don't mind not being able to look into their content too much when querying, you can use CLobs.
This works in most cases but I'm not sure if this is what you are looking for... Try setting up the RowTemplate and use that to set the rows height. Here is also a nice page on Windows Forms Programming Best Practices for Scaling the Windows Forms DataGridView Control which you may find to be handy: http://msdn...
This works in most cases but I'm not sure if this is what you are looking for... Try setting up the RowTemplate and use that to set the rows height. // my test to specify a size for a datagridview row dataGridView1.Columns.Add(new DataGridViewTextBoxColumn { Name = "ColumnNameGoesHere" }...
Check for the registry value at HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System The EnableLUA value determines if UAC is active.
This all depends on the RDBMS that you are using as well as the types of text that you are going to store. If the text is formatted into sizable chunks of data that mean something in and of themselves, like, say header/body, then you might want to break the data up into columns of these types. It may take multiple ta...
A big design goal for C# was to make the transition from C/C++ to it as easy as possible. Using dot syntax on a string literal would look *very* strange to someone with only a C/C++ background, and formatting strings is something a developer will likely do on day one with the language. So I believe they made it static ...
Watch out for the functions library in certain situations, especially when using Websphere to deploy! The company I work for deploys to Websphere 6.0 version 11, which does not support the functions library properly (it does not function properly when placed inside a tag body). I remember somewhere that they fixed it...
It's not, but sometimes it's a necessary evil. Take your case for an example, although code behind seems to have a better separation of concern, but the problem with it is that it may not separate out the concerns as clearly as you wish. Usually when we do the code behind stuff we are not building the apps in MVC fr...
MySQL stored procedures that produce datasets need you to use Perl DBD::mysql 4.001 or later. (http://www.perlmonks.org/?node_id=609098) Otherwise you get results like this: mysql> delimiter // mysql> create procedure Foo(x int) -> begin -> select x*2; -> end -> // $ ...
MySQL stored procedures that produce datasets need you to use Perl DBD::mysql 4.001 or later. (http://www.perlmonks.org/?node_id=609098) Below is a test program that will work in the newer version: mysql> delimiter // mysql> create procedure Foo(x int) -> begin -> select x*2; -> en...
how to get emacs to unwrap a block of code
|emacs|
Say I have a line in an emacs buffer that looks like this: foo -option1 value1 -option2 value2 -option3 value3 \ -option4 value4 ... I want it to look like this: foo -option1 value1 \ -option2 value2 \ -option3 value3 \ -option4 value4 \ ... I want each o...
How much tolerance does google have for large site maps...
|seo|sitemap|
I have a site map of a few thoasand pages where the only different content on them is the title attribute and the content plotted out in a google map? Will google punish me for this as spam?
Has the IdAttachment.Filename property been set? It's possible that between the Indy versions they changed the way that Filename works.
Using PNGs in IE6 is hardly any more difficult than any other browser. You can support all of it in your CSS without Javascript. I've seen this hack shown before... div.theImage { background : url(smile.png) top left no-repeat; height : 100px; width : 100px; } *...
Using PNGs in IE6 is hardly any more difficult than any other browser. You can support all of it in your CSS without Javascript. I've seen this hack shown before... div.theImage { background : url(smile.png) top left no-repeat; height : 100px; width : 100px; } *...
Community Server 2008.5 lets you add several members that can post articles. Also with Community Server 2008.5 you now have wiki's along with forums and the blogs. This probably has one of the better web based admin control panel's I seen in a while. This let's you easily change several things including the site's th...