instruction
stringlengths
0
30k
I think the Subversion documentation is a good place to start. I found that Wikipedia doesn't really help, since it only covers a 'fundamental' point of view. In the [Subversion Book][1] that alex mentioned, I'd especially recommend Chapter 1, although that might be on a level that's too low if you already have some...
I think the Subversion documentation is a good place to start. I found that Wikipedia doesn't really help, since it only covers a 'fundamental' point of view. In the **[Subversion Book][1]** that alex mentioned, I'd especially recommend Chapter 1, although that might be on a level that's too low if you already have ...
http://kenno.wordpress.com/2006/08/03/vim-tip-insert-time-stamp/ Tried it out, it works on my mac: :r! date produces: Thu Sep 11 10:47:30 CEST 2008
http://kenno.wordpress.com/2006/08/03/vim-tip-insert-time-stamp/ Tried it out, it works on my mac: :r! date produces: Thu Sep 11 10:47:30 CEST 2008 This: :r! date "+%Y-%m-%d %H:%M:%S" produces: 2008-09-11 10:50:56
For a unix timestamp: <pre> :r! date +\%s </pre> You can also map this command to a key (for example F12) in VIM if you use it a lot: Put this in your .vimrc: <pre><code> map &lt;F12&gt; :r! date +\%s&lt;cr&gt; </code></pre>
:r! date You can then add format to the date command (man date) if you want the exact same format and add this as a vim alias as well
:r! date You can then add format to the date command (man date) if you want the exact same format and add this as a vim alias as well :r! date +"\%Y-\%m-\%d \%H:\%M:\%S" That produces the format you showed in your example (date in the shell does not use \%, but just %, vim replaces % by the name of the curren...
I prefere `'`, especially for `'''docstrings'''`, as I find `"""this creates some fluff"""`. Also, `'` can be typed without the shift key...
I've recently stumbled upon this [article][1] which is quite good. [1]: http://www.bloomington.in.us/~brutt/emacs-c-dev.html
This article [http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907][1] provides a demo of how to do this from C++ (thought he article is framed as if you want to do it from Java, and provides a Java wrapper). The actual code in in a zip file at [http://www.codeguru.com/dbfiles/get_file/standbydet...
This article [http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907][1] provides a demo of how to do this from C++ (thought he article is framed as if you want to do it from Java, and provides a Java wrapper). The actual code in in a zip file at <http://www.codeguru.com/dbfiles/get_file/standbydet...
There are two APIs, depending on what version of Windows. XP,2000, 2003: <http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx> Respond to PBT_APMQUERYSUSPEND. Vista, 2008: <http://msdn.microsoft.com/en-us/library/aa373208(VS.85).aspx> There could be many valid reasons to prevent the compute...
This seems to be a reasonable tutorial with a few simple examples [UTL_FILE example][1] [1]: http://www.adp-gmbh.ch/ora/plsql/utl_file.html
Maybe you could try it with operator overloading ? (Maybe a = operator which is not a method of your class) ? Rect operator= (const Rect&,const rectangle&) More about this in the C++ programming language by Bjarne Stroustrup or maybe on this page: [http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-...
Create an intermediate shim type "RectangleEx", and define custom conversions to/from the 3rd-party string types. Whenever you speak to either API, do so through the shim class. Another way would be to derive a class from either rect or Rectangle, and insert conversions/constructors there.
Java Singleton vs static - is there a real performance benefit?
|java|design-patterns|singleton|
I am merging a CVS branch and one of the larger changes is the replacement wherever it occurs of a Singleton pattern with abstract classes that have a static initialisation block and all static methods. Is this something that's worth keeping since it will require merging a lot of conflicts, what sort of situation wo...
I'd suggest you to use the #error directive. Another pretty unknown attribute that might do the work is the [conditional attribute][1] (depending on what you're trying to ahieve) [Conditional("CONDITION")] public static void MiMethod(int a, string msg) which will remove the method invocation from the...
Create an Attribute to Break the Build
|.net|attributes|
OK, this kind of follows on from [my previous question](http://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method). What I would really like to do is create some sort of attribute which allows me to decorate a method that will **break the build**. Much like the _Obsolete("reason", false)_ attr...
OK, this kind of follows on from [my previous question](http://stackoverflow.com/questions/27758/notify-developer-of-a-do-not-use-method). What I would really like to do is create some sort of attribute which allows me to decorate a method that will **break the build**. Much like the _Obsolete("reason", true)_ attri...
One of the things I want in my reports is to have nice headers for my reports. I like to have a logo and the user's report parameters along with other data to show to give more information for the business needs the report needs to clarify. One of the things that Microsoft SQL Server 2005 Reporting Services cannot do...
Lotus Notes/Domino stores mail in a Notes database. There are APIs available for getting documents (emails), reading field values (From, Subject), and detaching files. APIs include -LotusScript (VB variant, available within the Notes database) -Java (from within or external to the database) -C API (externa...
|image|
I'm using the GoDiagrams suite which seems to recommend .emf files for node images since they scale better on resizing. Bitmaps get all blurry. Google doesn't show up any good tools that seem to do this... So to reiterate I'm looking for a image converter (preferably free) that converts an image (in one of the comm...
LINQ-To-SQL classes create properties of type System.Data.Linq.Binary for all binary and varbinary fields in SQL-Server. Th
LINQ-To-SQL classes create properties of type System.Data.Linq.Binary for all binary and varbinary fields in SQL-Server. The Binary type has a .ToArray() method that returns a byte[], and its constructor can take a byte[]. Older versions of SQLMetal generated properties of type byte[], but the problem with these was...
HTML to Image .tiff File
|c#|.net|html|image|tiff|
Is there a way to convert a HTML string into a Image .tiff file? I am using C# .NET 3.5. The requirement is to give the user an option to fact a confirmation. The confirmation is created with XML and a XSLT typically it is e-mailed. Is there a way I can take the HTML string generated by the transformation HTM...
[Inkscape][1] works well, it was recommended to me [here][2]. [1]: http://www.inkscape.org/ [2]: http://stackoverflow.com/questions/28872/free-windows-based-emf-editor
Have you taken a look at the [Cocoa OpenGL sample code][1]? It includes "a texture class for strings, showing how to use an NSImage to write a string into and then texture from for high quality font rendering." [1]: http://developer.apple.com/samplecode/CocoaGL/index.html "Cocoa OpenGL"
Andre Michelle and the Hobnox guys pulled off something similar with their Hobnox AudioTool, they ported a [Java Vorbis encoder to AS3][1]. They supposedly ended up with encoding taking twice the time of the audio duration. Don't know what your use case is, but in the Hobnox tool apparently audio is created at the c...
A starting point might be the software of [WebSuperGoo](http://www.websupergoo.com), which provide rich image editing products, cheap or for free. I know for sure their PDF Writer can do basic HTML (http://www.websupergoo.com/helppdf6net/source/3-concepts/b-htmlstyles.htm). This should not be too hard to convert to ...
Can you not just handle the TextChanged event and execute the command from there? private void _textBox_TextChanged(object sender, EventArgs e) { MyCommand.Execute(null); } The alternative, as you say, is to create a `TextBox` that acts as a command source, but that does seem like overkill ...
I usually don't really think about this and just do "what feels right" but usually I end up using names that fit the following strategy fairly well. I'll use the highest common namespace in the tree for the .dll name just like you seem to be doing; with lib and lib.data this is lib so the dll is called lib. With ...
It doesn't look like it's possible. My suggestion would be to catch the **Navigated** event and maintain your own list. A possible problem with that is when the user clicks *back* in the browser, you don't know to unwind the stack.
Does ruby have real multithreading?
|ruby|multithreading|
I know about the "cooperative" threading of ruby using <a href="http://en.wikipedia.org/wiki/Green_threads">green threads</a>. How can I create real "OS-level" threads in my application in order to make use of multiple cpu cores for processing?
Subversion merge history visualisation
|svn|merge|visualization|
Are there any utilities out there which can draw pictures of the merge history of a subversion repo - we always commit merges with a (fairly) consistent log message, and it would be handy to be able to automatically extract this info into a single picture that shows what branches occurred when, and what the state of me...
I use GWTDesigner http://www.instantiations.com/gwtdesigner/ which is not free but works well. Best of all, their customer support is top notch - very responsive.
Ruby 1.8 only has green threads, there is no way to create a real "OS-level" thread. But, ruby 1.9 will have a new feature called fibers, which will allow you to create actual OS-level threads. Unfortunately, Ruby 1.9 is still in beta, it is scheduled to be stable in a couple of months. Another alternative is to u...
Ajax Control Toolkit Calendar Control CSS
|css|
I am using the AJAX Control Toolkit Popup Calendar Control in a datagrid. When it is in the footer it looks fine. When it is in the edit side of the datagrid it is inheriting the style from the datagrid and looks completely different (i.e. too big). Is there a way to alter the CSS so that it does not inherit the st...
I prefer an old-school editing setup. I use command-line vim embedded in a <a href="http://www.gnu.org/software/screen/">GNU Screen</a> "window" inside of <a href="http://iterm.sourceforge.net/">iTerm</a>. This may not integrate well with XCode, but I think it works great for developing and using command-line progra...
Classes don't have values. Objects do. Is what you want basically a class that can reset an instance (object) to a set of default values? How about just providing a reset method, that resets the properties of your object to whatever is the default? I think you should simplify your question, or tell us what you r...
For completeness: Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Cache.SetNoStore(); Response.Cache.SetExpires(DateTime.Now.AddMinutes(-1));
Consider the following code: Public Class Foo Private ReadOnly _fooId As FooId Public Sub New() _fooId = New FooId() End Sub Public ReadOnly Property Id() As Integer Get Return _fooId.Id End Ge...
How to determine CPU and memory consumption from inside a process
|c++|c|
I once had the task of determining the following performance parameters from inside a running application: - Total swapspace available - Swapspace currently used - Swapspace currently used by my process - Total RAM available - RAM currently used - RAM currently used by my process - % CPU curr...
//C# 2.0 RemoveAll(delegate(Foo o){ return o.X >= 10; }); or //C# 3.0 RemoveAll(o => o.X >= 10); or Predicate<Foo> matches = delegate(Foo o){ return o.X >= 10; }); //or Predicate<Foo> matches = o => o.X >= 10; RemoveAll(matches);
The mechansism described under [6.2.5 Particular Templates][1] (under the section called bug/create/create.html.tmpl and bug/create/comment.txt.tmpl) works pretty well for us. Even though you say you don't want to create custom fields, adding some arbitrary HTML is easy enough. [1]: http://www.bugzilla.org/docs...
If you mean the pydb, there is no way to do it. There was some effort in that direction: [see the svn commit][1], but it was abandoned. Supposedly [winpdb supports it][2]. [1]: http://svn.python.org/projects/sandbox/trunk/pdb/mpdb.py [2]: http://winpdb.org/docs/launch-time/
Rule of thumb: if you never munge or look inside a string and instead treat it strictly as a blob of data, you'll be much better off. Even doing something as simple as splitting words or lowercasing strings becomes tough if you want to do it "the Unicode way". And if you want to do it "the Unicode way", you'll ne...
This is basically one of those things that reveal SQL to be less than ideal. I'm thinking maybe the right way to do this is to build a function that creates the range. (Or a generator.) I believe the correct answer to your question is basically, "you can't". (Sorry.)
Go into the install directory of web data admin, usually: <code>C:\Program Files\Microsoft SQL Server Tools\Microsoft SQL Web Data Administrator</code> Then in the "Web" folder open the file "QueryDatabase.aspx" and edit the following line: <code><%@ Page language="c#" Codebehind="QueryDatabase.aspx.cs" AutoEv...
For total stand alone [Synchro SVN][1] is one of the nicest looking and full featured ones. It is cross-platform (Win, Linux, OSX). [1]: http://www.syncrosvnclient.com/
This is a hard problem. I live in Canada, so multilingualism is a big issue. In all my years of doing software development, I've never seen a solution that I liked. I've seen a lot of solutions that worked, and got the job done, but they've always felt like a big kludge. I would go with @harriyott, and make sure th...
Just gave this a run and it seemed to work nicely. My coworker had a version which used a Thread object, but I find the BeginInvoke() method of delegate types to be a bit more elegant. namespace TimedReadLine { public static class Console { private delegate string ReadLineInvoker (); ...
What is wrong with this PHP regular expression?
|php|regex|
$output = preg_replace("|(/D)(/s+)(/d+)(;)|", "//1,//3;", $output); I'm trying to replace all alphabetical character followed by one or more whitespace characters (tabs and/or spaces) followed by one or more numerical characters followed by a semicolon with the alphabetical character followed by a comma followed...
I've tested your code and my mail is sent successfully. Assuming that you're using the same parameters for the old code, I would suggest that your mail server (MAIL_SERVER) is accepting the message and there's a delay in processing or it considers it spam and discards it. I would suggest sending a message using a th...
I've tested your code and my mail is sent successfully. Assuming that you're using the same parameters for the old code, I would suggest that your mail server (MAIL_SERVER) is accepting the message and there's a delay in processing or it considers it spam and discards it. I would suggest sending a message using a th...
How would you implement the IEnumerator interface?
|.net|collections|implementation|
I have a class that map objects to objects, but unlike dictionary it maps them both ways. I am now trying to implement a custom IEnumerator interface that iterates through the values. public class Mapper<K,T> : IEnumerable<T>, IEnumerator<T> { C5.TreeDictionary<K,T> KToTMap = new TreeDictionary<K...
TortoiseSVN can show revision graph - visual representation of branching\merging history.
Are you connecting via a phone provider - could that be the issue?
I use multiple exit points for having error-case + handling + return value as close in proximity as possible. So having to test for conditions a, b, c that have to be true and you need to handle each of them differently: if (a is false) { handle this situation (eg. report, log, message, etc.) ...
If you're using List<> you can use .AddRange to add one list to the other list. Or you can use yield return to combine lists on the fly like this: public IEnumerable<string> Combine(IEnumerable<string> col1, IEnumerable<string> col2) { foreach(string item in col1) yield return item;...
You can certainly do it, although the CaseMethod call isn't correct (it's a pointer to member function, so you have to specify the object on which the method should be called). The correct call would look like this: bool res = this->*CaseMethod( 999, "hello world" ); On the other hand, I'd recommend [boost::m...
I rewrote the code above to be shorter (but maybe it's too obfuscated now?) timeline = (start_date + timedelta(days=days) for days in count(0)) how_many_days = (end_date - start_date).days pick_a_day = lambda _:int(how_many_days * weibullvariate(0.5, 2)) days = sorted(imap(pick_a_day, xrange(how_m...
Two things stand out in my head: 1) You can turn Trace on and off from the code: if (Context.Request.QueryString["DoTrace"] == "true") { Trace.IsEnabled = true; Trace.Write("Application:TraceStarted"); } 2) You can build multiple ....
Two things stand out in my head: 1) You can turn Trace on and off from the code: if (Context.Request.QueryString["DoTrace"] == "true") { Trace.IsEnabled = true; Trace.Write("Application:TraceStarted"); } 2) You can build multiple ....
If you're working with Visual Studio, be sure to check out [Team Foundation Build][1] to see if it will suit your situation. It looks like Buck Hodges' [blog post on the VS 2008 version][2] is a good resource, too. [1]: http://msdn.microsoft.com/en-us/library/ms181710(VS.80).aspx [2]: http://blogs.msdn.com...
One of the first things I do on a new machine is remap Caps Lock to a new Control. Google around, there are plenty of `.reg` files available that will do this painlessly for you on Windows.
Konrad's advice is excellent, and you should become happily productive in a classic vi/cc/ld/db/make environment without too much trouble. Many, many university students have learned this toolchain over the course of a 10-15 week class. That said, the other classic environment is to go the Emacs route. I wouldn't ca...
Use yield return. http://stackoverflow.com/questions/39476/what-is-the-yield-keyword-used-for-in-c#39496
Should those forward-slashes be backslashes? You'll need to escape them for PHP too unless you change your double-quotes to single-quotes.
I believe you need to add the cache annotations to tell hibernate how to use the second-level cache (read-only, read-write, etc). This was the case in my app (using spring / traditional hibernate and ehcache, so your mileage may vary). Once the caches were indicated, I started seeing messages that they were in use from...
The /MP flag is only for builds, we at least it is according to this [msdn][1] Now I would love to be wrong about it, but im pretty sure its just for builds. Which of course is still very useful. [1]: http://msdn.microsoft.com/en-us/library/bb385193.aspx
Any good AJAX framework for Google App Engine apps?
|python|ajax|google-app-engine|
I am trying to implement AJAX in my Google App Engine application, and so I am looking for a good AJAX framework that will help me. Anyone has any idea? I am thinking about Google Web Toolkit, how good it is in terms of creating AJAX for Google App Engine?
Just implement the IEnumerable<T> interface, no need to implement the IEnumerator<T> unless you want to do some special things in the enumerator, which for your case doesn't seem to be needed. public class Mapper<K,T> : IEnumerable<T> { public IEnumerator<T> GetEnumerator() { retur...
Could not load type 'XXX.Global'
|asp.net|visual-studio|
Migrating a project from ASP.net 1.1 to ASP.net 2.0 and I keep hitting this error. I don't actually need Global because I am not adding anything to it, but after I remove it I get more errors.
I once had the task of determining the following performance parameters from inside a running application: - Total virtual memory available - Virtual memory currently used - Virtual memory currently used by my process<hr> - Total RAM available - RAM currently used - RAM currently used by my process<...
Can I filter the messages I receive from a message queue (MSMQ) by some property? (a.k.a. topic)
|msmq|
I am creating a Windows Service in C# that processes messages from a queue. I want to give ops the flexibility of partitioning the service in production according to properties of the message. For example, they should be able to say that one instance processes web orders from Customer A, another batch orders from Custo...