instruction
stringlengths
0
30k
|networking|ip|virtual|
This is actually a multi-part question: - What is it? - How does it work? - Why is it useful? Why should I use one? Where would it fit in my architecture (typical LAMP stack)? - How can I set one up (say on CentOS)?
How do you go about setting up a virtual IP address?
|networking|virtualipaddress|
... say for CentOS?
it's pretty simple: [0-9][0-9][0-9]
i have used a very similar architecture in the past. Spring + Java 1.5 + Actionscript 2/3 when combined with Flex Data Services made it all very easy (and fun!) to code. though, a Flex front end means you need adequately powerful client machines.
String concatenation will cost you more. In Java, You can use either StringBuffer or StringBuilder based on your need. If you want a synchronized, and thread safe implementation, go for StringBuffer. This will be faster than the String concatenation. If you do not need synchronized or Thread safe implementation, g...
You are correct. You can't do "new E". But you can change it to private static class SomeContainer<E> { E createContents(Class<E> clazz) { return clazz.newInstance(); } } It's a pain. But it works. Wrapping it in the factory pattern makes it a little more ...
The main problem I've encountered with variable length frame times is floating point precision, and variable frame times can surprise you in how they bite you. If, for example, you're adding the frame time * velocity to a position, and frame time gets very small, and position is largish, your objects can slow down o...
Php error_reporting, Best setting for development? E_STRICT ?
|php|error-reporting|error|level|e-all|
Typically I use E_ALL to see anything that php might say about my code to try and improve it. I just noticed a error constant E_STRICT, but have never used or heard about it, is this a good setting to use for development? The manual says: > Run-time notices. Enable to have PHP suggest changes to your code which w...
|php|error-reporting|
You can supply a callback to the effects functions that run after the effect has completed. $("#show-projects").click(function() { $(".page:visible").fadeOut("normal", function() { $("#projects").fadeIn("normal"); }); });
is there a way for my binary to react to some global hotkeys in linux ?
|linux|c|hotkeys|
Is it possible to listen for a certain hotkey ( e.g:Ctrl-I ) and then perform a specific action ? My application is written in C , will only run on Linux , and it doesn't have a GUI . Are there any libraries that help with this kind of task ? Thanks
|c|linux|hotkeys|
Is it possible to listen for a certain hotkey ( e.g:Ctrl-I ) and then perform a specific action ? My application is written in C , will only run on Linux , and it doesn't have a GUI . Are there any libraries that help with this kind of task ? EDIT:as an example,amarok has global shortcuts , so for example if you map...
With [Jython][1] you can have both. It's only at Phython 2.2, but still very useful if you need an embedded interpreter that has access to the Java runtime. [1]: http://www.jython.org/Project/
You should be able to set up public & private keys so that no auth is needed. Which way you do it depends on security requirements, etc (be aware that there are linux/unix ssh worms which will look at keys to find other hosts they can attack). I do this all the time from behind both linksys and dlink routers. I ...
We use DotTrace like you, but in the past we used [Ants Profiler][1] by RedGate. It is a nice tool also. [1]: http://www.red-gate.com/products/ants_profiler/index.htm
I think the only solution with your table structure is to work with a subquery: SELECT * FROM Thing WHERE ID IN (SELECT max(ID) FROM Thing WHERE ThingID IN (1,2,3,4) GROUP BY ThingID) (Given the highest ID also means the newest price) However...
I think the only solution with your table structure is to work with a subquery: SELECT * FROM Thing WHERE ID IN (SELECT max(ID) FROM Thing WHERE ThingID IN (1,2,3,4) GROUP BY ThingID) (Given the highest ID also means the newest price) However...
I think the only solution with your table structure is to work with a subquery: SELECT * FROM Thing WHERE ID IN (SELECT max(ID) FROM Thing WHERE ThingID IN (1,2,3,4) GROUP BY ThingID) (Given the highest ID also means the newest price) However...
I have an application that sometimes causes a BSOD on a Win XP machine. Trying to find out more, I loaded up the resulting *.dmp file (from C:\Windows\Minidump), but get this message when in much of the readout when doing so: ********************************************************************* * Symbols can not b...
|windows|windows-xp|dumpfile|bsod|minidump|
**Original Question** I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. What can I do better to teach him effectively? Is there a logical o...
**Original Question** I am currently engaged in teaching my brother to program. He is a total beginner, but very smart. I've noticed that some of our sessions have gotten bogged down in minor details, and I don't feel I've been very organized. *(But the answers to this post have helped a lot.)* What can I do be...
Why does Tomcat 5.5 (with Java 1.4, running on Windows XP 32-bit) suddenly hang?
|tomcat|java|windows|
I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat. The tomcat instance is allowed a gigabyte of memory on the heap, but...
|java|windows|tomcat|
I've been running Tomcat 5.5 with Java 1.4 for a while now with a huge webapp. Most of the time it runs fine, but sometimes it will just hang, with no exception generated, and no apparant way of getting it to run again other than re-starting Tomcat. The tomcat instance is allowed a gigabyte of memory on the heap, but...
I personally like Notepad++ with the XMLTools plugin. It will unfortunately allow you to edit the structure.
It is a **BAD PRACTICE** to use interfaces just to hold constants (named *constant interface pattern* by Josh Bloch). Here's Josh advices: > If the constants are strongly tied to > an existing class or interface, you > should add them to the class or > interface. For example, all of the > boxed numerical primiti...
<form> <label>Thingy 1: <input class="a" type="text" name="one" /></label> <label>Thingy 2: <input class="a" type="text" name="two" /></label> <label>Thingy 3: <input class="b" type="checkbox" name="three" /></label> <label>Thingy 4: <input class="b" type="checkbox" name="four" /></l...
In terms of setting up a profile, have you tried `perlcritic --profile-proto`? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in perlcriticrc format. Save and edit to match what you want. Whenever you upgrade Perl::Critic, you ...
In terms of setting up a profile, have you tried `perlcritic --profile-proto`? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in perlcriticrc format. Save and edit to match what you want. Whenever you upgrade Perl::Critic, you ...
I once worked on an application in which all changes made by a command to the application's model (i.e. CDocument... we were using MFC) were persisted at the end of the command by updating fields in an internal database maintained within the model. So we did not have to write separate undo/redo code for each action. Th...
Regex to Match first 28 days of the month
|asp.net|regex|
I am looking for a Regular expression to match only if a date is in the first 28 days of the month. This is for my validator control in ASP.NET
It is generally considered a bad idea to version control your binaries and I do not recommend doing so. But if you absolutely have to, you can use antcall combined with param to pass parameters and call a target. <antcall target="reusable"> <param name="some.variable" value="var1"/> </antcall> ...
I don't think this is a task very well-suited for a regexp. I'd try and use the library functions (DateTime.Parse for .NET) to parse the date and then check the day component of it. Everything else is duplicating half the library function anyways.
Why not just covert it to a date data type and check the day? Using a regular expression, while it could be done, just makes it overly complicated.
UNION removes duplicate records (where all columns in the results are the same), UNION ALL does not.
There is a program called [SciLab](http://www.scilab.org/) that is a Matlab clone. I haven't used it at all, but it is open source and might have the function you are looking for.
[GNU Octave][1] is another Matlab clone that might have what you need. [1]: http://www.gnu.org/software/octave/
Dundas has a set of tools that let you drag and drop dimensions/hierarchies/measures to create visualizations like charts and/or grids. The product name is Dundas Chart for ASP.NET Enterprise Edition, and it has a free demo. ProClarity also had a suite of tools. Not sure how you get those tools any longer, but I th...
<a href="http://stackoverflow.com/users/3475/scott">Scott</a> named a couple of other <a href="http://stackoverflow.com/questions/44034/how-can-i-get-the-definition-body-of-a-trigger-in-sql-server#44056">SQL tools</a> that address the problem of change management. But I'm still rolling my own. I would like to secon...
It means global scope. You might need to use this operator when you have conflicting functions or variables in the same scope and you need to use a global one. You might have something like (this likely won't compile!): void bar(); // this is a global function class foo { void some_func() { ...
force yourself not. the path to mastery love is.
You want to check out the [Type.IsInstanceOfType][1] method [1]: http://msdn.microsoft.com/en-us/library/system.type.isinstanceoftype.aspx
In how many languages is Null not equal to anything not even Null?
|sql|language-agnostic|
In how many languages is Null not equal to anything not even Null?
I would start with [argdo][1], and once you fall in love with that, the rest is easy... [1]: http://www.vim.org/htmldoc/editing.html#:argdo
Open Source Database Plugin For Eclipse?
|database|eclipse|ide|
Does anyone know of a good open source plugin for database querying and exploring within Eclipse? The active Database Exploring plugin within Eclipse is really geared around being associated with a Java project. While I am just trying to run ad-hoc queries and explore the schema. I am effectively looking for a just...
It's Ajax call, which is asynchronous. That means right after that request call, response hasn't come back yet, that's why $('content') is still empty.
Depending on the language, I usually use regular expressions to check if it has: - At least one uppercase and one lowercase letter - At least one number - At least one special character - A length of at least six characters You can require all of the above, or use a strength meter type of script. ...
Depending on the language, I usually use regular expressions to check if it has: - At least one uppercase and one lowercase letter - At least one number - At least one special character - A length of at least six characters You can require all of the above, or use a strength meter type of script. ...
In terms of setting up a profile, have you tried `perlcritic --profile-proto`? This will emit to stdout all of your installed policies with all their options with descriptions of both, including their default values, in perlcriticrc format. Save and edit to match what you want. Whenever you upgrade Perl::Critic, you ...
I would expect the result to be undetermined. As in it would vary from compiler to complier, langauge to language and OS to OS etc. So no, it is not safe WHy would you want to do this though - adding in a line to obtain a mutex lock is only one or two lines of code (in most languages), and would remove any possibili...
Not sure what you'd use for .NET but ordinarily I'd use [memcached](http://www.danga.com/memcached/) in a LAMP stack.
Yes it will get called. That's the whole point of having a finally keyword. If jumping out of the try/catch block could just skip the finally block it was the same as putting the System.out.println outside the try/catch.
Perhaps Akamaia isn't seeing the updated versions of your CSS files that are &lt;link /&gt;'d in your HTML code? It might be a good idea to embed a version number in the URL so that when you release an updated version of the HTML, it's always going to ask Akamai for a new version of the CSS as well (this applies to im...
**AssemblyVersion** Where other assemblies that reference your assembly will look at. If this number changes, other assemblies have to update there references to your assembly! The AssemblyVersion is required. I use the format: *major.minor.patch*. This would result in: [assembly: AssemblyVersion("1.0.1001...
You have only identified 3 handset 'platforms' as your target. One thing to consider is that there are a LOT more non-Blackberry / Windows Mobile / iPhone handsets out there and perhaps they will be the majority of your audience. (?) From how you describe your application (JUST text), you should be able to hit prett...
Also check out the subant task, which lets you call the same target on multiple build files: <project name="subant" default="subant1"> <property name="build.dir" value="subant.build"/> <target name="subant1"> <subant target=""> <property name="build.dir" value="sub...
function getDivByXY(x,y) { var alldivs = document.getElementsByTagName('div'); var d; for(d = 0; d < alldivs.length; d++) { if((alldivs[d].offsetLeft == x) && (alldivs[d].offsetTop == y)) { return alldivs[d]; } } return false; ...
What is Dynamic Code Analysis?
|code-review|code-analysis|dynamic-analysis|
What is Dynamic Code Analysis? How is it different from [Static Code Analysis][1] (ie, what can it catch that can't be caught in static)? I've heard of bounds checking and memory analysis - what are these? What other things are checked using dynamic analysis? -Adam [1]: http://stackoverflow.com/questio...
It's not the kernel that runs the binary. It's the processor. The binary does call library functions and those need to be 64bit. And if they need to make a system call, it's their responsibility to cope with the fact that they themselves are 64bit, but the kernel is only 32. But that's not something you would ha...
John Vasileff, Back to My Mac is a tunnelling / NAT traversal technique that enables the use of any networking (including VNC-based remote control). iChat screen sharing, Finder Screen Sharing and Remote Desktop all use VNC. Apple does not offer any non-VNC solutions.
No. I have tried pretty much every .NET profiler on the market (ANTS, vTune, OptimizeIt, DevPartner, YourKit), and in my opinion dotTrace is the best of the lot. It is one of only two profilers I have used (the other being YourKit) that has low enough overhead to handle a highly CPU-intensive application. If and onl...
I used Purify about 5 years ago. It was really flaky then. They kept promising to fix all the bugs in the 'next release'. We gave up on it in the end. One can only wonder if they used their own QA tools on their products. Oh the irony...
In order to do this I have my home router set up to forward port 22 back to my home machine (which is firewalled to only accept ssh connections from my work machine) and I also have an account set up with [DynDNS](http://www.dyndns.com) to provide Dynamic DNS that will resolve to my home IP automatically. Then when ...
Don't edit your web.config with notepad if you have accented characters, it will replace it with one with the wrong encoding. It will look the same though. Just your application will not run.
I seem to have found the solution for my problemby using the Server.Ecxcute method. I found an [article][1] that demonstared the use of it: TextWriter textWriter = new StringWriter(); Server.Execute("myOtherPage.aspx", textWriter); Then I do a few maniulatons on the textWriter, and insert it into an h...
**Viewstate** ... if you are using it ... can get out of control if you are not paying attention to it.
I fixed the syntax highlighting for him. Also, for those who weren't sure about the environment or were suggesting a more-secure hash: it's Classic (pre-.Net) VB, because .Net wouldn't allow that syntax for CopyMemory. IIRC, there aren't any secure hashes built in for Classic VB. There's not much out there ...
I fixed the syntax highlighting for him. Also, for those who weren't sure about the environment or were suggesting a more-secure hash: it's Classic (pre-.Net) VB, because .Net would require parentheses for the the call to CopyMemory. IIRC, there aren't any secure hashes built in for Classic VB. There's not ...
We ran into the same error recently with a client/server app communicating via DCOM. It turned out that the size of a marshalled interface pointer going across the wire (i.e., not local) had changed (gotten bigger). You might like to check whether your code is doing any special marshalling via CoMarshalInterface or the...
Is there a particular reason that you want the controls to be runat="server"? If so, I second the use of < asp : Literal > . . . It should do the job for you as you will still be able to edit the data in code behind.
The paradigm of major release.minor release.bug fix is pretty common, I think. In some enterprise support contracts there is $$$ (or breach of contract liability) associated with how a particular release is designated. A contract, for example, might entitle a customer to some number of major releases in a period ...
Perl aids for regression testing
|testing|perl|regression|
Is there a Perl module that allows me to view diffs between actual and reference output of programs (or functions)? The test fails if there are differences. Also, in case there are differences but the output is OK (because the functionality has changed) I want to be able to commit the actual output as future referen...
The short answer is no ... unless you are really really motivated. The only way to do this would be via reflection and stack walking. You would have to get a stack frame, work out whereabouts in the calling function you where invoked from and then using the CodeDOM try to find the right part of the tree to see what...
MSBuild ItemGroup, excluding .svn directories and files within
|.net|continuous-integration|msbuild|cruisecontrol.net|
How can I construct a MSBuild ItemGroup to exclude .svn directories and all files within (recursively). I've got: <ItemGroup> <LibraryFiles Include="$(LibrariesReleaseDir)\**\*.*" Exclude=".svn" /> </ItemGroup> At the moment, but this does not exclude anything!
No. A reference to your string variable gets passed to the funcion--there isn't any inherent metadeta about it included. Even reflection wouldn't get you out of the woods here--working backwards from a single reference type doesn't get you enough info to do what you need to do. Better go back to the drawing board o...
First, clone a remote git repository and cd into it: $ git clone git://example.com/myproject $ cd myproject Next, look at the local branches in your repository: $ git branch * master But there are other branches hiding in your repository! You can see these using the `-a` flag: $ git...
Although you cannot programatically create it, you can load it from a XAML string in code like this: public static DataTemplate Create(Type type) { return (DataTemplate) XamlReader.Load( @"<DataTemplate xmlns=""http://schemas.microsoft.com/client/20...