input
stringlengths
51
42.3k
output
stringlengths
18
55k
Why does ActiveRecord generated SQL includes Date for a Time column? <p>When I create a SQL Time column I get a pure time, ie. no date. But when I use the Ruby Time class I get a date as well. The problem is when do a 'find' the generated SQL includes a date and I seem to be getting weird results.</p> <p><em>The Table...
<p>Time in Ruby is more like Timestamp... always has a date. ActiveSupport has built-in conversions for this, so if the date is screwing up your results, you can use #to_s(:format) to get the results you need. By default, there is a :time option, but it only returns hours / minutes (%H:%M) , if you needed seconds as we...
Automate login to a site and click a button <p>To need to login to a site, go to a particular page (eg. local router page) and click a button to do an operation(eg Connect). Since I do it almost everyday, I thought of automating it through small C# application. I don't have any idea how to do it.Any pointers?</p>
<p>Capture the content of the HTTP-request using a tool like Fiddler. With this information you can build an application that executes these HTTP-requests.</p>
COM-like interfaces warn about non virtual destructor <p>Is there a way to tell gcc that the abstract class it's compiling does not need a virtual destructor (like COM-objects never have)? For example nsISupports always complains about the missing virtual destructor. Turning off the warning would not help as I may have...
<p>The missing virtual dtor warning is there for a reason - mainly because it's a debugging nightmare to track down, especially in a large and complex code base<br /> You may have a very specific reason for doing this but ask yourself, what happens if a class gets refactored such that it's usage changes later down the ...
Delphi and SAPI <p>does anyone have a resource from where I can learn to use SAPI from Delphi ?</p> <p>how to use Speech Recognition from Delphi Applications ?</p> <p>thanks.</p>
<p><a href="http://edn.embarcadero.com/article/29583" rel="nofollow">Speech Synthesis &amp; Speech Recognition: Using SAPI 5.1</a> from the makers of Delphi sounds like a good begin.</p>
is there any wayout to set init parameter in servletconfig or servletContext object? <p>if i want to modify init-parameter value in any of ServletContext or ServletConfig. any want it to be updated after servlet is destroyed by container. is there any wayout?</p>
<p>you can set params programmatically while accessing the <code>ServletConfig</code> </p> <pre><code>config.getServletContext().setInitParameter("foo", "bar") </code></pre>
Database design for school attendance system <p>I'm working on a project for a school where a particular module deals with attendance system. I'm using LAMP(PHP 5.2+ MYSQL 5+) stack for development. Now the school strength is around 1500 and total number of working days per year is around 250. Plus, I've to keep record...
<p>What you are doing is called premature optimization. This is a common mistake.</p> <p>You are better of getting your database structure as close to reality and in future if there becomes a need for optimization or speed improvement you can always do that.</p> <p>From experience and looking at your example the sing...
how to eliminate dots from filenames, except for the file extension <p>I have a bunch of files that look like this:</p> <pre><code>A.File.With.Dots.Instead.Of.Spaces.Extension </code></pre> <p>Which I want to transform via a regex into:</p> <pre><code>A File With Dots Instead Of Spaces.Extension </code></pre> <p>It...
<p>It appears Total Commander's regex library does not support lookaround expressions, so you're probably going to have to replace a number of dots at a time, until there are no dots left. Replace:</p> <pre><code>([^.]*)\.([^.]*)\.([^.]*)\.([^.]*)$ </code></pre> <p>with</p> <pre><code>$1 $2 $3.$4 </code></pre> <p>(...
Can a Class be self-referenced? <p>**If a structure can be a self-referential. like</p> <pre><code>struct list { struct list *next; }; </code></pre> <p>as there is no difference between class and struct, except the default access specifiers. then is it possible to write a class...</p> <pre><code>class list { ...
<p>Yes, but you can only self-reference a pointer or a reference to the class (or struct)</p> <p>The typical way is just:</p> <pre><code>class list { list* next; } </code></pre> <p>If you need two classes to mutually refer to each other, you just need to forward declare the classes, like so:</p> <pre><code>class li...
sharepoint access <p>Is there any method available for sharepoint that can do the following:</p> <p>Create an internet site suing wss3.0. login using fba. no need to login to edit documents from library that logged in user has access to.</p> <p>change the password of a user from the site?</p>
<p>You can create an internet site using FBA under WSS 3.0. You will need the appropriate license, which I believe is called the "internet connector" license in the case of WSS. I'm not sure what you mean by "no need to login to edit documents from library that logged in user has access to." You can expose a document l...
OCR graph paper <p>I would like to take a pdf of a scanned graph paper notebook (with handwriting) and turn it into a text file. </p> <p>How can I do this?</p> <p>Thanks</p>
<p>Check out an OCR library, like <a href="http://code.google.com/p/ocropus/" rel="nofollow">OCRopus</a>. I don't think it takes PDF, so you may have to convert it to a TIFF or JPEG first.</p>
Hosting wcf service in WAS <p>I wrote my WCF Service I need to host this in Windows Activation services (WAS) in my vista machine..</p> <p>Please tell how to host my service in WAS..</p> <p>Also how to consume this client apps</p>
<p>See <a href="http://channel9.msdn.com/shows/Endpoint/endpointtv-Screencast-Configuring-WAS-for-TCP-Endpoints/" rel="nofollow">Configuring WAS for TCP Endpoints</a> and the other resources at the <a href="http://msdn.microsoft.com/wcf/" rel="nofollow">WCF Developer Center</a> on MSDN.</p>
How do I connect CakePHP to a SQLite database? <p>I have a rather basic problem: I can't seem to connect CakePHP to my SQLite database. Surprisingly, I didn't find lots of information about it on the internet, though I may be looking up the wrong keywords. Nevertheless, this is my connection code:</p> <pre><code>var $...
<p>As of <a href="http://book.cakephp.org/2.0/en/appendices/2-0-migration-guide.html">CakePHP 2.0</a>, Sqlite 3 is supported out of the box. </p> <p>Be sure that sqlite is enabled in your PHP configuration:</p> <pre><code>phpinfo(); </code></pre> <p>Inside <code>app/Config/databases.php</code> you can define Sqlit...
jQuery XML Parsing/Traversing <p>I have the following XML-</p> <pre><code>&lt;rows&gt; &lt;row id="5"&gt; &lt;cell&gt;Item1&lt;/cell&gt; &lt;attrs&gt; &lt;attr&gt; &lt;id&gt;1&lt;/id&gt; &lt;type&gt;CheckBox&lt;/type&gt; &lt;values&gt; &lt;value&gt; &lt;id&gt;10&lt;/...
<p>I'm not clear what you're trying to loop over, I think one of the tags in your question was garbled. You say: "What I want to do is to loop each of the of a certain row." and I think you had a tag in there.</p> <p>Anyway, here's some examples of extracting data from the parsed xml document using jQuery. The comment...
Why would SVN command line client freeze with no output on Win XP? <p>I'm trying to connect from a Windows XP system to an SVN server but I'm getting weird behavior.</p> <p>When I run this...</p> <pre><code>svn ls svn+ssh://myusername@myhost.com/path/to/svn_repository </code></pre> <p>...the cursor just freezes as i...
<p>What do you have the SVN_SSH environment variable set to? Do you have any of the settings under [tunnels] in the svn config file?</p> <p>You should be able to run this at the cmd prompt:</p> <blockquote> <p>%SVN_SSH% -l myusername myhost.com</p> </blockquote> <p>and it should give you a login prompt without pr...
Do I need static libraries to statically link? <p>On 'C', Linux,</p> <p>Do I need static libraries to statically link, or the shared ones I have suffice? If not, why not? (Don't they contain the same data?)</p>
<p>Yes, you need static libraries to build a statically linked executable.</p> <p>Static libraries are bundles of compiled objects. When you statically link with to library, it is effectively the same as taking the compilation results of that library, unpacking them in your current project, and using them as if they ...
Is HBase stable and production-ready? <p>For folks who have deployed HBase on their own clusters, do you feel that it's sufficiently stable for production use? What types of troubles or issues have you run into?</p> <p>I do see a bunch of companies listed as using HBase in production (<a href="http://wiki.apache.org/...
<p>HBase is about to hit a major milestone with HBase-0.20. There's is an alpha and soon to be a RC. It has had very major performance improvements. StumbleUpon reportedly serve their site live out the trunk version of HBase, with no additional caching layer, as do others. So I'd say it's definitely ready for productio...
How do I handle memory management in this situation? <p>I have two classes, a class that handles db connectivity and an entity class. The db class has an instance method called GetEntityByID:(int)entity_id. This method does a simple select statement, and creates an Entity class instance using an init method. </p> <...
<p>You can call <code>autorelease</code> in your <code>GetEntityID</code> method on the class to autorelease the instance if it is not otherwise retained.</p> <p>Since the instantiation of the class is done within your DB connectivity class's method, the object that is returned the instance does not "own" it - your DB...
What does your ideal web development (ASP.NET) environment consist of? <p>I start at a new client on Monday. They’re just beginning to do web development (ASP.NET) and I’m going to help them with setting up a proper development environment.</p> <p>I don’t think I’ll have a say on what type of machines the dev...
<p>You said you won't have input on the machines, but I'd put dual monitors pretty high on the list as far as productivity goes for web development or just computer use in general.</p>
why destructor is not called implicitly in placement new"? <p>As referenced in this site... <a href="http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10" rel="nofollow">http://www.parashift.com/c++-faq-lite/dtors.html#faq-11.10</a> But i did not find the reason, why we should explicitly call the desturctor?</p>
<p>Normally, <code>new</code>ed objects are destructed when <code>delete</code> is called. delete is never called for placement new, so you have to figure out when to destruct the object yourself, and do so explicitly.</p>
GWT application/eclipse plugin crashes JVM <p>I'm trying to set up the GWT framework. I'm following the quick start at: <a href="http://code.google.com/eclipse/docs/getting_started.html" rel="nofollow">http://code.google.com/eclipse/docs/getting_started.html</a>. OS is Ubuntu 8.04. I create a new application and start/...
<p>I had the same exception, I just installed the latest VM release and now the compilation complete successfully :)</p>
What informataion analysis techniques are there for the qualitative analysis of user generated data? <p>There's a few algorithms we have for sorting data, finding the maximum and minimum, finding the shortest path between nodes etc.</p> <p>I've started looking into the qualitative analysis of user-generated data and h...
<p>That's...a pretty broad question. Analysis of user-generated data, textual or otherwise, is typically done through specialized applications of general <a href="http://en.wikipedia.org/wiki/Data%5Fmining" rel="nofollow">data mining</a> techniques. If you're interested in learning more about this extremely wide fiel...
What factors should determine how often a table is optimized in MySQL? <p>I've seen many different schedules for optimizing tables in MySQL: everything from immediately after a delete, to once a day, to never. I have often setup a cron job to run every night to optimize all the tables.</p> <p>What factors do you use t...
<p>Also this quote from <a href="http://dev.mysql.com/doc/refman/5.1/en/optimize-table.html" rel="nofollow">MySQL themselves</a> is good.</p> <blockquote> <p>In most setups, you need not run OPTIMIZE TABLE at all. Even if you do a lot of updates to variable-length rows, it is not likely that you need to do this more...
Moving from Gnome to XFCE <p>I'm using Gnome now and want to install XFCE. Nothing complicated but just curious - do all applications, installed previously on Gnome will be also removed or they would work on XFCE properly after installing XFCE and removing Gnome ?</p> <p>OS: Linux Mint 7</p>
<p>Don't uninstall Gnome, just select XFCE in the graphical login screen</p>
Search query with Subsonic <p>Ok, </p> <p>Today I am trying to learn Subsonic. Pretty cool stuff. </p> <p>I am trying to build some search functionality into my website but am struggling about how I might achieve this in Subsonic. </p> <p>I have one search field that could contain multiple keywords. I want to return...
<p>First question:</p> <pre><code>return new SubSonic.Select().From(Visit.Schema) .InnerJoin(InfopathArchive.VisitIdColumn, Visit.VisitIdColumn) .Where(InfopathArchive.XmlDocColumn).Like("%" + keywords + "%") .ExecuteTypedList&lt;Visit&gt;(); </code></pre> <p>Second question:</p> <p>Pass a Li...
subtle differences between JavaScript and Lua <p>I simply love JavaScript. It's so elegant (imagine the quiet sound of lovestruck fanboy sighing in the background).</p> <p>So, recently I have played with Lua via the <a href="http://love2d.org">löve2d</a> framework (nice!) - and I think Lua is also great. They way I s...
<p><strong>Some more differences:</strong></p> <ul> <li><em>Lua</em> has native support for <a href="http://www.lua.org/manual/5.1/manual.html#2.11">coroutines</a>.</li> <li><em>Lua</em> <a href="http://www.lua.org/manual/5.1/manual.html#2.5.2">doesn't convert</a> between types for any comparison operators. In JS, onl...
Hiding/Unhiding Control in Gridview’s column - shifting problem <p>This is a follow up to my previous question: <a href="http://stackoverflow.com/questions/1021983/hiding-unhiding-control-in-gridviews-column-using-javascript">link text</a></p> <p>In gridview's column i have a linkbutton and a label under it.</p> <p...
<p>I would suggest you change your CSS from display:none to display:hidden which will hide the control but maintain the space preventing the jumping around.</p>
What is the difference in speed between the DLR languages and C# in Silverlight 2? <p>For Silverlight 2, it looks like programming choices are:</p> <ul> <li>C#</li> <li>VB</li> <li>DLR scripting languages <ul> <li>IronRuby</li> <li>IronPython</li> <li>A sadly neglected (if not cancelled) Managed jScript</li> </ul></li...
<p>Unfortunately there is no hard and fast answer to this question. Performance of even the same language varies greatly based on a number of parameters. </p> <p>Yes, in <strong>general</strong> VB.Net and C# will be faster than DLR based languages. Static languages do more work at compile time such as method bindi...
accessing a variable from another class <p>Very simple question but I can't do it. I have 3 classes:</p> <p><strong><code>DrawCircle</code> class</strong></p> <pre><code>import java.awt.*; import java.awt.event.*; import javax.swing.*; class DrawCircle extends JPanel { private int w, h, di, diBig, diSmall, maxRa...
<p>You could make the variables public fields:</p> <pre><code> public int width; public int height; DrawFrame() { this.width = 400; this.height = 400; } </code></pre> <p>You could then access the variables like so:</p> <pre><code>DrawFrame frame = new DrawFrame(); int theWidth = frame.width; int theH...
Getters and Setters: Code smell, Necessary Evil, or Can't Live Without Them <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/996179/allen-holub-wrote-you-should-never-use-get-set-functions-is-he-correct">Allen Holub wrote &ldquo;You should never use get/set functi...
<p>Here is Allen Holub (who is brilliant) <a href="http://www.javaworld.com/javaworld/jw-01-2004/jw-0102-toolbox.html?page=1" rel="nofollow">on the matter</a>. He goes into much more detail on this subject in <a href="http://rads.stackoverflow.com/amzn/click/159059388X" rel="nofollow">Holub on Patterns</a>. Some thing...
Cannot implicitly convert type 'System.Collections.Generic.List' to 'System.Collections.Generic.List <p>Cannot implicitly convert type 'System.Collections.Generic.List' to 'System.Collections.Generic.List</p> <pre><code>Error 2 Cannot implicitly convert type 'System.Collections.Generic.List&lt;AnonymousType#1&gt;' to ...
<p>Instead of <strong>select new</strong>, use <strong>select new Product</strong>. It will return a list of type Product:</p> <pre><code>... select new Product { p.ProductId, p.ProductCategoryId, pc.ParentProductCategoryId, ProductN...
Memory-mapped files in Java <p>I've been trying to write some very fast Java code that has to do a lot of I/O. I'm using a memory mapped file that returns a ByteBuffer:</p> <pre><code>public static ByteBuffer byteBufferForFile(String fname){ FileChannel vectorChannel; ByteBuffer vector; try { vecto...
<p>Did anyone actually check to see if <code>ByteBuffers</code> created by memory mapping support invoking <code>.array()</code> in the first place, regardless of readonly/readwrite?</p> <p>From my poking around, as far as I can tell, the answer is <strong>NO</strong>. A <code>ByteBuffer</code>'s ability to return a ...
How to rewrite domain in Zend Framework <p>I am writing a user registration form.<br /> After the user registers with a username e.g. "Billy", I would like him to use the url billy.mydomain.com to access the server.</p> <p>The Zend framework link of billy.mydomain.com is<br /> www.mydomain.com/profile/index/username/b...
<p>Throwing away my initial answer, <a href="http://framework.zend.com/manual/en/zend.controller.router.html#zend.controller.router.routes.hostname" rel="nofollow">This Solution</a> is much more elegant.</p> <pre><code>$hostnameRoute = new Zend_Controller_Router_Route_Hostname( ':username.mydomain.com', array(...
Many-to-many insert using LINQ to SQL and ASP.Net MVC <p>I have two Tables: <code>Products(ProductID, ProductName)</code> and <code>Categories(CategoryID, CategoryName)</code> with a many-to-many relationship between <code>Products</code> and <code>Categories</code> <code>ProductsCategories(ProductID, CategoryID)</co...
<p>Since LINQ to SQL only supports a strict 1:1 mapping with your database you would have to make a link table. This would look something like...</p> <p>[ProductCategories]<br /> ID<br /> ProductID (FK)<br /> CategoryID (FK) </p> <p>Then for every relationship of product to categories you would just make a new Prod...
How can I replace (wrap) methods in new methods programmatically? <p>I have several methods that I need to wrap in new methods in basically the same manner. My first solution doesn't work, and I understand why, but I don't know if there is a simple solution to this problem or if it can't be done the way that I want to ...
<p>What you need is closure:</p> <pre><code>for(var i=0, l=arr.length; i&lt;l; i++){ (function(i){ var oldOnclick = arr[i].onClick; //etc. })(i); } </code></pre>
How can I install and use ack library on Windows? <p>I have never used Perl, but I am really impressed by the <a href="http://www.betterthangrep.com">ack</a>, which I would like to use for source code searching, etc.</p> <p>Can anyone guide me of how to make use of this excellent library on Windows?</p>
<p>Start by installing perl <a href="http://strawberryperl.com/">http://strawberryperl.com/</a></p> <p>Install <a href="http://search.cpan.org/~petdance/ack-1.88/">App::Ack</a> by typing (in a windows command shell)</p> <pre><code>C:\&gt;cpan App::Ack </code></pre> <p>And undoubtedly this will prove useful <a href="...
jquery + datalist <p>I am not familiar to jquery, and want to get ID of controls i have in datalist so that i can use them.</p>
<p>You need to read about selectors, and you can name your html tags accordingly, </p> <p>Start reading here:</p> <p><a href="http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery" rel="nofollow">http://docs.jquery.com/Tutorials:Getting_Started_with_jQuery</a></p> <p>You can then bind your controls like such....
Automatically closing braces in Emacs? <p>I've seen a plugin for Vim called <a href="http://www.vim.org/scripts/script.php?script%5Fid=1849">AutoClose</a> (discovered from <a href="http://stackoverflow.com/questions/1023002/how-to-minimize-use-of-arrow-keys-when-typing-code/1023699#1023699">this</a> post) which automat...
<p>yes, <a href="http://www.gnu.org/software/emacs/manual/html%5Fnode/emacs/Electric-C.html">this mode is called electric</a>. You can combine the electric behaviour with this simple macro for maximum confort:</p> <pre><code>(defun electric-pair () "If at end of line, insert character pair without surrounding spaces...
NSBasic/Palm 4.4 Tutorial <p>Can someone please recommend me a very good tutorial for NSBasic 4.4 (please post a link). I've came from the Handheld Basic background, then I recently used another IDE from a friend which has a version of NSBasic, but my friend develops in Handheld Basic.</p>
<p>For NSBasic don't have much things check for <a href="http://www.nsbasic.com/desktop/info/technotes/" rel="nofollow">technotes</a> if help. Or this <a href="http://tutomania.com.br/livro/apostila-de-ns-basic--palm" rel="nofollow">website</a> in brazilian</p>
second or third time a symbol appears <p>In PHP</p> <pre><code>$regex = '/ ([$]) *(\d+(:?.\d+)?)/'; preg_match($regex, $str, $matches); print_r($matches[2]); </code></pre> <p>This regex gives me the first occurence of a number that follows the first <code>$</code> sign in a web page.</p> <p>Now I want a regex that ...
<p>What you are looking for is the <em><a href="http://php.net/preg%5Fmatch%5Fall" rel="nofollow">preg_match_all</a></em> function. </p> <pre><code>preg_match_all('/([$])*(\d+(:?.\d+)?)/', $str, $result, [flags]); </code></pre> <p><em>$result</em> contains all matches in an array in the order specified by <em>flags</...
Exponential Moving Average Sampled at Varying Times <p>I have a continuous value for which I'd like to calculate an <a href="http://en.wikipedia.org/wiki/Exponential%5Fmoving%5Faverage#Exponential%5Fmoving%5Faverage">exponential moving average</a>. Normally I'd just use the standard formula for this:</p> <ul> <li>S<su...
<p>This answer based on my good understanding of low-pass filters ("exponential moving average" is really just a single-pole lowpass filter), but my hazy understanding of what you're looking for. I think the following is what you want:</p> <p>First, you can simplify your equation a little bit (looks more complicated b...
Shared memory and runnning multiple copies of an executable <p>I have an application (winform exe) that I run several times. Does this mean that I have share assemblies or does each instance have its own copie of the assemblies? When I run the app, it uses about 30MB (in task manager) and when I run another copy of the...
<p>It's complicated.</p> <p>Start by reading my recent article on virtual memory.</p> <p><a href="http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memory.aspx" rel="nofollow">http://blogs.msdn.com/ericlippert/archive/2009/06/08/out-of-memory-does-not-refer-to-physical-memo...
Keybinding a RelayCommand <p>I'm using the <a href="http://msdn.microsoft.com/en-us/magazine/dd419663.aspx">RelayCommand</a> in my app. It's great for putting the code in the viewmodel, but how do I bind keystrokes to my command?</p> <p>RoutedUICommand has its InputGestures property, which makes the command automatica...
<p>I don't think you can do this from XAML, for exactly the reasons you describe.</p> <p>I ended up doing it in the code-behind. Although it's code, it's only a single line of code, and still rather declarative, so I can live with it. However, I'd really hope that this is solved in the next version of WPF.</p> <p>Her...
how to select row om gridview by click? <p>How can i select row in gridview by clicking. But i want to add select id (from database such as primary id) in session. Listen please i dont want javascript Attribute method. Like that</p> <pre><code>session["selectedrow"] = gridview1.selectedrow[" which id? "] </code></pre>...
<pre><code>Session["selectedrow"]= gridview1.SelectedDataKey.Value(); </code></pre>
How to set a char inside a struct in C? <p>How do I allocate memory for a char variable (not a char pointer) inside a struct?<br /> (Variable names are in portuguese, sorry if it's kinda confusing)</p> <p>I have this struct: </p> <pre><code>typedef struct node{ char rotulo[10], instrucao[1][2][10], flag; int...
<p>Your problem is likely to be in this line:</p> <pre><code>realloc(NovoEstado-&gt;instrucao, i+1*sizeof(char[2][10])); </code></pre> <p>There is no need to allocate anything inside your structure because the field <code>instrucao</code> is statically defined by the statement <code>instrucao[1][2][10]</code>, it is ...
HTTPS Auto-Login Probs <p>I am trying to create a C# script to login automatically to a website and download a report.</p> <p>I have managed to login to the site. Effectively the steps are:</p> <p>1) Get login form 2) Sent login/pass with cookies 3) Logged In 4) Ask for Report &amp; Download</p> <p>The problem I am ...
<p>Use <a href="http://www.wireshark.org/" rel="nofollow">Wireshark</a> or similar to record a browser performing the operation. Then record a session with your program attempting to perform the operation (and failing). </p> <p>From those two traces see what the differences are. That will tell you what additional brow...
C# Eval() support <p><br /> we need to evaluate a value in an object in run time while we have a textual statement of the exact member path for example: <strong>myobject.firstMember.secondMember[3].text</strong><br /> we thought of parsing this textual statement using regex and then evaluate the text value by using ref...
<p>Probably the easiest way is to use <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.databinder.eval.aspx">DataBinder.Eval</a> from System.Web.UI:</p> <pre><code>var foo = new Foo() { Bar = new Bar() { Value = "Value" } }; var value = DataBinder.Eval(foo, "Bar.Value"); </code></pre>
Can't step into iterator block whilst debugging (C#) <p>I'm trying to debug my code which is being executed from a unit test project, but when I try to step into a method, it just passes straight onto the next line and the breakpoint inside that method isn't hit. The method is on a class which is in a different project...
<p>Iterator blocks use deferred execution - meaning: until you actually start iterating over the data, nothing is executed.</p> <p>So: has the data been iterated? Is anything looping over the values? If you need to add validation logic that runs as early as possible, you currently need two methods:</p> <pre><code>pub...
How can I put a block of dynamically generated content into a django template? <p>I want to include things like twitter status, or delicious tags, in my django templates.</p> <p>These things are dynamic, yet regular. How would this be done?</p>
<p>There are a number of ways to handle this, so you can choose a method that best matches your own personal style or requirements:</p> <ol> <li><p><strong>Template context variable</strong>: as answered by Alex you can put your content into a context variable that is included in the context of every template created ...
Is there any way other than javascript to fix IE 6 bugs? <p>For IE 6 we have plenty of bugs to bug us as a designer. </p> <p>incorrect box model etc etc. </p> <p>i have searched for fixes via JavaScript and found </p> <p>[link text][1] IE7.js IE7 is a JavaScript library to make Microsoft Internet Explorer behave lik...
<p>The alternative is to live within the IE 6 world of bugs and design your pages to look right despite them. You can serve up different css for your IE6 clients, or even different html if necessary, depending on your design. In some cases, you can use one CSS file that will mean different things to IE6 clients, but th...
Using Linux ioctl with Mono <p>I'm trying to do ioctl command through Mono framework, but I cant find what I'm looking for.</p> <p>I'm trying to send command to a DVB card that has a kernel module. I hope someone can link or explain clearly how this can be done. Any example with Mono using kernel modules would be usef...
<p>Mono does not contain a wrapper for ioctl in Mono.Unix, because ioctl call parameters vary greatly and such a wrapper would be almost useless. You should declare a <a href="http://mono-project.com/Interop%5Fwith%5FNative%5FLibraries" rel="nofollow">DllImport</a> for each ioctl you need.</p> <p>You probably don't ne...
Syncfusion DocIO -- how to insert image (local file) at bookmark using BookmarksNavigator <p>I have been using Syncfusion DocIO for generating MS Word documents from my .net applications (winforms). So far I have dealt with plain text and it is fairly straightforward to insert text in a word document template where boo...
<pre><code>private System.Drawing.Image LoadSignature(string sFileName) { string sImagePath = sFileName; System.Drawing.Image image = System.Drawing.Image.FromFile(sImagePath); return image; } private void MergeSignature(WordDocument doc, string sFile, string sBalise) { System.Drawing.Image iSignature ...
Sub Query Help <p>Hi I have the below query which i want to det the distinct districts and how sum of how many properties are for each one but i cant remember how to do the sub query!!!</p> <p>Can any one help please</p> <pre><code>SELECT DISTRICT, PROPREF FROM TBL_PROPERTY WHERE (CONTRACT = 'ma2') AND (LAS...
<p>I think you want this:</p> <pre><code>select DISTRICT, count(PROPREF) from TBL_PROPERTY where CONTRACT = 'ma2' and LASTSERVICEDATE &lt;= DATEADD(HH,23,CONVERT(DATETIME,'30/05/2009', 103)) and SERVICESTATUS = 'SERVICED' group by DISTRICT </code></pre> <p>If you also wanted it broken out by office, you'd add...
Looping Fget with fsockopen in PHP 5.x <p>I have a Python Server finally working and responding to multiple command's with the output's, however I'm now having problem's with PHP receiving the full output. I have tried commands such as fgets, fread, the only command that seems to work is "fgets".</p> <p>However this o...
<p>I believe you need to fix your server code a bit. I have removed the inner while loop. The problem with your code was that the server never closed the connection, so <code>feof</code> never returned true.</p> <p>I also removed the <code>+ " &amp;"</code> bit. To get the output, you need to wait until the process en...
Why is a gem specification needed and why do some gem creators not provide them? <p>I've noticed some ruby gems have .specification files and others don't.</p> <p>If they're important, why are you not required (by whatever tool builds them) to provide one when you attempt to create your gem?</p>
<p>Many gems are configured using hoe or newgem, which generate a specification only on the building of the gem. The spec is treated as a temporary bit of code only used to create a gem so it is typically not packaged up. There are rake tasks for both of these tools that will generate a spec file though.</p>
Calling a web service from php? <p>I am trying to call a publicly available web service from a PHP web page.</p> <p>The web service is: <a href="http://www.webservicex.net/uszip.asmx?WSDL" rel="nofollow">http://www.webservicex.net/uszip.asmx?WSDL</a></p> <p><hr /></p> <h3>My code:</h3> <pre><code>&lt;html&gt; &lt;b...
<p>You're feeding the ZIP code in incorrectly, and your constructor syntax is also incorrect. Use this syntax instead:</p> <pre><code>$wsdl = "http://www.webservicex.net/uszip.asmx?WSDL"; $client = new soapclient($wsdl); $response = $client-&gt;GetInfoByZIP(array('USZip' =&gt; $zip)); </code></pre> <p>I just tested i...
Calculating phi(k) for 1<k<N <p>Given a large N, I need to iterate through all phi(k) such that 1 &lt; k &lt; N quickly. Since the values of N will be around 10<sup>12</sup>, it is important that the memory complexity is sub O(n).</p> <p>Is it possible? If so, how?</p>
<p>This can be done with Memory complexity O(Sqrt(N)) and CPU complexity O(N * Log(Log(N))) with an optimized windowed Sieve of Eratosthenes, as implemented in the code example below.</p> <p>As no language was specified and as I do not know Python, I have implemented it in VB.net, however I can convert it to C# if you...
Reading a File with Ruby <p>I have a text file that contains a list of regexp's which I regularly use to clean html files according:</p> <p><strong>list.txt</strong></p> <pre><code>&lt;p[^&gt;]*&gt;|&lt;p&gt; &lt;\/?(font|span)[^&gt;]*&gt;| &lt;\/u&gt;\s*&lt;u&gt;| &lt;\/u&gt;\s*&lt;i&gt;\s*&lt;u&gt;|&lt;i&gt; </code...
<p>Try the following:</p> <pre><code>result = File.foreach("list.txt").collect do |line| *search, replace = line.strip.split("|", -1) [Regexp.new(search.join("|")), replace] end </code></pre> <p>Or if your separator does not occur in the regexes and replacements:</p> <pre><code>result = File.foreach("list.txt")....
Use a property trigger to change a property that already has a binding <p>How can I use a property trigger in a style (or another method) to change a property (ToolTip for example) that already has its value defined by a binding?</p> <p>I have a simple button like so:</p> <pre><code>&lt;Button Name="Button1" Style="{...
<p>The easiest solution to your problem is to create a button style that all of your buttons can use (_DisabledButtonToolTipStyle in the example below) and then define a unique style for each button that applies the enabled tool tip value. If the individual buttons always have a different tool tip value then I'd recomm...
Mono C# tutorial? <p>Is there any good tutorial to learn C# with mono? So far, google hasn't been helpful because most tutorial are for Visual Studio.</p> <p>I am a Java developer, so I am familiar with Object Oriented ideas.</p> <p>My goal, is to be able to develop a small portable application with a SQLite backend....
<p>The language itself will be the same whatever tutorial you use. Really you just need to know how to compile code using Mono instead of Visual Studio. The basic command line you'll want to use is:</p> <pre><code>gmcs Foo.cs Bar.cs </code></pre> <p>with these as the most important command line options:</p> <ul> <li...
Vehicle Make/Model and Parts Database <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/827486/where-can-i-find-data-on-used-car-makes-and-models">Where can I find data on used car makes and models?</a> </p> </blockquote> <p>I am looking for a web-based service...
<p>I just launched a free javascript API that you may find helpful.</p> <p><a href="http://www.carqueryapi.com/">http://www.carqueryapi.com/</a></p>
Unable to call generic method with wildcard <p>I have a class defined like so:</p> <pre><code>public class Test { static &lt;T&gt; List&lt;Class&lt;T&gt;&gt; filter(List&lt;Class&lt;T&gt;&gt; input) { // code here } public static void main(String[] args) { List&lt;Class&lt;? extends Throwa...
<p>Ah, the joys of generic signatures. </p> <p>You can fix it by declaring the parameter as:</p> <pre><code>static &lt;T&gt; List&lt;Class&lt;T&gt;&gt; filter(List&lt;Class&lt;? extends T&gt;&gt; input) { // code here } </code></pre> <p>As to exactly why, I'm not sure. Too many compilation problems with generics...
Find the ID after compiling <p>When you assign something an ID in asp.net such as:</p> <pre><code>&lt;asp:Label runat="server" ID="mylabel" Text="some text"&gt;&lt;/asp:Label&gt; </code></pre> <p>The code behind ID you use to reference that object is mylabel.</p> <p>However after the site has compiled and is running...
<p>I believe you are looking for the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx" rel="nofollow"><code>ClientID</code></a> property.</p> <blockquote> <p>The <code>ClientID</code> value is often used to programmatically access the HTML element rendered for a control in c...
how to eval() a segment of a string <p>I have a string that has HTML &amp; PHP in it, when I pull the string from the database, it is echo'd to screen, but the PHP code doesn't display. The string looks like this:</p> <pre><code> $string = 'Hello &lt;?php echo 'World';?&gt;'; echo $string; </code></pre> <p><stro...
<pre><code>$str = "Hello &lt;?php echo 'World';?&gt;"; $matches = array(); preg_match('/&lt;\?php (.+) \?&gt;/x', $str, $matches); eval($matches[1]); </code></pre> <p>This will work, but like others have and will suggest, this is a terrible idea. Your application architecture should never revolve around storing cod...
Allowing user to download from my site through Response.WriteFile() <p>I am trying to programatically download a file through clicking a link, on my site (it's a .doc file sitting on my web server). This is my code:</p> <pre><code>string File = Server.MapPath(@"filename.doc"); string FileName = "filename.doc"; if (Sy...
<p>Rather than having a button click event handler you could have a download.aspx page that you could link to instead.</p> <p>This page could then have your code in the page load event. Also add Response.Clear(); before your Response.ContentType = "Application/msword"; line and also add Response.End(); after your Resp...
Should I instantiate new objects for all different interactions? <p>Im having a hard time grasping this concepts of objects and how they should interact/exist.</p> <p>Should I for instance have different objects (well, maybee I mean connections to the database here if there is any difference) for interactions with my ...
<p>To me, what it seems like you're missing is that object-oriented programming isn't there to make you do extra work following its rules, it's there to make your life easier. If it isn't making your life easier, you're doing it wrong.</p>
How do you make a combo of two emotes in lua in World of Warcraft work? <p>How do you make a combo of two emotes in lua in World of Warcraft work?</p> <pre><code>function Button2_OnClick() PlaySoundFile("Interface\\Addons\\Fart\\common_fart[1].wav"); DoEmote("moon"); DoEmote("sit"); DoEmote("dance"); ...
<p>Blizzard has explicitly prohibited anything that can be used to make lua wait or pause because it is an essential ingredient to making a gold mining or grinding bot.</p> <p>There isn't a native (i.e. lua only) way to have lua wait without using all the CPU. Outside of the WOW client, you'd use <a href="http://stac...
Retrieve the formated URL from open_id form <p>I just added OpenID to my website using the PHP janrain libraries, and I got everything working but I have a question about how to do something.</p> <p>After receiving the openid_url from the user, I pass it to the openid lib, which then processes the url and gets it read...
<p>You get the final URL you want to use for tracking purposes back with a <code>Auth_OpenID_SuccessResponse</code> object, in the <code>claimed_id</code> attribute. (The <code>getDisplayIdentifier()</code> method outputs a version more intended for human consumption, which may or may not be different.)</p>
gcc link error occurred <p>I compiled with gcc </p> <blockquote> <p>gcc -l. 'net-snmp-config --cflags' -fPlC -shared -c -o matsu_object.o tsu_object.c</p> </blockquote> <p>but this error occurred</p> <blockquote> <p>gcc: -lcrypto: Because a link was not completed, the input file of the linker was not u...
<p>Did you mistype the question? There's no way for that to output the message you write, and I would expect that the proper command is something more like</p> <pre> gcc -L. `net-snmp-config --cflags` -fPIC -shared -c -o matsu_object.o tsu_object.c </pre> <p>Notice the <code>-L</code> uppercase, backticks instead of...
WCF ServiceHost.Close() Delay <p>I have a simple WCF duplex TCP service that I am trying to stop programmatically. If I don't have any connected users, ServiceHost.Close() is very quick but if I even have one connected user, I find the Close() function to take quite a bit of time, sometimes >30seconds. Is this usual be...
<p>It may be. The <a href="http://msdn.microsoft.com/en-us/library/ms405496.aspx">docs</a> state that</p> <blockquote> <p>The Close method allows any unfinished work to be completed before returning. For example, finish sending any buffered messages.</p> </blockquote> <p>There is an overload to <code>Close()<...
Error while using Fetcher plugin to process incoming mail with Rails? <p>I'm trying to get a basic example app running that processes email. Nothing fancy, just the barest of functionality at this point. I've installed Fetcher, configured the YAML, updated the :receiver, and created an IncomingMailHandler class.</p> <...
<p>Ok, so basically, I'm a dumbass. I was following instructions all over the damn web, except for the mostly cut and dry explanation on github. Days later now, I just went through the motions, and boom, it worked flawlessly.</p> <p>So, to anyone that finds this with the same problem (whether you were trying to follow...
Problem unsetting a session variable <p>There's a form on my site that's used for inviting friends. It's a simple text field and a submit button. If there is an error I redirect back to this page and display an error message if their is a session variable set.</p> <pre><code>if (isset($_SESSION['invite_error'])) { ...
<p><strong>Start the session before you start the output buffering.</strong> So, switch the <code>ob_start()</code> and <code>session_start()</code> calls.</p> <p>Since session cookies are defined in the headers sent to the browser, and headers are sent to the browser when you start the buffer, you must start the sess...
Google maps Polygon question <p>The following is an example of how to greate a polygon in the google maps API. <br />What is the purpose of latOffset and lonOffset? <br />We're creating an array of points to make a polygon, but what exactly is the offset doing?</p> <pre><code>var map = new GMap2(document.getElementBy...
<p>It's just building a diamond around the point (lat,lon).</p> <pre><code> * * O * * </code></pre> <p><code>Lat</code> is latitude and <code>lon</code> is longitude. The offsets are how far away from the center point the corners of the diamond are.</p> <p>I wonder how well it works at the north pole....
How can I pair up keys in an array? <p>I have 2 separate arrays, one is just the ids, the other is the percentage Ids:</p> <pre><code>Array ( [0] =&gt; 3 [1] =&gt; 4 [2] =&gt; 5 [3] =&gt; 6 [4] =&gt; 7 } </code></pre> <p>Percent array:</p> <pre><code>Array ( [0] =&gt; 28 [1] =&gt; 39 ...
<p>simply loop through the elements of the array (0..4) and add items to your new array.</p> <p>(I'm not including sample code, because this sounds like a homework assignment!)</p>
Can I buy 3rd-party tech support incidents for iphone development? <p>Instead of buying technical support for $195 from ADC, can anyone recommend another way to buy tech support for iphone development troubleshooting?</p>
<p>You could hire an independent iPhone developer to assist you with your problem. They will likely charge hourly <a href="http://blogs.oreilly.com/iphone/2008/11/turning-ideas-into-application.html" rel="nofollow">(they can charge in the neighborhood of $125 to $200 per hour)</a> and you'll have to do your homework to...
How do I get mit-scheme to return a floating point number? <p>(/ 4 3) returns 4/3 as an answer. What is the simplest way to get 1.3...?</p>
<p>An easy way would be to make sure that one of the numbers in the calculation is already a floating-point number:</p> <pre><code>&gt; (/ 4.0 3) 1.3333333333333333 </code></pre> <p>Another way would be to use <code>exact-&gt;inexact</code>:</p> <pre><code>&gt; (exact-&gt;inexact (/ 4 3)) 1.3333333333333333 </code><...
Find and rename files with no extention? <p>So, I've got a bunch of files with no extension. I want to write a windows batch script that will:</p> <ol> <li>Find files with no extension (in a specified folder)</li> <li>Add .bla to the end of the file name</li> </ol> <p>I'm such a windows batch script noob I don't eve...
<p>For windows batch files, this will rename only files with no extension to the .bla extension:</p> <pre><code>rename *. *.bla </code></pre> <p>Notice the first argument is a star and a dot: *.</p> <p>The second argument is: *.bla</p> <p>The start dot (*.) combination represents files with no extensions in this co...
I need some clarification on the MVC architecture and the three-tier architecture <p>I've been reading the book Pro ASP NET MVC Framework and I'm getting really confused with a lot of things. I've been trying to do some research but I'm finding that with so many different approaches and concepts being thrown at me, it'...
<ol> <li><p>MVC is mostly a pattern for the presentation layer, and it focuses on the interaction between the view and the controller. The model can be considered to be <a href="http://weblogs.asp.net/scottgu/archive/2007/10/14/asp-net-mvc-framework.aspx" rel="nofollow">the components of the application that are respon...
UIWebview is slow on the iPhone device, fast on simulator <p>I am loading a webpage from an external server using UIWebView. The page loads very slowly. Using Edge, it takes ~30 seconds. Using WiFi, it takes ~5-6 seconds. The same page is much faster when loading directly through Safari. </p> <p>In the simulator, the ...
<p>UIWebView is simply slow to load up compared to anything else, even when using simple static HTML. A UILabel is always far faster.</p> <p>I think this is because some aspects of the HTML engine you may not need (like the Javascript interpreter) take some time to load. But even if you keep an already created insta...
How to generate a URL with a sub domain to a new URL with a query string? <p>I'm very new to <a href="http://en.wikipedia.org/wiki/Nginx" rel="nofollow">nginx</a>, and now I want to use nginx to generate a new URL from the URL the user passed.</p> <p>Example:</p> <p>The user types into the browser like <b>http://us.d...
<p>Something not as fast, but more general:</p> <pre><code>server { listen 80; server_name domain.com; if ($host ~* (.*)\.domain\.com ) { set $subdomain $1; rewrite (.*) http://domain.com/?portal=$subdomain; } </code></pre>
Batch rename file extensions, including subdirectories <p>I'm renaming empty file extensions with this command:</p> <pre><code>rename *. *.bla </code></pre> <p>However, I have a folder with hundreds of such subfolders, and this command requires me to manually navigate to each subfolder and run it.</p> <p>Is there a ...
<pre><code>for /r c:\path\ %G in (*.) do ren "%G" *.bla </code></pre>
connecting an UIActivityIndicator to a UIButton <p>New to all this Xcode stuff - I have a few UIButton's that links to movie &amp; music files from my web site - they works fine, it's just that there's some lag time while it's loading the MoviePlayer where it seems as if nothing's happening.</p> <p>I would like to se...
<p>If you want to add an ActivityIndicator directly to your button, here's some code to do this:</p> <pre><code>UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; button.frame = CGRectMake(0,0,40,40); // increase width value if you want to add text [button addTarget:self action:@selector(buttonPr...
How do you automatically resize columns in a DataGridView control AND allow the user to resize the columns on that same grid? <p>I am populating a DataGridView control on a Windows Form (C# 2.0 not WPF).</p> <p>My goal is to display a grid that neatly fills all available width with cells - i.e. no unused (dark grey) a...
<p>This trick works for me:</p> <pre><code> grd.DataSource = DT 'set autosize mode grd.Columns(0).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells grd.Columns(1).AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells grd.Columns(2).AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill 'data...
Transferring cryptographic initialization vectors <p>I want to know the best way of transferring a cryptographic initialization vector (IV) from the place where my data is encrypted to the place where my data is decrypted.</p> <p>In other words, the IV should be randomly generated every time you encrypt a message (rig...
<p>The IV does not need to be kept secret, as the only secret data is the key (by definition).<br /> As long as the IV is random, go right ahead and transmit it any way you like - concatenating it with the encrypted data is just fine. </p> <p>(Of course, make sure you ARE protecting the <em>integrity</em> of the IV ...
Flex custom preloader images loading <p>I am writing a custom flex preloader which extends the <code>IPreloaderDisplay</code> class. How can I load the images from web in my custom preloader?</p> <p>Thanks,<br> Vladimir</p>
<p>You can't load your preloader images from the web because the framework hasn't loaded. You need to keep preloaders VERY lightweight and don't use any framework code. Just extend Sprite and implement the IPreloaderDisplay methods but embed your images and don't attempt to load them at runtime.</p>
Which is the best desktop search for programmers? <p>Can anyone recommend a desktop search product that specifically targets the development community? I know that Google Desktop Search, Copernic Desktop Search and Windows Search can all search through source code (PHP, C#, VB, C++, SQL, etc) with some tweaking. Howeve...
<p>By installing <a href="http://www.cygwin.com/" rel="nofollow">Cygwin</a> and findutils (within Cygwin), you can <code>updatedb</code> and then <code>locate FILENAME_PATTERN</code>. You can then <code>grep</code> to get what you are looking for.</p>
Java Card Conversion <p>I have written a Java Card App and want to upload it to a Card. But the card supports Java 2.1.1 standard. So I am looking for a way of generating a 2.1.1 Compliant CAP file with my 2.2.2 Kit</p> <p>I have:</p> <ul> <li>Java 1.6</li> <li>GPShell 1.4.2</li> <li>Java Card 2.2.2</li> <li>JCOP 30 ...
<p>Assuming that you don't use any new features only offered in Java Card 2.2 you still have a twofold problem: it concerns the format as well as the content of your CAP file.</p> <ol> <li>your CAP file is in Java Card 2.2 format, which is sligtly different to Java Card 2.1</li> <li>your CAP file contents fit to a Ja...
Using JQuery in a Subfolder When the MasterPage is in the Root Folder <p>I am trying to use the jquery library in ASP.NET in a subfolder called "samples" with a masterpage that is located in the root directory. Presently the references to the jquery scripts are located in the head tag of the master page. If the page I ...
<p>simply use this:</p> <pre><code>&lt;script src="/js/jquery.js" type="text/javascript"&gt;&lt;/script&gt; </code></pre> <p>putting <em>/</em> <strong>before</strong> <em>js</em> do the trick. I always keep my css and javascript files in separate folders and use this tweak to rightly include them.</p> <p>for intell...
Ajax code not working in Firefox <p>The following AJAX code seems to be working fine in IE but not in Firefox. I guess the problem is in the function <code>getElementsByTagName()</code>. I have no idea as to how to solve this problem.</p> <p>AJAX code: <a href="http://docs.google.com/View?id=dfv8mm9q%5F28ff5qrwht" rel...
<p><s>Without testing, I think the issue is innerHTML.</s> Try:</p> <pre><code>function disp(msgXML) { var messsage = msgXML.getElementsByTagName("name")[0].textContent; document.getElementById("message").textContent = messsage; } </code></pre> <p>EDIT: As Tom noted, the innerHTML you did will work. It was ...
How do I set up a basic website with registration in Python on Dreamhost? <p>I need to write a basic website on Dreamhost. It needs to be done in Python. I discovered Dreamhost permits me to write .py files, and read them.</p> <h3>Example:</h3> <pre><code>#!/usr/bin/python print "Content-type: text/html\n\n" print "h...
<p>Let me share my own experience with django. My prerequisits:</p> <ul> <li><p>average knowledge of python</p></li> <li><p>very weak idea of how web works (no js skills, just a bit of css)</p></li> <li><p>my day job is filled with coding in C and I just wanted to try something different, so there certainly was a pas...
Handling click events on z-index'd layers <p>I have 2 z-index layers in a map application I'm building. I have a problem when I click on the layers to zoom in. The click handler is on the underlying z-index layer and I don't want it to fire when a control in the overlying layer is clicked. </p> <p>The problem i have ...
<p>It's called event-bubbling, and you can control it with the event.stopProgation() method (event.cancelBubble() in IE). You can also control it by returning true/false from handlers called by onwhatever attributes on elements. It's a tricky subject so I suggest you do some <a href="http://www.quirksmode.org/js/events...
Rails equivalent for MapPath (from ASP.NET) <p>Does Rails have an equivalent of the Server.MapPath method from ASP.NET? I've tried looking for one, but couldn't find anything.</p> <p><strong>Edit</strong>: I need this to generate a PDF with some images stored on the server. I know the relative path (URL) of the images...
<p>Ruby has one: <a href="http://www.ruby-doc.org/core/classes/File.html#M002563" rel="nofollow">File.expand_path</a>. You can also use Rails.root to get the current path to rails project, then compose the path from there.</p> <pre><code>File.join(Rails.root, "public", "404.html") File.expand_path("public/404.html", R...
No route matches "/javascripts/prototype.js" -> explicitly define one? <p>When I call the <code>index</code> action of my <code>assets</code> controller, the corresponding <code>index</code> template uses the <code>assets</code> layout which includes this line:</p> <pre><code>&lt;%= javascript_include_tag 'prototype' ...
<p>You shouldn't need to define a route for this - it should be handled by the rewrite rules in your .htaccess file.</p> <p>You need to check that your mod_rewrite is enabled, and that the .htaccess file is correct - it should be sending the request to your dispatch.rb only if the requested file does not exist in your...
Error 1310. Error writing to file: C:\Config.Msi\997da2c.rbf <p>I am facing a peculiar problem; I am creating a <code>setup.exe</code> in Installshield 2008 Primer Edition and install the setup in a laptop which has the Operating System Windows XP Professional.</p> <p>The setup runs fine and install all the files succ...
<p>Right click on the installer and choose "Run as Administrator"</p>
Can I use Interface for CAO in Remoting? <p>In CAO there is no URI, so specified type has to be registered on the server side. But if my client and server interact through the same interface (remote object implements interface) then how can I call CAO remote object from client side. It gives me exception if I try to ca...
<p>I'm not sure I can post a solution to your actual issue. However, I can explain why the code you've posted throws an exception. You are trying to create an instance of an interface type. This cannot be done, an interface contains no implementation. Generically speaking, I believe what you want to do is create the re...
What is difference between my atoi() calls? <p>I have a big number stored in a string and try to extract a single digit. But what are the differences between those calls?</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; int main(){ std::string bigNumber = "93485720394857230"; char tmp = bigNum...
<p>I know why the 2nd number is displayed.</p> <p><a href="http://www.cplusplus.com/reference/clibrary/cstdlib/atoi/" rel="nofollow">From the atoi reference.</a></p> <blockquote> <p>If the correct value is out of the range of representable values, <strong><code>INT_MAX</code></strong> or INT_MIN is returned.</p> </...
Fluent nhibernate hasmanytomany & adding it <p>i have used fluent nhibernate for 3projects so i know the basics but i havent used the hasManyToMany yet. i have found documents that show me how to mapp it so i guess that is ok. my question about that is what sould use the hasManyToMany in its mapping and what should i p...
<p>i found a pretty good blogpost about this <a href="http://marekblotny.blogspot.com/2009/02/fluent-nhbernate-and-collections.html" rel="nofollow">http://marekblotny.blogspot.com/2009/02/fluent-nhbernate-and-collections.html</a></p>
How to find out next character alphabetically? <p>How we can find out the next character of the entered one. For example, if I entered the character "b" then how do I get the answer "c"?</p>
<p>Try this:</p> <pre><code>char letter = 'c'; if (letter == 'z') nextChar = 'a'; else if (letter == 'Z') nextChar = 'A'; else nextChar = (char)(((integer) letter) + 1); </code></pre> <p>This way you have no trouble when the char is the last of the alphabet.</p>
What's the standard convention for creating a new NSArray from an existing NSArray? <p>Let's say I have an <code>NSArray</code> of <code>NSDictionaries</code> that is 10 elements long. I want to create a second <code>NSArray</code> with the values for a single key on each dictionary. The best way I can figure to do t...
<p>In this particular case Cocoa is not outdone in succinctness :)</p> <pre><code>NSArray *newArray = [array valueForKey:@"name"]; </code></pre> <p>From the NSArray documentation:</p> <blockquote> <p><strong>valueForKey:</strong></p> <p>Returns an array containing the results of invoking valueForKey: using ...
Quickly debug helper methods in script\console <p>How would I quickly debug helper methods in script\console. I'm talking about making changes and then debugging, over and over again.</p> <p>This is a lot easier with Model methods, since all I have to do is use reload! to test the updated code, whereas to test a helpe...
<p>I don't think you can do that without hacking Rails. However, there's a workaround - debugging helper method in rails debugger: </p> <p>1) gem install ruby-debug</p> <p>2) ruby script/server --debugger</p> <p>3) place &lt;% debugger %> into some view and open that page in browser</p> <p>4) server window "turns i...
WCAT Problem <p>I am trying to stress test an ASP.Net MVC application using the WCAT tool. I get results when the WCAT client and controller are on the web server(localhost), but when I move the WCAT client to another machine, I get "404 Not found" errors. It seems that the WCAT client cannot make the http requests fro...
<p>Found the issue - when starting up the controller you must specify the server hostname (-a) and <em>not</em> "localhost".</p>