instruction
stringlengths
0
30k
Nah, you're doomed. Even if you pop the page up in some different browser and hid the back button, there's always the Backspace key. The problem with marketing guys and analyst types is that some of them do not understand the fundamental concept of the web being stateless. They do not understand that the page is tot...
This is [documented on the doxygen website][1], but to summarize here: You can use doxygen to document your Python code. You can either use the Python documentation string syntax: """@package docstring Documentation for this module. More details. """ def func(): """Documentati...
SSL Connection Limit
|ssl|connection|limit|
I'm using a device that's got GPRS media to connect to a PC running stunnel. On TCPIP connections, the number of sessions is limitless. However, when it comes to SSL connections, it could only go as far as 1062 successful sessions. I've tried it like 3 times but makes no difference. I've checked the OpenSSL codes and...
|ssl|connection|limits|
Problems with SSL Connection
HELP SSL GURUs!!! ... Problems with SSL Connection
I would suggest using [rsync](http://optics.ph.unimelb.edu.au/help/rsync/rsync_pc1.html), several ports are available, but [cwrsync](http://www.itefix.no/i2/node/10650) seems to work nicely on Windows.
If you want to find some integer N so that N*x is also an exact integer for a set of floats x in a given set are all integers, then you have a basically unsolvable problem. Suppose x = the smallest positive float your type can represent, say it's 10^-30. If you multiply all your numbers by 10^30, and then try to repr...
The way to go about it is to use a Sharepoint Solution (WSP) file. To change the user control, create a new Sharepoint feature with the new functionality. Include this feature in your solution. Deploy the solution either using the stsadm command line, or through Central Site Admin. This will then get automa...
Dojo has a [currency formatter][1] that's locale aware. If you don't want to include Dojo in your project just for this function, then perhaps you can localize the currency in your back-end? [1]: http://api.dojotoolkit.org/jsdoc/dojo/HEAD/dojo.currency.format
As others have mentioned the easiest way into this area is with the use of [Paypal][1], [Google checkout][2] or [Nochex][3]. However if you intend to to a significant amount of business you may wish to look up "upgrading" to higher level site integrations services such as [WorldPay][4], [NetBanx (UK)][5] or [Neteller (...
Use [svn:externals][1] to reference your legacy code as you would a third-party repository. Then you can separate your refactoring work from your dependent projects and (using fixed revision references i.e. -r1234) be very explicit about which revision of the legacy code the dependent project depends on. [1]:...
I would assume that *GetSystemMetrics()* is that you need to look at. I think that **SM_CXEDGE** and **SM_CYEDGE** are probably the values you want, but don't quote me on that. ;-)
Finding unused files in a project
|c++|file|version-control|
We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository. So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught them all....
A great resource for learning jQuery is: [Learning jQuery][1]. The author, Karl Swedberg, also co-wrote the book titled... ready? Yup, *[Learning jQuery][2]*. Remy Sharp also has great info geared towards the visual aspects of jQuery on [his blog][3]. --SEAN O [1]: http://www.learningjquery.com [2]: http:...
You have to check two things: - Are you closing the stream? Very important - Maybe you're giving stream connections "for free". The stream is not large, but many many streams at the same time can steal all your memory. Create a pool so that you cannot have a certain number of streams running at the same time
What is the best way to cache a menu system locally, in the browser?
|css|menu|
I have a very large cascading menu system with over 300 items in it. (I know it's large but it's a requirement.) Currently, it's written in javascript so the external file is cache by browsers. To improve search engine results I need to convert this to a css menu system. I realize the browsers will also cache external ...
PHP Multiform Validation and Redirection
|php|validation|post|
I have buy.php with a form where you enter items, quantity, shipping data, etc. When you click the Submit button, it posts back to buy.php ($_SERVER['PHP_SELF']) and does some data validation. If there are fields missing or errors, they are highlighted. If everything is correct, I save the $_POST data in $_SESSION vari...
The best way to accomplish what you want to do is using [SiteMaps][1] to inform Google about the urls for your web site. Basically you will want to translate your hierarchial data for the menus into a SiteMap. [1]: https://www.google.com/webmasters/tools/docs/en/protocol.html
It's a reasonable trade off for any site that can run on one server. It's fairly reasonable for small to medium traffic sites. When you grow to a point of a web farm, then you'll be better off with a separate server. Also, depending on how database dependent your application is, you may find better performance handi...
Javascript - Applying class to an HTML tag given an attribute/value
|javascript|html|attributes|
I am trying to apply styles to HTML tags dynamically by reading in the value of certain HTML attributes and applying a class name based on their values. For instance, if I have: `<p height="30">` I want to apply a `class="h30"` to that paragraph so that I can style it in my style sheet. I can't find any informati...
Attributes are just properties (usually). So just try: for (e in ...) { if (e.height == 30) { e.className = "h30"; } } Or use something like jquery to simplify this kind of stuff.
I guess I'd ask the question to why you are going after the GIS data directly in the database and not using what API that is typically provided as an abstraction for you. If this is an ESRI system there are tools that allow you to create static database views into their GIS objects and then maybe from that point it mi...
It could be because of couple of Browser settings. Try with these options checked.. Tools > Internet Options > Advanced > Enable Integrated Windows Authentication (works with Integrated Windows Authentication set on IIS) Tools > Internet Options> Security > Local Intranet > Custom Level > Automatic Logon
It could be because of couple of Browser settings. Try with these options checked.. Tools > Internet Options > Advanced > Enable Integrated Windows Authentication (works with Integrated Windows Authentication set on IIS) Tools > Internet Options> Security > Local Intranet > Custom Level > Automatic Logon Worst...
Fuzzy text (sentences/titles) matching in C#
|c#|algorithm|string|fuzzy-search|
Hey, I'm using [Levenshteins][1] algorithm to get distance between source and target string. also I have method which returns value from 0 to 1: /// <summary> /// Gets the similarity between two strings. /// All relation scores are in the [0, 1] range, /// which means that if the score gets a ...
How do I change the password of the root user in MySQL?
|mysql|
I have long since forgotten the password for the root user on one of my boxes. Is there a way I can change it without having to log in to the instance, or will I have to reinstall?
A quick Google resulted in this answer. In the root shell type: mysqladmin -u root password <password>
See: [getAttribute()][1]. Parameter is the name of the attribute (case insensitive). Return value is the value of the attribute (a string). Be sure to see the [Remarks][2] in MSDN before dealing with IE... [1]: http://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-666EE0F9 [2]: http://msdn.microsoft.com/en-u...
I found "The art of Prolog" a very good read.
Aside from is a/has a considerations, one must also consider the "depth" of inheritance your object has to go through. Anything beyond five or six levels of inheritance deep might cause unexpected casting and boxing/unboxing problems, and in those cases it might be wise to compose your object instead.
Online Interactive Consoles
|interactive|read-eval-print-loop|
Where can I find an online interactive console for my favorite language/api? * [Ruby][1] * Python? * PHP? * Perl? * Scheme? * Java? * C? [1]: http://tryruby.hobix.com/
[_Why][1] made one for [Ruby][2] [1]: http://whytheluckystiff.net/ [2]: http://tryruby.hobix.com/
* [Ruby](http://tryruby.hobix.com/) * [Python](http://try-python.mired.org/)
FirstObject XML Editor. http://www.firstobject.com/dn_editor.htm Its free, written in C++, optimized for working with very large xml files. While it is relatively limited in functionality, it can load 100MB+ unformatted files in seconds, indent them and locate specific elements using the tree view. By using t...
`RegisterHotKey()` suggested by John could work - the only catch is that it requires an HWND (using `PresentationSource.FromVisual()`, and casting the result to an HwndSource), however you'll also need to respond to the `WM_HOTKEY` message - I'm not sure if there is a way to get access to the WndProc of a WPF window or...
You can play around with [jsScheme][1] for Scheme, but it's a toy and shouldn't replace a console-based interpreter. [1]: http://www.bluishcoder.co.nz/jsscheme/
Jump straight into Grails. I'm sure Ruby/Rails is good but so in Groovy/Grails. I recommend this book. http://beginninggroovyandgrails.com Remember the errata is online. There are a couple of mistakes in the book. http://beginninggroovyandgrails.com/site/content/errata Also, check out the 3 minute and 30...
The short answer is that GetLeg isn't contravariant in its return type. The long answer can be found here: [Covariance and contravariance][1] [1]: http://blogs.msdn.com/ericlippert/archive/2007/10/16/covariance-and-contravariance-in-c-part-one.aspx
The short answer is that GetLeg isn't contravariant in its return type. The long answer can be found here: [Covariance and contravariance][1] I'd like to add that while inheritance is usually the first abstraction tool that most developers pull out of their toolbox, it is almost always possible to use composition in...
We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository. So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught them all....
|c++|version-control|file|
We are migrating our works repository so I want to do a cull of all the unreferenced files that exist in the source tree before moving it into the nice fresh (empty) repository. So far I have gone through by hand and found all the unreferenced files that I know about but I want to find out if I have caught them all....
AFAIK, JSON and YAML are exactly equivalent in data structure terms. YAML just has less brackets and quotes and stuff. So I don't see how you are rejecting one and keeping the other. Also, I don't see how XML's angle brackets are less "human readable" than JSON's square brackets, curly brackets and quotes.
Java Generics: Comparing the class of Object o to <E>
|java|generics|
I think an Inversion of Control Container like OSGi or Spring could do most of what you are talking about. (dynamic loading by name) You could build on top of their stuff. Then implement your code to 1. divide work units into discrete modules / classes (strategy pattern) 2. identify each module by unique na...
I'm a big fan of [TeraCopy][1]. [1]: http://www.codesector.com/teracopy.php
How about [unison](http://www.cis.upenn.edu/~bcpierce/unison/)?
You can either log to a table, by simply inserting a new row, or you can implement a CLR stored procedure to write to a file. Be careful with writing to a table, because if the action happens in a transaction and the transaction gets rolled back, your log entry will disappear.
Logging from inside a SQL sproc would be better done to the database itself. T-SQL can write to files but it's not really designed for it.
I think writing to a log table would be my preference. Alternatively, as you are using 2005, you could write a simple SQLCLR procedure to wrap around the EventLog. Or you could use **xp_logevent** if you wanted to write to SQL log
There's the [PRINT][1] command, but I prefer logging into a table so you can query it. [1]: http://msdn.microsoft.com/en-us/library/ms176047%28SQL.90%29.aspx
Here is an easy way using the Win32 API: <pre><code> [DllImport("winmm.dll", EntryPoint = "mciSendStringA", CharSet = CharSet.Ansi)] protected static extern int mciSendString(string lpstrCommand,StringBuilder lpstrReturnString,int uReturnLength,IntPtr hwndCallback); public void OpenCloseCD(bool Open) ...
/D may be what you are looking for. I find it works quite fast for backing-up as existing files are not copied. xcopy "O:\*.*" N:\Whatever /C /D /S /H /C Continues copying even if errors occur. /D:m-d-y Copies files changed on or after the specified date. If no date is given, copies only ...
ImageMagick can convert from svg to png, maybe you can take a look at the code, or simply create svg and use IM for the conversion? [Scruffy][1] does that. [1]: http://scruffy.rubyforge.org/ "Scruffy"
Building on [joshmsmoore][1], something like this would probably do it: # Returns the first instance variable whose value == x # Returns nil if no name maps to the given value def instance_variable_name_for(x) self.instance_variables.find do |var| x == self.instance_variable_get(var) ...
It's probably not what you're looking for, it's based on Mozilla, but for completeness sake: [Open Komodo][1] is an initiative by ActiveState to create an open source platform for building developer environments. [1]: http://www.openkomodo.com/
[LibHaru][1] > Haru is a free, cross platform, > open-sourced software library for > generating PDF written in ANSI-C. It > can work as both a static-library (.a, > .lib) and a shared-library (.so, > .dll). Didn't try it myself, but maybe it can help you [1]: http://sourceforge.net/projects/libharu/
Ctrl-Alt-UP or Ctrl-Alt-DOWN to copy lines
Alt-UP or Alt-DOWN to move lines
You could do a redirect to buy.php after saving to the session object, which then does a server redirect to check.php, it would mean when the user clicks back, they're going back to the GET request not the POST request
Why wouldn't you just point them to the S3 url?
Why wouldn't you just point them to the S3 url? Taking an artifact from S3 and then streaming it through your own server to me defeats the purpose of using S3, which is to offload the bandwidth and processing of serving the images to Amazon.
toby is right, you should be pointing straight to S3, if you can. If you cannot, the question is a little vague to give an accurate response: How big is your java heap? How many streams are open concurrently when you run out of memory? How big is your read write/bufer (8K is good)? You are reading 8K from the st...
It should be contained in the $_SERVER['REMOTE_ADDR'] variable.
But watch out for single quotes within your Stored Procedure - they need to be "escaped" by adding a second one. The first answer has done this, but just in case you missed it. A trap for young players.
Here's a quick solution that assumes a fixed length prefix (your "foo") and fixed length padding. If you need more flexibility, maybe this will at least be a helpful starting point. #!/bin/bash # some test data files="foo1 foo2 foo100 foo200 foo9999" for f in $files; do ...
We use [Elixir][1] alongside SQLAlchemy and have liked it so far. Elixir puts a layer on top of SQLAlchemy that makes it look more like the "ActiveRecord pattern" counter parts. [1]: http://elixir.ematia.de/trac/wiki
@lassevk: I agree with these rules, and have one more to add. When I have nested classes, I still split them out, one per file. Like this: // ----- Foo.cs partial class Foo { // Foo implementation here } and // ----- Foo.Bar.cs partial class Foo { class Ba...
In case `N` is not a priori fixed: for f in foo[0-9]*; do mv $f `printf foo%05d ${f#foo}`; done
Nah, you're doomed. Even if you pop the page up in some different browser and hid the back button, there's always the Backspace key. The problem with marketing guys and analyst types is that some of them do not understand the fundamental concept of the web being stateless. They do not understand that the page is tot...
Solid Config for webdev in emacs under linux AND windows ?
|windows|linux|emacs|cross-platform|
I have a windows laptop (thinkpad) and somewhat recently rediscovered emacs and the benefit that all those wacky shortcuts can be when the arrow keys are located somewhere near you right armpit. I was discouraged after php-mode, css-mode, etc, under mmm-mode was inconsistent, buggy, and refused to properly interpret...
Some applications are written so that it works in piping scenarios well e.g. svn status | find "? " is a command that pipes output of `svn status` into `find "? "` so it would filter subversion output down to unknown files (marked with a question mark) in my repos. Imagine if svn status would also output a...
Here's a quick sreencast of how to use Firebug to find out from where an element is getting it's style. [http://screencast.com/t/oFpuDUoJ0][1] [1]: http://screencast.com/t/oFpuDUoJ0
You can use `&#95;` in place of left underscores. Example: &#95;&#95;file__
Safari 3.1 doesn't need any magical commandline preferences -- the Advanced tab of the preferences window has an enable develop menu checkbox. That said if you can use the webkit nightlies (http://nightly.webkit.org), you're probably better off doing that as the developer tools are vastly improved, and you can more ea...
The [lxml package][1] supports xpath. It seems to work pretty well, although I've had some trouble with the self:: axis. There's also [Amara][2], but I haven't used it personally. [1]: http://codespeak.net/lxml/ [2]: http://pypi.python.org/pypi/Amara/1.1.6
If you have an empty partition, you can try to [create a mounted drive][1] (i.e. map the partition to an empty folder on the C: drive) and see whether the SP1 bootstrapper will be able to use it. [1]: http://support.microsoft.com/kb/307889
Is this of use to you? I am not into CF development, but it looks like you need to add some XML metadata to enable it: <http://blogs.msdn.com/bluecollar/archive/2007/02/08/adding-compact-framework-design-time-attributes-or-more-fun-with-textboxes.aspx>
Is this of use to you? I am not into CF development, but it looks like you need to add some XML metadata to enable it: <http://blogs.msdn.com/bluecollar/archive/2007/02/08/adding-compact-framework-design-time-attributes-or-more-fun-with-textboxes.aspx> Interesting read.. Looks like a lot of design time support wa...
Syntax is irrelevant, readability is not!