instruction
stringlengths
0
30k
<img src="http://i50.photobucket.com/albums/f324/ann1024/DevelopersAreBornBrave_Small.jpg" width="630">
Customising the generic Rails error message
|ruby-on-rails|
Our rails app is designed as a single code base linking to multiple client databases. Based on the subdomain the app determines which db to connect to. We use liquid templates to customise the presentation for each client. We are unable to customise the generic 'We're Sorry, somethign went wrong..' message for each ...
How to have silverlight get its data from MySQL
|silverlight|c#|mysql|data-binding|.net|
I've written a small hello world test app in Silverlight which i want to host on a Linux/Apache2 server. I want the data to come from MySQL (or some other linux compatible db) so that I can databind to things in the db. I've managed to get it working by using the [MySQL Connector/.NET][1]: MySqlConnection con...
Just to illustrate the remarks of the previous answers urging you to use table instead of div for _tabular_ data: **[CSS Table gallery][1]** is a great way to display beautiful tables in many many different visual styles. [1]: http://icant.co.uk/csstablegallery/
In XPath 2.0 and XQuery 1.0 you can test against the namespace prefix using the [in-scope-prefixes()][1] function in a predicate. e.g. //*[in-scope-prefixes(.)='html'] If you cant use v2, in XPath 1.0 you can use the [namespace-uri()][2] function to test against the namespace itself. e.g. //*[namesp...
Are you running on virtual or physical servers? We found that it is significantly faster on physical servers. Also, check the disk performance - if you are running the servers from a SAN it might be a sign that your SAN is over utilised.
Try to separate your content and layout from your code as much as possible. Any time you write any HTML in a .php file, stop and think "Does this _really_ belong here?" One solution is to use templates. Look at the [Smarty](http://www.smarty.net) templating system for a pretty easy-to-use option.
For a happy medium between a 2<sup>32</sup> lookup table and iterating through each bit individually: int bitcount(unsigned int num){ int count = 0; static int nibblebits[] = {0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4}; for(; num != 0; num >>= 4) count +=...
If you only need it to check when the user asks rather then all the time, don't use the FileSystemWatcher. Especially if it's a shared resource - the last thing you want is 50 client machines watching the same shared directory. It's probably just a typo, but you shouldn't be looking at the file access time, you wan...
I think it should be a combination of user-name plus IP block. Not just IP.
You need a framework. This will not only make your code pretty (because of the already-mentioned model-view-controller pattern, MVC) - it will save you time because of the components that are already written for it. I recommend QCodo, it's amazing; there are others - CakePHP, Symfony.
Hasn't this change from 2003 to 2007? There's no longer an excluded paths option.
It would of course depend on the wiki engine you're talking to. Most likely though, as sblundy says, it would be a security risk to allow free usage of javascript on the wiki page.
I've found Informatica to be an exceptionally useful data processing tool. The good news is that the more recent versions even allow Java transformations. If you're dealing with terabytes of data, it might be time to pony up for the best-of-breed ETL tools. I'm assuming you want to do something with the results of...
If your numerical data is regularly sampled and you need to do random access consider to store them in a [quadtree](http://en.wikipedia.org/wiki/Quadtree).
Yaml is a good solution and very close to what you have. Search for it.
It completely depends on the specific Wiki software you are using. The way I've seen work is to host a js file somewhere else and then include with a script tag with a src attribute. If they don't allow that, maybe they allow an IFRAME that you can set to a page that includes the script. Using the second techniq...
textboxes in Datarepeater dynamicly 'databound'
|vb.net|datarepeater|mysql|
I need to know if it is possible to dynamically bind a textbox residing within a datarepeater to a 'dynamically' created BindingSource. I am using VB.net. The database I am using is a MySQL database. I have to use the connection dynamicly due to the fact that the database my not permanently reside on the same se...
|mysql|vb.net|datarepeater|
I need to know if it is possible to dynamically bind a textbox residing within a datarepeater to a 'dynamically' created BindingSource. I am using VB.net. The database I am using is a MySQL database. I have to use the connection dynamicly due to the fact that the database my not permanently reside on the same se...
This is what I have used in many games. #define MAXSAMPLES 100 int tickindex=0 int ticksum=0; int ticklist[MAXSAMPLES]; /* need to zero out the ticklist array before starting */ /* average will ramp up until the buffer is full */ /* returns average ticks per frame over the MAX...
Free or open source IBM 3151 or aixterm emulators?
|aix|3151|terminalemulator|
Does anyone know of any free or open source terminal emulators that will emulate an IBM 3151 terminal or an HFT terminal (aixterm)? We have some offshore contractors that need access to some of our systems that need a 3151 or hft emulation, but are having issues transferring licenses of Hummingbird HostExplorer to...
|aix|terminalemulator|
I believe that v8 only works on x86 and arm processors at the moment. Which might be a disadvantage.
I believe that v8 only works on x86 and arm processors at the moment. Which might be a disadvantage. With regards to thread safety, from [include/v8.h](http://code.google.com/p/v8/source/browse/trunk/include/v8.h): * Multiple threads in V8 are allowed, but only one thread at a time * is allowed to use ...
First, it would be simpler if the onclick handler was set this way : <a id="someLinkId"href="#">Select</a> <script type="text/javascript"> document.getElementById("someLinkId").onClick = function() { SelectSurveyItem('<%itemid%>', '<%itemname%>'); return false; }; ...
Unicode debug visualizer in Visual Studio 2008
|visual|studio|2008|unicode|debugging|
Is there a unicode debug visualizer in Visual Studio 2008? I'm sure there was one in 2005 but all I see now is the ANSI version of the string. When looking at a piece of unicode XML it shows up perfectly when I view it in the Xml visualizer.
Is there a unicode debug visualizer in Visual Studio 2008? I have a xml file that I'm pretty sure is in unicode. When I open it in wordpad, it shows the japanese characters correctly. When I read the file into a string using File.ReadAllText (UTF8), all the japanese characters show up as blocks in the string visualizer...
|unicode|debugging|visual|studio|2008|
I would do something like this: RewriteRule ^/?(logout|config|foo)/?$ $1.php RewriteRule ^/?(logout|config|foo)/(new|edit|delete)$ $1_$2.php I prefer to explicitly list the url's I want to match, so that I don't have to worry about static content or adding new things later that don't need to be rewritten...
I don't believe you can customize the standard calendar date prompt in Cognos in the way that you are describing, and quick search of the Cognos knowledgebase didn't uncover any documents. However, it seems that the easiest way to provide a user-friendly prompt would be to just have a simple drop-down value prompt wi...
Try: RewriteRule ^/?(\w+)/?$ $1.php the $1 is the content of the first captured string in brackets. The brackets around the 2nd slash are not needed.
Try: RewriteRule ^/?(\w+)/?$ $1.php the $1 is the content of the first captured string in brackets. The brackets around the 2nd slash are not needed. edit: For the other match, try this: RewriteRule ^/?(\w+)/(\w+)/?$ $1_$2.php
Split the string into runs of letters and numbers, so "foo 12 bar" becomes the list ("foo", 12, "bar"), then use the list as the sort key. This way the numbers will be ordered in numerical order, not alphabetical.
If you haven't already, try HP Openview trial version, and apart of using SNMP, it also uses ARP tables to figure out your topology.
I have two suggestions. 1. Perhaps you need to consolidate all your tables. If they all contain the same structure, then why not have one "master" module table, that just adds one new column identifying the module ("A", "B", "C", ....) If your module tables are mostly the same, but you have a few columns that ...
Use cvs `-d/cvsroot checkout -d directory project/path/directory`. The first `-d` can be omitted if you set the root with the environment.
Use cvs `-d/cvsroot checkout -d directory project/path/directory`. The first `-d` can be omitted if you set the root with the environment. This is called "shortening the path" and can be avoided with the `-N` option to `checkout`.
One simple suggestion would be to group controls into panels based on access rights
CVS is 'tied' to the repository by files in the `.CVS` folder. Each folder is 'tied' individually. This means you can just check out the full thing (or if you already have the full thing), then cut/paste the `www` directory out to somewhere else, and it will remain linked to the correct CVS location.
Here is a Visual Studio theme generator which may help. [http://frickinsweet.com/tools/Theme.mvc.aspx][1] [1]: http://frickinsweet.com/tools/Theme.mvc.aspx
I believe those who study typography would tell you that 66 characters per a line is supposed to be the most readable width for length. Even so, if you need to debug a machine remotel over an ssh session, most terminals default to 80 characters, 79 just fits, trying to work with anything wider becomes a real pain in su...
os.system is OK, but kind of dated. It's also not very secure. Instead, try subprocess. subprocess does not call sh directly and is therefore more secure than os.system. Get more information at [http://docs.python.org/lib/module-subprocess.html][1] [1]: http://docs.python.org/lib/module-subprocess.html
Something I have done before has been to create a custom page class (Actually, I do this part on every project) that each ASP.NET Page inherits. This page class contains an IsAdmin property. I then subclass the commonly used controls that may or may not be visible between modes into custom controls, and add code ...
>>> x=[1,1,2,'a','a',3] >>> y = [ _x for _x in x if not _x in locals()['_[1]'] ] >>> y [1, 2, 'a', 3] <br> "locals()['_[1]']" is the "secret name" of the list being created.
Firstly, that is not in the context/scope of do. It is still in the context of main or global. You dont leave context until you enter {} in some way relating to subroutines or different 'classes' in perl. Within () parens you are not leaving scope. The sample you gave us is of an uninitialized hash and as Pi has sug...
Take a look at [fail2ban][1]. A python framework that allows you to raise IP tables blocks from tailing log files for patterns of errant behaviour. [1]: http://www.fail2ban.org/
In the Services on Server section check the properties for the search crawl account to make sure it is set up, and that it has permissions to access those sites.
First there's a layer of javascript code that is used to automate the browser and simulate events, run and verify tests. Next, you run a proxy server - which you point your browser to - that injects this javascript code. Then, you can talk to this proxy server through another port using a set of commands which causes t...
Where can I find some up to date information on OpenID authentication with rails?
|ruby-on-rails|openid|
The question says it all. I can't seem to find any recent rails tutorials or whatever to set up an OpenID authentication system. I found [RestfulOpenIDAuthentication](http://github.com/ReinH/restful_open_id_authentication/tree/master) but it's so much older than the vanilla Restful Authentication and the docs don't e...
A really great web part for doing this is the Content By Type web part on Codeplex. It also supports showing items of a given content type from any list in any subsite. See: http://www.codeplex.com/eoffice
Working from previous calls to the same script isn't really a good idea for this type of thing. What you want to do is always pass two values to your script, the date, and the movement. (the below example is simplified so that you only pass the date, and it will always add one day to it) Example http://www.sit...
getX() is often the name of an accessor function for member x, similar to your own usage. However, a "getX" accessor is also very often a read-only function, so that it may be surprising in other situations of your code base to see a call to "getX" that modifies X. So I would suggest, instead of just using a refere...
|visual-studio-2008|unicode|debugging|
Automatically select all text on focus in WinForms TextBox
|winforms|textbox|user-interface|
When a C# WinForms text box receives focus, I want to select all the text in the textbox. To see what I mean, click in your web browser's address bar. See how all text was selected? I want to do that. (Sounds like an easy question, but realize calling .SelectAll() during the .Enter or .GotFocus events won't work ...
When a C# WinForms text box receives focus, I want to select all the text in the textbox. To see what I mean, click in your web browser's address bar. See how all text was selected? I want to do that. **FASTEST GUN ALERT: please read the following before answering!** > (Sounds like an easy question, but > reali...
When a C# WinForms text box receives focus, I want to select all the text in the textbox. To see what I mean, click in your web browser's address bar. See how all text was selected? I want to do that. **FASTEST GUN ALERT: please read the following before answering!** > Calling **.SelectAll() during > the .Enter...
|winforms|user-interface|textbox|
When a C# WinForms text box receives focus, I want to select all the text in the textbox. To see what I mean, click in your web browser's address bar. See how all text was selected? I want to do that. **FASTEST GUN ALERT: please read the following before answering!** Thanks guys. :-) > Calling **.SelectAll() dur...
Generating a list of dependencies in Matlab
|matlab|
In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies for a given m-file is. Is there a built-in/freely downloadable way to do ...
|c#|.net|mysql|silverlight|data-binding|
I've written a small hello world test app in Silverlight which i want to host on a Linux/Apache2 server. I want the data to come from MySQL (or some other linux compatible db) so that I can databind to things in the db. I've managed to get it working by using the [MySQL Connector/.NET][1]: MySqlConnection con...
I advise against it too, but would recommend reading the [DDD forum][1] as there are many posts about it on there. Its questionable whether you should even inject into domain services, in more complex domains I think not. As Bil said services are great for cross-aggregate coordination and especially any co-ordinatio...
A few ideas: - DEP - try disabling DEP for the program an see if it solves the problem - ASLR - It fails to get access to some resource, gets a NULL pointer (a common way of functions to signal that they failed) and tries to use that (with predictable results) The best thing would be to run with a debugge...
How to get notified of Windows process maximizing CPU?
|windows|performance|utilities|
Is there a tool for Windows XP and Vista (built-in or otherwise ideally freeware/[OSS][1]) that can notify the user when the CPU is above a (configurable) threshold for some (configurable) duration? I am particularly interested in a _minimalist_ tool that fits the following bill and in order of importance (which a l...
I don't think so. A const method is a method that doesn't change the state of the object (i.e. its fields), but you can't assume that given the same input, return value of a const method is determined. In other words, `const` keyword does NOT imply that the function is one-to-one. For instance a method that returns the...
No. A const method is a method that doesn't change the state of the object (i.e. its fields), but you can't assume that given the same input, return value of a const method is determined. In other words, `const` keyword does NOT imply that the function is one-to-one. For instance a method that returns the current t...
Usually with a VTable, an array of pointers to functions.
Make a call to a reliable destination, or perhaps a series of calls, ones that should go through and return if the user has an active net connection - even something as simple as a token ping to google, yahoo, and msn, or something like that. If at least one comes back green, you know you're connected.
Each object has a vtable pointer that points to an array of member functions.
The most fundamental design pattern should be KISS (keep it simple stupid) Which means that sometimes not using classes for some elements at all it the right solution. That and CRC(Class, Responsibility, Collaborators) cards (write the card down in your header files, not on actual cards that way they because easy t...
This may have something to do with it: A stored function acquires table locks before executing, to avoid inconsistency in the binary log due to mismatch of the order in which statements execute and when they appear in the log. Statements that invoke a function are recorded rather than the statements executed within ...
You're being very explicit about the type you're referencing, and that is a benefit. Although, in the very same process you're giving up code clarity, which clearly is a downside in my case, as I want code to be readable and understandable. I go for the short version unless I have a conflict in different namespaces whi...
I don't think there is really a downside, just readability vs actual time spent coding. In general if you don't have namespaces with ambiguous object I don't think it's really needed. Another thing to consider is level of use. If you have one method that uses reflection and you are alright with typeing System.Reflec...
Checkstyle. Its very quick. FindBugs is wonderful but quite slow
How do you transfer or export SQL Server 2005 data to Excel.
|sql|sql-server|
I have a simple SQL 'Select' query, and I'd like to dump the results into an Excel file. I'm only able to save as .csv and converting to .xls creates some super ugly output. In any case, as far as I can tell (using Google) this doesn't seem to be so straight forward. Any help would be greatly appreciated.
I second the [YAML][1] suggestion. It's extremely easy to edit, very forgiving of mistakes and widely supported (especially among the dynamic languages). [1]: http://www.yaml.org/
Putting code to the matter, you can do this from the parent window: var thisIsAnObject = {foo:'bar'}; var w = window.open("http://example.com"); w.myVariable = thisIsAnObject; or this from the new window: var myVariable = window.opener.thisIsAnObject; I prefer the later, because yo...
@[yukondude] I'm using Perl myself, and I've gone down the route of Rails-style migrations semi-manually in the same way. What I then did was have a single table "version" with a single column "version", containing a single row of one number which is the current schema version. Then it was (quite) trivial to wr...
@[yukondude] I'm using Perl myself, and I've gone down the route of Rails-style migrations semi-manually in the same way. What I did was have a single table "version" with a single column "version", containing a single row of one number which is the current schema version. Then it was (quite) trivial to write a...