instruction
stringlengths
0
30k
[StreamReader][1] is a concrete class, so many mocking systems won't allow you to mock it. [TypeMock Isolator][2] will, however. You may find you want to mock it if you need to force errors to come from the reader, rather than just having it supply data to your class under test. If you don't need this functionalit...
At this point, without a large new direction in bug tracking/ticketing, it would simply be re-inventing the wheel. Which seems to be what everyone else thinks, generally.
You can use a factory method to return a TextReader that could either be the mock object or an actual StreamReader.
Try with relative paths, see what is the current directory when your controllers are executed with os.path.abspath(os.path.curdir) and build a path to the templates relative to that location (without the os.path.abspath part of course). It would be a good idea to keep a global variable template_dir for controllers in c...
Cppunit is a direct equivalent of Junit for C++ applications <http://cppunit.sourceforge.net/cppunit-wiki> Personally, I created the unit tests in a different project, and created a separate build configuration which built all the unit tests and dependent source code. In some cases I wanted to test private member f...
I'm pretty sure that it generates an error if the variable wasn't previously declared. If your installation isn't showing such errors, check the error_reporting() level in your php.ini file.
iframe sizing
|html|css|
I am displaying pages from an external site (that I own) in an iframe in one of my pages, and it's fine except when viewed in Opera with the browser reduced down (not widescreen), when the iframe shrinks and squashes the content. It works in widescreen (maximise browser window), and is OK in IE7, Firefox, Chrome and Sa...
A clustered index actually describes the order in which records are physically stored on the disk, hence the reason you can only have one. A Non-Clustered Index defines a logical order that does not match the physical order on disk.
You can try to play with the error reporting level as indicated here: <http://us3.php.net/error_reporting> but I'm not sure it mention the usage of non initiated variable, even with E_STRICT.
my guess, by your use of quotes, is you did something like re = new RegExp('.+\$chkChecked'); which won't work because js takes advantage of the \ in its string interpretation as an escape so it never makes it into the regex interpreter instead you want re = new RegExp('.+\\$chkChecked');
Clustered basically means that the data is in that phisical order in the table. This is why you can have only one per table. Unclustered means it's "only" a logical order.
If the site is usable with JavaScript and CSS disabled, then you're doing pretty well. The Web Developer toolbar in Firefox lets you easily disable both of these. Another way to check is to use Lynx, a command-line, text-only browser. Beyond that, your best bet is to check the site heuristically against whatever guidel...
I think the easiest thing to do is to include some kind of JavaScript library on the HTML page, say jQuery, and use it's functions for determining the position and size of DOM nodes. I would do it more or less like this: var jsCode : String = "function( id ) { return $('#' + id).offset(); }"; var offset :...
In the beginning, a compiler was responsible for turning a high-level language (defined as higher level than assembler) into object code (machine instructions), which would then be linked (by a linker) into an executable. At one point in the evolution of languages, compilers would compile a high-level language into ...
GLSL major mode for emacs?
|emacs|glsl|elisp|
I found this link <http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/>, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. If there isn't one,...
I found this link <http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/>, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. If there isn't one,...
|emacs|elisp|glsl|
I found this link <http://artis.imag.fr/~Xavier.Decoret/resources/glsl-mode/>, but there isn't a lot of description around it, aside that it's "simple". Ideally, I'd like an extension to CcMode that can do it, or at least a mode that can handle auto-styling and has similar shortcuts to CcMode. If there isn't one,...
You could do this: <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'><\/sc" + "ript>"); document.write("<script language='javascript' type='text/javascript'>function during(){alert('during');}<\/sc" + "ript>"); ...
See also <a href="http://stackoverflow.com/questions/70573/best-online-source-to-learn-perl">best online source to learn perl</a> Specifically for perldoc, you can also view the content online which might be easier on the eyes: <a href="http://perldoc.perl.org/">perldoc online</a>
You might be able to reduce the problem, and then do an intensive search on a small set. Process each polygon first by finding: - Center of polygon - Maximum radius of polygon (ie, point on edge/surface/vertex of teh polygon furthest from the defined center) Now you can collect, say, the 5-10 closest poly...
This is easy. Yes, you need a "sms gateway" provider. There are a lot out there. These companies provide APIs for you to send/receive SMS. e.g. the German company [Mobilant][1] provides an easy API. If you want to receive a SMS just program a simple PHP / JSP / s.th.else dynamic web page and let Mobilant call it. ...
Are you using the Catalog Library List parameter? This is what my connection string typically looks like: > [add name="AS400ConnectionString" > connectionString="Data > Source=DEVL820;Initial > Catalog=Q1A_DATABASE_SRVR;Persist > Security Info=False;User > ID=BLAH;Password=BLAHBLAH;Provider=IBMDASQL.DataSource...
M-x speedbar ([speedbar website](http://cedet.sourceforge.net/speedbar.shtml)) will pop up an emacs frame that lists the contents of the current directory depending on the buffer you're in. The frame is small and stays out of the way so you can always glance at it while you're editing files. It also can filter this d...
I'm not up with Java, so here's a nice guide on how to do it in Ruby on Rails: http://www.lukeredpath.co.uk/2007/8/29/sending-sms-messages-from-your-rails-application If you want to send 'true' SMS you'll need to use an SMS gateway, (use of one is outlined in the above guide). You can use MMS to send messages, t...
div class vs id
|css|xhtml|class|div|
When using divs when is it best to use a class vs id? Is it best to use class, on say font variant or elements within the html? Then use id for the structure/containers? This is something I've always been a little uncertain on, any help would be great.
The `dirname` function returns an absolute path, use relative paths. See what is the current directory when your controllers are executed with `os.path.abspath(os.path.curdir)` and build a path to the templates relative to that location (without the `os.path.abspath` part of course).
The `dirname` function returns an absolute path, use relative paths. See what is the current directory when your controllers are executed with `os.path.abspath(os.path.curdir)` and build a path to the templates relative to that location (without the `os.path.abspath` part of course). This will only work if the curre...
Not Invented Here syndrome! Build your own bug tracker? Why not build your own mail client, project management tool, etc. As Omer van Kloeten says above, pay now or pay later.
How do I use a pipe in the exec parameter for a find command?
|bash|
I'm trying to construct a find command to process a bunch of files in a directory using two different executables. Unfortunately, -exec on find doesn't allow to use pipe or even \| because the shell interprets that character first. Here is specifically what I'm trying to do (which doesn't work because pipe ends t...
|bash|shell|
My current best (in x86 assembly) is: push eax jmp short $-1 which results in 3 bytes of object code (`50 EB FD`). For 16-bit code, this is also possible: call $ which also results in 3 bytes (`E8 FD FF`).
Most importantly, where will you submit the bugs for your bug tracker?? But seriously. The tools already exist, there's no need to reinvent the wheel. Modifying tracking tools to add certain specific features is one thing (I've modded Trac before)... rewriting one is just silly.
Most importantly, where will you submit the bugs for your bug tracker before it's finished?? But seriously. The tools already exist, there's no need to reinvent the wheel. Modifying tracking tools to add certain specific features is one thing (I've modded Trac before)... rewriting one is just silly. The most imp...
The installation barrier will be a problem until it ships with Windows by default. But even then developers will only support the established Flash. Considering certain mobile platforms have neither Flash nor Silverlight, it's best to back the one more likely to be ported to all platforms, and that's the dominant Flash...
Stop SubText/FCKEditor messing up the HTML
|syntax-highlighting|fckeditor|subtext|
I'm trying to put together a blog, and have gone with SubText and I've just installed SyntaxHighlighter but it doesn't seem to work properly. SubText or FCKEditor seems to tamper with the HTMl, inlineing everything in the pre tags and placing line-breaks at the end of each line. Bad times! Anyone know how to sto...
A like for like port I take it? I don't really see the point and what you will gain for all the effort. Maybe write any new features or refactor sluggish/bad existing logic/service layers into c# but as for web pages I don't see the 80/20 benefit.
That's tricky... you can use performance monitor to track hardware and OS factors - like CPU usage, memory; and also various SQL Server counters like queries per second. Obviously memory usage would tell you if you need more RAM, but its not so easy to tell if (say) high CPU usage is due to the inefficient code, or jus...
Have you read the [Markers reference in Scintilla doc][1]? This reference can be a bit obscure, so I advise to take a look at the source code of SciTE as well. This text editor was originally a testbed for Scintilla. It grown to a full fledged editor, but it is still a good implementation reference for all things Scin...
The only thing that I can really think of is to ensure that your instance of JRuby is using gems by default. I ran into that problem a few times when using gems where I would forget to either set the environmental variable or pass in the switch to Ruby. I don't know if things are different for JRuby though.
How do I present text vertically in a JLabel ? (Java 1.6)
The old ADO.Net (sqlConnection, etc.) is a dinosaur with the advent of LINQ. LINQ requires .Net 3.5, but is backwards compatible with all .Net 2.0+ and Visual Studio 2005, etc. To start with linq is ridiculously easy. - Add a new item to your project, a **linq-to-sql** file, this will be placed in your **App...
How to transform a date-string in classic asp
|asp-classic|
I'm a little blockheaded right now... I have a date string in european format **dd.mm.yyyy** and need to transform it to **mm.dd.yyyy** with classic ASP. Any quick ideas? Thanks in advance!
That's a reasonable approach. I've had very good results both with [UnitTest++][1] and [Boost.Test][2] [1]: http://unittest-cpp.sourceforge.net/ [2]: http://www.boost.org/doc/libs/1_36_0/libs/test/doc/html/index.html
That's a reasonable approach. I've had very good results both with [UnitTest++][1] and [Boost.Test][2] I've looked at CppUnit, but to me, it felt more like a translation of the JUnit stuff than something aimed at C++. [1]: http://unittest-cpp.sourceforge.net/ [2]: http://www.boost.org/doc/libs/1_36_0/li...
Here is a [python sample code calling a CVI][2]. There are [DaqMx python bindings][1] too. [1]: http://www.scipy.org/Cookbook/Data_Acquisition_with_PyUL [2]: http://decibel.ni.com/content/docs/DOC-1494
A clustered index is essentially a sorted copy of the data in the indexed columns. The main advantage of a clustered index is that when your query (seek) locates the data in the index then no additional IO is needed to retrieve that data. The overhead of maintaining a clustered index, especially in a frequently u...
Check out error reporting, http://php.net/manual/en/function.error-reporting.php What you want is probably E_STRICT. Just bare in mind that PHP has no namespaces, and error reporting becomes global. Kind of sucks to be you if you use a 3rd party library from developers that did not have error reporting switched on.
Okay...during... // During.js during[fish](); after... // After.js alert("After"); fish++ HTML <!-- some html --> <script language="javascript" type="text/javascript"> document.write("<script language='javascript' type='text/javascript' src='before.js'></sc" + "ript>"...
You are going to have two basic problems that will make this hard: 1) Floating point isn't an exact representation which means that if you have a fraction of "x/y" which results in a value of "z", your fraction algorithm may return a result other than "x/y". 2) There are infinity many more irrational numbers than...
Set max\_allowed_packet to the same (or more) than what it was when you dumped it with mysqldump. If you can't do that, make the dump again with a smaller value. That is, assuming you dumped it with mysqldump. If you used some other tool, you're on your own.
Can this macro be converted to a function?
|c++|define|
While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be converted into an inline function or template?
While refactoring code and ridding myself of all those #defines that we're now taught to hate, I came across this beauty used to calculate the number of elements in a structure: #define STRUCTSIZE(s) (sizeof(s) / sizeof(*s)) Very useful as it is but can it be converted into an inline function or template? ...
When using Opacity property have to remember that its of type double and is based on a percentage. So 1.0 is complete opacity, and 0.0 is completely transparent. private void fadeTimer_Tick(object sender, EventArgs e) { this.Opacity -= 0.01; if (this.Opacity <= 0) ...
I have often found that learning another language, especially a dynamically typed language, can teach you things about other languages and make you an overall better programmer. Learning ruby, for example, will teach you Object Oriented programming in ways Java wont, and vice versa. All in all, I believe that it is b...
Philosophical issues aside, I know that I have gotten value from writing quick-and-dirty Ruby scripts to solve brute-force problems that Java was just too big for. Last year I had three separate directory structures that were all more-or-less the same, but with lots of differences among the files (the client hadn't he...
You may want to look at [Trac][1]. [1]: http://trac.edgewall.org/ "Trac"
There are lots of things that can make XML malformed. It might be a problem with character entities. Try running anything output from a database through htmlentities() when you concatenate the string. Do you have an example of the generated XML for us to look at so we can see where the problem is?
There are lots of things that can make XML malformed. It might be a problem with character entities (a '<', '>', or '&' in the data between the XML tags). Try running anything output from a database through htmlentities() when you concatenate the string. Do you have an example of the generated XML for us to look at so ...
I don't know Service Factory so i am not sure if this will help. Anyway: maybe the article [Naming a File or Directory][1] from MSDN can help. Windows API has a maximum length for paths (MAX_PATH = 260). If you want to use longer pathnames you will have to use the Unicode versions of the API by prefixing your paths ...
First, you need an SMS gateway. Take a look at [Kannel][1] SMS Gateway. [1]: http://www.kannel.org/
[http://trac.edgewall.org/][1] - might be a bit hard to install but otherwise is very good if coupled with svn repository [1]: http://trac.edgewall.org/
I thin you need to investigate [Selenium][1]. We use it to do automated UI testing throughout our solution, and it is cross browser and cross platform. You can use the [Selenium IDE][2] to record a walkthrough of your web application, and then you can either run it in the browser, or export it to various languages s...
Pros: Clustered indexes work great for ranges (e.g. select * from my_table where my_key between @min and @max) In some conditions, the DBMS will not have to do work to sort if you use an orderby statement. Cons: Clustered indexes are can slow down inserts because the physical layouts of the records have to ...
The easiest to write a new program in would be the one you're most familiar with. The easiest to use, test or distribute would probably be the most cross-platform, most distributed or the most supported one, so GTK+/wx/Qt/Tk? Note that C itself isn't a particularly *easy* language, especially with the growing obj...
I would make 3 tables. users, groups and usersgroups which is used as cross-reference table to link users and groups. In usersgroups table I would add userId and groupId columns and make them as primary key. BTW. What naming conventions there are to name those xref tables?
I would probably build the assembly, and then use reflection to iterate over all the exported types... If you want some sample code you can find inspiration in <a href="http://www.timvw.be/presenting-assemblytypepicker/">http://www.timvw.be/presenting-assemblytypepicker/</a>.
DataGridViewComboBoxColumn adding different items to each row . .
|c#|winforms|datagridview|
I am building a table using the DataGridView where a user can select items from a dropdown in each cell. To simplify the problem, lets say i have 1 column. I am using the DataGridViewComboBoxColumn in the designer. I am trying to support having each row in that column have a different list of items to choose from. ...
fopen deprecated warning
|visual-c++|deprecated|
On *Visual Studio 2005 C++ compiler*, I get the following warning when my code uses the **fopen** and such calls. 1>foo.cpp(5) : warning C4996: 'fopen' was declared deprecated 1> c:\program files\microsoft visual studio 8\vc\include\stdio.h(234) : see declaration of 'fopen' 1> Message: 'T...
It looks like Microsoft has deprecated lots of calls which use buffers to improve code security. However, the solutions they're providing aren't portable. Anyway, if you aren't interested in using the secure version of their calls (like **fopen_s**), you need to place a definition of **\_CRT\_SECURE\_NO\_DEPRECATE** be...
Regex and unicode
|python|regex|unicode|
I have a script that parses the filenames of TV episodes (show.name.s01e02.avi for example), grabs the episode name (from the www.thetvdb.com API) and automatically renames them into something nicer (Show Name - [01x02].avi) The script works fine, that is until you try and use it on files that have Unicode show-name...
You can also try [Visual Studio for Database Professionals][1]. It's mainly about change management but also has tools for generating test data and unit tests. It's pretty expensive tho. [1]: http://msdn.microsoft.com/en-gb/vsts2008/products/bb933747.aspx
If you have a windows 2003 server, you can have a look at Sharepoint Services 3.0 (http://technet.microsoft.com/en-us/windowsserver/sharepoint/bb684453.aspx). It can do version control for documents, and has a nice integration with Office, starting with Office xp, but office 2003 and 2007 are better. Office and PDF ...
The URL POSTed to might be returning a Redirect -- that would cause a GET. This is commonly done so that the page can be refreshed without reposting.
With the increasing use of Web 2.0, I think there are two important methods missing from your list: 8 AJAX applications - since the page doesn't reload and there is no page to page navigation, state isn't an issue (but persisting user data must use the asynchronous XML calls). 9 Local persistence - Browser-based ...
How to add FTP support to eclipse?
|eclipse|ftp|eclipse-pdt|
I'm using Eclipse PHP Development Tools, which would be the easiest way to access a file or maybe create a remote project trough FTP and maybe SSH and SFTP?.
Did you try: <pre> execBtn.setAttribute("onclick", function() { runCommand() }); </pre>
My favorite datetime parser is [DateTime::Format::ISO8601](http://search.cpan.org/perldoc?DateTime::Format::ISO8601) Once you've got that working, you'll have a DateTime object, easily convertable to epoch seconds with epoch()