input
stringlengths
51
42.3k
output
stringlengths
18
55k
How should I parse a fixed length record file in Ruby? <p>I was wondering if anyone had any advice on parsing a file with fixed length records in Ruby. The file has several sections, each section has a header, <em>n</em> data elements and a footer. For example (This is total nonsense - but has roughly similar content)...
<p>There are a number of ways to do this. The <a href="http://ruby-doc.org/core/classes/String.html#M000760"><code>unpack</code> method of <code>string</code></a> could be used to define a pattern of fields as follows :-</p> <pre><code>"209231-231992395 MoreData".unpack('aa5A1A9a4Z*') </code></pre> <p>This returns...
What exactly does database normalization do? <p>New to database and so no to get upset with simple questions. As far as my googled and gathered knowledge normalization reduces redundancy of data and increase the performance. But really, I didn't understand what exact reason for dividing the master table into other smal...
<p>The main reason is to eliminate repetition of data, so for example if you had a user with multiple addresses and you stored this information in a single table the user information would be duplicated along with each address entry. Normalisation would seperate the addresses into their own table and then link the two ...
UNIX wrapper in PHP <p>For a simple web application, I'd like to be able to take advantage of several UNIX features that are stable, have a long history, and are well proven in production, rather than having to write my own code. Take users, for example. Rather than having an entire user, group, permission infrastructu...
<p>It's really not a good idea to fumble around with the user and permission settings <strong>of the actual system that is hosting your site</strong>. If you want to protect individual directories of your site, you're better off using <code>.htaccess</code> files. If OTOH you're working with virtual URLs, you'll have a...
Approximate cost of iPhone app? <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/209170/how-much-does-it-cost-to-develop-an-iphone-application">How much does it cost to develop an iPhone application?</a> </p> </blockquote> <p>What would be the approximate cost...
<p>Depends on various Factors . I am a 16 year old iOS app developer and develop apps for free for my school and my dads company etc ...</p> <p>But if you dont know anything about developing it could cost you +$100,000 to get a custom made app </p>
Haskell cabal+hsc2hs <p>Can cabal use hsc2hs to create hs files? How?</p> <p>I didn't find an answer in the manuals, googling, nor in other projects (had my hopes up for gtk2hs but it turns out that it doesn't use cabal)</p>
<p>Yes, cabal understands that when you list module Foo in your .cabal file, and it finds Foo.hsc on disk, that it must run hsc2hs on the module first.</p> <p>Cabal transparently handles the existence of .hsc files.</p>
What is the benefit of splitting aggregator and parent projects? <p>I've read that it's supposedly a good idea to split an aggregator project (the one with all the module declarations) from the parent/dependency project (the one with all the shared or common dependencies). So that the parent project is not the one you ...
<p>In a large environment you may want to have parents that define common behaviour for classes of projects (e.g. a servlet parent, a portlet parent, a war parent etc). Because there is no multiple inheritance in Maven, you either have to have a gigantic parent POM with all this content in and some complicated profile ...
Is there a newer version than Xcode 3.1.2? <p>For some reason the Interface Builder of Xcode 3.1.2 has graphical bugs. It draws its interface badly and messes up everything. It's a graphics problem on a brand new MacBook Pro. Two months ago that was not the case. But Xcode doesn't offer me an update-function, does it?<...
<p>you are on the latest version and i noticed that too no auto update either.</p> <p>i would just try re-downloading and reinstalling </p>
Is there any free network drive/share benchmark tool for Windows? <p>I want to know if there is any free tool to test the performance of a smb/CIFS network share. All free speed test I saw were for local drives only.</p>
<p>There certainly is, it is called iPerf and it works pretty well. Only used the windows version on NT shares but there is a linux version too and you can test speed between one installed on the client (windows) and another installed on Linux (server)</p> <p>Get it <a href="http://sourceforge.net/projects/iperf/" rel...
Can MVC run on 3.5 IIS6? NON SP1 <p>I was lead to believe that MVC apps were BIN-deployable, so could be deployed to any ASP.net 3.5 compatible server. I'm trying to deploy to a Windows Server 2003 x64 with 3.5 (no SP1) and am having trouble getting it working.</p> <p>I get the following when hitting the homepage, whi...
<p>IIS 6 does not handle .mvc extensions correctly. Among other things you have to map .mvc to the ASP.NET handler. Here is a walkthrough for you: <a href="http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough.aspx" rel="nofollow">http://haacked.com/archive/2008/11/26/asp.net-mvc-on-iis-6-walkthrough...
How would you encode a Map<String, Object> using Protocol Buffers? <p>I'm trying to use <a href="http://www.google.de/url?sa=t&amp;source=web&amp;ct=res&amp;cd=1&amp;url=http%3A%2F%2Fcode.google.com%2Fp%2Fprotobuf%2F&amp;ei=jrBVStaVC5vcmgO9m93dCQ&amp;usg=AFQjCNEH5XQOuk2HkPhnqqJRXpNgRAOWdQ&amp;sig2=UttuiLusS0zx5cbmEYa76...
<p>I'd model a tuple with a key and a value (probably one value field per type that the value could be). Then just have a repeated list of that tuple type. You'd need to build the map itself in code.</p> <p>When you say you can't specify the types - what sort of types are you talking about? If you have an optional fie...
Why isn't speech recognition advancing? <p>What's so difficult about the subject that algorithm designers are having a hard time tackling it?</p> <p>Is it really that complex?</p> <p>I'm having a hard time grasping why this topic is so problematic. Can anyone give me an example as to why this is the case?</p>
<p>Auditory processing is a very complex task. Human evolution has produced a system so good that we don't realize how good it is. If three persons are talking to you at the same time you will be able to focus in one signal and discard the others, even if they are louder. Noise is very well discarded too. In fact, if y...
Unit testing javascript in visual studio 2008 <p>I want to start unit testing my javascript files as part of my build process in an MVC application I am building using jquery and jqueryUI.</p> <p>I know how to use qunit and jsunit but I want to try and get VS to run these tests and integrate the results into my build ...
<p>Take a lookt at <a href="http://blog.bluewire-technologies.com/2008/01/30/jsunit-msbuild-task/">JSUnit MSBuild task</a>. I'm sure there's something similar for qunit, JSSpec, etc.</p>
Fixed keyboard inside a UIView <p>Is there a way to include a keyboard inside of a view? I want it to be part of the view and not be dismissed as well.</p> <p>Birdfeedapp does this in it's 'add account' modal view.</p>
<p>Simply just add this code to your view. This will show the keyboard:</p> <pre><code>-(void) viewDidAppear:(BOOL)animated{ [super viewDidAppear:animated]; [YOURTEXTVIEW becomeFirstResponder]; } </code></pre>
How to query a subproperty with NHibernate's criteria api? <p>I would like to make a query which needs to compare an property's property with some value. For example:</p> <pre><code>... WHERE Identity.Location.Room = "room #1" </code></pre> <p>How can I achieve this with criteria api?</p> <p>Best Regards<br />Oliver...
<p>This will perform a query by joining your tables:</p> <pre><code>var criteria = session.CreateCriteria(typeof(Identity)) .CreateAlias("Location", "l") .Add(Restrictions.Eq("l.Room", "room #1")); </code></pre>
Escaping quotes in a string in VB6 <p>I am trying to make some small changes to an old VB web app I need to add quotes inside of a string I've had no luck so far. The string is </p> <pre><code>Dim sql As String = "Select * from Usertask Where UserId = " &amp; Session("UserId") &amp; " and JobID=" &amp; ddlReqTask.Se...
<p>You can use <code>""</code> to insert a quote into a string e.g:</p> <p><code>dim sometext as String = "Hello ""Frank"" how are you?"</code></p> <p>Which gives you </p> <p>Hello "Frank" how are you?</p>
How to play a mp3 file from within the Resources folder of my application? <p>I am making an app that will play sound on events but I can't figure out how to access files from the ressources folder of the Application. </p> <p>Here is what I'm doing : </p> <pre><code>NSSound *player = [[NSSound alloc] initWithContent...
<p>You need to use the <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/nsbundle%5FClass/Reference/Reference.html#//apple%5Fref/occ/instm/NSBundle/pathForResource:ofType:"><code>NSBundle</code></a> class with the <code>pathForResource:ofType:</code> method to reference the file:</p> ...
The way to check the javascript injections <p>Is it enough to avoid javascript injection validating input data in such way:</p> <pre><code>xssValidate = function(value) { var container = $("&lt;u&gt;&lt;/u&gt;").text(value); if($(container).html() != value) return mc.ERROR_INVALID_FORMAT; } </code></pre> <p>I...
<p>I think that's going to be very annoying for your users... what if I want to type "this &amp; that" or "11 > 7"?</p> <p>What you should be doing really is escaping it when you output it.</p> <p>Additionally, I hope you're validating on the server as well as the client side.</p>
What size chunks should I copy files in? <p>Our .NET app copies large files, and needs to give the user feedback; so rather than use <code>File.Copy</code> we read a chunk of one file and write it to the other, and display the progress after each chunk. Nothing out of the ordinary. But what's the right size of chunk ...
<p>A very large buffer will give you the best transfer speed but a coarse feedback. So it's a trade-off and it also depends very much on the hardware. </p> <p>I did something like this a while back and settled on a 64k buffer, but you might want to experiment a little.</p> <p>And whatever you pick, make sure it's a m...
Return number of rows affected by UPDATE statements <p>How can I get the number of rows affected by an UPDATE query in a Stored Procedure (SQL Server 2005), as a resultset. e.g.</p> <pre><code>CREATE PROCEDURE UpdateTables AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with S...
<pre><code>CREATE PROCEDURE UpdateTables AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; DECLARE @RowCount1 INTEGER DECLARE @RowCount2 INTEGER DECLARE @RowCount3 INTEGER DECLARE @RowCount4 INTEGER UPDATE Table1 Se...
Flash Run-Time performance testing <p>Lee Brimelow got me thinking about my Flash Application CPU and Memory consumption in his blog. So I'm thinking if there is a good (non task manager) tool for performance testing?</p>
<p>you can measure your FPS if you want ... you can put your FPS to the max your system allows ... and then watch the framerate drop as you run your app ... it's at leas an indicator ... :)</p> <p>you can use <code>flash.system::System.totalMemory</code> to have the memory used ...</p> <p>also, you should have a look...
Array which Pages to Disk <p>Does anyone know of a .NET array class/library which will page its contents out to disk? </p> <p>The idea is to be able to use it as a normal array but the class uses less RAM (to avoid getting out-of-memory exceptions with more than 2GB of data). Ideally the class will implement one of:</...
<p>I haven't come across anything like that, but I guess that's because it's rarely needed. After all, a database table (in SQL Server or any other database) is in essence a disk-based array.</p> <p>You could write an IList&lt;> wrapper around a database table. Throw in some caching and you have a perfect disk-based a...
Which .NET 2.0 development pattern (MVP, MVC, etc) would best lend itself to allowing easy re-use when we transition to WPF and MVVM? <p>We're looking at patterns such as MVP that can help make us seperate UI from logic from data. The initiative is late in the game, but is an effort to begin to set rules that we need ...
<p>The MVP pattern will give you that logical separation, but mostly I believe that MVP`s strength lies in writing testable code. </p> <p>I would recommend reading Uncle Bob`s (Robert C Martin ) book called Agile Principles, Patterns and practices.</p> <p>Also I believe that you don`t necessarily need to use a patter...
Best practice: multiple entities to single entity <p>This is a very hard to explain question and I hope my code extract explains most of it.</p> <p>Let's say you have the following database design: <img src="http://img190.yfrog.com/img190/2080/musicstylerelations.jpg" alt="musicstyle relations" /></p> <p>And you want...
<p>Assuming that id represents the member's id, you could create 3 separate functions to handle each type, thus separating your concerns more than they are now.</p> <p>Example:</p> <pre><code>[AcceptVerbs(HttpVerbs.Post)] public JsonResult DeleteMusicStyleByMember(int id) { if (!(Session["MemberLoggedIn"] is Memb...
How do I in JDBC read a possibly null double value from resultSet? <p>I have a column in my database that is typed <code>double</code> and I want to read the value from it using a JDBC ResultSet, but it may be null. What is the best way of doing this? I can think of three options none of which seem very good.</p> <p>O...
<p>Option 1 is closest:</p> <pre><code>double d = rs.getDouble(1); if (rs.wasNull()) { // do something } else { // use d } </code></pre> <p>It's not very nice, but that's JDBC. If the column was null, the double value is considered "bad", so you should check using <code>wasNull()</code> every time you read a prim...
SQL calculate difference between cell values <p>Hi i was wondering if anyone knows how i can calculate the difference between two tables in tsql. I dont mean finding which cells are different - i mean calulcating the numerical difference. eg - Table A has column1, column 2 and only one 1 row. A1 = 40, B1 = 30. Table B ...
<p>Given that you have no way to join the tables, you'll need a Cartesian product of the two. Luckily since each table only has one record that's not a problem.</p> <p>You do it like this:</p> <pre><code>SELECT TableA.A1 - TableB.A1 AS A1, TableA.B1 - TableB.B1 AS B1 FROM TableA, TableB </code></pre> <p>If you ...
SOAP::RPC::Driver formatting problems. How can I change it? <p>I'm dealing with a SOAP webservice call from a server that is expecting to receive method calls with the paramaters in the format of:</p> <pre><code>&lt;urn:offeringId&gt; 354 &lt;/urn:offeringId&gt; </code></pre> <p>But SOAP::RPC::Driver is generating me...
<p>Okay, what I ended up doing was using SOAP:RPC:Drivers add_document_method, which requires me to give it the wsdl, namespace, etc, and then give it the attributes later as a single input hash thingy (and gives me the output in a similar format). It worked, it just wasn't as clean as add_rpc_method (which is waht add...
Entity Framework Query Xml <p>How would you build up this query with Entity Framework :</p> <pre><code>SELECT * FROM TreeNodes WHERE data.value('(/edumatic/assessmentItem/@type)[1]', 'nvarchar(max)') like 'multiplechoice1' </code></pre> <p>data column is XML. Apparently this is converted to a string by the Enti...
<p>Neither of the Entity Framework's query languages (LINQ to Entities and eSQL) directly support nested XML queries. So you are not going to be able to do this sort of thing. Unless you run the XML query after a call to <code>AsEnumerable()</code>, which of course is somewhat undesirable from a performance perspective...
Suggestions for setting up a subversion repository <p>Our team is just ramping up to use source control through SVN. We are currently using some test repositories for getting used to the process.</p> <p>We're nearly ready to put this into full time use. </p> <p>We build only small to medum/large web apps, most of whi...
<p>I think a single repository (backed up, of course) with individual project directories below it should suffice:</p> <pre><code>/usr/share/code_repository /base /trunk /branches /tags /project1 /trunk /branches /tags /project2 /trunk /branches /tags ....
ClearCase and Eclipse: How to hide/ignore files? <p>I'm working with Eclipse and ClearCase and we're facing the problem that there's no "ignore"-feature in ClearCase and we're having regularly checked-in files that shouldn't have been checked in. </p> <p>In Eclipse, I already found the "Ignored Resources" configuratio...
<p>Within eclipse itself, the current ClearCase plugin cannot specify files to ignores, and they will always show up with a native <code>ls -private</code> command as private files.</p> <p>Only a dedicated GUI (like <strong>CCRC</strong> -- ClearCase Remote Client -- used as Rich Client Platform based on eclipse) has ...
Bash Script -- logname validation <p>How do I validate that the LOGNAME is present in a bash script</p> <pre><code>if [`logname`]; then echo -e \\t "-- Logname : `logname`" &gt;&gt; $normal_output_filename fi </code></pre> <p>The above gives me an error line 76: [logname]: command not found</p>
<p>Maybe try:</p> <pre><code>if [ -e /bin/logname ]; then LOGNAME=`logname` echo -e \\t "-- Logname : ${LOGNAME}" &gt;&gt; $normal_output_filename fi </code></pre> <p>Actually, instead of using backtics it's better to use command substitution, namely:</p> <pre><code>LOGNAME=$(logname) </code></pre> <p>Using...
Embed FontDialog in another WinForms Dialog <p>I would like to embed the FontDialog control into a settings dialog box for my C# WinForms application, but if I drag the control over it, of course, just adds it to the list of Dialog controls at the bottom of the designer. But instead of opening a separate dialog, I wou...
<p>It's a long shot, but have a look a <a href="http://writer.live.com/" rel="nofollow">Windows Live Writer</a>. It's a free app from Microsoft that's written in managed code. It has an "insert picture" dialog that embeds the OpenFileDialog onto another WinForms dialog.</p> <p>You can use reflector to see how they did...
Which should be the first responder: my view or UIDatePicker? <p>I'm creating sibling of <code>UITextField</code>, but with <code>UIDatePicker</code> instead of a keyboard. </p> <p>I want multiple such controls to play nicely with each other and also standard <code>UITextField</code> (i.e. swap keyboard for date picke...
<p>Override the resignFirstResponder method in your class, write your hide-UIDatePicker code in it, after checking the instance is the category of your sibling class.</p>
How do I remove characters from an NSString? <p>I want to strip a Unicode character (\u0097) from NSString....</p>
<p>This is simplest to remove \u0097:</p> <pre><code>NSString * deGremlinedString = [theString stringByReplacingOccurrencesOfString:@"\u0097" withString:@""]; </code></pre> <p>The docs for that method <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSString%5FClass/Reference/NSStr...
Upload a potentially huge textfile to a plain WSGI-server in Python <p>I need to upload a potentially huge plain-text file to a very simple wsgi-app without eating up all available memory on the server. How do I accomplish that? I want to use standard python modules and avoid third-party modules if possible.</p>
<p>wsgi.input should be a file like stream object. You can read from that in blocks, and write those blocks directly to disk. That shouldn't use up any significant memory.</p> <p>Or maybe I misunderstood the question?</p>
How do you find out what controller and action you are in? <p>How does one find out which controller or which action they are in from an erb template in Rails?</p>
<pre><code>&lt;%= controller_name %&gt; &lt;%= action_name %&gt; </code></pre>
Java HashMap get works but containsKey does not <p>I am trying to locate a key in a HashMap. I can print the selected key by using 'get' but when I use 'containsKey' in an if statement, it is not found.</p> <p>I KNOW the key is present in the Map but it keeps returning false. Any ideas people?</p> <p>My code:</p> ...
<p>You must ensure that the <code>Location</code> class has properly implemented its <code>hashCode()</code> and <code>equals(Object)</code> methods (<a href="http://java.sun.com/javase/6/docs/api/java/lang/Object.html">documentation</a>). That is, if two <code>Location</code> objects are effectively equal, they should...
Microsoft Access SQL Date Comparison <p>I am using Access 2007.</p> <p>I need to return rows with a date/time field falling within a date range to be specified in query parameters.</p> <p>The following doesn't error out, but doesn't appear to work.</p> <pre><code>SELECT FIELDS FROM FOO WHERE (FOO.CREATED_DTG BETWEEN...
<p>Is BLAH the name of a field or a table? As you SELECT BLAH I imagine it names a field, but then <code>BLAH.CREATED_DTG</code> makes no sense -- do you mean <code>FOO.CREATED_DTG</code> perchance?</p>
itextsharp - the name rtfwriter does not exist in the current context <p>I'm trying to convert XML docs into rtf documents. I can successfully perform xml to pdf conversions, but whenever I attempt to use <code>RtfWriter.GetInstance</code> or <code>RtfHeaderFooters</code> I get the following error message:</p> <pre>...
<p>I ran into the same problem. You should use:</p> <pre><code>RtfWriter2 rtfWriter = RtfWriter2.GetInstance(...); </code></pre>
Java: Multiple threads vs. sockets <p>I've written a simple application in Java where there are two nodes, each with a ServerSocket open to a port listening for incoming connections. The nodes run two threads each, sending 1000 messages to the other node through a persistent TCP socket created when sending the first me...
<p><code>SendMsg()</code> is creating a new socket every call, so you aren't using a persistent TCP connection. The method isn't closing the socket, either, so you have a lot of open collections. You may be reaching a limit to the number of connections the process can make (the sockets may not be closed when the object...
Concerns about releasing a project as Open Source <p><strong>Community Wiki</strong></p> <p>I've been working on a fairly large project <a href="http://www.wikipediamaze.com" rel="nofollow">www.wikipediamaze.com</a> and I initially intended for it to be open source, but as I get closer and closer to "done" I'm getting...
<p>Michael,</p> <p>In my opinion these are the reasons that you might open source a project:</p> <ol> <li>The project is a light version. You offer the pro version for a fee on your site. </li> <li>The project can be used as a library in someone else project. You want to show good will towards other developers.<...
apache xampp gzip <p>I am trying to get the GZIP module working in XAMPP window vista 64 bit. I have added the .dll file for gzip into the module directory and added in httpconf. Once I add it say it cannot start apache since it cannot find the ApacheGZIP module in the directory that is mentioned in httpconf file...(w...
<p>You can try uncommenting the following in /xampp/apache/conf/httpd.conf:</p> <pre><code>LoadModule deflate_module modules/mod_deflate.so </code></pre> <p>You should already have mod_deflate.so enabled if you are using XAMPP. XAMPPLite, however, has that disabled.</p>
Tutorials for iPhone Web Dev <p>I was wondering if any one knows of some good tutorials for iPhone web development. Specifically, for optimizing a website for viewing in MobileSafari</p>
<p>The Apple Developer Center has some good stuff, start here: </p> <p><a href="http://developer.apple.com/safari/library/referencelibrary/GettingStarted/GS_iPhoneWebApp/index.html" rel="nofollow">http://developer.apple.com/safari/library/referencelibrary/GettingStarted/GS_iPhoneWebApp/index.html</a></p>
TMenuItem-Shortcuts overwrite Shortcuts from Controls (TMemo) <p>What can I do that shortcuts for menu items don't overwrite those from local controls? Imagine this simple app in the screenshot. It has one "undo" menu item with the shortcut CTRL+Z (Strg+Z in German) assigned to it. When I edit some text in the memo an...
<p>The VCL is designed to give menu item shortcuts precedence. You can, however, write your item click handler (or action execute handler) to do some special handling when ActiveControl is TCustomEdit (call Undo, etc.)</p> <p>Edit: I understand you don't like handling all possible special cases in many places in your ...
Thread Safe Control - Crashing VS 2008 <p>I am working on creating a thread safe control for my windows forms application.</p> <p>I understand I can set the text on a control thread safe by using the following code:</p> <pre><code>private delegate void SetTextD(Control control, string value); private static void Set...
<p>Try a</p> <pre><code>return base.Text; </code></pre> <p>or you will run into a endless loop (when you add the Label to your Form the Text-property is queried - and the endless loop makes VS crash). Same for your setter.</p>
How to run query, automate using VBA Macro and Excel, make "loading" feature while reconciling? <p>I am building a reconciliation tool via VBA that automates queries from my oracle database and a worksheet. When I run the query I want the user to input what ITEM (in this case pipeline) to query (the worksheet has many ...
<p>Since you changed your questions, I'll add another answer.</p> <p><strong>1) It is querying - if the value is NULL, how may I tell it to print out "DATA NOT AVAILABLE"</strong></p> <p>Which value? I suspect that you mean when the query returns no records. To check this, test for rsObject.RecordCount = 0:</p> <pre...
How to store file on server ASP.net <p>Ok so I am trying to have error log file for the website running on ASP.net and C#.</p> <p>I tried storing to drive with regular path. Expecting it because it is in c# code (code behind page) it will pick up the server and store it there. (In the end it is a code that gets execut...
<p>You can log to any location on the web server (that the ASPNET user account has permission to write to) with code such as this:</p> <pre><code>string log = String.Empty; // format log string using error message try { using (StreamWriter logFile = new StreamWriter(@"C:\WebSite\logs.txt", true)) { l...
How can I append text to a databound field? <p>If I have this:</p> <pre><code>&lt;img ID="imgField" runat="server" ImageUrl='&lt;%# DataBinder.Eval(Container.DataItem,"Name") %&gt;' /&gt; </code></pre> <p>How can I add "images/" or any other string add on to the url?</p> <p>I tried</p> <pre><code>ImageUrl=' "images...
<pre><code>&lt;img ID="imgField" runat="server" ImageUrl='&lt;%# string.Format("images/{0}", DataBinder.Eval(Container.DataItem,"Name")) %&gt;' /&gt; </code></pre> <p>Or, if you want to shorten it up a bit...</p> <pre><code>&lt;img ID="imgField" runat="server" ImageUrl='&lt;%# string.Format("images/{0}", Eval("Name")...
Good open-source examples of using entity groups in App Engine? <p>I know all details about how entity groups work in GAE's storage, but yesterday (at the App Engine meetup in Palo Alto), as a presenter was explaining his use of entity groups, it struck me that I've never really made use of them in my own GAE apps, and...
<p>The main use of entity groups is to provide the means to update more than one entity in a transaction.</p> <p>If you haven't had to use them, count your blessings. Either you have been designing your data models such that no two entities ever need to be updated at the same time in order to remain consistent, or el...
Recursion in C with Pre increment <pre><code>int fact_rec(int n) { printf("%d\n",n); if(n==1) return n; else return fact_rec(--n)*n; //else return n*fact_rec(--n); gives same result //correct output comes for n*fact(n-1) } </code></pre> <p>In the above recursive implementation of the factorial func...
<pre><code>return fact_rec(--n)*n </code></pre> <p>is dangerous. The order of argument evaluation is undefined in C (except for <code>&amp;&amp;</code>, <code>||</code>, comma and ternary operators) so value for second occurrence of <code>n</code> could vary.</p> <p><strong>The rule of thumb:</strong> never use varia...
Can I create a file system accessible from CE 6.0 and my bootloader? <p>I have a CE 6.0 project on a PXA310 where I need to be able to download OS updates (nk.bin) via Wi-Fi and safely flash the new OS to my device. I'm open to other suggestions about how to do this, but I'm considering saving the nk.bin to my file sy...
<p>Technically just about anything is possible. For this strategy what you would need is code for your bootloader to mount the NAND flash as a drive and have a FAT driver so that it can traverse that file system and find the image. That is a lot of work if you don't already have it.</p> <p>THe other option is to jus...
Weblogic Bea 10.0 M1 and WorkManager <p>I have to execute long running threads in a WebLogic Bea 10.0 M1 server environment. I tried to use WorkManagers for this. Using an own WorkManager allows me to specify my own thread timeout (MaxThreadStuckTime) instead of adjusting the timeout for the whole business application....
<p>You need to remove the WorkManager refrence from your <strong>weblogic-ejb-jar.xml</strong>, this refenece should go to <strong>ejb-jar.xml</strong>.</p> <p>Infact I doubt if Weblogic schema definition "weblogic-ejb-jar.xsd" will allow you to add a reference element, you must be getting xsd validation errors.</p> ...
Necessary to pin_ptr on C++ CLR Value types, why? <p>Since .NET Value types (managed C++ structs) are stored on the Stack why is it (or, alternatively is it actually) necessary to pin_ptr them in order to pass a pointer to an unmanaged function?</p> <p>Eg. BYTE b[100];</p> <p>If I pass &amp;b to an unmanaged function...
<p>You are correct that <code>BYTE b[100];</code> is created on the native stack and therefore is not subject to managed heap moving, etc. However I believe your problem is a simple C++ mistake.</p> <p>You say,</p> <blockquote> <p>If I pass &amp;b to an unmanaged function without first pinning it, may the stack...
To EJB3 or not? <p>I have an architecture scenario and I would like to discuss to get your opinion. </p> <p>I can choose between these two (this is a constraint imposed on me)</p> <ol> <li>Use EJB3+JPA - no Spring/Hibernate</li> <li>POJO + JDBC - again no Spring/Hibernate</li> </ol> <p>I have series of web applicati...
<p>EJB and JPA are just interfaces; you'll still need someone to implement them. So if Spring+Hibernate aren't possible, then this means no JPA unless you can get an OK for another framework (... err ... Toplink, maybe? Is there <em>anything</em> which isn't Hibernate based?)</p> <p>If you're stuck with POJO and JDBC,...
Include ServiceDependancy if checkbox selected WIX <p>Is it possible to include a ServiceDependency based on whether a checkbox was selected in a WIX application?</p>
<p>Your check box control will likely set a property. You could then use a condition on a component to control if that component, which adds the service dependency, is installed.</p>
Page_Load not being called on re-navigation <p>I am having a strange problem. Here is the scenario</p> <p>Here are my files:</p> <ol> <li><strong>Project1.aspx</strong></li> <li><strong>Project2.aspx</strong></li> </ol> <p>They are set up the exact same, including their Page_Load functions:</p> <pre><code>Protecte...
<p>Try disabling output cache and see if the problem still occurs:</p> <pre><code>&lt;system.web&gt; &lt;caching&gt; &lt;outputCache enableOutputCache="false"/&gt; &lt;/caching&gt; &lt;system.web&gt; </code></pre>
Executing a FuncView within a Stored Procedure <p>I am trying to modify an exisiting SPROC in SQL 2000. The original SPROC used a FuncView as part of a a cursor. The new report does not require the cursor, but I am unsure how to execute the FuncView outside of the cursor statement. The first example below is the cur...
<p>WOW, cursors AND dynamic SQL; you're getting exposed to all kinds of bad habits, aren't you :) It's a good way to learn something, but it sucks when it comes to maintenance.</p> <p>It looks like your code needs to be adjusted thusly:</p> <pre><code>SELECT @FuncView_PlantConditionAssessmentMetrics = 'UPDATE #rs...
call pthread_cond_broadcast with mutex held or not? <p>With a pthread_cond_t we have to associate a mutex, When signalling the condition I've seen code such as</p> <pre><code>pthread_mutex_lock(&amp;mutex); //code that makes condition true pthread_cond_broadcast(&amp;cond); pthread_mutex_unlock(&amp;mutex); </code><...
<p>Depends what the sinks are doing (and any other sources).</p> <p>In your second code sample, it's possible that in between unlock and broadcast, a bunch of other threads will come along and do some combination of things which makes the condition false again. You'll then be broadcasting pointlessly. And you won't ne...
Sanity Check: Floats as primary keys? <p>I'm working with an old sql server 2000 database, mixing some of it's information with a new app I'm building. I noticed some of the primary keys in several of the tables are floats rather than any type of ints. They aren't foreign keys and are all unique. I can't think of any r...
<p>I worked with someone who used floats as PKs in SQL Server databases. He was worried about running out of numbers for identifiers if he stuck to INTs. (32 bit on SQL Server.) He just looked at the range of float and did not think about the fact never mind that for larger numbers the ones place is not held in the num...
Inheritance issue with ivar on the iPhone <p>I am using the BLIP/MYNetwork library to establish a basic tcp socket connection between the iPhone and my computer. So far, the code builds and runs correctly in simulator but deploying to device yields the following error:</p> <blockquote> <p>error: property 'delegate' ...
<p>It looks like TCPEndpoint has a private instance variable called "delegate", and since it's private, this subclass can't access it.</p> <p>If you need TCPConnection to have a distinct delegate object, then I would recommend the following (cutting out unnecessary stuff):</p> <pre><code>//TCPConnection.h @interface ...
Symfony "cannot fetch TableMap" error when using propel:build-all <pre><code>Cannot fetch TableMap for undefined table: order_product. Make sure you have the static MapBuilder registration code after your peer stub class definition. </code></pre> <p>Even if I erase the entire schema, clear the cache, and delete every...
<p>Turns out I had defined a class with the same name as one of the models. Whoops.</p>
How do I add an array as an Object Property to a class declared within a PHP extension? <p>I want my PHP extension to declare a class equivalent to the following PHP:</p> <pre><code>class MyClass { public $MyMemberArray; __construct() { $this-&gt;MyMemberArray = array(); } } </code></pre> <p>...
<p>The answer is to use <code>add_property_zval_ex()</code> in the constructor, rather than <code>zend_declare_property()</code>.</p> <p>The following works as intended:</p> <pre><code>PHP_METHOD(MyClass, __construct) { zval *myarray; zval *pThis; pThis = getThis(); MAKE_STD_ZVAL(myarray); arra...
Is there a way to draw colored text using the UIKit addition for NSString on the iPhone? <p>Is there a way to draw colored text using the UIKit addition for NSString on the iPhone?</p>
<p>Brad's solution adds quite a bit of code if you do not have a context handy (for example if you are doing this in a drawRect: method).</p> <p>The way to do it without CG is</p> <pre><code>[[UIColor redColor] set]; </code></pre> <p>or whatever colour you want.</p>
I am not able to use mouse while executing the selenium test cases <p>Hi I am executing the selenium test cases .if I dont touch the mouse manually while eecuting, the test case passes.if I move the mouse my Login process fails and all the testcases followed by are failing, Basically I should be in a position to work...
<ul> <li>Which OS and browser are you using?</li> <li>Can you show us a sample of your tests? </li> <li>Do you use any javascript tricks in your pages?</li> <li>Do you use any javascript tricks in your tests?</li> </ul>
How to use a Query in another DB as a Form's RecordSource? <p>I'm trying to split a database into two pieces -- a backend that updates automatically, and a front-end that allows searching and adding/editing comments. The data in the source database is pulled together from multiple tables into a pair of queries, and I ...
<p>Hope I'm understanding you correctly, but the most sensible solution would be to link the tables in the backend DB and copy the queries to the UI database. Those queries would still be able to access the uderlying tables (via the linked tables) without issues and would be accessible through normal means to your form...
Making Silverlight App plugin capable <p>I want to know about general methods to dynamically load content into your silverlight application. More specifically, I want to create something like a widget-based application, where all GUI objects are small independent widgets. I want to provide a static chrome, like a fram...
<p>You can dynamically load controls from dlls that your widget authors could provide, MS's <a href="http://www.silverlightshow.net/items/Silverlight-Dynamically-Loading-an-Assembly.aspx" rel="nofollow">Mike Taulty's done a walkthrough</a>.</p> <p>Microsoft also have <a href="http://www.microsoft.com/downloads/details...
Exceptions to page size when paging hierarchical data <p>I have a webpage that displays a very large list of data. Since this was bogging down the browser, I implemented paging (using a PagedDataSource) to display 20 Marbles at a time. </p> <p>My data model is such that a Bag contains multiple Marbles, and on my repea...
<p>You could handle some of it with your SQL query (assuming SQL Server 2005). If you introduce RANK as a result you could make a determination of how many rows each result takes up. Here's a sample query that could be within a sproc:</p> <pre><code>SELECT RANK() OVER (ORDER BY b.BagID) as RowNum, b.BagID, b.BagInfo...
Tools for regression testing / test automation of database centric java application? <p>I'm looking for a good, preferably free tool for automating tests of a java (EJB3) application without any kind of GUI.</p> <p>Tool should be capable of at least:</p> <ul> <li>Inserting / updating / deleting data on database</li> ...
<p>It sounds like you are looking for a combination of DBUnit and Cactus (the FTP stuff might require Commons-NET or Commons-VFS). Use ANT, with its scripting support, to get the reporting on the test results and the scripting.</p> <p>That hits the checklist. If you want to test those EJB's out of the container, there...
Working with data and a JTable? <p>I have a JTable that I want to use to display some data (a <code>String</code> and a <code>Boolean</code> in each row). The data is maintained by my own class. Is there some way to bind the data model to the JTable, so that when I add to the model, the JTable is dynamically updated an...
<p>You'll probably find both the <a href="http://java.sun.com/docs/books/tutorial/uiswing/components/table.html" rel="nofollow">Java JTable tutorial</a> and the <a href="http://java.sun.com/j2se/1.4.2/docs/api/javax/swing/JTable.html" rel="nofollow">JTable API documentation</a> helpful in understanding how JTable works...
Getting HTTP request from IE <p>Is there a way to access the http request IE made when the page is already loaded. For instance, I have an application that is opening a browser window. I want to scrape the page, but would like to get the entire http request for that page (not just the URL).</p> <p>I have downloaded th...
<p>There's a great utility called "<a href="http://www.fiddler2.com/fiddler2/" rel="nofollow">Fiddler</a>" that you can use.</p> <p>It is a web debugging proxy, so it'll act as a go-between for all your web requests.</p> <p>It's an awesome utility and has helped me many times with things like this.</p>
Exercises to enforce good practices such as TDD and Mocking <p>I'm looking for <strong>resources</strong> that provide an <strong>actual lesson plan or path</strong> to encourage and reinforce programming practices such as <strong>TDD</strong> and <strong>mocking</strong>. There are plenty of resources that show examp...
<p>It's a difficult thing to encourage because it can be perceived (quite fairly) as a sea-change; not so much a progression to a goal but an entirely different approach to things.</p> <p>The short-list of advice is:</p> <ul> <li><p>You need to be the leader, you need to become proficient before you can convince othe...
sharepoint file upload <p>I can upload a 250MB file to sharepoint 2007 but nothing larger. I have changed the two webconfig file, set the admin site to 2047MB and it still fails.</p> <p>Please help this was to be completed asap.</p> <p>thanx</p>
<p>SPS ignore the file size setting for max file size, according to various testings.</p> <p>Instead see KB 925083 for info on how to change size <a href="http://support.microsoft.com/kb/925083" rel="nofollow">http://support.microsoft.com/kb/925083</a></p>
Local static variables in Timer.Tick event (Stopping a Timer) <p>I have a timer on a page in ASP.NET.</p> <p>After a certain period of time elapses, I want to disable the timer.</p> <p>I want to put a static variable in the timers tick event that will track how many seconds have elapsed.</p> <p>My question is, will ...
<p>No, it won't work. <code>Static</code> in VB.Net is syntactic sugar that hides a hidden shared variable at the class level in a thread-safe way. Since a shared class variable would be, well, shared for <em>all</em> users of that page at once, this would not work at all how you hoped.</p> <p>Instead, store your da...
Is it better to call ToList() or ToArray() in LINQ queries? <p>I often run into the case where I want to eval a query right where I declare it. This is usually because I need to iterate over it multiple times <em>and</em> it is expensive to compute. For example:</p> <pre><code>string raw = "..."; var lines = (from l i...
<p>Unless you simply need an array to meet other constraints you should use <code>ToList</code>. In the majority of scenarios <code>ToArray</code> will allocate more memory than <code>ToList</code>. </p> <p>Both use arrays for storage, but <code>ToList</code> has a more flexible constraint. It needs the array to be...
How to make Notepad++ run script based on its name? <p>I want to make notepad++ run the "ruby {filename_here}" command if the current filename ends with .rb and "perl {filename_here}" if it ends with .pl. I've tried to use the NppExec plugin, but it can't do conditional stuff, so I wrote a bat</p> <pre><code>@echo of...
<p>You need to put the file name at the end of the command. In the Run(F5) dialog, try this:</p> <pre><code>runscript $(FULL_CURRENT_PATH)\$(FILE_NAME) </code></pre> <p>If you want to test it out, you could put a <code>&amp; pause</code> at the end, just to see if it worked.</p> <p>You could also tweak your script a...
Show pdf in Flex air <p>I went through a document at Adobe Livedocs that describes working with pdf: <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html" rel="nofollow">http://livedocs.adobe.com/flex/3/html/help.html?content=PDF_1.html</a></p> <p>But I'm stuck with it and can't get it to work....
<p>Adobe Air relies on the Adobe Reader browser plugin to render the PDF files. So a user of the AIR application will have to have Adobe Reader installed. This also means that any customization that might have been done by the user to the Adobe Reader interface will be reflected in their AIR app.</p> <p>This being sai...
serving xhtml + mathml to firefox and IE <p>Firefox requires xhtml extension for mathml but IE will not display pages with xhtml extension (it displays a download dialog box instead).</p> <p>I have tried apache content negotiation like so:</p> <pre><code>RewriteEngine on RewriteCond %{HTTP_USER_AGENT} .*MSIE.* Rewrit...
<p>It seems that this works:</p> <pre><code>&lt;ifmodule mod_rewrite.c&gt; RewriteEngine On RewriteCond %{HTTP_USER_AGENT} !.*MSIE.* RewriteRule \.html$ - [T=application/xhtml+xml] RewriteCond %{HTTP_USER_AGENT} .*MSIE.* RewriteRule \.html$ - [T=text/html] &lt;/ifmodule&gt; </code></pre> <p>If it weren't for intern...
Algorithm challenge: Generate color scheme from an image <h2>Background</h2> <p>So, I'm working on a fresh iteration of a web app. And, we've found that our users are obsessed with being lazy. Really lazy. In fact, the more work we do for them, the more they love the service. A portion of the existing app requires...
<ol> <li><p>To find the primary X colors, screencap the app. Run a color histogram on the image. The top X colors in the histogram are the theme. Edit: if gradients are used, you'll want to pick distinct "peaks" of colors; that is, you may have a whole bunch of colors right around "orange" if orange is one of the ma...
ASP.NET User control, databinding DataTable <p>I got a user control containing a form. On a page that includes the user control, I need to populate the form in the user control, when the user pushes a button.</p> <p>Heres how I've done it, and it doesn't work:</p> <p>User Control:</p> <pre><code>public partial class...
<p>User controls aren't meant to be as complex as this. They're meant to be a simple matter of pulling out some reusable portion of markup, then maybe adding a few properties, methods and events. They're not meant to do data binding. You really should rewrite tihs control as a composite server control.</p> <p>That sai...
Best way in Oracle to go from this data to this result <p>What is the best way in oracle to ge the following result set from a table like this:</p> <pre><code>GROUP ID VALUE -------------------- 1 1 A 1 2 B 1 3 C 2 4 D 2 5 E 3 6 F 4 7 G 4 8 ...
<p>Is there any problem that prevents you from doing:</p> <pre><code>SELECT t.ID, NVL((SELECT MAX(t2.ID) FROM Table t2 WHERE t.GROUP = t2.GROUP AND t2.ID &lt; t.ID), 0) AS Parent_ID , t.Value FROM TABLE t </code></pre> <p>May be you prefered a Connect By ...
How do you add textboxes to Oracle APEX reports? <p>I'm generating a matrix report in Oracle APEX. I've got the values displaying properly, but when I click the "Edit button", I want all the cells to turn into textboxes. I know that you can do this by changing some settings in the Report Attributes, but the problem is...
<p>I just decided to go with using a Tabular Form on a view that I created in the PL/SQL database. There are a few complications with dynamic data but I'm currently trying to get around that.</p>
How do you sanitize your data? <p>This is the function i currently use(from a php book i bought):</p> <pre><code>function escape($data) { return mysql_real_escape_string(trim($data), $this-&gt;linkid); } </code></pre> <p>But I feel like it could be safer. for example, maybe use htmlspecialchars. It always makes me ...
<p>You're talking about two different types of escaping.</p> <p><code>mysql_real_escape_string()</code> escapes data so it'll be safe to send to MySQL.</p> <p><code>htmlspecialchars()</code> escapes data so it'll be safe to send to something that renders HTML.</p> <p>Both work fine for their respective purposes, but...
How can I construct a family tree with Perl? <p>I have a programming assignment in Perl that requires me to do the following:</p> <ol> <li><p>Creates a table in a mySQL database, and inserts these records into it:</p></li> <li><p>Loads the data from the table into an array of instances of class Son.</p></li> <li><p>Us...
<p>While awaiting clarification as to what the question is, I figured seeing you're in some sort of learning institution getting given Perl related assignments, I reasoned there's no better time to introduce you to Moose and CPAN, things you really should be using in the real world. </p> <p>It, and its various extensi...
Is there an easy way to display playing cards in a WinForms app? <p>I am writing a quickie BlackJack Winforms app to demonstrate a couple of concepts. The engine itself is fairly simple, however, I'd like to display actual playing cards on the WinForm.</p> <p>Is there a library out there that I can use (preferably fr...
<p>Not sure how good this is, but a quick search found <a href="http://playingcards.codeplex.com/" rel="nofollow">PlayingCards</a> on codeplex. It looks like you might be able to pull out the PlayingCardsLibrary project and use that. Or modify it as needed.</p>
nothing happens after building an OpenCV project <p>I'm using OpenCV for the first time (Windows, Eclipse), after installing and configuring Eclipse using this manual:</p> <p><a href="http://tommy.chheng.com/development/windows%5Fdevelopment%5Fsetup.html" rel="nofollow">http://tommy.chheng.com/development/windows_deve...
<p>Are you sure that &lt;...>\OpenCV\bin has been permanently added to the system PATH? It requires a restart of windows.</p>
What all APIs are affected by {$IOCHECKS OFF}? <p>We have some ancient Delphi code (might have even originated as Turbo Pascal code) that uses <code>{$I-}</code>, aka <code>{$</code><a href="http://www.delphibasics.co.uk/RTL.asp?Name=%24IOChecks" rel="nofollow"><code>IOCHECKS</code></a><code> OFF}</code>, which makes ...
<p>Since <code>$I</code> is a compiler directive, it can only affect compiler-generated code, and it can only affect code that actually gets compiled.</p> <p>For those two reasons, it <em>cannot</em> affect things like <code>TFileStream</code>. It's a class in <em>Classes.pas</em>, which is a unit you don't compile. A...
How to display HTML <FORM> as inline element? <p>This is probably a basic html/css question...</p> <p>I have a simple one-button form that I would like to display inline inside paragraph text.</p> <pre><code>&lt;p&gt;Read this sentence &lt;form style='display:inline;'&gt; &lt;input style='display:inline;' ...
<p>Move your form tag just outside the paragraph and set margins / padding to zero:</p> <pre><code>&lt;form style="margin: 0; padding: 0;"&gt; &lt;p&gt; Read this sentence &lt;input style="display: inline;" type="submit" value="or push this button" /&gt; &lt;/p&gt; &lt;/form&gt; </code></pre>
Compiling code using gcc and SciTE? <p>I'm trying to compile C/C++ code from an external source using SciTE. The SciTE has a built-in feature where it searches for the gcc compiler and libraries in the same folder. The problem occurs if I try to compile from SciTE externally. Compiling with <kbd>F5</kbd> (compile and r...
<p>I used MinGW as an external source to compile in C and C++ code in scite.</p> <p>If you do not have MinGW you can <strong>get MinGW here</strong>: <a href="http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/" rel="nofollow">http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/</a><...
Get Keyboard input c++ outside of terminal <p>I am trying to write a c++ program that responds to keyboard input. I want to run this as a daemon so I can't use cin, I would also like to output each character as it is pressed to a picoLCD screen that I have set up. What is the best way to do this?</p>
<p>If the application is running in the background as a daemon, you can use the common Windows approach of a "keyboard hook". This is performed much differently on Linux though and there are various methods you may want to look into.</p> <p>It is discussed a bit in this SO question: <a href="http://stackoverflow.com/q...
Find functions explicitly defined in a module (python) <p>Ok I know you can use the dir() method to list everything in a module, but is there any way to see only the functions that are defined in that module? For example, assume my module looks like this:</p> <pre><code>from datetime import date, datetime def test()...
<p>Are you looking for something like this?</p> <pre><code>import sys, inspect def is_mod_function(mod, func): return inspect.isfunction(func) and inspect.getmodule(func) == mod def list_functions(mod): return [func.__name__ for func in mod.__dict__.itervalues() if is_mod_function(mod, func)] ...
Objective C - Making UILabel update as user types text in UITextField <p>How would I make a UILabel update as a user enters text in a UITextField. In my case, I have a quadratic equation solver for the iPhone and as the user enters the values of a b &amp; c, I want a UILabel to update with the numbers given by the user...
<pre><code>[textField addTarget:self action:@selector(textFieldDidChange:) forControlEvents:UIControlEventEditingChanged]; </code></pre> <p>Then your textFieldDidChange method is just something like:</p> <pre><code>self.quadLabel.text = self.quadInput.text; </code></pre>
New alternative to the Gof design pattern book for uml MDD with C++ <p>I am using lately a tool i.e. Rhapsody for MDD with C++ and I have difficulties on coding the classes by beginning with the uml diagram. Simultaneously I am trying to integrate some of the Gof book examples in the UML diagram and somehow it confuses...
<p><a href="http://oreilly.com/catalog/9780596007126/" rel="nofollow"><strong>Head First Design Patterns</strong></a> is the book that I first used to learn design patterns. It is definitely a lot easier to start learning design patterns with that the GoF book. After I understood it the GoF book wasn't that difficult t...
Need help on iphone crash log. Any experts around? <p>my iphone app crashes unexpectedly and looking at the crash log I can't tell where my code is doing something wrong. All I get in the stack are calls to the framework it's self.</p> <p>Any help? please! </p> <p>this is the link to the crash log (rather than copy p...
<p>Looks like you're crashing at <code>mach_msg_trap</code>, the function that handles Objective-C message passing. This is often a sign that you're doing one of two things:</p> <ol> <li>You have a memory management issue somewhere - you're trying to call a selector on an object that's already been released, you're ov...
Add commandline arguments to service installer c# <p>I am working on an application which starts as a service but only if a commandline switch tells it to (otherwise a standard form is opened). So when the service is started by Windows at bootup, it must pass this commandline option or the service fails to start.</p> ...
<p>When I've added command-line options to services, I've always defaulted to running as a service. However, I know that the opposite is possible because it's how SvcHost works: it's an EXE that's always configured to load DLL's as services.</p>
Cygwin GDB gives error 193 when trying to start program <p>When I attempt to debug a simple program with gdb on cygwin I get the following:</p> <pre><code>C:\Users\Benoit St-Pierre\workspace_cpp\cs454&gt;gdb a.exe GNU gdb 6.8.0.20080328-cvs (cygwin-special) Copyright (C) 2008 Free Software Foundation, Inc. License GPL...
<p>The problem is that you have space character in your path name. Move the file to a different directory and gdb will be able to start the process.</p>
Sequel + Sinatra + Phusion Passenger + MySQL Connection Management <p>We are using Sinatra and Sequel for a small API implementation. The problem we have however is that on every page request Sequel opens new connections to MySQL, and keeps them open till they timeout, or you restart Apache.</p> <p>There's not a lot o...
<p>I wrapped the Sequel stuff in a tiny wrapper and reuse this wrapper, like this:</p> <pre><code>get '/api/:call' do @@api ||= SApi.new @@api.call(params[:call]) end class SApi def initialize connect end def connect @con = Sequel.connect("...") end def call(x) #handle call using @con end ...
change images using jQuery? <p>I'm trying to make an image change depending on the list-item you hover on.</p> <p>I have a container containing an ul. I have three list-items (a small horizontal navigation). The list items are sitting on the bottom of the container which leaves an empty space on top of the li's. I wan...
<p>HTML:</p> <pre><code>&lt;div id="container"&gt; &lt;img id="yourImg" src="spacer.gif" width="..." height="..."&gt; &lt;ul id="yourUL"&gt; &lt;li data-imageswap="someimg.png"&gt;One&lt;/li&gt; &lt;li data-imageswap="another.png"&gt;Two&lt;/li&gt; &lt;li data-imageswap="andathird.png"&...
Making Commits to a Local copy of an SVN repository <p>I've checked out a copy of a project hosted on google code. I'm going to be making changes to it, and I'd like to keep these under version control on a repository on my local machine.</p> <p>I'd like to use svn if possible, because I already know the very basics o...
<p>I've been very happy using svn against a remote repository + using mercurial or git as a local repository on top of the svn repo.</p> <p>They're both distributed source control tools, and I like them both for slightly different reasons.</p> <p>I've found it to be very powerful to use my own local repo that coincid...
Project wide "Remove and Sort Usings" <p>Has anyone written a macro that will remove and sort your usings in an entire project? I would like to accomplish this without any third part add-in like ReSharper.</p>
<p>If you will consider using a <em>Microsoft</em> add-in, you'll find that the <a href="http://code.msdn.microsoft.com/PowerCommands" rel="nofollow">Power Commands</a> utility will do this for a project or solution.</p> <p>Updated: I knew I had a bit of code that did something like this, I found it and and here it is...
Allow unregistered customers to place orders in Microsoft Commerce Server 2002 <p>What is the best way of implementing a checkout process that allows customers to place orders without first requiring registration on the site, and without requiring that users create an account during the checkout process.</p> <p>I was ...
<p>Well the easiest way to do this is to create an account for the user as they checkout. You can generate a password for them to comply with the existing model, and depending on how you want to handle these users you could also flag the record as a "temp" user. You can then remove these users as time expires. These ap...
GWT and Key object <p>I'm writing Java app using GWT on Google AppEngine. So I have JDO Entities on Server side and POJO DTOs on Client's side. For some of my entities I have to use Key objects for ids Pojo's cannot have that object because that is not standard class. is there any easy work around for this so I can use...
<p>You can use the Key class in GWT code by adding these additional jar files: </p> <p><a href="http://www.resmarksystems.com/code/" rel="nofollow">http://www.resmarksystems.com/code/</a></p> <ul> <li>appengine-utils-client-1.0.jar</li> <li>appengine-utils-server-1.0.jar</li> </ul> <p>This basically gives the GWT co...