instruction
stringlengths
0
30k
is there an effective tool to convert c# to java?
|c#|java|
is there an effective tool to convert c# to java?
I enjoy using XSLT only for changing the tree structure of XML documents. I find it cumbersome to do anything related to text processing and relegate that to a custom script that I may run before or after applying an XSLT to an XML document. XSLT 2.0 included a lot more string functions, but I think it's not a good...
Convert 00:00:00 to hours, minutes, seconds
|php|
I have video durations stored in HH:MM:SS format. I'd like to display it as HH hours, MM minutes, SS seconds. It shouldn't display hours if its less than 1.
How do you convert 00:00:00 to hours, minutes, seconds in PHP?
|php|date|
I have video durations stored in HH:MM:SS format. I'd like to display it as HH hours, MM minutes, SS seconds. It shouldn't display hours if its less than 1. What would be the best approach?
I have video durations stored in HH:MM:SS format. I'd like to display it as HH hours, MM minutes, SS seconds. It shouldn't display hours if it's less than 1. What would be the best approach?
Only sensible solution (without reinventing the wheel) seems to use libbfd. Downsides are its documentation is scarce and it is a bit bloated for my purposes.
Whats the best windows tool for merging RSS Feeds?
|rss|merge|
It seems like such a simple thing, but I can't find any obvious solutions... I want to be able to take two or three feeds, and then merge then in to a single rss feed, to be published internally on our network. Is there a simple tool out there that will do this? Free or commercial..
It seems like such a simple thing, but I can't find any obvious solutions... I want to be able to take two or three feeds, and then merge then in to a single rss feed, to be published internally on our network. Is there a simple tool out there that will do this? Free or commercial.. update: Should have mention...
The box model is usually the culprit. Basically what this means is that any div you are trying to position and use unsupported CSS with will cause this problem. You may find it happens if you are using min-{width,height} or max-{width,height}. this provides a great reference for checking compadibility with diffe...
http://www.positioniseverything.net/ will certainly address your problem. It provides comprehensive and in-depth descriptions of browser bugs along with options to work around them. A must read, in my opinion,
what interrupt would you hook from DOS to get the real-time clock
|x86|interrupt|
what interrupt would you hook from DOS to get the real-time clock
CSS layouts are generally much better for accessibility, provided the content comes in a natural order and makes sense without a stylesheet. And using tables to layout everything makes it much harder for mobile browsers to render a page properly. Also, with a div-based layout you can very easily do cool things with...
in your rails home directory mongrel_rails cluster::restart
Here is my solution: Construct a hash whose keys are the union of all the elements in the input lists, and the values are bit strings, where bit *i* is set if the element is present in list *i*. The bit strings are constructed using bitwise or. Then, construct each output list by iterating over integers from 1 to *n...
Here is my solution: Construct a hash whose keys are the union of all the elements in the input lists, and the values are bit strings, where bit *i* is set if the element is present in list *i*. The bit strings are constructed using bitwise or. Then, construct the output lists by iterating over the keys of the hash,...
StringBuilder is preferable *IF* you are doing multiple loops, or forks in your code pass... however, for PURE performance, if you can get away with a *SINGLE* string declaration, then that is much more performant. For example: string myString = "Some stuff" + var1 + " more stuff" + v...
To be able to quickly edit a shell script you know is in your $PATH (do not try with ls...): function viscr { vi $(which $*); }
In our application we subclass [Ext.data.DataProxy](http://extjs.com/deploy/dev/docs/?class=Ext.data.DataProxy) like this: var MyProxy = function(fn) { this.fn = fn; }; Ext.extend( MyProxy, Ext.data.DataProxy, { load: function(params,reader,callback,scope,arg) { this.fn(params,fu...
Python doesn't force you on using "self". You can give it whatever name you want. You just have to remember that the first argument in a method definition header is a reference to the object.
I think you can just drag them into the library of your main swf and make references to them. At least the other SWFs you can, not sure about the CSS and XML.
In an application I worked on, the Last name field was considered reliable. So presented all the all the records with the same last name to the user. User could sort by the other fields to look for similar names. This solution was good enough to greatly reduce the issue of users creating duplicate records. Basica...
IEnumerables that are generated via yield returns are not serializable. This is because the compiler generates a separate class to implement yield return and that class is not marked as serializable.
Send file using POST from a Python script
|python|
Is there a way to send a file using POST from a Python script?
Well, in practice it is rarely an issue. Usually the different team members are working on different areas of the code, so there is no conflict. Also, the bulk of the refactoring will go in when you are doing your TDD (which might even be before you check your code in, but most definitely before others start using an...
Small changes committed often. As for your example, you would start by creating the class, committing that change. Then adding a similar function in the class as the old one and commit that change. Then change all the references from the old function to the new class function, commit that. Then remove the old functi...
How to show loading spinner in jQuery?
|jquery|
In <b>Prototype</b> I can show a "loading..." image with this code: <pre><code> var myAjax = new Ajax.Request( url, {method: 'get', parameters: pars, onLoading: showLoad, onComplete: showResponse} ); function showLoad () { ... } </code> </pre> In <b>jQuery</b>, I can load a server page into an ele...
As an extension to CTRL-r to search backwards, you can auto-complete your current input with your history if you bind 'history-search-backward'. I typically bind it to the same key that it is in tcsh: ESC-p. You can do this by putting the following line in your .inputrc file: `"\M-p": history-search-backward` ...
Find/Replacing using Regular Expressions In the Find and Replace dialog, expand *Find Options*, check *Use*, choose *Regular expressions* *Find What*: ":Zs#$" *Replace with*: "" click *Replace All*
Find/Replacing using Regular Expressions In the Find and Replace dialog, expand *Find Options*, check *Use*, choose *Regular expressions* *Find What*: "`:Zs#$`" *Replace with*: "" click *Replace All* In other editors (a *normal* Regular Expression parser) "`:Zs#$`" would be "`\s*$`".
In Java5 (and later) you can call StackTraceElement[] stackTrace = Thread.currentThread().getStackTrace(); Inspect the stack trace to whatever depth you want and log accordingly. In Java 1.4 you can get the same info with StackTraceElement[] stackTrace = new Exception().getStackTrace();
There's one good reason not to use them: **If you don't understand their role or how to use them.** In the wrong situations, foreign key constraints can lead to waterfall replication of accidents. If somebody removes the wrong record, undoing it can become a mammoth task. Also, conversely, when you need to r...
From <a href='http://lt2.php.net/manual/en/oci8.setup.php'>php.net</a> You will need the Oracle client libraries to use this extension. The most convenient way to install all the required files is to use Oracle Instant Client, which is available from <a href='http://www.oracle.com/technology/software/tech/oci/ins...
Verifying foreign key constraints takes some CPU time, so some folks omit foreign keys to get some extra performance.
You want to associate logger objects with threads I think. A ThreadLocal variable holding a log4j logger instance for each thread might help: http://java.sun.com/javase/6/docs/api/java/lang/ThreadLocal.html
The Clarify database is an example of a commercial database that has no primary or foreign keys. http://www.geekinterview.com/question_details/18869 The funny thing is, the technical documentation goes to great lengths to explain how tables are related, what columns to use to join them etc. In other words, t...
To put scroll bars on an element such as a div: <code>&lt;div style="overflow-x: auto; overflow-y: auto;&gt;the content&lt;/div&gt;</code> If you only want a horizontal or vertical scroll bar, only use whichever of overflow-x and overflow-y you need.
Order of DOM NodeList returned by getChildNodes()
|java|xml|dom|
The DOM method `getChildNodes()` returns a `NodeList` of the children of the current `Node`. Whilst a `NodeList` is ordered, is the list guaranteed to be in document order? For example, given `<a><b/><c/><d/></a>` is `a.getChildNodes()` guaranteed to return a `NodeList` with `b`, `c` and `d` *in that order*? The ...
|javascript|xml|dom|
|java|xml|dom|
If you have just the number, then you can do this: int val; //Input ... int ones = 0; while(val != 0) { ones += ((val % 10) == 1) ? 1 : 0; val /= 10; } If you have a string (char*), the you'd do something like this: while(*str != '\0') { if(*str++ == '1...
Something along the lines of: int val=11031; int count=0; int i=0; char buf[100]; sprint(buf, "%d", val); for(i=0; (i < sizeof(buf)) && (buf[i]); i++) { if(buf[i] == '1') count++; }
Anyone know of a list of delegates already built into the framework?
|.net|
I find myself writing delegates occasionally for really simple functions (take no arguments and return void for example) and am wondering if anyone knows someplace that has compiled a list of all the delegates already available in the .NET framework so I can reuse them? If not, sounds like a good idea for a blog art...
I find myself writing delegates occasionally for really simple functions (take no arguments and return void for example) and am wondering if anyone knows someplace that has compiled a list of all the predefined delegates already available in the .NET framework so I can reuse them? To be clear I am looking for someth...
**Nemerle**: This **crashes the compiler** with aStackOverflowException: def o(){[o()]}
**Nemerle**: This **crashes the compiler** with a StackOverflowException: def o(){[o()]}
I'd love to tell you that this is guaranteed (as I believe it is) but the [Document Object Model specification][1] itself seems ambiguous in this case. I'm pretty sure that it's always document-order, though. [1]: http://www.w3.org/DOM/
Here is a command-line script to do just that: [http://zach.in.tu-clausthal.de/software/][1]. It's a little down the page under "Move Off-Screen Windows to the Main Screen". [1]: http://zach.in.tu-clausthal.de/software/
To start with, we've got the [Wikipedia comparison of OpenGL and Direct3D](http://en.wikipedia.org/wiki/Comparison_of_OpenGL_and_Direct3D). But I'd really like to hear some practical viewpoints, especially in the light of recent developments of OpenGL&nbsp;3.0 and DirectX 10.
Depends on how up to date you want the information to be. If you **must have** the very latest data in your report then querying directly from AD is reasonable. And I agree that AD is quite robust, a typical dedicated AD server is actually very lightly utilised in normal day to day operations *but best to check with ...
I started to use subversion after reading Wil Shipleys blog. So I started checking in code, one machine and dreamhost account. Then after I accidentally deleted a function and saved my project I knew I was in deep "dudu", but with subversion I just checked out the latest version of that file and it was like nothing...
# Useful command: Rake In addition to the commands listed by Joseph Pecoraro, the 'rake' command is also pretty standard when working with Ruby. Rake makes it easy to automate (simple) tasks; like building a RubyGem or running your unit tests. With rake, the only important command to remember is 'rake -T', which sh...
I did my dissertation at uni on a comparison of OpenGL vs Direct3D. The real benefits of Direct3D are that it has a regular release schedule - it's always being updated to take advantage of the latest advances in graphics hardware. How long has it taken between the OpenGL 2.0 and 3.0 releases? Also, a lot of work has b...
Figured it out! Here is the services configuration section from web.config Look at the bindingConfiguration attribute on the endpoint. The value "webBinding" points to the binding name="webBinding" tag in the bindings and that is what tells the service to use Transport level security it HTTPS. In my case the attr...
Figured it out! Here is the services configuration section from web.config Look at the bindingConfiguration attribute on the endpoint. The value "webBinding" points to the binding name="webBinding" tag in the bindings and that is what tells the service to use Transport level security it HTTPS. In my case the attr...
You asked for good tips to help get past the learning curve on the vi text editor. Many of the previous answers suggest you use no other editors. I think that is good advice. Switching to vi from a more graphical editor requires a change in mindset. It requires thinking in terms of commands, rather than visual changes...
Setting include path in PHP intermittently fails. Why?
|php|
I have tried both ini_set('include_path', '.:.:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes'); in the code itself and also php_value include_path ".:.:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes" in the .htaccess file. Both methods actually **do work** but only intermittently. T...
I have tried both ini_set('include_path', '.:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes'); in the code itself and also php_value include_path ".:/usr/share/php5:/usr/share/php5/PEAR:lib:app/classes" in the .htaccess file. Both methods actually **do work** but only intermittently. That ...
Using IDs in the URL is not necessarily bad. This site uses it, despite being done by professionals. How can they be dangerous? When users are allowed to update or delete entries belonging to them, developers implement some sort of authentication, but *they often forget* to check if the entry really **belongs** to y...
How do I set the HttpOnly flag on cookie in rails
|rubyonrails|
The page <a href="http://www.codinghorror.com/blog/archives/001167.html"> explains why making HttpOnly cookies is a good idea How do I set this property in RubyOnRails
|rubyonrails|ruby|ruby-on-rails|
The page <a href="http://www.codinghorror.com/blog/archives/001167.html">http://www.codinghorror.com/blog/archives/001167.html</a> explains why making HttpOnly cookies is a good idea How do I set this property in RubyOnRails
How can I get the unique values of an array in .net?
|.net|arrays|unique|
Say I've got this array: MyArray(0)="aaa" MyArray(1)="bbb" MyArray(2)="aaa" Is there a .net function which can give me the unique values? I would like something like this as an output of the function: OutputArray(0)="aaa" OutputArray(1)="bbb"
Just define a struct/class. [Serializable] public struct KeyValuePair<K,V> { public K Key {get;set;} public V Value {get;set;} }
That's pretty nifty. He uses "position:fixed" on most of the divs, and the one that scrolls is the one that doesn't have it.
Information about how many files to compile before build in Visual Studio
|visual-studio-2005|
How can I figure out, how many files needs to be recompiled **before** I start the build process. Sometimes I don't remember how many basic headerfiles I changed so a RebuildAll would be better than a simple build. There seams to be no option for this, but IMHO it must be possible (f.e. XCode give me this informatio...
How can I figure out, how many files needs to be recompiled **before** I start the build process. Sometimes I don't remember how many basic headerfiles I changed so a RebuildAll would be better than a simple build. There seams to be no option for this, but IMHO it must be possible (f.e. XCode give me this informatio...
I've been using ASP.NET MVC in production on several sites since Preview 2, and it has got progressively better with each release. One issue to be aware of with the latest release (Preview 5) is that there is a bug in the VirtualPathProviderViewEngine that can cause the wrong view to be rendered if you run in prod...
This can be done in CSS using the "position:absolute;" clause Here is an example template: http://www.demusdesign.com/bipolar/index.html From http://www.demusdesign.com/
I'm going to assume that you're somewhat familiar with the structure of a .WAV file : it contains a WAVEFORMATEX header struct, followed by a number of other structs (or "chunks") containing various kinds of information. See <a href="http://en.wikipedia.org/wiki/WAV">Wikipedia</a> for more info on the file format. ...
Does Scripting.Dictionary's RemoveAll() method release all of its elements first?
|vb6|memory-management|dictionary|
In a VB6 application, I have a `Dictionary` whose keys are `String`s and values are instances of a custom class. If I call `RemoveAll()` on the `Dictionary`, will it first free the custom objects? Or do I explicitly need to do this myself? Dim d as Scripting.Dictionary d("a") = New clsCustom d(...
I only learned vi when I started working for an ISP where the scripts for editing domains only opened vi on a terminal. I had no choice but to learn it, but I've never regretted it. In short, put yourself in a situation where you have no choice but to learn it.
I'm confused, isn't the best editor for Flash 9 shared objects... Flash? It already has methods for loading, editing and saving them.