instruction stringlengths 0 30k ⌀ |
|---|
You could try using a diff tool (such as SourceGear's free DiffMerge tool) on the decompiled sources. That should pick up the file differences, although it will likely pick up "insignificant" differences, for example if variables have been named differently in the two versions.
http://www.sourcegear.com/diffmerge/ |
If you can cope w/ VB.Net: http://www.codeproject.com/KB/vb/mp3id3v1.aspx
If you can cope w/ C++/.Net: http://www.codeproject.com/KB/audio-video/mp3fileinfo.aspx
For either (assuming the C++) is compiled to .Net, you can use Reflector to disassemble the binary and convert it to C#. Check w/ the respective author... |
How do you configure django for simple development and deployment? |
|python|django| |
I tend to use sqlite when doing django development, but on a live server, something more robust is often needed (mysql/postgres, for example). Invariably, there are other changes to make to the django settings as well -- different logging locations / intensities, media paths, etc.
How do you manage all these change... |
Grab an old spare computer & put it in the corner of your office. Set it up to build your project. Write a small script that does:
1. Get latest version of all files.
2. If there was a file change, build
3. Notify you if there's a failure.
When you catch a break, compassionately get it fixed.
Consid... |
|gui|model-view-controller|glossary|patterns|mvp| |
def quit()
global root
root.quit()
or
def quit()
global root
root.destroy()
|
A round trip to the DB server is not the same as a round trip to the database on disk.
Before you decide that the round trips are a bottleneck, do some actual measurements.
There are ways to insert multiple rows with a single insert, depending on your DBMS. Before you invest the coding effort, figure out wh... |
I use the the advantage of bigger screens to have multiple pieces of code next to eachother.
You won't get any ammo from me. In fact, I'd hate to see it changed since in emergencies I still see rare cases where I need to change code from a text-console. |
You can build some fancy PDFs from Python with the [ReportLab](http://www.reportlab.org/rl_toolkit.html) toolkit. |
I actually follow a similar rule for my own code but only because of printing code to an A4 page - 80 columns is about the right width for my desired font size.
But that's personal preference and probably not what you were after (since you want ammo to go the other way).
What don't you question the reasoning behi... |
To choose between them I use this simple rule:
GET for reads. (reading data and displaying it)
POST for anything that writes (i.e updating a database table, deleting an entry, etc.)
The other consideration is that GET is subjected to the maximum URI length and of course can't handle file uploads.
[This p... |
You should just do it for the sake of everyone who doesn't have a 22 inch widescreen monitor. Personally, I work on a 17 inch 4:3 monitor, and I find that more than sufficiently wide. However, I also have 3 of those monitors, so I still have lots of usable screen space.
Not only that, but the human eye actually ... |
Both set of values is easily monitored by hackers or other stuff, but GET is less secure in the way that its very visible what the values are (right in the addressbar).
Use SSL for security if that is needed.
A good advice: Always use POST for forms, use querystrings (?value=products), when you are not posting th... |
If you are passing things like passwords or other sensitive information, always use POST and make sure you are using SSL so that data doesn't travel between the client and server in clear-text.
Security-wise, the downside of using GET is that all the submitted data will be in the URL, and therefore stored locally o... |
I would say that J2EE experience = in-depth experience with a few J2EE technologies, general knowledge about most J2EE technologies, and general experience with enterprise software in general. |
Do you just want to run class files that just so happen to be bundled in the WAR, or do you want ot interact with the actual, running WAR instance? If the former, then the WAR is just a normal Jar file and you can execute classes in that just like any other other Jar file.
If you want to interact with the running WA... |
How can I give java.util.Random a specific seed in thirdparty classes? |
|java|jvm|random|classloader| |
I have a Java program that loads thirdparty class files (classes I did not write) and executes them. These classes often use `java.util.Random`, which by default generates random starting seed values every time it gets instantiated. For reasons of reproducability, I want to give these classes the same starting seed eve... |
|java|random|jvm|classloader| |
I have a Java program that loads thirdparty class files (classes I did not write) and executes them. These classes often use `java.util.Random`, which by default generates random starting seed values every time it gets instantiated. For reasons of reproducability, I want to give these classes the same starting seed eve... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to describe the "API" of classes, but not their actual code. It is possible to include code in the header, that's called header-inlining. You have inlined everything in CppClass.cpp, and then... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. Header files are there to describe the "API" of classes, but not their actual code. It is possible to include code in the header, that's called header-inlining. You have inlined everything in CppClass.cpp (not goo... |
What is the current state of art in Linux virtualization technology? |
|linux|virtualization|stateoftheart| |
What VM technologies exist for Linux, their pros and cons, and which is recommended for which application?
Since this kind of question can be asked for X other than "VM technologies for Linux", and since the answer changes with progress, I suggest to define a template for this kind of pages. Those pages will have t... |
|linux|virtualization| |
Multiple Constructors with complex logic |
|c#| |
In C#, if you have multiple constructors, you can do something like this:
public MyClass(Guid inputId, string inputName){
// do something
}
public MyClass(Guid inputId): this(inputId, "foo") {}
The idea is of course code reuse. However, what is the best approach when there is a bit of com... |
In C#, if you have multiple constructors, you can do something like this:
public MyClass(Guid inputId, string inputName){
// do something
}
public MyClass(Guid inputId): this(inputId, "foo") {}
The idea is of course code reuse. However, what is the best approach when there is a bit of com... |
The solution was to add these flags to JVM command line when Tomcat is started:
-XX:+CMSClassUnloadingEnabled -XX:+CMSPermGenSweepingEnabled
You can do that by shutting down the tomcat service, then going into the Tomcat/bin directory and running tomcat6w.exe. Under the "Java" tab, add the arguments to the "J... |
There's an easy answer to this one, which I first heard in a discussion about reflection: "if you have to ask, you can't afford it."
Basically, if you need ToString() of large objects in the day-to-day operation of your program, then your program is crazy. Even if you need to ToString() an integer for anything time... |
Your application should be able to use the file directly from within the jar, no need for extracting it. Or do you mean something else? |
If it can't be checked/caught earlier it might be difficult to do anything else.
I've had to write a raiseerror in a procedure I wrote and used as a constraint on inserting/updating a table because it was the 'last stop' for the data and I had to check it there.
I think in general if you are getting errors ba... |
Personally I always insist on putting data integrity code on the table itself either via a trigger or a check constraint. The reason why is that you cannot guarantee that only the user interface will update insert or delete records. Nor can you guarantee that someone might not write a second sp to get around the constr... |
Ok, after the clarification edits, I would suggest looking at the introspection available in .Net. I will warn you however that I think you will get more satisfying results if you forgo introspection and define the specific properties that you want for the file types that you expect to see.
Since scripting is valid,... |
Take a look at [RFC 2616: Section 9 "HTTP/1.1 Method definitions"][1]
[1]: http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html |
Use GET if you want the result to be bookmarkable. |
[Blender][1] is a free 3D modeling tool. Here is an article covering from installation of blender, exporting, to the importing of a model made in Blender into the XNA enviroment:
[Getting started with Blender 3D and XNA][2]
[1]: http://www.blender.org/
[2]: http://www.virtualrealm.com.au/blogs/getting-star... |
GET might be easier to debug 'cause you can monitor all sended values in the adress bar without any additional tools. But there is a limitation of the max. length so with a few variables you may excess this.
POST isn't much securer these days 'cause with free tools like Fiddler & co. you can grip the values very eas... |
Mysql has an extended SQL style that can be used, where mass inserts are put in several at a time.
> INSERT INTO `table` (`id`, `event`) VALUES (1, 94263), (2, 75015), (3, 75015);
I will usually collect a few hundred insert-parts into a string before running the SQL query itself. This will reduce the overhead of ... |
GET passes data in the URL, POST passes the same data in the HTTP content, both are exactly the same from a security standpoint (that is, completely insecure unless you do something about it yourself, like using HTTPS).
GET is limited by the maximum URL length supported by the browser and web server, so it can only ... |
The other answers already summed things up nicely, but it is also worth considering when you might want to copy & paste some code into an email, or if not code then a diff.
That's a time when having a "max width" is useful. |
Generally best to use POST because it's a bit better hidden for snooping, better handling of spaces/encoding in the fields with some browsers, and especially because of limitations in the overall length of GET fields. |
TFS 2008 is pretty good
As are CruiseControl and Nant
Have a look at [CI factory][1], which requires minimal configuration
[1]: http://www.cifactory.org/joomla/ |
Take a look at trueSpace also, its just become free - but as Evil Activity stated; Blender is also a good sugestion i just never really got use to its interface and how to do stuff. trueSpace is a little more easy in that way, but i think that blender is more powerful.
I guess you know http://creators.xna.com/, ther... |
I would recommend using the [.Net Memory Validator][1] tool from software verify.
This tool helped me to solve many different issues related to memory management in .Net application I have to work with.
I use more frequently the C++ version but they are quite similar and the fact that you can really see in real-tim... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. In Java the process of defining something is usually in one piece. You declare and define at the same time. In C/C++ it's a two-step process. **Declaring** something tells the compiler "something exists with this t... |
It's obvious you come from a Java background because you haven't yet grasped the concept of header files. In Java the process of defining something is usually in one piece. You declare and define at the same time. In C/C++ it's a two-step process. **Declaring** something tells the compiler "something exists with this t... |
php.ini & SMTP= - how do you pass username & password |
|php|email| |
My ISP account requires that I send a username & password for outbound SMTP mail.
How do I get PHP to use this when executing php.mail()? The php.ini file only contains entries for the server (SMTP= ) and From: (sendmail_from= ).
|
|php|smtp| |
|php|smtp|email| |
Most projects of reasonable size should have a programming/coding standards document that dictates common conventions and naming guidelines that should be followed. |
Most projects of reasonable size should have a programming/coding standards document that dictates common conventions and naming guidelines that should be followed.
Another way to help with this is through code reviews. Obviously some coordination among reviewers is required (the document helps with that, too). Code... |
In the words of Knuth, "premature optimization is the root of all evil!" The small defference eiter way will most likely not have much of an effect in the end; I'd choose the more readable one. |
In the words of Knuth, "premature optimization is the root of all evil!" The small defference either way will most likely not have much of an effect in the end; I'd choose the more readable one. |
ClientDatasets can contain fields that are themselves other datasets. So if you want to create three tables in a single dataset, create three ClientDatasets holding the three result sets that you want, and then you can put them into a single clientdataset.
This article:
[http://dn.codegear.com/article/29001][1]
... |
Some short background:
Unfortunately the Unix API doesn't provide a running program with the full path to the executable. There are, as all the answers point out, various heuristics for finding likely candidates. But nothing short of searching the entire filesystem will always work, and even that will fail if the ... |
Some short background:
Unfortunately the Unix API doesn't provide a running program with the full path to the executable. In fact, the program executing yours can provide whatever it wants in the field that normally tells your program what it is. There are, as all the answers point out, various heuristics for find... |
I think you've got a <a href="http://en.wikipedia.org/wiki/Bin_packing_problem">bin packing problem</a> on your hands (which is NP-hard), so I think the only solution is going to be to try every possible combination until you find one that works.
|
I think you've got a <a href="http://en.wikipedia.org/wiki/Bin_packing_problem">bin packing problem</a> on your hands (which is NP-hard), so I think the only solution is going to be to try every possible combination until you find one that works.
Edit: As pointed out in a comment, you won't _always_ have to try _eve... |
C#: Import/Export Settings into/from a File |
|c#|visual-studio|visual-studio-2005| |
What's the best way to import/export app internal settings into a file from within an app?
I have the Settings.settings file, winform UI tied to the settings file, and I want to save and use multiple sets of settings.
|
What's the best way to import/export app internal settings into a file from within an app?
I have the Settings.settings file, winform UI tied to the settings file, and I want to import/export settings, similar to Visual Studio Import/Export Settings feature.
|
|c#|.net|visual-studio|visual-studio-2005| |
How do you get selenium to recognize that a page loaded? |
|java|selenium| |
In certain unknown situations selenium does not detect that a page has loaded when using the open method. I am using the Java API. For example (This code will not produce this error. I don't know of an externally visible page that will.):
Selenium browser = new DefaultSelenium("localhost", 4444, "*firefox", "htt... |
Are you doing something specific to extract the jar file? I ask because normally jar files are not extracted when executing them.
If you run "java -jar myJar.jar" or "java -cp myJar.jar com.example.MyMainClass" the jar files that is referenced will not be extracted. Java will load your classes and resources direct... |
How do you convert your office to build automation? |
|build-automation| |
For your third question, maybe the `trace` module is what you need:
>>> def y(a): return a*a
>>> def x(a): return y(a)
>>> import trace
>>> tracer = trace.Trace(countfuncs = 1)
>>> tracer.runfunc(x, 2)
4
>>> res = tracer.results()
>>> res.calledfuncs
{('<stdin>', '<stdin>'... |
If you cannot or don't wish to store your data in XHTML format, then XSLT is definitely the way you want to go. By its very definition, it is a transformation language designed to transform data from one format to another. Because this is it's focus, it provides power, speed and flexibility you won't find in many other... |
Application Context in Rails |
|ruby-on-rails| |
Rails comes with a handy session hash into which we can cram stuff to our heart's content. I would, however, like something like ASP's application context, which instead of sharing data only within a single session, will share it with all sessions in the same application. I'm writing a simple dashboard app, and would l... |
The humble **for** command has accumulated some interesting capabilities over the years:
D:\> FOR /F "delims=X" %i IN ('date /t') DO set today=%i
D:\> echo %today%
Sat 20/09/2008
(note that *delims=X* is used to over-write the default space and tab delimiters so that the output of the date command g... |
The humble **for** command has accumulated some interesting capabilities over the years:
D:\> FOR /F "delims=" %i IN ('date /t') DO set today=%i
D:\> echo %today%
Sat 20/09/2008
(note that *delims=* is used to over-write the default space and tab delimiters so that the output of the date command get... |
You should be doing paging back on the database server. E.g. on SQL 2005 and SQL 2008 there are paging techniques. I'd suggest looking at paging options for whatever system you're looking at. |
Just so that I understand the problem.
You have, if you order the row set based on the timestamp, sometimes *duplicate* values occuring next to each other, like the above pair of 1's in the 2nd and 3rt item? and then you have double 0's in the 4th and 5th, is that it?
And you want the last of the corresponding pa... |
Here's the beginnings of a script in Python. It loads the map file into a list of Sections and Symbols (first half). It then renders the map using HTML (or do whatever you want with the `sections` and `symbols` lists).
You can control the script by modifying these lines:
with open('t.map') as f:
colors =... |
Here's the beginnings of a script in Python. It loads the map file into a list of Sections and Symbols (first half). It then renders the map using HTML (or do whatever you want with the `sections` and `symbols` lists).
You can control the script by modifying these lines:
with open('t.map') as f:
colors =... |
Producing error messages with a full stack trace is *usually* bad security practice.
On the other hand, and more in line with Toyota's intent, every developed module should be traced back to the original programmer(s) - and they should be held accountable for shoddy work, bug fixes, security vulnerabilities, etc. No... |
I would recommend using [Memory Validator][1] from software verify.
This tool proved itself to be of invaluable help to help me track down memory leaks and to improve the memory management of the applications i am working on.
A very complete and fast tool.
[1]: http://www.softwareverify.com/cpp/memory/index.... |
Well... I would say [Slime for scheme][1] is the closest thing to Slime for Scheme ;)
[1]: http://mumble.net/~campbell/slime48.html |
I'm not a CakePHP expert, but I still think it would make sense to have your own controller. From what I remember from doing one of those CakePHP blog tutorials is, that you need to link the comments and the post in the comment model. This is some of the code I have from it:
class Comment extends AppModel
{... |
I'm not a CakePHP expert, but I still think it would make sense to have your own controller. From what I remember from doing one of those CakePHP blog tutorials is, that you need to link the comments and the post in the comment model. This is some of the code I have from it:
class Comment extends AppModel
{... |
There's two main things to get used to about the App Engine datastore when compared to 'traditional' relational databases:
- The datastore makes no distinction between inserts and updates. When you call put() on an entity, that entity gets stored to the datastore with its unique key, and anything that has that key g... |
Since you already have a heap, couldn't you just use the second phase of the [heap sort][1]? It works in place and should be nice and efficient.
[1]: http://en.wikipedia.org/wiki/Heapsort |
You need to set the height of each item using the iIntegral member of the TVITEMEX structure that you specify when you insert the item. |
Currently I use a plugin for VS2005 that I found on CodeProject ([http://www.codeproject.com/KB/cs/Code_convert_add-in.aspx][1]); it use an external service ([http://www.carlosag.net/Tools/CodeTranslator/][2]) to perform translation.
Occasionally, when I'm offline, I use a converter tool ([http://www.kamalpatel.net/... |
To be a bit more specific, the situation here is this :
I have a menu on the right, (VisualStudio style) when the user wants to add an element, should I expand the menu down and let them select something from it there, and then have to press the OK button, or display a Modal popup forcing them to select.
(the s... |
<a>http://www.cppreference.com/wiki/operator_precedence</a> (Found by googling "C++ operator precedence")
That page tells us that &&, in group 13, has higher precedence than || in group 14, so the expression is equivalent to a || (b && c).
Unfortunately, the wikipedia article <a>http://en.wikipedia.org/wiki/Opera... |
The humble **for** command has accumulated some interesting capabilities over the years:
D:\> FOR /F "delims=" %i IN ('date /t') DO set today=%i
D:\> echo %today%
Sat 20/09/2008
(note that *delims=* is used to over-write the default space and tab delimiters so that the output of the date command get... |