instruction
stringlengths
0
30k
JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site? **Please look up HttpOnly before answering this question.** *Edit:* I'm sorry, I guess a lot of people don't understand the question, as evidenced by the edit to my que...
JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site? **Please look up HttpOnly before answering this question.** *Edit:* I'm sorry, I guess a lot of people don't understand the question, as evidenced by the edit to my que...
How do you write the syntax for a While loop? ## C`#` int i = 0; while (i != 10) { Console.WriteLine(i); i++; } ## VB.Net Dim i As Integer = 0 While i <> 10 Console.WriteLine(i) i += 1 End While ## PHP <?php while(COND...
I personally would not try to re-invent the wheel here. If you already have an Excel sheet that has the formatting you want, just export the data from Access into Excel for the report. Now, if you didn't have the original Excel sheet to begin with, that would be a completely different story. As for breaking lines ...
The following selector should also work in jQuery: `'input:checkbox'`. You can then string the `:gt(index)` and `:lt(index)` filters together, so if you want the 5th to 7th checkboxes, you'd use `'input:checkbox:gt(4):lt(2)'`.
The following selector should also work in jQuery: `'input:checkbox'`. You can then string the `:gt(index)` and `:lt(index)` filters together, so if you want the 5th to 7th checkboxes, you'd use `'input:checkbox:gt(4):lt(2)'`. To get the index of the currently clicked checkbox, just use `$("input:checkbox").index...
The likely reason they're using `blockquote` is that many people dabbling in HTML don't know enough about CSS to know that a `div` can be given the same left-margin as `blockquote` renders with by default.
As far as I know, not all the crawlers support Allow tag. One possible solution might be putting everything except the home page into another folder and disallowing that folder.
I'm not sure there's any easy way to parse a date and work out its pattern, but I would have thought that the pattern for the one you posted would be: EEE MMM dd HH:mm:ss zzz yyyy
Are you just asking for the pattern for that given date? If so, I think this should do it: "EEE MMM d HH:mm:ss z yyyy" Or are you trying to take any formatted date, and infer the format, and parse it?
The format to pass to SimpleDateFormat could be looked up at http://java.sun.com/javase/6/docs/api/java/text/SimpleDateFormat.html new SimpleDateFormat("EEE MMM dd HH:mm:ss zzz yyyy") As for your second question, I don't know of any Java library to figure out a date format and parse it without knowing in adva...
|asp.net|asp.net-mvc|mvc|
Using preview 4 of [ASP.NET MVC][1] Code like: <%= Html.CheckBox( "myCheckBox", "Click Here", "True", false ) %> only outputs: <input type="checkbox" value="True" name="myCheckBox" /> There is a `name` there for the form post back but no `id` for javascript or labels :-( I was hoping that ch...
Using [preview 4][1] of [ASP.NET MVC][2] Code like: <%= Html.CheckBox( "myCheckBox", "Click Here", "True", false ) %> only outputs: <input type="checkbox" value="True" name="myCheckBox" /> There is a `name` there for the form post back but no `id` for javascript or labels :-( I was hoping th...
Now, I'm not saying that this is the greatest name in the world, but here was the idea as I understand it. Originally, the popen family was in the os module and was an implementation of the venerable posix popen. The movement to the subprocess module would have been an opportune to rename them, but I guess that kee...
Now, I'm not saying that this is the greatest name in the world, but here was the idea as I understand it. Originally, the popen family was in the os module and was an implementation of the venerable posix popen. The movement to the subprocess module would have been an opportune time to rename them, but I guess tha...
If you're using Visual Studio, there's the option to break whenever an exception is thrown, regardless of whether it's unhandled or not. When the exception is thrown, the exception helper (maybe only VS 2005 and later) will tell you what kind of exception it is. Hit Ctrl+Alt+E to bring up the exception options dial...
@sectrean That doesn't work because the compiler ignores the Exception ex value if there is nothing using it.
How to download a live MySQL db into a local test db on demand, without SSH?
|php|ruby|database|mysql|
I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doing ...
I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doing ...
JavaScript needs access to cookies if AJAX is used on a site with access restrictions based on cookies. Will HttpOnly cookies work on an AJAX site? *Edit:* Microsoft created a way to prevent XSS attacks by disallowing JavaScript access to cookies if HttpOnly is specified. FireFox later adopted this. So my question ...
You want a[0,1] instead of a[0].
Here's my solution, but even more importantly my approach to solving the problem. I approached the problem by - drawing the memory cells and drawing arrows from the destination to the source. - made a table showing the above drawing. - labeling each row in the table with the relative byte address. This showe...
So, you intend to modify the data being dropped based on the drop target? I don't think this is possible; after all, you populate the data when the drag is initiated.
FLVPlayback component memory issues
|actionscript-3|memory|video|flash|
My website is entirely flash based, it moves around a 3D model which was given to me as chunks of video that I've converted to FLV files. I'm using the FLVPlayback component to control the video inside of my program. While running memory checks using System.totalMemory I've noticed that whenever a video is loaded, it w...
How Best to Compare Two Collections in Java and Act on Them?
|java|collections|
I have two collections of the same object, `Collection<Foo> oldSet` and `Collection<Foo> newSet`. The required logic is as follow: - if `foo` is in(*) `oldSet` but not `newSet`, call `doRemove(foo)` - else if `foo` is not in `oldSet` but in `newSet`, call `doAdd(foo)` - else if `foo` is in both collections ...
DSL in Finance
|dsl|finance|
does anyone here have ever worked with [DSLs (Domain Specific Languages)](http://www.google.com.br/url?sa=t&ct=res&cd=1&url=http%3A%2F%2Fen.wikipedia.org%2Fwiki%2FDomain-specific_programming_language&ei=QyWvSIXcC4foebjSlHs&usg=AFQjCNFsZOnJm-AGmi5sxai8YI-0Al6wfA&sig2=6nX5EkUmNkEwiSKAkUeyZQ) in the finance domain ? I am ...
mockRepository.Expect( r => r.Query() ).Returns( myEnumerable.AsQueriable() );
In Moq it would be: mockRepository.Expect( r => r.Query() ).Returns( myEnumerable.AsQueriable() );
In Moq it would be: mockRepository.Expect( r => r.Query() ).Returns( myEnumerable.AsQueriable() ); In RhinoMocks it would be: Expect.Call( repository.Query() ).Return( myEnumerable.AsQueriable() );
@MrBrutal I love Notepad2 as well. The only problem is it's lame with large files. :(
Depends on the implementation. What language/library/class? There may be a best case, but it would be very specific to the number of features in the implementation.
One huge difference would be the move from Matz's interpreter to [YARV][1], a bytecode virtual machine that helps significantly with performance. [1]: http://en.wikipedia.org/wiki/YARV
Do you write your own specific Exceptions?
|java|exception|
I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException { /* ... logic that could throw a MailException */ } `MailException` could be thrown for a nu...
Do you write exceptions for specific issues or general exceptions?
|java|c#|exception|
|c#|java|exception|
I have some code that gives a user id to a utility that then send email to that user. emailUtil.sendEmail(userId, "foo"); public void sendEmail(String userId, String message) throws MailException { /* ... logic that could throw a MailException */ } `MailException` could be thrown for a nu...
> The answer above doesn't account for decompressors. There is no CLSID_VideoDecompressorCategory. Is the are a way to ask a filter if it is a video decompressor? **Not that I know of.** Most filters in this list are codecs, so contain both a encoder and decoder. The filters in the CLSID_ActiveMovieCat...
I cannot recommend this as *the way*, but you could create a COM-callable wrapper for your C# library, then create a VB6 ActiveX exe project that delegates calls to your C# library.
This [post][1] suggests that there is one line that needs to be added to the crossdomain.xml file. <allow-http-request-headers-from domain="*" headers="*"/> [1]: http://willperone.net/Code/as3error.php
[**JAXB**][1]. The Java Architecture for XML Binding. Basically you create an xsd defining your XML layout (I believe you could also use a DTD). Then you pass the XSD to the JAXB compiler and the compiler creates Java classes to marshal and unmarshal your XML document into Java objects. It's really simple. BTW, t...
Seems like my installation of Visio is the problem. I've tried on another computer here and it allow me to open 2 instances of the software.
Another point I forgot. The Windows Media Foundation is a toolkit for using WMV/WMA. It does not provide all things that DirectShow supports. It is really only a SDK for Windows Media. There are bindings in WMV/WMA to DirectShow, so that you can use WM* files/streams in DirectShow applications.
You've done a good job of explaining what you want to do but not why. There are several XML frameworks that simplify marshalling and unmarshalling Java objects to/from XML. The simplest is [Commons Digester][1] which I typically use to parse configuration files. But if you are want to deal with Java objects then yo...
@Matt Dillard - Did setting these to nothing fix your memory leak? VB6 doesn't have a formal garbage collector, more along the lines of what @Konrad Rudolph said. Actually calling unload on your forms seems to me to be the best way to ensure that the main form is cleaned up and that each subform cleans up their a...
Here's my solution, but even more importantly my approach to solving the problem. I approached the problem by - drawing the memory cells and drawing arrows from the destination to the source. - made a table showing the above drawing. - labeling each row in the table with the relative byte address. This showe...
Firstly, "ugly no-char boxes" might not be an encoding problem, they might just be a sign you don't have a font installed that can display the glyphs in the page. Most character encoding problems happen when strings are being passed from one system to another. For webapps, this is usually between the browser and the...
grep a file, but show several surrounding lines?
|linux|search|logging|grep|
I would like to grep for a string, but show the preceding 5 lines and following 5 lines as well as the matched line. I'm scanning for errors in a logfile, and want to see the context. Any clues for the clueless?
I believe this is changing in Ruby 1.9 such that "asdf"[2] yields "d" rather than the character code
|php|database|ruby|mysql|
I have a fairly small MySQL database (a Textpattern install) on a server that I do not have SSH access to (I have FTP access only). I need to regularly download the live database to my local dev server on demand; i.e., I would like to either run a script and/or have a cron job running. What are some good ways of doing ...
Encrypt data from users in web applications
|web-applications|privacy|encryption|
Some web applications, like Google Docs, store data generated by the users. Data that can only be read by its owner. Or maybe not? As far as I know, this data is stored as is in a remote database. So, if anybody with enough privileges in the remote system (a sysadmin, for instance) can lurk my data, my privacy could...
|encryption|web-applications|privacy|
have you tried to print (Console.WriteLine()) the exception inside the catch clause, and not use visual studio and run your application on console?
I suppose you're using mod_php, right? When a PHP file finishes executing all it's state is killed so there's no way (in PHP code) to do connection pooling. Instead you have to rely on extensions. You can [mysql_pconnect][1] so that your connections won't get closed after the page finishes, that way they get reus...
Hopefully it will be standards compliant and erase a little midget of Internet Explorer's market share - Firefox has ease of use and plugins going for it, but "security" is something non-technical people can understand... which one could hope would make development easier. That's assuming it stays standards complian...
Embed Powerpoint into HTML
This is a quick solution, but I would give each checkbox a unique ID, perhaps with an index hint, like so: <input id="checkbox-0" type="checkbox" /> <input id="checkbox-1" type="checkbox" /> <input id="checkbox-2" type="checkbox" /> <input id="checkbox-3" type="checkbox" /> ...
> here's ya problem: >> 3.2GHz P4 Hyperthreaded, 2GB RAM > Hypertheaded means "doesn't actually have two CPU's, but it fakes it". If you have a process with just one thread running, then you get bad performance. It was a good short-term measure, but compared to having two REAL CPU's, it's a slow hack. I don't ...
> One of the biggest culprits for Visual Studio 2005 slowness is Intellisense. This has been brought up on the MSDN forums again and again and again. What I frequently experience is that Intellisense is working nearly non-stop to "re-index" symbols [...] I agree. I use Visual Assist. It is much better. There is no r...
As explained in other answers, there are many choices for a modulo operation with negative values. In general different languages (and different machine architectures) will give a different result. According to the [Python reference manual][1], >The modulo operator always yields a result with the same sign as its...
How Would You Create a Pattern from a Date that is Stored in a String?
|java|date|
I have a string that contains the representation of a date. It looks like: **Thu Nov 30 19:00:00 EST 2006** I'm trying to create a Date object using SimpleDateFormat and have 2 problems. 1.) I can't figure out the pattern to hard-code the solution into the SimpleDateFormat constructor 2.) I can't find a w...
What's the purpose (if any) of "javascript:" in event handler tags?
|javascript|
I'm a self-proclaimed javascript dunce. I can usually "make it work" when needed, but I'm sure I end up doing things less than optimally 99% of the time. I hope to pick a javascript lirbrary/framework and stick with it (i.e. jQuery), but that's not the topic of this question. This is probably due in large part to th...
I'm a self-proclaimed javascript dunce. I can usually "make it work" when needed, but I'm sure I end up doing things less than optimally 99% of the time. I hope to pick a javascript library/framework and stick with it (i.e. jQuery), but that's not the topic of this question. This is probably due in large part to the...
@ Michael DSL=[Domain Specific Language][1] As for what you should learn, that depends on what you're interested in. Are you looking to challenge yourself while staying in the same medium (web-centric applications)? I would suggest learning about Apache and the LAMP (Linux, Apache, MySQL, PHP) architecture and ch...
The more languages you know, the more marketable you are. Look and see what the more popular (market for, not fan base) languages are, then add on some cutting edge tech that is not in much use yet, rounded out by general programming skill. With your skill set I would recommend (as far as languages): - Java as ...
>>Basically, is there any appreciable difference between: `onchange="javascript: myFunction(this)"` and `onchange="myFunction(this)"` ? Assuming you meant `href="javascript: myFunction(this)"`, yes there is, especially when loading content using the javascript. Using the javascript: pseudo protocol makes the conten...
Why won't .NET deserialize my primitive array from a web service?!
|.net|java|service|primitive|
Help! I have an Axis web service that is being consumed by a C# application. Everything works great, except that arrows of long values always come across as [0,0,0,0] - the right length, but the values aren't deserialized. I have tried with other primitives (ints, doubles) and the same thing happens. What do I do? ...
Help! I have an Axis web service that is being consumed by a C# application. Everything works great, except that arrays of long values always come across as [0,0,0,0] - the right length, but the values aren't deserialized. I have tried with other primitives (ints, doubles) and the same thing happens. What do I do? ...
What you probably want is a combination of a queue that contains updates for the linked server and a process that reads data from the queue and updates the remote server. The trigger will then insert a message into the queue as part of the normal transaction. This data will be read by the separate process and used to...
We develop a 32-bit application using VS 2005 (2008 soon) and have just purchased some new machines with XP Pro x64 or Vista Business 64-bit on them so that we can take advantage of the extra RAM whilst holding a watching brief on the possibility of doing a 64-bit port if it becomes commercially necessary to do so. We ...
If there's no requirement on preserving file type after scaling I'd recommend the following approach. Image src = Image.FromFile("main.gif"); Bitmap b = new Bitmap(100, 129); using (Graphics g = Graphics.FromImage(b)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.Interpolation...
If there's no requirement on preserving file type after scaling I'd recommend the following approach. Image src = Image.FromFile("main.gif"); Bitmap dst = new Bitmap(100, 129); using (Graphics g = Graphics.FromImage(dst)) { g.SmoothingMode = SmoothingMode.AntiAlias; g.Interpola...
[@Chris][1], That's just how [] and [,] are defined for the String class. Check out the [String API][2]. [1]: http://stackoverflow.com/questions/29511/ruby-convert-integer-to-string#29513 [2]: http://ruby-doc.org/core/classes/String.html#M000786
Or you can convert the integer to its character value: a[0].chr
Even with rep, there should still be SOME type of capcha, to prevent a malicious script attack.
Here a working solution, using temporary variables: <pre><code> void shift_4bits_left(uint8_t* array, uint16_t size) { int i; uint8_t shifted = 0x00; uint8_t overflow = (0xF0 & array[0]) >> 4; for (i = (size - 1); i >= 0; i--) { shifted = (array[i] << 4) | overflow; ...
Here a working solution, using temporary variables: <pre> void shift_4bits_left(uint8_t* array, uint16_t size) { int i; uint8_t shifted = 0x00; uint8_t overflow = (0xF0 & array[0]) >> 4; for (i = (size - 1); i >= 0; i--) { shifted = (a...
Here a working solution, using temporary variables: void shift_4bits_left(uint8_t* array, uint16_t size) { int i; uint8_t shifted = 0x00; uint8_t overflow = (0xF0 & array[0]) >> 4; for (i = (size - 1); i >= 0; i--) { shifted = (array[i]...