instruction
stringlengths
0
30k
I have a few scripts on a site I recently started maintaining. I get those Object Not Found errors in IE6 (which Firefox fails to report in its Error Console?). What's the best way to debug these- any good cross-browser-compatible IDEs, or javascript debugging libraries of some sort?
In response to the Y combinator comment, i might as well through in the Y-combinator in the SKI calculus: S (K (S I I)) (S (S (K S) K) (K (S I I))) There aren't any SKI interpreters that i know of but i once wrote a graphical one in about an hour in actionscript. I would be willing to post if there is interest (t...
Single most effective practice to prevent arithmetic overflow and underflow
|language-agnostic|numbers|
What is the single most effective practice to prevent [arithmetic overflow][1] and [underflow][2]? Some examples that come to mind are: * testing based on valid input ranges * validation using formal methods * use of invariants * detection at runtime using language features or libraries (this does not prevent ...
I wrote a huge amount of batch processing and report generation programs in both PL/SQL and Pro*C for one project. They generally preferred I write in PL/SQL as their own developers who would maintain in the future found that easier to understand than Pro*C code. It ended up being only the really funky processing o...
Manage memory the same way you manage other resources (handles, files, db connections, sockets...). GC would not help you with them either.
Check which database and server you are connecting to on each machine - the query is simple enough that you must get the same answer everywhere UNLESS you are connecting to different databases or servers.
To Sum up, there are three ways to go: 1) Make the tests one liners that call down to common methods (answer by Rick, also Hallgrim) 2) Use MBUnit's RowTest feature to automate this (answer by Jon Limjap) 3) Use a base class, answer by belugabob<br> I have made a sample based on this idea public abstra...
To Sum up, there are three ways to go: 1) Make the tests one liners that call down to common methods (answer by Rick, also Hallgrim) 2) Use MBUnit's RowTest feature to automate this (answer by Jon Limjap). I would also use an enum here, e.g. [RowTest] [Row(RepositoryType.Sql)] [Row(RepositoryType...
I'd compile it and use JNA. JNA (Java Native Access) is basically does in runtime what JNI at compile time and doesnt need any non-java code (not much java either). I don't know about its performance or usability in your case but I'd give it a try.
F#, there's a CTP release available from microsoft.
Read up on the <a href="http://en.wikipedia.org/wiki/Intel_8259">Intel 8259</a> family of Programmable Interrupt Controllers. According to this, it's interrupts 8 (master) and 112 (slave). Here's a very technical document on the 8259A: <a href="http://pdos.csail.mit.edu/6.828/2008/readings/hardware/8259A.pdf">http://...
A common problem is padding not getting added to the width of a block element. So for layout div's, avoid using padding and instead use elements within them to define the padding.
You can indeed do serious development using the Visual Studio 2008 express editions, this includes commercial products [see question number 7 in the [FAQ][1] which says: > Seven) Can I use Express Editions for commercial use? > Yes, there are no > licensing restrictions for > applications built using Visual Stu...
You can indeed do serious development using the Visual Studio 2008 express editions, this includes commercial products see question number 7 in the [FAQ][1] which says: > Seven) Can I use Express Editions for commercial use? > Yes, there are no > licensing restrictions for > applications built using Visual Stud...
The information is stored within the image in a format called [EXIF][1] or [link text][2]. There several libraries out there capable of reading this format, like [this one][3] [1]: http://en.wikipedia.org/wiki/Exchangeable_image_file_format [2]: http://www.exif.org [3]: http://www.drewnoakes.com/code/exif...
First things first: get yourself the [Internet Explorer Developer Toolbar][1]. It's a life saver and works great with IE6 and/or IE7. It's no replacement for Web Developer Toolbar or Firebug for Firefox, but it's better than nothing. Also, read up on the quirks of IE --- particularly [hasLayout][2] and [overflow]...
Placing a PDF inside another PDF document with Zend_PDF
|php|pdf|zend|
I have a pdf file of a logo, about 1"x2" in dimension. Can anybody provide the code snippet to import that PDF logo into another PDF file using the [Zend_PDF][1] API's? Ideally, I'd like to be able to place it like the PNG, TIFF or JPG objects with the Zend_Pdf_Image object. TIA! [1]: http://framework.zend...
I have a pdf file of a logo, about 1"x2" in dimension. Can anybody provide the code snippet to import that PDF logo into another PDF file using the [Zend_PDF][1] API's? Ideally, I'd like to be able to place it like the PNG, TIFF or JPG objects with the Zend_Pdf_Image object. In other words, I want to be able ...
There is no benefit to compiling to the 3.5 framework if you are not using any classes from that version of the framework.
If you have a set of load-balanced servers, you will be able to take one by one offline separately and update it. No downtime for the users!
I would agree that SQLite is the way to go. Subsonic 2.1 now includes SQLite support as well.
This is how I do debug print outs in C++. Define 'dout' (debug out) like this: #ifdef DEBUG #define dout cout #else #define dout 0 && cout #endif In the code I use 'dout' just like 'cout'. dout << "in foobar with x= " << x << " and y= " y << '\n'; If the preprocessor replaces 'do...
If your existing code base doesn't lend itself to unit testing, and it's already in production, you might create more problems than you solve by trying to refactor all of your code so that it is unit-testable. You may be better off putting efforts towards improving your integration testing instead. There's lots of ...
One of the best things about unit testing is that your code will become easier to test as you do it. Preexisting code created without tests is always a challenge because since they weren't meant to be unit-tested, it's not rare to have a high level of coupling between classes, hard-to-configure objects inside your clas...
I think that the single most important factor is the number of users that are using your project. Otherwise its just a really well written, usefull and well documented bunch of stuff that sits on a server not doing very much...
If you have a good design you should be able to determine if you can use the overloading approach or if you're going to run into a problem where if you overload you're going to end up having two methods with the same parameter type. Overloading seems like the best way initially, but if you end up not being able to a...
N2 CMS
|asp.net|.net-3.5|content-management-system|
Hy, does anyone worked with N2 Content Management System(http://www.codeplex.com/n2). If yes, how does it perform, performance wise(under heavy load)? It seems pretty simple and easy to use. Adrian
|asp.net|.net-3.5|content-management-system|n2|
Not exactly an answer to the question... but if you are trying to detect a specific browser brand, the point of feature-checking is kind of lost. I highly doubt any other browsers are using the Chrome userAgent string, so if your question is 'is this browser Chrome', you should just look at that. (By the way, window.Ac...
To acquire contributors, you first need users, then you need some incompleteness. You need to trigger the "This is cool, but I really wish it had this or was different in this way." If you are missing an obvious feature, it's extremely likely a user will become a contributor to add it.
The only one I know of is Boehm, which at the bottom is a traditional mark and sweep. It probably uses various techniques to optimize this, but typically incremental/generational/compacting GC's will be hard to create for C++ without going for a managed subset such as what you can get with .Net C++. Some of the approac...
Provided you only want to use the dataset in its own thread, you can just use synchronize to communicate with the main thread for any VCL/UI update, like with any other component. Or, better, you can implement communication between the mainthread and worker threads with your own messaging system. check Hallvard...
Be aware that catching these unhandled exceptions can change the security requirements of your application. Your application may stop running correctly under certain contexts (when run from a network share, etc.). Be sure to test thoroughly.
perl -ne 'print if 16224..16482' file.txt > new_file.txt
One alternative to the tree-method: Use the Morton-Order to encode your data. In three dimension it goes like this: Take the coordinate components and interleave each bit two zero bits. Here shown in binary: 11111b becomes 1001001001b A C-function to do this looks like this (shown for clarity and only for 11 bi...
On the [Java GNU Scientific Library][1] project I used [Swig][2] to generate the JNI wrapper classes around the C libraries. Great tool, and can also generate wrapper code in several languages including Python. Highly recommended. [1]: http://sf.net/projects/jgsl [2]: http://www.swig.org/
If User and Company really have a **one-to-one** relationship, then you only need one table: (ID, UserName, CompanyName) But I suspect you really meant that there is a *one-to-many* relationship between user and company - one or more users pr company but only one company pr user. In that case the two-table so...
Quick and dirty: head -16428 < file.in | tail -259 > file.out Probably not the best way to do it but it should work. BTW: 259 = 16482-16224+1.
Assuming you have .Net 3.5/LINQ: string[] OutputArray = MyArray.Distinct().ToArray();
[http://www.c-sharpcorner.com/UploadFile/psingh/PDFFileGenerator12062005235236PM/PDFFileGenerator.aspx][1] is open source and may be a good starting point for you. [1]: http://www.c-sharpcorner.com/UploadFile/psingh/PDFFileGenerator12062005235236PM/PDFFileGenerator.aspx
valgrind (only avail for *nix platforms) is a very nice memory checker
How to make jQuery effects run in sequence, not simultaneously?
|javascript|jquery|
How do I have two effects in jQuery run in sequence, not simultaneously? Take this piece of code for example: $("#show-projects").click(function() { $(".page:visible").fadeOut("normal"); $("#projects").fadeIn("normal"); }); The fadeOut and the fadeIn run simultaneously, how do I make th...
Use CHAR(10) if you are storing US Phone numbers only. Remove everything but the digits.
Never used it but [Borland SlikTest][1] seems to be another meeting your requirements. [1]: http://www.borland.com/us/products/silk/silktest/index.html
Never used it but [Borland SilkTest][1] seems to be another meeting your requirements. [1]: http://www.borland.com/us/products/silk/silktest/index.html
Best way to implement Google Customer Search on an aspx page
|search|google|custom|
Google custom search code is provided as a form tag. However, Asp.net only allows a single form tag on a page. What is the best way to implement their code so you can include it on an aspx page (say as part of a Masterpage or navigation element). <form action="http://your-search-results-page.aspx" id="cse-search-bo...
Date.getTime returns the number of milliseconds since January 1, 1970, 00:00:00 GMT represented by the Date object. So "06-04-2007 07:05" - "01-01-1970 00:00" is equal to 1180955340000 milliseconds. Since the only concern of your question is about the time portion of the date, a rough way of thinking of this calculatio...
SQL Server 2005 is pretty well optimized for substring queries for text in indexed varchar fields. For 2005 they introduced new statistics to the string summary for index fields. This helps significantly with full text searching.
a PHP file with a 301 HTTP permenant redirect. Put the following into index.php in the root directory of guardthe.net <?php Header( "HTTP/1.1 301 Moved Permanently" ); Header( "Location: http://guardthe.net/punbb/" ); ?> browser will re-direct with search engine friendliness.
First Things First ------------------ Get yourself the [Internet Explorer Developer Toolbar][1]. It's a life saver and works great with IE6 and/or IE7. It's no replacement for Web Developer Toolbar or Firebug for Firefox, but it's better than nothing. Know Thy Enemy -------------- Read up on the quirks of ...
How can I create and develop new database projects in Visual Studio?
|visual-studio|database|projects|
I want to find a way to develop database projects quickly in Visual Studio. Any ideas?
There may be such a library for C#, but you should probably consider just using F# <http://research.microsoft.com/fsharp/fsharp.aspx> and <http://msdn.microsoft.com/en-us/fsharp/default.aspx>. Microsoft plans to make F# a first-class language in Visual Studio so there should be little risk in using one of the CTPs t...
Unless you *really* need your Logger to be static, you could use final Logger logger = LoggerFactory.getLogger(getClass());
Have you taken a look at [Lucene.net][1]? It is a port of the Java Lucene search engine API to the .Net platform. That library offers a lot of search functionality. I played around with it a year or so ago, so don't take my suggestion as based on tons of experience. I saw it in the book *Windows Developer Power Too...
Looks like I should be using the `all_constraints` table. select owner, constraint_name, constraint_type, table_name, search_condition from all_constraints where constraint_name = 'SYS_C003415';
Looks like I should be querying `ALL_CONSTRAINTS`. select OWNER, CONSTRAINT_NAME, CONSTRAINT_TYPE, TABLE_NAME, SEARCH_CONDITION from ALL_CONSTRAINTS where CONSTRAINT_NAME = 'SYS_C003415';
> &lt;xsl:text **disable-output-escaping="yes"**&gt;I want to be &lt;strong&gt;bold&lt;strong&gt; &lt;/xsl:text&gt;
Man do I have experience with this. I work on a project where we originally stored all of our data using XML, then moved to sqlite. There are many pros and cons to each technology, but it was performance that caused the switchover. Here is what we observed. For small databases (a few meg or smaller), XML was mu...
Some of that depends on if you're updating a database as well. In the past, if the DB was being updated we downed the site for a planned (and published) maintenance period - usually something really off hours where impact was minimal. If the update doesn't involve the DB then, in a load balanced environment, we'd take ...
> I run a fitting algorithm and the minimum error of the fitting result is way larger > than the precision of the Math.exp(). Transcendental functions are always much more slower than addition or multiplication and a well-known bottleneck. If you know that your values are in a narrow range, you can simply build a ...
> I run a fitting algorithm and the minimum error of the fitting result is way larger > than the precision of the Math.exp(). Transcendental functions are always much more slower than addition or multiplication and a well-known bottleneck. If you know that your values are in a narrow range, you can simply build a ...
The hardest part is going to be keeping your change history intact. I had to do this a couple of years ago. There was a *lot* of trial and error involved in the process. I don't know if migration tools have gotten any better. Google for "sourcesafe svn migration". Once you're over that part, the rest is easy.
Database design for a booking application e.g. hotel
|php|mysql|bookingcalendar|
I've built one, but I'm convinced it's wrong. I had a table for customer details, and another table with the each date staying (i.e. a week's holiday would have seven records). Is there a better way? Many thanks. - I code in PHP with MySQL
<a href="http://www.getfirebug.com">Firebug</a> It's only for firefox but it should let you figure out what's happening on IE especially once you have the script line numbers.
Advantages of XSLT: * Domain-specific to XML, so for example no need to quote literal XML in the output. * Supports XPath/XQuery, which can be a nice way to query DOMs, in the same way that regular expressions can be a nice way to query strings. * Functional language. Disadvantages of XSLT: * Can be obscenel...
Everybody seems to be posting the "problems" with using this technique, but I haven't seen any solutions. What are the alternatives. There has to be something in the URL that uniquely defines what you want to display to the user. The only other solution I can think of would be to run your entire site off forms, and h...
This is actually an example in the <a href="http://docs.python.org/lib/node535.html">docs</a>: p1 = Popen(["dmesg"], stdout=PIPE) p2 = Popen(["grep", "hda"], stdin=p1.stdout, stdout=PIPE) output = p2.communicate()[0] which means for you: import subprocess import sys file = sys...
It's known as spaghetti code and many programmers find it objectionable... then again, if you and the other developers at your company find it readable and maintainable, who am I to tell you what to do. For sure though, use includes to reduce redundancy (DRY - don't repeat yourself)
Design problem regarding type slicing with many different subclasses.
|c#|design-patterns|type-slicing|
A basic problem I run into quite often, but ever found a clean solution to, is one where you want to code behaviour for interaction between different objects of a common base class or interface. To make it a bit concrete, I'll throw in an example; *Bob has been coding on a strategy game which supports "cool geograph...
`sed -n '16224,16482p' < dump.sql`
This error probably comes from an user who deleted/inserted that record within a transaction but did not yet commit said transaction.
It is probably easier if you have a sequence number as well as the time-stamp: in most RDBMSs you can create an auto-increment column and not change any of the `INSERT` statements. Then you join the table with a copy of itself to get the deltas select after.moment - before.moment, before.state, after.state ...
DevArt's OraDirect provider now supports entity framework. See [http://devart.com/news/2008/directs475.html][1] [1]: http://devart.com/news/2008/directs475.html
mysqldump by default performs a per-table lock of all involved tables. If you have many tables that can exceed the amount of file descriptors of the mysql server process. Try --skip-lock-tables or if locking is imperative --lock-all-tables.<br /> <http://dev.mysql.com/doc/refman/5.1/en/mysqldump.html><blockquote><pre...
Quite simple using head/tail: head -16482 in.sql | tail -258 > out.sql using sed: sed -n '16482,16482p' in.sql > out.sql using awk: awk 'NR>=10&&NR<=20' in.sql > out.sql
You can use fixed positioning or absolute positioning to tie various elements to fixed positions on the page. Alternatively you can specify a fixed size element (such as a DIV) and use `overflow: scroll` to force the scrollbars on that. As already mentioned, getting everything to work in Internet Explorer AND Firefo...
[This article in codeproject by our host Jeff Atwood][1] is what you need. Includes the code to catch unhandled exceptions and best pratices for showing information about the crash to the user. [1]: http://www.codeproject.com/KB/exception/ExceptionHandling.aspx
sed -n '16224,16482 p' orig-data-file > new-file Where 16224,16482 are the start line number and end line number, inclusive. This is 1-indexed.
Reasons to use Foreign Keys: - you won't get Orphaned Rows - you can get nice "on delete cascade" behavior, automatically cleaning up tables - knowing about the relationships between tables in the database helps the Optimizer plan your queries for most efficient execution, since it is able to get better esti...
SQL 2005 Snapshot Security
|sql-server|snapshot|
In SQL Server 2005, a snapshot of a database can be created that allows read-only access to a database, even when the database is in "recovery pending" mode. In use case for this capability is in creating a reporting database that is a copy of a production database, that is kept current through log-shipping. I...
In SQL Server 2005, a snapshot of a database can be created that allows read-only access to a database, even when the database is in "recovery pending" mode. One use case for this capability is in creating a reporting database that references a copy of a production database, which is kept current through log-shipping...
There is a tool from Microsoft to convert java to C#. For the opposite direction take a look [here][1] and [here][2]. If this doesn't work out, it should not take too long to convert the source manually because C# and java are very similar, [1]: http://www.scorm.com/pages/cs2j.aspx [2]: http://www.theservers...