instruction
stringlengths
0
30k
|statistics|r|vector|
Yes people, even though I'm talking about the R Project for Statistical Computing, it can still require programming! Suppose I have a vector that is nested in a dataframe one or two levels. Is there a quick and dirty way to access the last value, without using the length() function? Something ala PERL's $# special...
Ant is not able to delete some files on windows
|java|windows|ant|build-automation|
I have an ant build that makes directories, calls javac and all the regular stuff. The issue I am having is that when I try to do a clean (delete all the stuff that was generated) the delete task reports that is was unable to delete some files. When I try to delete them manually it works just fine. The files are appare...
0x is C/C++ specific prefix. A hex number is just digits like a decimal one. You'll need to check for presence of those characters then parse appropriately.
use [exiftool][1] (it supports ID3 too). written in perl, but can also be used from the command line. it has a compiled windows and mac version. it is light-years ahead of any other metadata tool, supporting almost all known audio, video and image files, supports writing (not just reading), and knows about all the...
I use 4 different approaches depending on the client environment: 1. Capistrano and similar tools (effective, but complex) 2. `rsync` from + to Windows, Linux, Mac (simple, doesn't enforce discipline) 3. `svn` from + to Windows, Linux, Mac (simple, doesn't enforce discipline) 4. On-server scripts (run through the...
The session is bound to a user cookie, the chances of that messing up in a normal scenario is very unlikely, however there could be issues if using distributed session state.
This is a (bad) form of the double check locking pattern which is **not** thread safe in C#! There is one big problem in this code: s\_Initialized is not volatile. That means that writes in the initialization code can move after s\_Initialized is set to true and other threads can see uninitialized code even i...
This is a (bad) form of the double check locking pattern which is **not** thread safe in C#! There is one big problem in this code: s\_Initialized is not volatile. That means that writes in the initialization code can move after s\_Initialized is set to true and other threads can see uninitialized code even if s\...
It depends what you're trying to do, but if your database supports it, you might consider using roles. The advantage of this is that the database provides security around roles, and you don't have to create any tables.
Anyone got a working example of using ruby to post to a presigned URL on s3
[ViewSourceWith][1] is another addon worth lookng at. It supports more than just edit boxes and text. For answering questions on SO, you may also want to get the [Vim Markdown Syntax file][2] [1]: https://addons.mozilla.org/en-US/firefox/addon/394 [2]: http://www.vim.org/scripts/script.php?script_id=1242
[ViewSourceWith][1] is another addon worth lookng at. It supports more than just edit boxes and text. For example, you can configure it to open images in the GIMP. Another feature that I find useful is that it can pop-up a dialog box that shows all the js and css scripts used on the page. You can then choose to v...
How far can LISP macros go?
|lisp|macros|
I have read a lot that LISP can redefine syntax on the fly, presumably with macros. I am curious how far does this actually go? Can you redefine the language structure so much that it borderline becomes a compiler for another language? For example, could you change the functional nature of LISP into a more object or...
I have read a lot that LISP can redefine syntax on the fly, presumably with macros. I am curious how far does this actually go? Can you redefine the language structure so much that it borderline becomes a compiler for another language? For example, could you change the functional nature of LISP into a more object or...
I have read a lot that LISP can redefine syntax on the fly, presumably with macros. I am curious how far does this actually go? Can you redefine the language structure so much that it borderline becomes a compiler for another language? For example, could you change the functional nature of LISP into a more object or...
I need to jump on the Umbraco bandwagon here. As far as ease of use from a developer standpoint goes, there is nothing easier than umbraco and v. 4 has full master page support and a tone of other stuff... and it's free.
Safe to use TAdsSettings object in the main thread, and AdsQuery objects in other threads?
|delphi|multithreading|advantage-database-server|
I have a Win-CGI application I am currently converting to ISAPI. The application uses the TDataset descendants for Extended Systems Advantage Database Server. As there can be only one instance of a TAdsSettings object, this must be in the main thread. TAdsQuery objects are needed in the request threads. W...
My e-mail is on a separate computer from my coding machine at work so that helps. Most other diversions are blocked. Besides that all I have to distract me is the phone and coworkers walking by. StackOverflow isn't blocked, though, and that's becoming an increasing distraction. ;)
You want to only load the control when not isPostBack
I always develop on my box first. I'll test, make a backup of the live site, and then ftp the updates over. Simple, but I haven't had an issue yet. Also: I have svn running, too, and I do commit changes before updating the live site. That way I have two backups: source control and physical, zipped backups.
You may want to check out my [answer][1] to this question: [ASP.NET - Building your own routing system][2]. I include some good references to help build your own routing system with either using the url rewriting method or the new routing engine that you can use that came out of the ASP.NET MVC project. [1]: h...
You could try if (arrayofA[0] is IFoo) {.....} which sorta answer your question. arrayOfA is an array. An array is an object which implements ICloneable, IList, ICollection, & IEnumerable. IFoo isn't among them.
You sound like you have common part fixed - setting the appropriate appSettings in the web.config in %ProgramFile%\Microsoft Visual Studio 2008 Team Foundation Server\Web Services\Services. The following post from Pete Sheill might help you debug what's going wrong. - [http://blogs.msdn.com/psheill/archive/2005/1...
[This article][1] shows how to do it with jQuery. Basically you are assigning the onError event for the image to reassign the source. This can be done without jQuery: function ImgError(source){ source.src = "/images/noimage.gif"; source.onerror = ""; return true; } ...
The only thing I can think of is to have the create method on at factory object, which you would than mock. But in terms of mocking a constructor call, no. Mock objects presuppose the existence of the object, whereas a constructor presuppose that the object doesn't exist. At least in java where allocation and init...
It's not possible. Sessions are tied to the creator. Do you want to mix up, or do you have a case when it looks like mixed up?
ALTER TABLE ADD ColumnName Options Here is a link that has all of the alter table syntax: http://doc.ddart.net/mssql/sql70/aa-az_5.htm EDIT: Accidentally hit submit. And markdown ate my brackets.
Removing leading zeroes from a field in a SQL statement
|sql|t-sql|
I am working on a SQL query that reads from a SQLServer database to produce an extract file. One of the requirements to remove the leading zeroes from a particular field, which is a simple VARCHAR(10) field. So, for example, if the field contains '00001A', the SELECT statement needs to return the data as '1A'. Is t...
This is like asking, “what's this obsession with CPU instructions? Do I miss out on something by not sprinkling x86 MOV instructions all over the place?” You just _need_ pointers when programming on a low level. In most higher-level programming language implementations, pointers are used just as extensively as in ...
Use the **Modules** view to see if your exe/dll is loaded, and if not, to specify where to load the PDB from.
You're missing out on a lot! Understanding how the computer works on lower levels is very useful in several situations. C and assembler will do that for you. Basically a pointer lets you write stuff to any point in the computer's memory. On more primitive hardware/OS or in embedded systems this actually might do som...
Is it possible to set code behind a resource dictionary in WPF for event handling?
|wpf|
Is it possible to set code behind a resource dictionary in WPF. For example in a usercontrol for a button you declare it in XAML. The event handling code for the button click is done in the code file behind the control. If I was to create a data template with a button how can I write the event handler code for it's but...
Yes, any change in any part of the URL (excluding the protocol prefix) is interpreted as a different resource by the browser (and any intermediary proxies).
Yes, any change in any part of the URL (excluding the protocol prefix) is interpreted as a different resource by the browser (and any intermediary proxies). **Update:** The claim in [this ThinkVitamin article](http://www.thinkvitamin.com/features/webapps/serving-javascript-fast) that Opera and Safari/Webkit brows...
Yes, any change in *any part* of the URL (excluding HTTP and HTTPS protocols changes) is interpreted as a different resource by the browser (and any intermediary proxies), and will thus result in a separate entity in the browser-cache. **Update:** The claim in [this ThinkVitamin article](http://www.thinkvitamin.c...
You hit in yourself -- use a pool of objects and reuse those objects. The semantics of the calls to those object would need to be hidden behind a factory facade. You'll need to grow the pool in some pre-defined way. Perhaps double the size everytime it hits the limit -- a high water algorithm, or a fixed percentage....
Many years ago, I ran into this same issue, and yes, the answer was to load the .dll manually. The reason, as far as I can remember, is that the RichEdit window class is registered in DllMain of riched20.dll.
I would look no farther than Dundas if you have the cha-ching to pay for it. I've used it on several projects and not found a better option. Cheaper with better licensing, yes, but not better in terms of functionality.
It's no longer legal to use the May CTP (the beta software). It's not legal to deploy System.Core.dll (among others) without installing .Net 3.5 The best way to do LINQ in VS2005 is to use [LINQBridge][1] for LinqToObjects, and to use simple table adapters or some other data access method to punt your data into o...
The Java standard library seems to have been written with the intent of keeping the cost of toString calls very low. For example, Java arrays and collections have toString methods which do not iterate over their contents; to get a good string representation of these objects you must use either <code>Arrays.toString</c...
MySQL is extremely cheap when you have the distro (or staff to build) that carries MySQL Enterprise edition. This is a High Availability version which offers multi-master replication over many servers. Pros are low (license-) costs after initial purchase of hardware (Gigs of RAM needed!) and time to set up. The ...
If you feel like you are getting your hands dirty, then you have either been brainwashed, or are still feeling the after affects of the "DHTML years". JavaScript is very powerful, and is suited well for its purpose, which is to script interactivity client side. This is why JavaScript 2.0 got such a bad rap. I mean, why...
Deserializing Client-Side AJAX JSON Dates
|c#|asp.net|ajax|json|
Given the following JSON Date representation: "\/Date(1221644506800-0700)\/" How do you deserialize this into it's JavaScript Date-type form? I've tried using MS AJAX JavaScrioptSerializer as shown below: Sys.Serialization.JavaScriptSerializer.deserialize("\/Date(1221644506800-0700)\/") However, ...
Ok, the problem seems to be in your ThreadPool#signal method. What may happen is: 1 - All your worker are busy and you try to process a new job 2 - line 90 gets a nil worker 3 - a worker get freed and signals it, but the signal is lost as the ThreadPool is not waiting for it 4 - you fall on line 95, wai...
Maybe you are seeing this because many of the popular desktop apps have a code base older than 2001? Edit: I should probably have said older than 2003 or 2004...I doubt anyone would have started a major desktop app the first year or two of the .NET release.
Sorry for the obvious answer, but does the problemtable exist? Your code looks like pseudo code because of the table/column names, but be sure to double check your spelling. It's not a view which might even consist of joined tables across different databases/servers?
Design Pattern for multithreaded observers
|design-patterns|multithreading|dataflow|observer-pattern|
In a digital signal acquisition system, often data is pushed into an observer in the system by one thread. example from [Wikipedia/Observer_pattern][1]: foreach (IObserver observer in observers) observer.Update(message); When e.g. a user action from e.g. a GUI-thread requires the data to stop ...
Here is a simple code snippet that will help illustrate the difference. The difference being that throw ex will reset the stack trace as if the line "`throw ex;`" were the source of the exception. Code: using System; namespace StackOverflowMess { class Program { sta...
From Perl documentation, perlvar: --------------------------------- **$*** Set to a non-zero integer value to do multi-line matching within a string, 0 (or undefined) to tell Perl that it can assume that strings contain a single line, for the purpose of optimizing pattern matches. Pattern matches on strings cont...
From [Perl 5.8 version of perlvar](http://perldoc.perl.org/5.8.8/perlvar.html): > Set to a non-zero integer value to do > multi-line matching within a string > [...] Use of $* is deprecated in > modern Perl, supplanted by the /s and > /m modifiers on pattern matching. While using /s and /m is much better, yo...
From [Perl 5.8 version of perlvar](http://perldoc.perl.org/5.8.8/perlvar.html): > Set to a non-zero integer value to do > multi-line matching within a string > [...] Use of $* is deprecated in > modern Perl, supplanted by the /s and > /m modifiers on pattern matching. While using /s and /m is much better, yo...
For editing the documents I have worked with [SyncFusions][1] Essential PDF and it worked quite well [1]: http://www.syncfusion.com
How do I compare two glob values in Oracle
|sql|oracle-database|minus|
I have two tables I would like to complare. One of the columns is type glob. I would like to do something like this: select key, glob_value source_table minus select key, glob_value target_table Unfortunately, Oracle can't perform minus operations on globs. How can I do this?
It looks like [Sync](http://technet.microsoft.com/en-us/sysinternals/bb897438.aspx) lets you specify -e to eject removable drives. While not a win32 API, you could probably just call `sync -e [drive_letter]` from your makefile.
There's a sample in the SDK that might be useful in your case. Basically, what it does is attach an IErrorHandler implementation to your service that will catch the error when WCF declares the message to be "poison" (i.e. when all configured retries have been exhausted). What the sample does is move the message to anot...
You can remap the escape key from ctrl-A to be another key of your choice, so if you do use it for something else, e.g. to go to the beginning of the line in bash, you just need to add a line to your ~/.screenrc file. To make it ^b or ^B use: escape ^bB From the command line, use names sessions to keep mul...
If you feel like you are getting your hands dirty, then you have either been brainwashed, or are still feeling the after affects of the "DHTML years". JavaScript is very powerful, and is suited well for its purpose, which is to script interactivity client side. This is why JavaScript 2.0 got such a bad rap. I mean, why...
Poor system admins is the biggest in my experience.
CMake is the only tool which can actually generate real Visual Studio projects (i.e. not "Makefile"-projects which call out to an external tool), and which automatically recreates the projects when the build input file (CMakeLists.txt) changes. SCons performance issues are well-known and a thorougly debated topic on...
Any system is only as strong as its weakest link. Invariably that will not be the OS or the server software, it will be the end application you develop or install.
Javascript can get more information than just time. E.g. screen resolution (+ color depth) being one of them. See [Getting Screen Resolution with JS][1] Everything JS can capture, can be transmitted using AJAX without the user performing any interaction. Other examples are (not all will work in every browser): ...
My friend Luis figured it out: You should use encodeURI does the UTF8URL encoding http://livedocs.adobe.com/flex/3/langref/package.html#encodeURI() but not unescape because it unescapes to ASCII see http://livedocs.adobe.com/flex/3/langref/package.html#unescape() I think that is where we are getting a %E9 in...
Basically you want to handle the onError event for the image to reassign the source. This can be done without jQuery: function ImgError(source){ source.src = "/images/noimage.gif"; source.onerror = ""; return true; } <img src="someimage.png" onerror="ImgError(this);"/>...
What are the differences between struct and class in C++
|c++|oop|class|struct|
This question was [already asked in the context of C#/.Net][1]. Now I'd like to learn the differences between a struct and a class in (unmanaged) C++. Please discuss the technical differences as well as reasons for choosing one or the other in OO design. I'll start with an obvious difference: * If you don't sp...
Looks like you can't. This is the answer I got from MSDN: *Not possible. All of the aggregations are handled by Analysis Services. Since XL is not in charge of the aggregations it has no ability to do custom calculations... -- HTH... Jim Thomlinson*
Looks like you can't. This is the answer I got from MSDN: *Not possible. All of the aggregations are handled by Analysis Services. Since XL is not in charge of the aggregations it has no ability to do custom calculations.HTH... Jim Thomlinson*
Why Does Ruby Only Permit Certain Operator Overloading
|ruby|methods|operator-overloading|
In Ruby, like in many other OO programming languages, operators are overloadable. However, only certain character operators can be overloaded. This list may be incomplete but, here are some of the operators that cannot be overloaded: !, not, &&, and, ||, or
My guess is that microsoft would really have to stand up and say "MVC is the *only* way you should be doing web applications" before businesses bothered with it on a large scale. So no, as it stands now, small user base.
It should be using the most secure set of algorithms that were in both lists. I find it hard to believe that it isn't, because SslStream is wrapping the SChannel SSPI, and if that were broken then Internet Explorer, IIS and everything else on Windows would be broken too. It could be that you have an outdated version...
$#{$ARRAY[$i]} = 42;
Using the WebServiceMessageDrivenBean is very similar to the Spring support for Message Driven Beans (MDBS). First you create a MDB: <code> public class HelloWorldMessageDrivenBean extends WebServiceMessageDrivenBean { private static final long serialVersionUID = -2905491432314736668L; } </code> ...
ALTER TABLE Protocols ADD ProtocolTypeID int NOT NULL DEFAULT(1) GO
The problem was located elsewhere. My serverproject was an web-app and some options wasn't available for web-apps just for web-sites. So I made a small web-site project and compared web.configs and noticed that some lines diffed. These lines was in the website web.config but not in my other projekt <soapSer...
To change the active row for the datagrid you need to set the current cell property of the datagrid to a non-hidden non-disabled, non-header cell on the row that you have selected. You'd do this like: dataGridView1.CurrentCell = this.dataGridView1[YourColumn,YourRow]; Making sure that the cell matches the abo...
In my experience, Scrum is definitely geared more towards new development than it is towards maintenance. New development is much more predictable than maintaining an old, large code base. With that said, one possible problem is that you're not breaking up the tasks into small enough chunks. A common problem peopl...
I would probably evaluate each word using a SOUNDEX algorithm against a database of english words. If you're doing this on a SQL-server it should be pretty easy to setup a database containing a list of most english words (using a freely available dictionary), and MSSQL server has SOUNDEX implemented as an available sea...
thnx! it did the trick, no problems poped up, so far :)....one thing thou... i had to implement BatcherFactory class and put it int the persistence.xml file, like this: property name="hibernate.jdbc.factory_class" value="path.to.my.batcher.factory.implementation" from that factory i've called my batcher implement...
thnx! it did the trick, no problems poped up, so far :)....one thing thou... i had to implement BatcherFactory class and put it int the persistence.xml file, like this: property name="hibernate.jdbc.factory_class" value="path.to.my.batcher.factory.implementation" from that factory i've called my batcher implement...
You can remap the escape key from ctrl-A to be another key of your choice, so if you do use it for something else, e.g. to go to the beginning of the line in bash, you just need to add a line to your ~/.screenrc file. To make it ^b or ^B use: escape ^bB From the command line, use names sessions to keep mul...