input
stringlengths
51
42.3k
output
stringlengths
18
55k
Nested Object w/ Checkboxes - mass-assignment even with accepts_nested_attributes_for? <p>I thought that there should have been a simple solution to this, given that Rails 2.3 has this newfangled nested forms feature. Basically I want to create or update a user and assign them roles at the same time.</p> <p>It seems l...
<p>If you correct the spelling of attributes in your <code>check_box_tag</code>, it looks like it should work.</p> <pre><code>&lt;% for role in Role.all %&gt; &lt;%= check_box_tag( "user[roles_attributes][id]",role.id) %&gt; &lt;%= role.rolename %&gt; &lt;br/&gt; &lt;% end %&gt; </code></pre>
How to receive MPEG-TS multicast from Windows <p>We currently have a system with live video encoded to an MPEG-TS multicast stream, being received by televisions with STBs. In addition to televisions we'd like to embed the video in our Windows application.</p> <p>I know that VLC will receive the stream, but would pref...
<p>You'll need to develop a simple <code>DirectShow</code> filter that listens on a given port and just passes down every packet it had received.</p> <p>I don't have a sample handy, but it's really simple, several hundreds lines of code.</p> <p>Then you just connect this filter to an <code>MPEG2 Demultiplexer</code> ...
How do I write to the console in Google App Engine? <p>Often when I am coding I just like to print little things (mostly the current value of variables) out to console. I don't see anything like this for Google App Engine, although I note that the Google App Engine Launcher does have a Log terminal. Is there any way to...
<p>You'll want to use the Python's standard <code>logging</code> module.</p> <pre><code>import logging logging.info("hello") logging.debug("hi") # this won't show up by default </code></pre> <p>To see calls to <code>logging.debug()</code> in the GoogleAppEngineLauncher Logs console, you have to first add the flag <c...
SOAP on Subdomains <p>I am working with an application that is used by multiple clients. Each client has its own database, but multiple clients use the same php codebase. In essence, we use named virtual servers on apache to point the url to the right codebase on the server. When the browser hits the php code, the c...
<p>I'm not sure about it, but you can have a dynamic WSDL file, which itself is a PHP script. based on the request parameters (that will indicate which customer is requesting), a specific XML data will be generated and sent to the user.</p>
MySQL set storing <p>I have a couple of tables in a web application I'm coding in PHP, and I would like to know if this would be good pratice.</p> <pre><code>CREATE TABLE `products`( `product_id` int NOT NULL auto_increment, `name` varchar(255) NOT NULL, `variations` varchar(255) default NULL, PRIMARY KEY (`p...
<p>I believe the wise thing to to is add another table:</p> <pre><code>CREATE TABLE `products_variations`( `product_id` int NOT NULL, `variation_id` int NOT NULL, PRIMARY KEY (`product_id`, `variation_id`) ); </code></pre> <p>From there, a simple query joining the three tables will give you the results you nee...
Anonymous delegates in vb.net (pre vb9)? <p>Is it possible to create anonymous delegates in vb.net version 8 or earlier? If so, could someone provide an example of the syntax? Thanks.</p>
<p>In VB 9.0 you can create single line lambda expressions </p> <pre><code>Dim del = Function (x) x + 42 </code></pre> <p>In VB 10.0 (not yet released). You will be able to create both multiline function and sub routines (as well as single line subs). For example</p> <pre><code>Dim del = Function (x) R...
Beyond Compare for Object Instances <p>Does anyone know of a tool or library in .net that can be used to compare object properties and sub-objects like beyond compare does for text files? What I am looking for is a way to show two instances of the same type and show colored coded differences between them and allow the ...
<p>Using <a href="http://www.oz-code.com/" rel="nofollow" title="BugAid">OzCode</a> you can compare objects with other objects or saved snapshots.</p> <p><img src="http://i.stack.imgur.com/GEiWE.png" alt="Comparison sample"></p>
NSURLConnection delegate doesn't get its didReceiveAuthenticationChallenge method on server status 401 <p>I've setup a simple NSURLConnection to query an http-server.</p> <pre><code>GET /path HTTP/1.1 Host: 192.168.1.161:8282 User-Agent: NetTest1.0 CFNetwork/441.0.2 Darwin/9.6.0 Accept: */* Accept-Language: en-us Acce...
<p>The WWW-Authenticate header looks malformed, try:</p> <pre><code>WWW-Authenticate: Basic realm="My Realm" </code></pre>
Regarding Terracotta and Servlets/ Shared Threads <p>I have a system that I need to distrubte that works as follows. Servlets served by tomcat start up and spawn off threads with a large number of shared (distributed) fields. Ergo, I set the thread as a root and attempt to spawn the threads as normal from my servlet co...
<p>Solved. I had to restart the Terracotta server, which then let me see errors indicating that Statement and Connection were nonportable classes that needed to be made transient.</p>
Perforce Dev Branches - Sparse Branching vs. Private Branching <p>I'm looking for some feedback on the advantages and disadvantages of the methods available for creating individual development branches in a Perforce depot. If I understand correctly, there are two ways of handling this. The first is to create a Privat...
<p>As you noted from the documentation space is not really an issue. Speed is though. Syncing down the entire development tree may take a long time. The integration back will also take a while. If you only need a branch of the tree then both of those operations are much faster. </p> <p>Human error, as you already said...
C# tab gui, Hide the body? <p>How do i get rid of the body in my tabControl? and how do i add and remove tabpages? I need to add/remove tabpages in code but hide the body in code or in the editor. I tried making the tabControl hight &lt;20 but no matter what it has a line showing how wide it is.</p>
<p>As far as I know, there's no built-in control for a row of tabs without pages for each tab.</p> <p>You could just cover the body with a Panel. If you adjust the size of the panel carefully, it should look ok.</p>
Three arguments to main, and other obfuscating tricks <p>The following obfuscated C code prints the words to the "12 days of Xmas".</p> <p>I was trying to puzzle out how it works. I'm basically completely lost. What is the significance of the three untyped arguments to main in the initial call, the series of characte...
<p>Someone's already gone and reversed this: <a href="http://research.microsoft.com/en-us/um/people/tball/papers/xmasgift/">http://research.microsoft.com/en-us/um/people/tball/papers/xmasgift/</a>. Just read through that. It'll explain how it all works.</p>
DDD, related entities in master detail relationships <p>As I understand it all DDD entities should have an ID. So my question is in a master detail relationship, say a Product and a ProductDetail, should the ProductDetail have any knowledge of the Product? Is it necesarry with a ProductID property in the ProductDetail ...
<p>How will end users retrieve the ProductDetail? If the answer is that they will likely navigate to it from the Product, then the ProductDetail is simply a property of Product, or part of a collection of ProductDetails that is a property of the Product. </p> <p>So in your object-oriented code, the ProductDetail objec...
Can I dynamically unload and reload (other versions of the same) JAR? <p>I am writing a server program which is used to run unit tests of an API <i>(displaying lots of information and providing web access to control / monitor the whole thing)...</i></p> <p>This API is <strong>known to the server during compile time</s...
<p>I think if you load a class using</p> <pre><code>Class.forName(clsname, init, classloader); </code></pre> <p>(<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/Class.html#forName%28java.lang.String,%20boolean,%20java.lang.ClassLoader%29">Javadoc</a> here) you will get an instance of the class provided by ...
How to do a 'ExecuteNonQuery' in Castle Active Record <p>I have the following code to perform a database level operation through our active record ORM layer.</p> <pre><code>public static void Vacuum() { Execute( delegate(ISession session, object instance) { ISQLQuery query = session.CreateSQLQuery(...
<p>For specific DB calls you can get a raw IDbConnection from </p> <pre><code>ActiveRecordMediator.GetSessionFactoryHolder().GetSessionFactory(typeof (object)).ConnectionProvider.GetConnection() </code></pre>
How does a string differ from an array of char pointers in C? <p>I was under the impression that they were the same thing. However, it looks to my like they are being treated differently here. The part I am confused about looks like this.</p> <pre><code>Foo* initFoo(char* name); int main { Foo* foo; char* player_...
<p>A string is an array of characters. What you have here is an array of pointers to characters.</p>
Set attributes for parameters in SOAP request PHP <p>I'm trying to use a webservice which only allows SOAP request</p> <p>as far as I know I must create a request that looks like this</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;SessionCreateRQ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...
<p>Firstly you need WSDL definition for this service (online or in local file). Any not bad SOAP service provide WSDL to users.</p> <p>Secondly you need translate WSDL service definition to PHP-code. Try <a href="http://sourceforge.net/projects/wsdl2php" rel="nofollow">wsdl2php</a> generator. Its generate file with c...
What is the largest open source project written in Visual C++? <p>What is the largest open source project written in Visual C++ ?</p> <p>I can see that eMule project is pretty big, but what is largest?</p>
<p>I think some of the largest pieces of software that you will find are some of the open Source Game engine, such as Ogre3D: <a href="http://www.ogre3d.org/" rel="nofollow">http://www.ogre3d.org/</a> or Irrlicht: <a href="http://irrlicht.sourceforge.net/" rel="nofollow">http://irrlicht.sourceforge.net/</a></p> <p>Th...
How do I correctly clone a JavaScript object? <p>I have an object, <code>x</code>. I'd like to copy it as object <code>y</code>, such that changes to <code>y</code> do not modify <code>x</code>. I realized that copying objects derived from built-in JavaScript objects will result in extra, unwanted properties. This isn'...
<p>To do this for any object in JavaScript will not be simple or straightforward. You will run into the problem of erroneously picking up attributes from the object's prototype that should be left in the prototype and not copied to the new instance. If, for instance, you are adding a <code>clone</code> method to <code>...
ASP.NET CustomValidator client side <p>I can't get this CustomValidator working.</p> <p>In the &lt;head&gt;:</p> <pre><code>&lt;script language="javascript" type="text/javascript"&gt; function ValidateFile(sender, args){ alert("Hi"); args.IsValid = document.getElementById("fuFile").value != "" || ...
<p>I find it helpful to actually let the code behind tell your JavaScript code what the client-side ID of the control is, since it's possible it's different than what you would think (based on what ASP .NET decides to do):</p> <pre><code>document.getElementById('&lt;%=fuFile.ClientID %&gt;'); </code></pre>
Is there a way to get Asio working without Boost? <p>I know there is a version of ASIO that is not included in the Boost namespace, but even then ASIO depends on Boost, but I'm wondering if there is a way to get ASIO to work without dependencies on Boost (because I cannot include Boost into the project, for too many re...
<p>No, i don't believe so. ASIO has been using boost for as long as i have heard of it. I think they're very much interconnected. But you may be interested in a tool, <a href="http://www.boost.org/doc/libs/1%5F38%5F0/tools/bcp/bcp.html">bcp</a>, which lets you extract the minimal subset of boost required for the librar...
Event Tracking <p>I want to understand event cycles. I have a form with a grid and textboxes. It has a grid, bound to DataTable, and textboxes bound to same table too. I'm trying to debug something and need to know how to identify ALL events fired in the form to see what may solve an issue for me.</p> <p>Anyhow, un...
<p>You could fire up a profiler and look at the method call tree.</p>
Common Lisp: What's the best way to use libraries in a shared hosting environment? <p>I was thinking about this the other day and wanted to see what the SO community had to say about the subject.</p> <p>As it stands right now Common Lisp is getting some attention as a web development platform, and with good reason (of...
<p>There are two ways I would look at it:</p> <ol> <li><p>start a Lisp for each request</p> <p>This way it would be much better that the Lisp is a saved image with all necessary libraries and data loaded. But that approach does not look very promising to me.</p></li> <li><p>run a Lisp and let a frontend (web browser,...
Mutable Value Objects / Sharing State (and beer brewing!) <p>I'm a rusty programmer attempting to become learned in the field again. I've discovered, fitfully, that my self-taught and formal education both induced some bad habits. As such, I'm trying to get my mind around good design patterns, and -- by extension -- wh...
<p>Are you sure <code>HopVariety</code> should be a value object? It sounds to me like an entity - "Amarillo" hop variety is one and only one, so it should be a uniquely identifiable object. Just like "Tony Wooster" is only one (well not exactly, but you get the point ;) )</p> <p>I recommend reading about <a href="htt...
Remove excessive line returns <p>I am looking for something like trim() but for within the bounds of a string. Users sometimes put 2, 3, 4, or more line returns after they type, I need to sanitize this input.</p> <p>Sample input</p> <pre><code>i like cats my cat is happy i love my cat hope you have a nice day <...
<pre><code>function str_squeeze($body) { return preg_replace("/\n\n+/", "\n\n", $body); } </code></pre>
Cross tab data control for winform.net 2.0 <p>Could anyone suggest me any winforms controls for showing cross tab data in .net?</p> <p>Updates: 1. The control should be editable 2. Binding support will be add-on feature.</p>
<p>If you only need a read-only display of the data, it might be easiest to use the <a href="http://www.gotreportviewer.com/" rel="nofollow">ReportViewer control</a> with a Matrix.</p>
Is there a way to use VS with a remote site accessible only by sftp? <p>I'm working with with asp.net and writing a few classes (controls for the CMS) to use on my website. At the moment i'm using a text editor (UE) which has sftp support and syntax highlighting to edit the files and save via sftp. Then i just test it ...
<p>One way to do this would be to mount the SFTP server as a windows drive.</p> <p>If the SFTP server is on your local network then you can mount it as a windows share. If it is outside your network on in your DMZ, then you can find software that lets you mount the SFTP server as a drive.</p> <p>Software that allows...
How do I generate the value of a field the first time it's accessed? <p>Using Django, how do I generate the value of a field the first time it's accessed? Then storing the value on the field.</p> <p>In my case it's an image, but it could be anything I suppose. What I need is a function that runs before the field is ac...
<p>There's been a <a href="http://code.djangoproject.com/ticket/3148" rel="nofollow">getters and setters</a> ticket open in the djangoproject for a couple years now, but no luck. I've seen three common approaches to the situation you describe:</p> <ul> <li><p>Put your model field at a different name, say <code>image_f...
MySql Stored procedure creation Error <p>I am trying to create a stored procedure in my mysql database usin the below code.I am getting an error.Please help me to solve</p> <p>My MySQl version is 5.0.51b</p> <pre><code>CREATE PROCEDURE tv_insert_user(IN firstName VARCHAR(25), IN lastName VARCHAR(25), IN emailId VARCH...
<p>The lname-thing isn't what the error message is about. You need to specify a different delimiter. The default delimiter for MySQL commands is the semicolon, but semicolons are used inside stored procedures at the the end of statements. In this example I change the delimiter to //, and use that to end the procedure....
Function returning an iterator of vector <p>I have this new class Seq that inherits vector and has some additional features. I can use all methods of vector with Seq.</p> <p>Having this data structure:</p> <pre><code>Seq&lt; vector&lt;int&gt; &gt; sweepEvents; </code></pre> <p>I want to have a function that takes an...
<p>Is Seq&lt; vector&lt; T > >::iterator defined in your Seq class?</p> <p>Making the parameter of the template 'vector' does not imply that exists the type Seq&lt; vector&lt; int > >::iterator</p>
software fails to write to C: with Win2003 limited user "out of disk space" <p>software fails to write to profile folder stored in C: with Win2003 limited user due "out of disk space"</p> <p>When I look with Admin rights, there is plenty of space on C: drive</p> <p>When I go with limited to user to cmd.exe and say...
<p>Looks like there is a <a href="http://www.microsoft.com/technet/scriptcenter/topics/win2003/quotas.mspx" rel="nofollow">disc quota</a> in place.</p>
Problems with php-cli and mysql, why is mysql_pconnect() not available? <p>I've installed various PHP packages to be able to use PHP with Apache but also in the commandline. From both I need to be able to connect to MySQL databases. Pretty simple right? That's what I thought but with php-cli I receive following error:<...
<pre><code>php -i | grep mysql </code></pre> <p>The first line should contain:</p> <pre><code>Configure Command =&gt; '../configure' ... '--with-mysql=shared,/usr' </code></pre> <p>Also check </p> <pre><code>grep extension_dir /etc/php5/cli/php.ini </code></pre> <p>Should be something like: <code>extension_dir = ...
Automatically creating child objects during Silverlight DataBinding? <p>I have a parent object of type Parent and it currently has a null property called Foo of type Child and that Child class has a property of type string called Name.</p> <p>If the user types into a Text Box for that Name property then I want to auto...
<p>There is no automatic way. You could consider using a pattern like M-V-VM and handling this logic in the ViewModel. You might also possibly get creative with an IValueConverter so that your binding can run custom code when the value is set. But WPF / Silverlight binding will not automatically do this work for you.</...
C#: How to add subitems in ListView <p>Creating an item(Under the key) is easy,but how to add subitems(Value)?</p> <pre><code>listView1.Columns.Add("Key"); listView1.Columns.Add("Value"); listView1.Items.Add("sdasdasdasd"); //How to add "asdasdasd" under value? </code></pre>
<p>You whack the subitems into an array and add the array as a list item.</p> <p>The order in which you add values to the array dictates the column they appear under so think of your sub item headings as [0],[1],[2] etc.</p> <p>Here's a code sample:</p> <pre><code>//In this example an array of three items is added t...
How can I catch a symbol that user is hit on keyboard? <p>Yes, many controls have KeyUp/KeyDown propertys. But in they arguument I can catch Key class only. Not real symbol. For example, when user type "d" symbol is become a Key.D in KeyDown. All symbols in any other langauge that stay on the same plase on keyboard wil...
<p>read here:<br /> <a href="http://msdn.microsoft.com/en-us/library/ms754010.aspx#text_inputReal" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms754010.aspx#text_inputReal</a><br /> It seems that what you need to do is to handle the <code>TextInput</code> event rather than the <code>KeyUp/KeyDown</code> even...
Python script - SCP on windows <p>How is it possible to do secure copy using python (windows native install - ActivePython). Unfortunately pexpect module is for unix only and we don't want cygwin locally. I wrote a script that based on pscp.exe win tool - but always stops at first execution becuse of fingerprint host i...
<p><a href="http://www.lag.net/paramiko/" rel="nofollow">paramiko</a> is pretty slick. See <a href="http://stackoverflow.com/questions/250283/how-to-scp-in-python">this question</a> for some more details.</p>
Right-align items within wpf expander header <p>I want to have some text in an expander header left aligned, then some text right aligned. I have found how to expand the header to the width of the container, and thought I could simply add a dockpanel and set the second text block to Dock Right, but it doesn't seem to h...
<p>This is what worked for me. This also moves the arrow to the right, because it's reverting the order of the header and re-reverting the order for the content. </p> <pre><code>&lt;Expander FlowDirection="RightToLeft" &gt; &lt;Expander.Header&gt; &lt;DockPanel FlowDirection="LeftToRight" Horizontal...
How must i save my Images in my Project? <p>This is what i want to do............</p> <p>I am going to let each user upload multiple images into a folder called "pics". If the user upload say "MyImage.jpg" i will rename it "MyImage_UserID.jpg". Where UserID will be the User's unique ID of course. This way when i look...
<p>Provided there will be some significant number of users with significant amount of images per user, your File System will start to suffocate (provided it won't crash being unable to handle large number of files).</p> <p>What I recommend is to create a folder for each user. And no, this is not stupid.</p>
JQuery .trigger('submit') breaking <p>Im finding that because all the forms that Im working on have a submit button which inlcudes a 'name="submit"' attribute, that the trigger submit is breaking when I click on the link that is supposed to trigger the form submit.</p> <p>Does anyone know how I can get round this.</p>...
<p>It's because you've given your submit button a name of "submit". Because this is already a property of the form object, it messes with the binding of the submit event.</p> <p>See this note from the <a href="http://api.jquery.com/submit/">jQuery docs</a>:</p> <blockquote> <p>Forms and their child elements should ...
WPF - fast way of getting the visual tree <p>I am adding some controls dynamically within a grid. I will not know how many and I will not know the exact hierarchy. What I want to do is to access some controls that have a specific type (Button for example) and instantiate some properties. What is the best way to do this...
<p>You can override button style at grid level. Here's an example:</p> <pre><code>&lt;Grid&gt; &lt;Grid.RowDefinitions&gt; &lt;RowDefinition Height="144*" /&gt; &lt;RowDefinition Height="171*" /&gt; &lt;/Grid.RowDefinitions&gt; &lt;Grid.Resources&gt; &lt;!-- Override all Buttons sty...
C# How to invoke with more than one parameter <p>I use the code below to access the properties on my form,but today I'd like to write stuff to a ListView,which requires more parameters.</p> <pre><code> public string TextValue { set { if (this.Memo.InvokeRequired) { ...
<p>(<strong>edit</strong> - I think I misunderstood the original question)</p> <p>Simply make it a method instead of a property:</p> <pre><code>public void DoSomething(string foo, int bar) { if (this.InvokeRequired) { this.Invoke((MethodInvoker)delegate { DoSomething(foo,bar); }); ...
Optimal Layout Algorithm <p>I'm implementing a CSS Sprites setup in my ASP.NET application based on this article..</p> <p><a href="http://weblogs.asp.net/zowens/archive/2008/03/05/css-sprite-for-asp-net.aspx" rel="nofollow">http://weblogs.asp.net/zowens/archive/2008/03/05/css-sprite-for-asp-net.aspx</a></p> <p>In the...
<p>This is known as the rectangle packing problem. Even in very simple cases, finding the optimal solution is NP-hard, although often there are good heuristics. Googling rectangle packing gives some interesting algorithms and code.</p>
jQuery plugin show image <p>I generate a HTML page with the links to images from a directory.</p> <p>First I was thinking to load/display all the images and then to hide them using jQuery .hide() When a user will click to a image I'll display that image, but I hope you can offer me a better approach.</p> <p>It's pos...
<p>You can use <a href="http://www.ibegin.com/labs/ibox/" rel="nofollow">Ibox</a> and do something like this:</p> <pre><code>&lt;a href="http://site.com/img.jpg" rel="ibox"&gt;Image 1&lt;/a&gt; </code></pre> <p>When someone clicks this link, the image will show up in a small hovering window.</p>
How to use multiple caches in rails? <p>I have a rails application where I would like to use both memcached and the file store cache, for different purposes.</p> <p>I want to use the file store cache to keep a large number of pages that don't change often (some not at all) - i.e. page caching - and use memcached for e...
<p>A simpler approach may be to use a http cache upstream of your application as your page cache rather than two stores within rails. This way you can use http headers to control the cache behavior, including TTL's. These same limits will also apply to browser's local caches as a nice bonus.</p> <p><a href="http://var...
Fill-in color on triangle using mouse click <p>I was wondering how to fill in a triangle shape with color when a user click on the triangle.</p> <p>So far I am using txt file as input file to read the coordinate of the triangle to be drawn on screen.</p>
<p>I did something like this long ago .. <a href="http://www.developer.com/tech/article.php/874351" rel="nofollow">here's something that might help</a></p>
JavaScript Charting library - Google Analytics Style <p>I'm searching for a Javascript library to create line charts like the ones of Google Analytics. When the mouse is over a point, a box shows you the data.</p> <p>An example is at <a href="http://wikirank.com/en">http://wikirank.com/en</a></p> <p>No Flash or Air, ...
<p>Edit: If you want a free library, try <a href="http://code.google.com/p/flot/">Flot</a>.</p> <p><a href="http://www.ejschart.com/">Emprise Charts</a> is a commercial library that I've seen featured on news sites.</p>
Java type cannot be resolved <p>I have a statement</p> <pre><code>String pass = com.liferay.portal.util.PortalUtil.getUserPassword( renderRequest) </code></pre> <p>that causes the following error in eclipse IDE:</p> <blockquote> <p>The type javax.servlet.http.HttpSession cannot be resolved. It is indirec...
<p>It sounds like you haven't referenced the right libraries. Add a reference to servlet.jar.</p>
Which one of the major operating systems is best suited for a quick boot and startup of a Java application? <p>I created a Java application which is the only application active on a workstation. (Similar to a kiosk system)</p> <p>The problem is that the application has to be up and running as fast as possible after st...
<p>I would look at <a href="http://www.bootchart.org/" rel="nofollow">BootChart</a> to optimise your Fedora boot time. If you're running one app, then you can certainly remove a lot of the services that Fedora would normally come configured with.</p> <p>I would also point out that perhaps for the amount of time you're...
Javascript MVC framework (seperation of concerns) is compatible with asp.net MVC? <p>Anyone had a chance to use the javascript MVC framework with ASP.NET MVC?</p> <p>Basically i looking for advise on a way of using them together if possible, my asp.net MVC app i can't get rid of but i would love to use some sort of se...
<p>I'm one of the JMVC guys. Yes you can use those two together. We advice using REST services to separate your client/server layers, as it provides the cleanest separation for your data. With REST you'd consume data with your client by making requests for all todos, which would come back as JSON. JavaScriptMVC wou...
Testing ClickOnce Applications <p>What method would you use for testing a new version of a ClickOnce application (side by side with the current version) amongst multiple users? Are there any best practices (especially as the applications depend on different servers for the live/test versions of SQL / web services etc)....
<p>For ClickOnce deployment testing, we set up a few virtual machines and have testers connect using remote desktop. The VM desktop backgrounds are an ugly color and say "TESTING" in big bold red letters.</p> <p>Also, all of our applications display a warning message if the user is about to connect to anything but the...
Are there any more benefits, or perhaps drawbacks of the "new" way to define properties? <p>Are there any further benefits to the "new", shorter way to handle properties, other than shorter code - like performance benefits, less memory usage etc.? </p> <p>Writing</p> <pre><code>public string StrVariable { get; set;} ...
<p><a href="http://stackoverflow.com/questions/9304/c-3-0-auto-properties-useful-or-not">Heres a link you may find useful.</a></p>
Windows Form TreeView - PNG Image Background <p>We are using famfamfam png icons. When TreeNodes are assigned one of these images there is an odd blue background colored inside the icons. How can we fix this?</p>
<p>Could it be something to do with the bit depth of the PNGs?</p> <p>Try exporting them at a different depth, such as 32bit, and make sure your associated ImageList is set to a sensible depth (should match the images ! - I'd suggest everything is 32bit).</p> <p>Failing that, you could always use the Owner Draw funct...
nhibernate: How do I map a component which references an enity? <p>My db looks somthing like this:</p> <pre><code>MyEntity State ----- ----- id id street name stateId ... zip status ... </code></pre> <p>My Model looks like this:</p> <pre><code>class MyEntity { int id { get; set; ...
<p>I'm also unsure of what to make of referencing an entity from a component. I've done so myself (with a State entity, no less).</p> <p>As far as the mapping, it's pretty straightforward:</p> <pre><code>public class MyEntityMap : ClassMap&lt;MyEntity&gt; { public MyEntityMap() { Id(x =&gt; x.id); ...
Do you use (or define) non standard annotations, and for what reason. How about recursive annotations? <p>The question tells it all.</p> <p>For the experts, is there a reason the SUN java 5 compiler accepts recursive annotations (contrary to the langspec), while the later compilers do not? I mean, what could be an arg...
<p>First -- I'm not sure what you mean by recursive annotations. Do you mean annotations that can contain references to other annotations of the same type? Something like</p> <pre><code>@Panel(layout=BorderLayout.class, nested={ @Panel(region=NORTH, layout=FlowLayout.class, ...) @Panel(region=SOUT...
Is there a difference between "throw" and "throw ex"? <p>There are some posts that asks what the difference between those two are already.<br /> (why do I have to even mention this...)</p> <p>But my question is different in a way that I am calling "throw ex" in another error <em>god-like</em> handling method.</p> <pr...
<p>Yes, there is a difference;</p> <ul> <li><code>throw ex</code> resets the stack trace (so your errors would appear to originate from <code>HandleException</code>)</li> <li><code>throw</code> doesn't - the original offender would be preserved.</li> </ul>
Updating backend database from cooked XML/PDF input: Which is the best tool/approach? <p>We have to automate database updation couple of times a month. </p> <p>My current use case is as follows.</p> <p>Currently we manually diff the input data with the previous month's input. If it is XML we use MS xmldiff. If it is ...
<p>I think Python is easy to learn language, and in my opinion if you have VBScript experience, you should be able to pick it up quickly.</p> <p>I used BeautifulSoup for my XML/HTML parsing, which I found very easy to use. <a href="http://www.crummy.com/software/BeautifulSoup/documentation.html" rel="nofollow">http://...
How to throw exception without resetting stack trace? <p>This is a follow-up question to <a href="http://stackoverflow.com/questions/730250/is-there-a-difference-between-throw-and-throw-ex">Is there a difference between “throw” and “throw ex”</a>?</p> <p>is there a way to extract a new error handling method wi...
<p>Yes; That's what the InnerException property is for.</p> <pre><code>catch(Exception ex) { throw new YourExceptionClass("message", ex); } </code></pre> <p>This will allow you to add your own logic, then throw your own exception class. The StackTrace of the YourExceptionClass instance will be from within this co...
gprof and arguments to executable <p>when using gprof:</p> <pre><code>$ gprof options [executable-file [profile-data-files...]] [&gt; outfile] </code></pre> <p>if you have options to pass to the executable like:</p> <pre><code>gprof a.out --varfred=32 </code></pre> <p>then gprof assumes that I am passing an invalid...
<p>You don't run your executable with gprof, so you only specify it so gprof can load symbols. You run the executable first, on its own just as normal, and it then emits profiling data. </p> <p>This data is loaded, along with the executable, by gprof later.</p> <p>This is all explained in the <a href="https://sourcew...
RMI interface design principles <p>Im currently working on an RMI client that will talk to an RMI server (developed by a different division of the company I work for). The other team own the interface, but IMO it's overly complex, with many different types being passed backwards and forwards, as well as an unnecessaril...
<p>First of all, I would say that the problem you described pertains not only to RMI but to any kind of interface of a component, including plain Java interface, although in case of RMI a bad design may have additional caveats, e.g. performance.</p> <p>Not knowing the details, I can only guess by looking at my experie...
How do I get the server endpoint in a running flex application? <p>I need a way of getting the active server address, port, and context during runtime from my flex application. Since we are using ant for our build process, the server connection information is dynamically specified in our build properties file, and the...
<p>We use an Application subclass that offers the following methods :</p> <pre><code> /** * The URI of the AMF channel endpoint. &lt;br/&gt; * Default to #rootURI + #channelEndPointContext + #this.channelEndPointPathInfo */ public function get channelEndPointURI() : String { return this.rootServerURI + ( t...
How to generate a modular directory structure with Zend_Tool? <p>The only examples I've seen of generating a Zend Framework project with Zend_Tool create this directory structure:</p> <p>/application/controllers <br> /application/models <br> /application/views</p> <p>Does Zend_Tool have the ability to generate a <str...
<p>You should probably ask this question on the Zend Framework development mailing lists. <code>Zend_Tool</code> is available only in the ZF 1.8 Preview Release currently, and it is still under active development. Large pieces of the documentation for <code>Zend_Tool</code> are still unwritten.</p> <p>You can also a...
How does a hash table work? <p>I'm looking for an explanation of how a hashtable works - in plain English for a simpleton like me! </p> <p>For example, I know it takes the key, calculates the hash (I am looking for an explanation how) and then performs some kind of modulo to work out where it lies in the array where t...
<p>Here's an explanation in layman's terms.</p> <p>Let's assume you want to fill up a library of books and not just stuff them in there, but you want to be able to easily find them again when you need them.</p> <p>So, you decide that if the person that wants to read a book knows the title of the book and the exact ti...
StringTemplate ListDictionary Iteration <p>I'm trying to iterate over a ListDictionary (C# StringTemplate) in a template and have each list item invoke another template:</p> <pre><code>DataDefAssign(cols) ::= &lt;&lt; &lt;cols.keys: { k | &lt;PropDef(name=&lt;k&gt;, type=&lt;cols.(k)&gt;) }&gt; &gt;&gt; </code></pre> ...
<p>I had a syntax issue. The iteration should be:</p> <pre><code>&lt;cols.keys: { k | &lt;PropDef(name=k, type=cols.(k))&gt; }&gt; </code></pre> <p>Thanks to micha-1@fantasymail.de for pointing this out on the StringTemplate list.</p>
SQL: 3 self-joins and then join them together <p>I have 2 tables to join in a specific way. I think my query is right, but not sure. </p> <pre><code>select t1.userID, t3.Answer Unit, t5.Answer Demo FROM table1 t1 inner join (select * from table2) t3 ON t1.userID = t3.userID inner join (select ...
<pre><code>SELECT du.userID, unit.answer, demo.answer FROM ( SELECT DISTINCT userID FROM table1 WHERE date &gt; '1/1/2009' ) du LEFT JOIN table2 unit ON (userID, question, counter) IN ( SELECT du.userID, 'Unit', MAX(counter) FROM table2 ...
How do you "decode" Visual Studio Link Errors? <p>I'm not very experienced in C++, and when I have to work with another library and I get link errors, I'm completely in the dark on what the compiler is trying to tell me (other than it can't find something reference somewhere).</p> <p>Are there any good links that desc...
<p>The symbols are the "mangled" versions of the function names. Basically because of c++ overloading (2 functions with different signatures can have the same name). The signature information is encoded into the name.</p> <p>The message you pasted has <strong>both</strong> the encoded and plain text versions.</p> <pr...
Which is the fastest way to access native code from Java? <p>Which is the fastest way of calling a native library from Java?</p> <p>The ones I know about are</p> <ul> <li><a href="http://johannburkard.de/software/nativecall/" rel="nofollow">NativeCall</a> - what we're currently using</li> <li><a href="http://jna.java...
<p><a href="http://www.swig.org/">Swig</a> makes JNI easier too. </p> <p>In terms of speed, I suspect there will be subtle variations - I strongly suggest you pick a call that you know you'll be making a lot, and benchmark all of the solutions offered.</p>
Is it possible to extract information from an excel file into c# on a computer without excel installed? <p>Is it possible to extract information from an excel file (.xls) into c# on a computer <strong>without excel</strong> installed?</p> <p>I've got the following code: </p> <pre><code> OleDbConnection objConn =...
<p>Check out the open-source <a href="http://nexcel.sourceforge.net/">NExcel</a>. Last updated about 2 years ago, so it doesn't have support for the newer Excel 2007 .xlsx format, but will read Excel 07-Excel 2003.</p>
C# How to set the autopostback property when using asp.net mvc? <p>I am using asp.net MVC framework. On my page i have a dropdwonbox and when an option is clicked i want to go to another page. But i can't find how/where to set the autopostback property to true. This is the code i'm using:</p> <p>Aspx:</p> <pre><code>...
<p>You can use the onchange client event:</p> <pre><code>&lt;%= Html.DropDownList("qchap", new SelectList( (IEnumerable)ViewData["qchap"], "Id", "Title" ), new { onchange = "this.form.submit();" }) %&gt; </code></pre>
How do I loop through all layers of Treeview nodes? <p><strong><em>Read EDIT 2 first</em></strong></p> <p>I am trying to set up some way to visually distinguish the nodes in a winform app. For example, alternating colors.</p> <p>Can some one start me down that path? Also, has anyone else had to do that before and h...
<p>Recursion?</p> <p><strong>Edit: added code for eliminating color repetition</strong></p> <pre><code>protected void ColorNodes(TreeNode root, Color firstColor, Color secondColor) { Color nextColor; foreach (TreeNode childNode in root.Nodes) { nextColor = childNode.ForeColor = childNode.Index % 2...
'Application.Restart' not working in ClickOnce deployed application <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/95098/why-is-application-restart-not-reliable">Why is Application.Restart() not reliable?</a> </p> </blockquote> <p>I pulled <a href="http://ms...
<p>Is your application <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow">Windows Forms</a> or <a href="http://en.wikipedia.org/wiki/Windows_Presentation_Foundation" rel="nofollow">WPF</a>? Because <code>Application.Restart</code> only exists in the Windows Forms <code>Application</code> object (<a hre...
ifstream object.eof() not working <p>I think i might need to use a boolean bValue = false for my while condition:</p> <pre><code>char cArray[ 100 ] = ""; ifstream object; cout &lt;&lt; "Enter full path name: "; cin.getline( cArray, 100 ); if ( !object ) return -1 // Path is not valid? This statement executes why? i...
<p>Please will you and everyone else note that the correct way to read a text file does NOT require the use of the eof(), good(), bad() or indifferent() functions (OK, I made the last one up). The same is true in C (with fgets(), feof() et al). Basically, these flags will only be set AFTER you have attempted to read so...
primary filegroup full <p>I discovered an error in a log file while troubleshooting another issue on our SQL 2000 server. I am seeing primary filegroup is full. The MDF and LDF files are in the default location on the system partition, on an NTFS drive. The MDF file is 1962MB in size. Some posts have indicated that...
<p>The 2GB database size limit only applies to MSDE (the free, "desktop" version of SQL 2000). Other SQL 2000 version don't have that limitation.</p> <p>There is no "magic" way to purge or archive old, historical data. You have to know your database and its structure, your customer requirements, and your data retentio...
How do you set the heights of cells in a table that expands to fill the window in IE? <p>I am trying to construct a simple, one-column layout. I want the top two rows to have smaller, fixed heights. The third row should expand to fill the rest of the page. Here is my current source:</p> <pre><code>&lt;!DOCTYPE HTML PU...
<p><a href="http://apptools.com/examples/tableheight.php" rel="nofollow">Here is an article</a> for you that tells you how this can be done. I just tested the example that they provided in IE 6 and it works.</p> <p>It appears that you must use the height property of the table, and NOT do it via a style attribute.</p>...
Alternatives to server controls in MVC <p>What is the replacement for a server control in ASP.NET MVC? What I want to do is to create a declarative and imperative binding so I can write</p> <pre><code>&lt;cc1:MyControl Header="Some Header" Content="Some Content" /&gt; </code></pre> <p>which would mean that an instanc...
<p>You can still use <strong>all controls</strong> in ASP.NET MVC if they don't require rendering in a server form.</p> <p><code>ascx</code> files and <code>@Register</code> directives still work pretty well. The great new thing is <code>Html.RenderPartial</code> method that lets you pass a model object to a partial v...
How do I set up a route for the home page of an ASP.NET MVC site? <p>I'm working with an ASP.NET MVC site which will use a CMS controller for all pages of the site except for the home page. Here's the idea:</p> <p><strong>Home controller:</strong></p> <ul> <li>www.site.com</li> <li>www.site.com/default.aspx</li> </ul...
<p>www.site.com can be handled by an root map route</p> <pre><code>routes.MapRoute( "Root", "", new { controller = "Home", action = "Index", id = "" } ); </code></pre> <p>Put the following in page load of Default.aspx</p> <pre><code>HttpContext.Current.RewritePath(Request.ApplicationPath, false); IHttpHa...
Convert byte array to .wav java <p>I have a web service that returns an array of bytes and my intention is to convert said array to a .wav in the client (a handheld such as Blackberry). However I really have no idea of how to do that, I tried just making an FileOutputStream but of course that wouldn't play. So I am onc...
<p>So, there are LOTS of .WAV formats, here's some documentation:</p> <ul> <li><a href="http://en.wikipedia.org/wiki/WAV" rel="nofollow">http://en.wikipedia.org/wiki/WAV</a></li> <li><a href="http://ccrma.stanford.edu/courses/422/projects/WaveFormat/" rel="nofollow">http://ccrma.stanford.edu/courses/422/projects/WaveF...
Regular Expression to Find/Replace in a Fix Length File <p>So I have this big file of fix length lines. I want to do a find and replace on a character line position.</p> <p>Example:</p> <pre><code>xxxxxxx 010109 xxxxxx xxxxx xxxxxxx 010309 xxxxxx xxxxx xxxxxxx 021506 xxxxxx xxxxx xxxxxxx 041187 xxxxxx...
<p><strong>Edited: after testing, Notepad++ doesn't support the {n} method of defining an exact number of chars</strong></p> <p>This works, tested on your data:</p> <p>Find:</p> <pre><code>^(............)...... </code></pre> <p>Replace:</p> <pre><code>\1010107 </code></pre>
What's easiest way to get Python script output on the web? <p>I have a python script that runs continuously. It outputs 2 lines of info every 30 seconds. I'd like to be able to view this output on the web. In particular, I'd like the site to auto-update (add the new output at the top of the page/site every 30 second...
<p>This question appears to have two things in it.</p> <ol> <li><p>Presentation on the web. This is easy to do in Python -- use Django or TurboGears or any Python-based web framework.</p></li> <li><p>Refresh of the web page to show new data. This can be done two ways.</p> <ul> <li><p>Some fancy Javascript to refres...
Sharepoint controls in ASP.NET application <p>Is there a way I can use the sharepoint controls in a ASP.NET web application like any other controls that come out of box for ASP.NET? If yes, what are the pre-requisites I need to install?</p> <p>Thank you, Harsha</p>
<p>Yes, you can use SharePoint "controls" in an ASP.NET application, as long as the application is running in SharePoint.</p> <p>In other words, the prerequisite is SharePoint.</p>
Is the name IsFemale inappropriate for a database column? <p>Just browsing our db schema and found a field named 'IsFemale'</p> <p>Is the name good, or is it kinda laughable?</p>
<p>You should stick with the <a href="http://en.wikipedia.org/wiki/ISO%5F5218" rel="nofollow">ISO standard</a> if at all possible.</p>
Can someone explain the following javascript code? <p>In addition to the explanation, what does the $ mean in javascript? Here is the code:</p> <pre><code>var ZebraTable = { bgcolor: '', classname: '', stripe: function(el) { if (!$(el)) return; var rows = $(el).getElementsByTagName('tr'); for (...
<blockquote> <p>Can someone explain the following javascript code?</p> </blockquote> <pre><code>//Shorthand for document.getElementById function $(id) { return document.getElementById(id); } var ZebraTable = { bgcolor: '', classname: '', stripe: function(el) { //if the el cannot be found, re...
Using a UUID as a Database Primary Key, Java type is a byte[] <p>Are there any issues with using a byte[] as a primary key in a JPA Entity?</p> <p>I want to use a UUID as my primary key, but stored as a string I feel it will be too large. </p> <p>I was thinking of doing something like this to store the ID as a byte[]...
<p>I don't think there are going to be issues with this other than a little bit of performance penalty for having a Primary Key larger than a usual 4 bytes (int) one.</p> <p>Why do you need a UUID as your primary key? Why can't you just use a surrogated integer key with a autoincrement?</p>
Rails associations with the same models <p>I have two classes with the following associations:</p> <pre><code>class Incident has_one :assignee has_one :technician class User has_many :incidents </code></pre> <p>Note that the assignee and technician fields refer to objects of type User. How should these relati...
<p>Presumably the Incident should belong_to an assignee and technician, because the foreign key holding those relationships would be in the incidents table, not the employees table</p> <pre> class Incident belongs_to :assignee, :class_name => 'User' belongs_to :technician, :class_name => 'User' class User has_...
How do I override page load lifecycle in ASP.NET to prevent ASPX form from loading? <p>I need to test a condition in several ASPX code-behind files and, in some cases, would like to completely bypass the normal page load process so that the corresponding ASPX page is not loaded. Intead, I'd like to send a custom respo...
<p>Probably the easiest way to do it - use <code>Page_Load()</code>.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { bool customResponse = true; if (customResponse) { Response.Write("I am sending a custom response"); Response.End(); //this is what keeps it from continu...
EJB and FLEX <p>I'm working on a new application using EJB3 -> BlazeDS -> Flex. I can't find good example to see how to integrate EJB with BLAZEDS. Can someone give me some pointers on how to link them together.</p>
<p>You need the <a href="http://www.adobe.com/cfusion/exchange/index.cfm?event=extensionDetail&amp;extid=1089970" rel="nofollow">EJB and Flex Integration v1.1</a>.</p> <p>It can be used with BlazeDS or LCDS and supports remote and local EJBs.</p>
CSS selector for targeting only immediate children and not other identical descendants <p>I have nested sortable list that can have items dynamically added or removed and can be nested n-levels deep. On nesting, a new ul element is injected into whatever li element is selected to be the parent. The initial state of the...
<pre><code>ul &gt; li </code></pre> <p>only does the immediate children. So, for example, to do only the top level list elements you could use:</p> <pre><code>#parent &gt; li </code></pre> <p><strong>Note:</strong> this isn't supported on IE6.</p> <p>The common workaround for backwards compatibility is to do someth...
how to iterate in reverse over a map in c++ <p>I'm having trouble iterating in reverse over a map in gcc c++. When I use a reverse iterator, it seems I can't assign anything to it - the compiler complains. I'm working around it with some awkward code using a forward iterator, but it's not very elegant. Any thoughts? <...
<p>Here's an example of iterating backward through a <code>std::map</code>:</p> <pre><code>#include &lt;iostream&gt; #include &lt;map&gt; #include &lt;string&gt; int main() { std::map&lt;std::string, std::string&gt; m; m["a"] = "1"; m["b"] = "2"; m["c"] = "3"; for (auto iter = m.rbegin(); iter !=...
Serving static files with mod_wsgi and Django <p>I have a django application using mod_python, fairly typical configuration except that media files are being served by a (I know, not recommended) 'media' directory in the document root. I would like to test and maybe deploy with mod_wsgi but I cannot figure out how to ...
<p>I run a a dozen or so Django sites on the same server and here's how I configure the media URL's.</p> <p>Each VirtualHost has the following configuration:</p> <pre><code>Alias /media /path/to/media/ &lt;Directory /path/to/media&gt; Include /etc/apache2/vhosts.d/media.include &lt;/Directory&gt; </code></pre> <...
Documentation not visible in Javadoc <p>I have the following function:</p> <pre><code>/** * @param parent ... * @param key ... * @param isRed ... * ... */ public redBlackNode(redBlackNode parent, int key, boolean isRed) { ... } </code></pre> <p>I can't see it (or anything else that I documented) in my ...
<p>Try running javadoc with the -verbose flag. Maybe there is an error or warning occurring that you're not seeing.</p>
Using "Microsoft Chart Controls for .NET Framework", how to set a bubble's diameter in a dynamically generated bubble chart? <p>m_chart.Series("TestSeries").ChartType = SeriesChartType.Bubble m_chart.Series("TestSeries").MarkerStyle = MarkerStyle.Circle</p> <p>m_chart.Series("Default").Points. ...</p> <p>at this poin...
<p>That's the second Y-value on the bubble chart:</p> <pre><code>m_chart.Series("TestSeries").Points.Add(x, y, diameter) </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/dd456658.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/dd456658.aspx</a></p>
Advanced JavaScript data store & grid widget <p>We have written a data store / grid widget system in JavaScript that automatically updates all widgets associated with a data store whenever some of the data changes. </p> <p>Its nice features are:</p> <ol><li>it supports <b>sorting by multiple attributes</b> (for examp...
<p>Ext is well-designed and complete, it is one of the few libraries designed to do the majority of what you want. I would recommend simply enhancing what is there in Ext. </p> <p>Multi-column has already been done:</p> <p><a href="http://www.extjs.com/forum/showthread.php?t=48324" rel="nofollow">http://www.extjs.com...
javascript event for "Find In Page" event? <p>I know how to listen for keystrokes CTRL+F, alerting me that the user has probably asked to bring up the "find in page" search option in their browser. </p> <p>Is there a way to listen for when the user has brought up the "find in page" search option using the browser men...
<p>That isn't part of the normal JavaScript implementation. JS lives in a sandbox, which means it is totally unaware of anything beyond the scope of the DOM except when the browser chooses to grace it with a bit of information. Opening the find dialog/bar is not one of those.</p> <p>Going in that direction would start...
How do I share MenuItems between a ContextMenu and a ToolStripMenuItem? <p>I have a context menu attached to a panel, that should mirror commands available in a toolbar menu.</p> <p>Currently in my <code>MouseUp</code> event, I set the <code>enabled</code> state of the <code>MenuItem</code>s, and add them to the conte...
<p>I don't think you can have the same object in both the toolstrip and context menu, but they can both call the same function in their OnClick event.</p>
Table design <p>I was wondering is this a good design, assuming the tables as follows</p> <pre><code>ADDRESS(id, address, city_fk, stateFK, countryFK), CITY(id, name, stateFK, countryFK), STATE(id, name, countryFK), COUNTRY(id, name) </code></pre> <p>Notice how country fk is repeated in 3 tables? and state fk repeate...
<p>You want something more like this:</p> <ul> <li>ADDRESS(id, address, city_fk)</li> <li>CITY(id, name, state_fk)</li> <li>STATE(id, name, country_fk)</li> <li>COUNTRY(id, name)</li> </ul> <p>And if it was me, i'd rename the fields a bit:</p> <ul> <li>ADDRESS(id, address, city_id)</li> <li>CITY(id, city, state_id)<...
Updating text from textfield from one scene to other <p>I am having a problem in placing data(textField text) from one scene to another scene. I'm attaching my source code with this mail. Please help me if anything wrong in my code.</p> <pre><code>// // PlayerSettingsAppDelegate.m // PlayerSettings // // // #...
<p>not entirely sure, but I believe the</p> <pre><code>label = [Label labelWithString:@"result" fontName:@"Helvetica" fontSize:20.0]; </code></pre> <p>Should read</p> <pre><code>label = [Label labelWithString:result fontName:@"Helvetica" fontSize:20.0]; </code></pre>
Any good cfml Shopping Cart app? <p>Any good cfml Shopping Cart app? Tried using one? What's your experience with it?</p>
<p>There are few carts listed in <a href="http://www.carehart.org/cf411/#ecm" rel="nofollow">Arehart's list</a>. Haven't tried any, so can't give advices.</p>
In ruby, how do I attempt a block of code but move on after n seconds? <p>I have a library method that occasionally hangs on a network connection, and there's no timeout mechanism.</p> <p>What's the easiest way to add my own? Basically, I'm trying to keep my code from getting indefinitely stuck.</p>
<p>Answered my own question:</p> <p><a href="http://www.ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html" rel="nofollow">http://www.ruby-doc.org/stdlib/libdoc/timeout/rdoc/index.html</a></p> <p>require 'timeout' status = Timeout::timeout(5) { # Something that should be interrupted if it takes too much time......
restful_authentication applied to only an action within a controller? <p>I have installed and implemented the plugin restful_authentication from technoweenie.</p> <p>My application is, for the most part, intended to be open, except for the case of say, writing a review.</p> <p>So I have a reviews_controller.rb, but t...
<p>Include the AuthenticatedSystem module in the controller you need it for (or ApplicationController if you need it for more than one), and then use the before_filter applied only to the actions you want, e.g.:</p> <pre><code>class VendorsController &lt; ApplicationController include AuthenticatedSystem before_fi...
What are scenarios in which one would use Sinatra or Merb? <p>I am learning Rails and have very little idea about Sinatra &amp; Merb. I was wondering are the situations where you would use Merb/Sinatra.</p> <p>Thanks for your feedback!</p>
<p>Sinatra is a much smaller, lighter weight framework than Rails. It is used if you want to get something up running quickly that just dispatches off of a few URLs and returns some simple content. Take a look at the <a href="http://www.sinatrarb.com/">Sinatra home page</a>; that is all you need to get a "Hello, World"...
Please confirm that this XMPP code is not threadsafe <p>I'm reading the source code to the Smack api and the the method XMPPConnection#<em>disconnect</em> looks like this:</p> <pre><code>public void disconnect(Presence unavailablePresence) { // If not connected, ignore this request. if (packetReader == null ||...
<p>Looks like it's a <a href="http://www.igniterealtime.org/issues/browse/SMACK-230" rel="nofollow">known bug</a>.</p>