instruction
stringlengths
0
30k
I have an extender control that raises a textbox's OnTextChanged event 500ms after the user has finished typing. The problem with this is that OnTextChanged get raised when the textbox loses focus, which causes problems (because of the postback). What I'd like to do is give the extender control its own server-side e...
I dunno if it works, but no matter what **your algorithm is not even worth implementing**. Finding _all_ cycles will be the freaking huge bottleneck that will kill it. Also doing that without iterations is impossible. Why don't you implement some standard algorithm, let's say [Prim's][1]. [1]: http://en.wikipedi...
What exactly is Appdomain recycling
|asp.net|
I am trying to figure out what exactly is Appdomain recycling? When a aspx page is requested for the first time from a DotNet application, i understand that an appdomain for that app is created, and required assemblies are loaded into that appdomain, and the request will be served. Now, if the web.config file or the...
[Andy Rutledge][1] has written a pretty interesting article on success. Though the title is [Pre-bid Discussions][2], the article defines *having a successful project*, which for Andy entails: 1. Will I or my team be allowed to bring our best work to the final result? 2. Is the client prepared to engage in the pr...
You can generally twist a code coverage tool's arm and get a report that shows the paths that have been executed during a given run. This report should show the code itself, with the first few columns marked up according to the coverage tool's particular notation on whether a given path was executed. You might be a...
How can I allow incoming connections to a server inside of VirtualBox?
|virtualbox|
I have a NAT configured to run when loading up my favorite Linux distribution in VitualBox. This allows outgoing connections to work successfully. How do I allow incoming connections to this box, like, say, Web traffic? The IP address is 10.0.2.15. A ping request from my main box results in a Timeout.
Use GtkBuilder instead of Glade, it's integrated into Gtk itself instead of a separate library. The main benefit of Glade is that it's much, much easier to create the interface. It's a bit more work to connect signal handlers, but I've never felt that matters much.
This is the best I could come up with on a first cut: public List<String> getRandomItemsFromList(int returnCount, List<String> list) { List<String> returnList = new List<String>(); Dictionary<int, int> randoms = new Dictionary<int, int>(); while (randoms.Count != returnCount) ...
A quick Google turned up [this][1] for a toolkit. While I have never used it, it seems to be quite popular and solid. Not exactly a package, and not really rolling your own, but sort of in the middle. [1]: http://www.cs.fsu.edu/~engelen/soap.html
I'd also like to point out an excellent [tutorial/discussion](http://railsforum.com/viewtopic.php?id=14216&p=1) on extending the core functionality of Restful Authentication, in case you're looking for something a bit more robust.
RegEx to Detect SQL Injection
|sql|regex|
I'm looking for a good solid Regular Expression for detecting SQL in a string. Does anyone have a sample of something they've used before?
I've mainly used plain ASP.NET pages that return XML for situations that are mainly one-way (data from ASP.NET --> Flex/Flash) communication. The Flex side just uses a URLLoader to hit the ASP.NET page and loads the result as XML. If the communication needs to be a little more two-sided (sending more than a couple p...
One thing to remember about Apache's Etags is that they don't play well in clusters because they include inode information that can—and probably will—vary between machines in the same cluster.
Don't do it. You're practically guaranteed to fail. Use `PreparedStatement` (or its equivalent) instead.
I don't have a regex but my understanding is that the most important thing is to detect the single quote. All the injection attacks start from there. They probably have the -- in there too to comment out and other SQL that might be after the string.
use stored procs or prepared statements, how will you detect something like this? BTW do NOT run that DECLARE%20@S%20VARCHAR(4000);SET%20@S=CAST(0x4445434C415 245204054205641524348415228323535292C40432056415243 4841522832353529204445434C415245205461626C655 F437572736F7220435552534F5220464F522053454C45...
I have found that generally the most performant and stable way to push/pull large amounts of data of a device over activesync is to use a socket. Early on we used CeRapiInvoke and a stream to pull data down of the device but ditched this early on in favour of using tcp/ip over a socket.
Oh no, [red tape][1]. Well this is going to be a tall order to fill. You mentioned [here][2] that you use a state server to serve your session state. How do you have this setup? Maybe you can do something similar here also? [1]: http://stackoverflow.com/questions/48070/moving-viewstate-out-of-the-page#48105...
Oh no, [red tape][1]. Well this is going to be a tall order to fill. You mentioned [here][2] that you use a state server to serve your session state. How do you have this setup? Maybe you can do something similar here also? Edit Awh @Jonathan, [you posted][3] while I was typing this answer up. I think going...
From [Dragons in the Algorithm][1], an interpretation in C#: int k = 10; // items to select var items = new List<int>(new[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12 }); var selected = new List<int>(); var needed = k; var available = items.Count; var rand = new Random(); while (select...
Just to add something here, process explorer comes in handy when trying to track down a process: [http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx][1] Beats task manager hands down and can be substituted. [1]: http://technet.microsoft.com/en-us/sysinternals/bb896653.aspx
VirtualBox (after version 1.3.8, anyway) will let you map incoming connections in the NAT configuration. There's an excellent tutorial on [Aviran's Place][1] that describes the steps to configure port mapping. [1]: http://www.aviransplace.com/2008/06/12/virtualbox-configuring-port-forwarding-with-nat/
I think you just answered your own question: platform independence. Platform-independent bytecode is produced and distributed to its target platform. When executed it's quickly compiled to native code either before execution begins, or simultaneously ([Just In Time][1]). The Java JVM and presumably the .NET runtimes op...
The only answer I can think of right now is - read the manual for uudeview. As much as I would like to help you, I am not an expert in this area, so you'll have to wait for someone more knowledgable to come down here and help you. Meanwhile I can give you links to some documents that might help you: * <http://...
If you are into web design and website creation then I recommend [Boagworld][1] and also [The Rissington podcast][2] even if you are not. [1]: http://boagworld.com/ [2]: http://therissingtonpodcast.co.uk/
I agree that your text editor is probably your best bet. I do know some people who swear by [XMLSpy][1], if you need something that's tailored specifically for dealing with XML files in a visual way. I bet you could find some F/OSS work-alikse but I'm not aware of any. [1]: http://www.altova.com/products/xmlsp...
The [oXygen XML Editor][1] a great IDE for Windows, bit expensive tho. [1]: http://www.oxygenxml.com/
[Open source XML editors examined](http://www.linux.com/articles/43020) - it is a little bit outdated though.
It's kinda low tech, and there might be a better solution out there, but you could just store your schema in an SQL script which can be run to create the database. I think you can execute a command to generate this script, but I don't know the command unfortunately. Then, commit the script into source control along...
I work a lot with XML, and have found [Oxygen][1] to be a great editor. It's cross-platform and has a graphical schema editor, but since I use DTDs and not schemas, I can't vouch for the schema editor's quality. The rest of the editing package (such as the XML editor and XSLT debugger) is solid, so it could be worth ...
The [Google Developer Podcast][1] is good. [1]: http://google-code-updates.blogspot.com/2007/05/introducing-google-developer-podcast.html
denny wrote: > I personally feel that if reusable code is split into projects it is simpler to use other places than if it is just in folders. I really agree with this - if you can reuse it, it should be in a separate project. With that said, it's also very difficult to reuse effectively :) Here at SO, we've tr...
Disable WPF label accelerator key (text underscore is missing)
|wpf|user-interface|
I am setting the .Content value of a Label to a string that contains underscores; the first underscore is being interpreted as an accelerator key. Without changing the underlying string (by replacing all _ with __), is there a way to disable the accelerator for Labels?
I also never heard of nested functions in C, but if gcc supports it, this is not going to work the way you expect. You are just simply copying the machine instructions of isNot, and that won't include the actual value of "original" at the time "not" is being called. You should you a C++ class to implement a [functio...
I also never heard of nested functions in C, but if gcc supports it, this is not going to work the way you expect. You are just simply copying the machine instructions of isNot, and that won't include the actual value of "original" at the time "not" is being called. You should use a C++ class to implement a [functio...
Generate disk usage graphs/charts with CLI only tools in Linux
|linux|storage|disk|shell|diskspace|
[In this question][1] someone asked for ways to display disk usage in Linux. I'd like to take this one step further down the cli-path... how about a shell script that takes the output from something like a reasonable answer to the previous question and generates a graph/chart from it (output in a png file or something)...
I just don't get continuations!
|functional-programming|learning|
What are they and what are they good for? I do not have a CS degree and my background is VB6 -> ASP -> ASP.NET/C#. Can anyone explain it in a clear and concise manner?
|functional-programming|continuations|callcc|
It really depends on the application and the situation, but just keep in mind that every hit to the server is costly, both in adding load (perhaps minimally), but also in terms of UI responsiveness. I am of the mind that doing things in JavaScript when possible is a good idea, if it can make your UI feel snappier. ...
[Subsonic][1] is also another option. I often use it to generate entity classes that map to a database. It has a command line utility that lets you specify tables, types, and a host of other useful things [1]: http://subsonicproject.com/
What are advantages of bytecode over native code?
|bytecode|.net|java|
It seems like anything you can do with bytecode you can do just as easily and much faster in native code. In theory, you could even retain platform and language independence by distributing programs and libraries in bytecode then compiling to native code at installation. So in general, when would you want to execut...
|.net|java|bytecode|
It seems like anything you can do with bytecode you can do just as easily and much faster in native code. In theory, you could even retain platform and language independence by distributing programs and libraries in bytecode then compiling to native code at installation, rather than JITing it. So in general, when wo...
Hank Shiffman from SGI said (a long time ago, but it's till true): > There are three advantages of Java > using byte code instead of going to > the native code of the system: > > 1. **Portability**: Each kind of computer has its unique instruction > set. While some processors include the > instructions for...
[pyPDF][1] works fine (assuming that you're working with well-formed PDFs). If all you want is the text (with spaces), you can just do: import pyPdf pdf = pyPdf.PdfFileReader(open(filename, "rb")) for page in pdf.pages: print page.extractText() You can also easily get access to the metadat...
[Wine][1] is the the only way to run DirectX in Linux [1]: http://winehq.com
Ideally you would have portable bytecode that compiles Just In Time to native code. I think the reason bytecode interpreters exist without JIT is due primarily to the practical fact that native code compilation adds complexity to a virtual machine. It takes time to build, debug, and maintain that additional component...
Bytecode creates an extra level of indirection. The advantages of this extra level of indirection are: - Platform independence - Can create any number of programming languages (syntax) and have them compile down to the same bytecode. - Could easily create cross language converters - x86 and x64 no lo...
I would like to compare two collections (in C#), but I'm not sure of the best way to implement this efficiently. I've read the other thread about [Enumerable.SequenceEqual][1], but it's not exactly what I'm looking for. In my case, two collections would be equal if they both contain the same items (no matter the ...
1) Start -> Run -> msconfig 2) Check the Startup tab 3) If you don't know what it is, uncheck 4) Reboot Its not the registry, its the crap you have running in the background.
Instead of hiding, what I have done is swapping buttons using javascript. Show another greyed out image on the click of the first button.
You don't necessarily want to show the button disabled on postback. You want to make sure they don't accidentally submit twice. So disabling or hiding the button as a result of a _server-side_ action is already too late in the game. By this point the 2nd request is already on it's way. You need to either do it with...
arr.GetLength(y) should be arr.GetLength(1)
CSS - Placement of a div in the lower left-hand corner
|divpositioning|
I wish I were a CSS smarty .... How can you place a div container in the lower left-hand corner of the web page; taking into account the users scroll-position? Thanks in advance for any assistance.
|html|positioning|
What's the easiest way to read a FoxPro DBF file from Python?
|python|dbf|visual-foxpro|foxpro|
I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too.
|python|foxpro|visual-foxpro|dbf|
I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too. **Update**: Thanks @cnu, I used Yusdi Santoso's [`dbf.py`][1] and it works nicely. One gotcha: The memo file name extension...
In the absence of a VCS for table changes I've been logging them in a wiki. At least then I can see when and why it was changed. It's far from perfect as not everyone is doing it and we have multiple product versions in use, but better than nothing.
> Very close, but then I lose everything from ClassX. Below is something a collegue gave me that does do the trick, but it's hideous. There has to be a better way. Looks like you're trying to set up some sort of proxy object scheme. That's doable, and there are better solutions than your colleague's, but first consi...
Start Schedulrd Windows Task From SSIS
|ssis|sql-server|windows|
Does anyone know if you can and how to start off a scheduled Windows task on a Remote Server from within an SSIS package? Cheers Nigel
Can you start a scheduled Windows task from SQL Server Integration Services ?
|windows|sql-server|ssis|
Use the &lt;noscript&gt; HTML tags.
Here is something a little different, use a FilterAttribute: [NavigationLocationFilter("Products")] public ViewResult List() { return View(); } ... public class NavigationLocationFilterAttribute : ActionFilterAttribute { public string CurrentLocation { get; set; } public NavigationLoc...
<noscript> ...some non-js code </noscript>
You might have javascript execute some AJAX query and check to see if it has. Those that download the page and don't execute the query either have JS disabled or they're robots.
[How A Method Becomes An Action](http://haacked.com/archive/2008/08/29/how-a-method-becomes-an-action.aspx) by Phil Haack
He's asking for a check to see if javascript is enabled. I can only think of doing exactly what the OP said - try using some Javascript with an interval to send a callback if JS is activated - unfortunately I don't think you can check server side whether JS is enabled which is why you use <noscript> tags rather than r...
Really all you can do is put some message in the <noscript> tags. I seem to remember trying this on ASP.NET somewhere, but you can really only tell if the browser supports Javascript, not whether or not it is actually allowed/enabled.
I don't know much about CFML, but .NET has the ability to detect browser capabilities. It does not, however, have the ability to detect if the browser is **capable** of javascript, but has it turned **off**. So, you're stuck there too. Besides the HTML noscript tag, there's not much you can do, as far as I know, bes...
Not sure what you are trying to do but if you just need to inform the user that Javascript is required you can just use the '&lt;noscript&gt;' tag. If you need to know on the server you could make an Ajax style request to the server from javascript. If you get the request javascript is working otherwise its not.
I don't know JS, but would it be possible to modify the links inside the page with JS? If someone goes to the unmodified link, they're not using JS, but if they do then they are using JS. Does this make any sense?
@Dave Ward: This normally would work. However, the code is to attach event on behavior object. Because the creation of behavior object happens during Application.Init, attaching to that event will lead to unpredictable behavior. It will be nice if there is PostInit event.
You attach the emails then reference them in your HTML like so: <img src="cid:imagefilename.jpg" /> Outlook, at least, recognizes this as a reference to an attached image and dumps it in appropriately.
|css|html|positioning|
Based on the javadoc for LWUIT and J2ME and guessing that the custom J2ME class is a [Canvas](http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Canvas.html) it looks like you would have to: * Subclass [LWUIT's Component class](https://lwuit.dev.java.net/javadocs/com/sun/lwuit/Component.html) ...
Based on the javadoc for LWUIT and J2ME and guessing that the custom J2ME class is a [Canvas](http://java.sun.com/javame/reference/apis/jsr118/javax/microedition/lcdui/Canvas.html) it looks like you would have to: * Subclass [LWUIT's Component class](https://lwuit.dev.java.net/javadocs/com/sun/lwuit/Component.html) ...
[phpUnderControl][1] - continuous integration. Don't forget about version control (e.g. using [CVS][2] or [Subversion][3])! [1]: http://www.phpundercontrol.org/ [2]: http://www.nongnu.org/cvs/ [3]: http://subversion.tigris.org/
Turns out, that while loop is severe CPU hog :P I found a better way: ZipCommand = "7za.exe a -r -y " & ZipDest & BuildLabel & ".zip " & buildSourceDir Set wshShell = WScript.CreateObject("Wscript.Shell") wshShell.Run ZipCommand,1,1 The last two arguments are Show window and Block Exe...