instruction
stringlengths
0
30k
I don't know of a way to stop .NET from mangling the ID, but I can think of a couple ways to work around it: 1 - Nest spans, one with runat="server", one without: <style type="text/css"> #position_title { // Whatever } <span id="position_titleserver" runat="server"><span id="position_title">Man...
Can Maven be made less verbose?
|maven-2|
I'm sometimes forced to use Maven (eww). It spews out far too many lines of output to my taste (I like the Unix way: no news is good news). The lines I want to get rid of are marked [INFO], but I couldn't find any mention of an argument or config settings that controls the verbosity of Maven. Is there no LOG4J-like ...
I would use SSIS or DTS (assuming you are talking about MSSQL). They are made for that purpose and work with SPs if you need them. Another option is to preprocess the data using Perl. Even though it sounds like a wierd suggestion, Perl is actually extremely fast in these scenarios. I've used it in the past to proces...
Guile scheme period at end of a list?
|scheme|guile|
What does the following Guile scheme code do? (eq? y '.) (cons x '.) The code is not valid in MzScheme, is there a portable equivalent across scheme implementations?
What does the following Guile scheme code do? (eq? y '.) (cons x '.) The code is not valid in MzScheme, is there a portable equivalent across scheme implementations? I am trying to port this code written by someone else. Guile seems to respond to '. with #{.}#, but I'm not sure what it means or how to...
Guile scheme - quoted period?
I have used [DotNetZip library][1] and it seems to work properly. Typical code: ZipFile zipFile = new ZipFile(); zipFile.AddDirectory(sourceFolderPath); zipFile.Save(archiveFolderName); [1]: http://www.codeplex.com/DotNetZip
Are there any compression and encryption libraries in C# ?
|c#|encryption|compression|
I want to compress some files (into zip format) and encrypt them if possible using C#. Is there some way to do this? Can encryption be done as a part of the compression itself?
If you are talking about virtual destructors (in C++) then they should always be used if you are using your child classes polymorphically. class A { ~A(); } class B : public A { ~B(); } A* pB = new B(); delete pB; // NOTE: WILL NOT CALL B's destructor ...
If you are talking about virtual destructors (in C++) then they should always be used if you are using your child classes polymorphically. class A { ~A(); } class B : public A { ~B(); } A* pB = new B(); delete pB; // NOTE: WILL NOT CALL B's destructor ...
There are a lot of factors at play here that you've left out. What kind of database is it? Are those tables indexed? How are they indexed? How large are those tables? (Premature optimization is the root of all evil!) It could be that if "t1.id" and "t2.id" are indexed, the database engine joins them together ...
One thing that hasn't been mentioned yet is that it's perfectly possible to use git in the [same centralized manner that you're used to with Subversion][1]. It really is an outstanding piece of software. [1]: http://git.or.cz/course/svn.html
I am not sure this is an anti-pattern. I have commonly seen this used instead of exceptions for performance reasons, or perhaps to make the fact that the method can fail more explicit. To me, it seems to be a personal preference rather than an anti-pattern.
Mine is [Test Driven Development by Example][1] [1]: http://www.amazon.com/Test-Driven-Development-Addison-Wesley-Signature/dp/0321146530/ref=pd_bbs_sr_1?ie=UTF8&s=books&qid=1221574622&sr=1-1
[Lean Software Development][1] by Mary and Tom Poppendieck is definitely one for every developers bookshelf [1]: http://www.poppendieck.com/ld.htm
Question is not very clear (algorithm or library???) but only thing that comes to mind is Lucene.NET, the porting of the popular Lucene library on the .Net framework. HTH.
I've used GZipStream to compress the output from the .NET XmlSerializer and it has worked perfectly fine to decompress the result with gunzip (in cygwin), winzip and another GZipStream. For reference, here's what I did in code: FileStream fs = new FileStream(filename, FileMode.Create, FileAccess.Write); ...
HttpModules attach to the ASP.NET request processing pipeline itself. The httpModule itself must take care of figuring out which requests it wants to act on and which requests it wants to ignore. This can f. ex. be achieved by looking at the context.Request.Path property.
I'm just releasing Java 5/6 annotations and an annotation processor to help this. Check out http://code.google.com/p/javadude/wiki/Annotations The documentation is a bit light right now, but the quickref should get the idea across. Basically it generates a superclass with the getters/setters (and many other co...
I thought I'd summarise some of the great answers I've had to this question, together with my own thoughts now I've read them all :) There are two distinct issues here: 1. Should I pre-populate the database with my special 'admin' user? Or should the application provide a way to set up when it's first used? 2...
I use Quantum DB, and it seems to work quite well. http://quantum.sourceforge.net/
sc delete name
How to convert a FLV file to MP3 in C# ?
|c#|mp3|flv|
I'm looking for a way to extract the audio part of a FLV file. I googled it and I've found several implementations but none of them in C#. I know I could use a tool like ffMpeg but I'd prefer a pure code solution. **DISCLAIMER** : I'm not attempting to do anything illegal (like stealing copyrighted content...). T...
How to convert a FLV file recorded with Red5 / FMS to MP3 ?
|mp3|flv|
I'm looking for a way to extract the audio part of a FLV file. I'm recording from the user's microphone and the audio is encoded using the [Nellymoser Asao Codec][1] It seems that [FFmpeg][2] can convert these FLV to MP3. I'll give it a try and i'll update this question. **DISCLAIMER** : I'm not attempting to...
I'm looking for a way to extract the audio part of a FLV file. I'm recording from the user's microphone and the audio is encoded using the [Nellymoser Asao Codec][1]. This is the default codec and there's no way to change this. **DISCLAIMER** : I'm not attempting to do anything illegal (like stealing copyright...
This is not an answer, more of a plea: Please don't do that. Your reimplemented widgets will lack all sorts of functionality that users will miss. Will your text-entry boxes support drag'n'drop? Copy/paste? Right-to-left scripts? Drag-select? Double-click-select? Will all these mechanisms follow the native conventio...
<p> Last I looked at Sphinx, it had issues with 8khz audio which resulted in really poor performance. There's not a lot of people talking about successful deployments of Sphinx in real environments, but you might be able to get it to work with some trailblazing effort. See here for more info: </p> <a href="h...
What is a good equivalent to Perl lists in bash?
|unix|bash|
In perl one would simply do the following to store and iterate over a list of names my @fruit = (apple, orange, kiwi); foreach (@fruit) { print $_; } What would the equivalent be in bash?
I did some research and came across these two sites. Maybe they could help. [ASP.NET MVC Tip #31 – Passing Data to Master Pages and User Controls][1] [Passing Data to Master Pages with ASP.NET MVC][2] [1]: http://weblogs.asp.net/stephenwalther/archive/2008/08/12/asp-net-mvc-tip-31-passing-data-to-master-pa...
Going the Flickr route is easy and will work well. If you want to go more advanced, I'd recommend [snipshot][1] or [picknik][2] (Flickr uses it). Both are free to use and have APIs to use. [1]: http://snipshot.com/services/ [2]: http://www.picnik.com/info/api
When you are in Enterprise Manager or SSMS, can you see the name of the database that you are talking about? There might be a leftover database in a funky state. I'd make sure that you have a backup or a copy of the mdf somewhere safe. If this is the case, maybe try dropping the database and then re-attaching it.
That's a pretty broad question, some of the top open source stacks are - [YUI][1] (Yahoo) - Prototype with [Scriptaculuous][2] - [ExtJs][3] - [Dojo][4] It's a pretty personal choice based on code style, look and feel, and which one you prefer. [1]: http://developer.yahoo.com/yui/ [2]: http://scri...
So you need a *thing* that can create instances of an unknown type that implements an interface. You've got basically three options: a factory object, a Type object, or a delegate. Here's the givens: public interface IInterface { void DoSomething(); } public class Foo : IInterface ...
I found Lippman et al's "C++ Primer: 4th edition" to be excellent. It emphasizes STL usage, best practices, and auto_ptr usage from the very first. I went from a Java position to a C++ assignment, and it was really excellent. As a pure reference, Josuttis's "The C++ Standard Library" was STL at its best (and worst...
This is really two questions, you realize. :-) The answer to the first one is that it's never *mandatory*, but honestly, parsing HTML request parameters directly is pretty horrible right from the start. I don't want to do it even once, so I tend to go toward a framework relatively early on. As far as what measurem...
When you said, "our code base does not lend itself to easy testing" is the first sign of a code smell. Writing Unit Tests means you typically write code differently in order to make the code more testable. This is a good thing in my opinion as what I've seen over the years in writing code that I had to write tests fo...
I don't know of a way to stop .NET from mangling the ID, but I can think of a couple ways to work around it: 1 - Nest spans, one with runat="server", one without: <style type="text/css"> #position_title { // Whatever } <span id="position_titleserver" runat="server"><span id="position_title">Man...
I don't know of a way to stop .NET from mangling the ID, but I can think of a couple ways to work around it: 1 - Nest spans, one with runat="server", one without: <style type="text/css"> #position_title { // Whatever } <span id="position_titleserver" runat="server"><span id="position_title">Man...
I hate to say it, but move on from WinHelp. It's been deprecated for a reason. We were able to migrate to a .chm in only a few hours. It's pretty straight-forward to use the newer help authoring tools, and newer formats like .chm give you benefits like cascading style sheets.
Comet implementation for ASP.NET?
|asp.net|iis|comet|
I've been looking at ways to implement gmail-like messaging inside a browser, and arrived at the [Comet][1] concept. However, I haven't been able to find a good .NET implementation that allows me to do this within IIS (our application is written in ASP.NET 2.0). The solutions I found (or could think of, for that ma...
These are Keyword substitutions. The link to Red-Bean's book version 1.4 is here: [http://svnbook.red-bean.com/en/1.4/svn.advanced.props.special.keywords.html][1]. Subversion's built-in keywords are: - Date / LastChangedDate - Revision / Rev / LastChangedRevision - Author / LastChangedBy - HeadURL / UR...
Dunno if this helps, but when you subclass (including anonymously) a generic type, the type information is available via reflection. e.g., public abstract class Foo<E> { public E instance; public Foo() throws Exception { instance = ((Class)((ParameterizedType)this.getClass(). ...
Dunno if this helps, but when you subclass (including anonymously) a generic type, the type information is available via reflection. e.g., public abstract class Foo<E> { public E instance; public Foo() throws Exception { instance = ((Class)((ParameterizedType)this.getClass(). ...
Use getenv("homepath") to get the value of enviroment variable. You should handle the case in wich the variable has not been defined (getenv returns NULL in that case). To compose the path use sprintf char * homepath = getenv("homepath"); if(homepath == null) { /* variable HOMEPATH has not been de...
Since you don't know where the gaps are, and yet you want all the values (presumably) from the first date in your list to the last one, do something like: use DateTime; use DateTime::Format::Strptime; my @row = $sth->fetchrow; my $countdate = strptime("%Y-%m-%d", $firstrow[0]); my $thisdate =...
Just because a language uses significant indentation doesn't mean that it is inherently context-sensitive. As an example, Haskell makes use of significant indentation, and (to my knowledge) its grammar is context-free. An example of source requiring a context-sensitive grammar could be this snippet from Ruby: ...
Jquery has been around for a few years, so like everyone else has said, it has a deep community, lots of plug-ins, and decent support. What set it aside for me was that it's easy to learn. See http://visualjquery.com/1.1.2.html
How to rotate the images has been described in a number of ways. How to detect <i><b>when</b></i> to trigger the rotate depends on what you are doing (please clarify and people can provide a better answer). Options include: 1. Trigger the rotate on 'first access after midnight'. Assumes some sort of initiating e...
I do a bit in the kernel space, and keep coming back the scope. For example: $ cd /usr/src/redhat/BUILD/kernel-version $ cscope -R -p4 Find this C symbol: Find this function definition: Find functions called by this function: Find functions calling this function: Find ...
I would recommend a distributed version control system (mercurial, git, bazaar, darcs) rather than a centralized version control system (cvs, svn). They're much easier to setup and work with. Try mercurial (which is the VCS that I used to understand how version control works) and then if you like you can even move t...
I'd choose delphi. Only because I have more experience with it. I don't think that there is other reasonabl criterias.
I think you'll want to capture the HTTP_HOST value and then use that in the rewrite rule: RewriteCond %{HTTP_HOST} (.*) RewriteRule ^/terms http://support.%1/article/terms [NC,R=302]
WSDL Generation Tools
|soap|wsdl|
Can anyone recommend a good (preferably open source) tool for creating WSDL files for some soap web services? I've tried playing around with some of the eclipse plug ins available and was less than impressed with what I found.
Can I supress FX Cop code analysis violations globaly?
|.net|visual-studio|code-analysis|
When you use Visual Studio's code analysic (FxCop), and want to supress a message there are 3 options. 1. Supress a violation in code. 2. Supress a violation in a GlobalSupression.cs file. 3. Disable the violation check in the project file (via Project -> Properties -> Code Analysic). The later is very hard to ...
By web client do you mean web browser? If so looking at stuff like DWR or JAX-RS are my recommendations. RMI or JMS only really work when both sides are Java code. With any remoting technology the biggest issue using them tends to be how intrusive the technology becomes on your business objects. e.g. using RMI inter...
We use [Ant Installer][1] to deploy our application, app server and install it as a service. We embed [Java Service Wrapper][2] in the installer to install the Windows service. [1]: http://antinstaller.sourceforge.net/ [2]: http://wrapper.tanukisoftware.org/doc/english/integrate.html
forget truncate and delete. maintain your table definitions (in case you want to recreate it) and just use drop table.
I like using the AddWithValue method. I always specify default SQL parameters for the "optional" parameters. That way, if it is empty, ADO.NET will not include the parameter, and the stored procedure will use it's default value. I don't have to deal with checking/passing in DBNull.Value that way.
Under the hood, it actually creates and appends to a StringBuffer, calling toString() on the result. So it actually doesn't matter which you use anymore. So String s = "a" + "b" + "c"; becomes String s = new StringBuffer().append("a").append("b").append("c").toString(); That's true for a bunch ...
The biggest downside is that if you really want to do TDD properly you will have to fail a lot before you succeed. Given how many software companies work (dollar per KLOC) you will eventually get fired. Even if your code is faster, cleaner, easier to maintain, and has less bugs. If you are working in a company that ...
Because Strings are imutable in Java, every time you concanate a String, new object is created in memory. SpringBuffer use the same object in memory.
I think what you want to do is this: >>> class Foo(): ... def __init__(self, x): ... self.x = x ... >>> def bar(self): ... print 'bar:', self.x ... >>> bar.func_name = 'foobar' >>> Foo.foobar = bar >>> f = Foo(12) >>> f.foobar() bar: 12 >>> f....
StringBuffer is mutable. It adds the value of the string to the *same* object without instantiating another object. Doing something like: myString = myString + "XYZ" will create a *new* String object.
I also recommend using FlashDevelop. It's another open source tool that's a very lightweight IDE (SciTE based I believe) that integrates SWFMILL, a popular tool which can create SWF layout items from XML files, and mtasc, a popular third party compiler for Actionscript. I am not entirely sure you can take .FLA files ...
`Enumerable#multisort` is a generic solution that can be applied to arrays of **any size**, not just those with 2 items. Arguments are booleans that indicate whether a specific field should be sorted ascending or descending (usage below): items = [ [3, "Britney"], [1, "Corin"], [2, "Cody"], ...
[Code Style Enforcer](http://joel.fjorden.se/static.php?page=CodeStyleEnforcer) Lets you define a .NET code style (with some degree of flexibility) and underlines violations. Has context-menu options to change the code to match the style. Requires DXCore, which is linked from the Code Style Enforcer page. Both are fre...
If you're doing C++ coding, hands down [Visual Assist][1]. [1]: http://www.wholetomato.com/
I wrote a script I call "psh": #! /usr/bin/perl while (<>) { chomp; my $result = eval; print "$_ = $result\n"; } Whatever you type in, it evaluates in Perl: > gmtime(2**30) gmtime(2**30) = Sat Jan 10 13:37:04 2004 > $x = 'foo' $x = 'foo' = foo ...
On a UNIX-style system, I would use a signal handler trapping ALRM events, then use the alarm function to start a timer before starting an action that I expected might timeout. If the action completed, I'd use alarm(0) to turn off the alarm and exit normally, otherwise the signal handler should pick it up to close ever...
On a UNIX-style system, I would use a signal handler trapping ALRM events, then use the alarm function to start a timer before starting an action that I expected might timeout. If the action completed, I'd use alarm(0) to turn off the alarm and exit normally, otherwise the signal handler should pick it up to close ever...
There are frameworks that are there for getting moving very quickly with a simple blog, [django](http://www.djangoproject.com) or [RoR](http://www.rubyonrails.org) all the way to enterprise full-stack applications [Zope](http://www.zope.org). Not to be tied to just the buzz world, you also have ASP.Net and J2EE, etc.
All frameworks and libraries are tools at your disposal. Determine which ones will make your life easier for your given project and use them.
I agree with the other posters. I've kept my code from school in a personal source code repository. What harm does hanging on to it really do?
As far as IDEs go, I've found Eclipse to be about the best you could ask for. If you are used to IDEs full of features like VS, it should be right up your alley, and it isn't particularly resource-hungry; the way it organizes your projects makes the whole thing pretty simple as well, and it's also good to have on your ...
Consider that the question may be faulty. Many of the most complex websites don't use any popular, preexisting, framework. Google has their own web server and their own custom way of doing things, as does Amazon, and probably lots of other sites. If a framework makes your task easier, or provides added value, go for...
Kind of hacky, but the following should work :) import os filePath = "/foo/bar/baz.py" serverPath = "/blah/boo/boom.py" os.system("scp "+filePath+" user@myserver.com:"+serverPath)
That depends on what information you need and what workflows you want to support. Do you want to be able to: - know what information was there (before it was deleted)? - know when it was deleted? - know who deleted it? - know in what capacity they were acting when they deleted it? - be able to un-delete ...
If you are looking at OpenID you should check out [http://eaut.org/][1] and [http://emailtoid.net][2]. Basically you can accept email addresses for a login and behind the scenes translate them to OpenID without the user having to know anything. Its pretty slick stuff... [1]: http://eaut.org/ [2]: http://ema...
If you really want to do this kind of thing, you should have different values for each error, and check for success. Something like define ('OK', 0); define ('DUPLICATE_USERNAME', 1); define ('DATABASE_ERROR', 2); define ('INSUFFICIENT_DETAILS', 3); and check if (createUser('fred') == OK) { //ok...
[Replace Error Code with Exception][1] [1]: http://www.refactoring.com/catalog/replaceErrorCodeWithException.html
Either use a blacklist of stuff you do not want, or preferably a white list (set). With a white list you iterate over the string and only copy the letters that are in your white list to the result string. You said remove, and the way you do that is having two pointers one you read from (R) and one you write to (W): ...
Well, it's *not* an antipattern. The C++ standard library makes use of this feature and .NET even offers a special `FunctionResult` class in the .NET framework. It's called `Nullable`. Yes, this isn't restricted to function results but it can be used for such cases and is actually very useful here. If .NET 1.0 had alre...