input
stringlengths
51
42.3k
output
stringlengths
18
55k
server side paging with jQgrid <p>I just took a look at <a href="http://www.trirand.com/jqgrid/jqgrid.html" rel="nofollow">jqgrid</a>. Has anyone tried implementing this plugin, or used jQuery, to achieve server side pagination?</p> <p>I am using struts2 and populating a html table with list returned from DB. This l...
<p>I've successfully used <a href="http://www.datatables.net/" rel="nofollow">http://www.datatables.net/</a> - a jQuery plugin that does server-side data and pagination.</p> <p>Here's a basic implementation of datatables (version 1.5 beta 3) that uses server-side paging: <a href="http://artlung.com/temp/comics/" rel="...
Why won't the Auth Component username & password login automagic work as expected in CakePHP? <p>I am trying to build the login registration page for my website, I am facing problems with he Auth Component,</p> <pre><code>function beforeFilter() { $this-&gt;Auth-&gt;loginAction = array('controller'=&gt;'users','ac...
<p>From the CakePHP cookbook:</p> <blockquote> <p>By default, the AuthComponent expects you to have a table called 'users' with fields called 'username' and 'password' to be used.</p> </blockquote> <p>I wonder if the automagic will work if you're using <code>email</code> as the field name?</p> <p>Try adding this t...
UIImagePickerController in iPhone OS 3.0 <p>I am using iPhone OS 3.0 SDK. My requirement is that I want to get the image from the photo albums library and display it on an image view. I am using the <code>UIImagePickerController</code> for that.</p> <p>But the problem is the <code>- (void)imagePickerController:(UIIma...
<p>use this delegate method of UIImagePickerController in your implementation file.</p> <pre><code>-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info { [picker dismissModalViewControllerAnimated:YES]; imageView.image = [info objectForKey:@"UIImageP...
Access denied error ( Visual Studio and WatiN ) <p>I'm using the WatiN testing tool with Visual Studio 2005. When I try to select a value from my list box I am getting an "access denied" error.</p>
<p>I have seen this a lot with select lists recently when using the WatiN 2.0 beta. Instead of using the aSelectList.Select(strText) option, it seems to work better when you do this:</p> <pre><code>ie.SelectList(Find.ById("MySelect")).Option(Find.ByText("Option 1")).Select(); </code></pre> <p>This can also happen whe...
Load Jpg/Gif/Bitmap and convert to Bitmap <p>I have to load an image from an XML file. There is no information in the XML file about whether the image is JPG/GIF/BMP. After loading the image, I need to convert it to Bitmap.</p> <p>Does anyone have any clue how to convert images to Bitmap without knowing the actual fil...
<p>Delphi 2009 comes with built in support for JPEG, BMP, GIF and PNG.</p> <p>For earlier versions of Delphi you may need to find third party implementations for PNG and GIF, but in Delphi 2009 you simply add the <code>Jpeg</code>, <code>pngimage</code> and <code>GIFImg</code> units to your uses clause.</p> <p>If the...
Linq to SQL : How do I get the property values from a query's results? <p>I m just starting with microsoft (MVC,C#, LINQ), so far so good, but i have a question about LINQ uses, How do i get the value form a LINQ like this one?</p> <pre><code> var x = from a in db.tablex where a.eventID ...
<p>Ok guys here was the thing, (it wasnt the typo it was just in the post), i was missing a using :</p> <pre><code>using System.Reflection; </code></pre> <p>with this C# automatically creates a class from them, and now it works</p> <p>What a noob of me =).</p>
Discovering which CSS rule is responsible for the format of any element <p>I want to click / look at on an html element and find out which css rule is responsible for which format property.</p> <p>i.e. I want to know the font's come from body{ } the color from h { } and the padding from #headercontainer </p> <p>Is ...
<p>It's right here in firebug:</p> <p><a href="http://i.imgur.com/O3LuKW2.png" rel="nofollow"><img src="http://i.imgur.com/O3LuKW2l.jpg" alt="firebug"></a></p> <p>The built-in tools basically offer the same feature now:</p> <p><a href="http://i.imgur.com/pxBdQ8M.png" rel="nofollow"><img src="http://i.imgur.com/pxBdQ...
Getting nonsensical results from SQL query <p>I've encountered a very, very strange situation in my application. I say strange because the errors are <strong>intermitent</strong> and I cannot find out why they occur.</p> <p>I've pass a sqlcommand to the DB (Sql 2005) trying to get a bigint (column ID_Facultate) from a...
<p>From your code I could only think of getting the value using the field name.</p> <pre><code>rd["ID_Facultate"].ToString() </code></pre> <p>Although your code seems correct, I always prefer using field names to get the values instead of index position, that can be easily changed in a number of situations. Some of t...
set active accordion in Jquery <p>I am using MVC with C# also with jquery.</p> <p>I am using an jquery accordion to see the list of employee details. On clicking an accordion it'll show the employee details.</p> <p>When I click Edit of an Employee, it takes to the Employee details page and after save it'll have the E...
<p>When you're editing your employee data I expect you're returning the user back to the correct page in your employee list.</p> <p>On that assumption when your are looping through your list of employees you can check your _employee.EmployeeDetailsID value against the session variable and then write the Loop itteratio...
What is NHibernate? <p>As a followup to my <a href="http://stackoverflow.com/questions/959161/is-making-a-dll-compatible-to-all-database-is-good-idea">previous question</a>. I am an ASP.NET Programmer, and am wondering how NHibernate would help me get my job done easier and more quickly than it would otherwise. Prete...
<p>NHibernate is an ORM, or Object-Relational Mapper. In the same line as LINQ to SQL, Entity Framework, LLBLGen, and others, ORM tools remove most of the need to write stored procedures to handle common data access (CRUD) for your business objects. ORM tools require that you create (either manually or with a visual de...
how to reload or refresh a view in iphone? <p>i have a uitableviewcontroller here is the .h file code</p> <pre><code>@interface addToFavourites : UITableViewController { } @end </code></pre> <p>and here is the .m file code</p> <pre><code>#import "addToFavourites.h" @implementation addToFavourites - (id)initWith...
<p><code>addToFavouritesobj.tableView</code> will give you access to the <code>UITableView</code> object.</p> <pre><code>[addToFavouritesobj.tableView reloadData] </code></pre> <p><hr /></p> <p>BTW: class names should start with capital letter. A better name for your class would be <code>AddToFavouritesController</c...
Safest way to remove unwanted whitespace <p>I have this HTML string which often has a lot of whitespaces</p> <p>Example:</p> <pre><code>&lt;p&gt;All these words &lt;br /&gt; &lt;strong&gt;All&lt;/strong&gt; &lt;em&gt;these&lt;/em&gt; words &lt;pre&gt; All these words&lt;/pre&gt; &lt;/p&gt; </code></pre>...
<p>You can't do this with regular expressions and it's as simple as that.</p> <p>Regular expressions are a poor choice for this kind of thing. <code>&lt;pre&gt;</code> blocks can contain other tags and so forth. Also what about CSS (either inline or with classes) that uses the <code>white-space: pre</code> property?</...
Performing an ASP.NET database search with StartsWith keyword <p>I have a query. I am developing a site that has a search engine. The search engine is the main function. It is a business directory site.</p> <p>A present I have basic search sql that searches the database using the "LIKE" keyword.</p> <p>My client has ...
<p>how about this: <code>SELECT * FROM MyTable WHERE MyColumn LIKE 'PLU%'</code></p> <p><br>please note that the % sign is only on the right side of the string <br>example in MS SQL</p>
For two methods who need to call each other: how do I prevent an infinite loop? <p>I have two classes (A and B) which depend on each other in following sense:<br /> Each class has a method performing some action.<br /> The action of each class depends on an action of the other class.</p> <p>So, if the user calls actio...
<p>I would handle this by rethinking the logic. Circular dependencies are typically a sign that something is a little ... off. Without more insight into the exact problem I can't be more specific.</p>
MVC naming conventions for JSON actions <p>What naming convention is recommended when writing an MVC app that has both front-end and JSON paths to the required data?</p> <p>For example, let's say the user of your site has "Things". They should be able to go to a page to view their things, but we also need a way to pu...
<p>Arguably the path names could all be the same. You can examine the Accept header for the mime-type of your client's desired response, and then return an appropriate view based on what you find there:</p> <ul> <li>application/json: JSON View </li> <li>text/xml: XML View </li> <li>text/plain, text/html: JSP View</li...
Reporting tool for Excel <p>We are developing a Asp.net 3.5 web application for a rather strict environment. We need to generate reports and <em>export them to Excel</em>. </p> <p>Please suggest some tool which we don't need to install into GAC. Because to install anything into GAC we have to go through many hurdles. ...
<p>Check out <a href="http://www.codeplex.com/ExcelPackage" rel="nofollow">http://www.codeplex.com/ExcelPackage</a></p> <p>It has some limitations, like no proper support for graphs, but you can get around that by predefining the graphs in a template file.</p>
How to implement a voice changer? <p>I want to write a app which change the microphone input voice and make it like robot or some funny man's voice.It must support send changed voice to all application like IM Software or Game Client. Which technology should I pick up? Windows WaveForm Api? DirectX? audio driver?</p> ...
<p>There's an MSDN <a href="http://blogs.msdn.com/coding4fun/archive/2009/02/02/9391048.aspx">Coding4Fun article</a> that explains how to create a voice changer that operates over Skype, in C# (.NET). The full source code is also hosted as a project on <a href="http://www.codeplex.com/skypefx">CodePlex</a>. In addition...
Generic way to detect if html form is edited <p>I have a tabbed html form. Upon navigating from one tab to the other, the current tab's data is persisted (on the DB) even if there is no change to the data.</p> <p>I would like to make the persistence call only if the form is edited. The form can contain any kind of con...
<p>In pure javascript, this would not be an easy task, but jQuery makes it very easy to do:</p> <pre><code>$("#myform :input").change(function() { $("#myform").data("changed",true); }); </code></pre> <p>Then before saving, you can check if it was changed:</p> <pre><code>if ($("#myform").data("changed")) { // s...
One callback for multiple json requests <p>I want to make X number of ajax requests in jQuery and add the json response to an array. When all the ajax requests are done, I would like to execute some code. Is there a good way to solve this?</p>
<p>I don't know any way other than counting the requests up and counting them back in manually in your code. Once they're all back and accounted for, execute your master callback.</p>
chunk_split in python <p>I'm trying to find a pythonic way to do this PHP code:</p> <pre><code>chunk_split(base64_encode($picture)); </code></pre> <p><a href="http://us2.php.net/chunk%5Fsplit" rel="nofollow">http://us2.php.net/chunk_split</a></p> <p>chunk_split split the string into smaller chunks of 76 character lo...
<p>This should do it:</p> <pre><code>str.encode("base64").replace("\n", "\r\n") </code></pre>
Row Col Transposition in SQL Server 2005/2000 <p>In SQL Server 2005, I have a table say tbl_Info. There I have one column say Info.</p> <p>The values are as under</p> <pre> Name1 Age1 Sex1 Name2 Age2 Sex2 ..... ..... .....</pre> And the row values goes on like this. My question is how to make row col transposition....
<p>The general idea is that you need another column to guarantee order -- that's typically going to be a primary key of some integer type, but to keep things simple say we just use:</p> <pre><code>CREATE TABLE foo (ord INT, col VARCHAR) </code></pre> <p>with <code>ord</code> just inserted as 0, 1, 2, etc.</p> <p>Now...
Custom Context Menu WITH selectable enabled in AS3 <p>I have a Label in AS3 that I want to be selectable (.selectable = true) AND I want the clipboardMenu to show up on right-click ALONG with custom menu items.</p> <p>If I do THIS:</p> <pre><code>var label:Label = new Label(); label.text = "test"; label.selectable = ...
<p>Try using UITextField insted of label:</p> <pre><code>var label:UITextField = new UITextField(); label.text = "test"; label.selectable = true; var contextMenu:ContextMenu = new ContextMenu(); contextMenu.clipboardMenu = true; contextMenu.clipboardItems.copy = true; contextMenu.clipboardItems.selectAll = true; cont...
fastest way to replace string in a template <p>I have some template string</p> <blockquote> <p>this is my {0} template {1} string</p> </blockquote> <p>which I plan to put user values in using <code>String.Format()</code>.</p> <p>The string actually is longer so for readability I use:</p> <blockquote> <p>this is...
<p>You can put the parameters in a dictionary and use the <code>Regex.Replace</code> method to replace all of the parameters in one replacement. That way the method scales well if the template string gets long or the number of parameters grows.</p> <p>Example:</p> <pre><code>Dictionary&lt;string, string&gt; parameter...
NoClassDefFoundError inside jar <p>I have a class that that sits in a package called com.toptur.sysTray all it does is load system tray it does not use any external packages. i create a SysTray object to install the system tray. Everthing builds fine. i can run the application from command line and systray gets install...
<p>The Class not Found Exception should mention the name of the class it is looking for.</p> <p>Since you have only the jar on the classpath it should be in the jar, but it isn't. Figure out why, possible reasons:</p> <ul> <li>the class file is not where it belongs when ant builds the package</li> <li>the directory s...
Singular Value Decomposition (SVD) in PHP <p>I would like to implement Singular Value Decomposition (SVD) in PHP. I know that there are several external libraries which could do this for me. But I have two questions concerning PHP, though: 1) Do you think it's possible and/or reasonable to code the SVD in PHP? 2) If (1...
<p>SVD-python Is a very clear, parsimonious implementation of the SVD. It's practically psuedocode and should be fairly easy to understand and compare/draw on for your php implementation, even if you don't know much python.</p> <p><a href="http://stitchpanorama.sourceforge.net/Python/svd.py">SVD-python</a></p> <p>T...
JQuery Widget Events in Object Orientated Javascript <p>I'm attempting to write a custom widget and I want to use existing UI widgets within the class that I'm writing. The problem is that when an event fires the class method that is invoked seems out of scope from the rest of the class, as any members I attempt to re...
<p>See <a href="http://www.alistapart.com/articles/getoutbindingsituations/" rel="nofollow">http://www.alistapart.com/articles/getoutbindingsituations/</a> for methods on binding <code>this</code>, using closures </p> <p>EDIT: As a concrete example of how this can be achieved...</p> <pre><code>$.extend(MyClass.proto...
Why do I get an error when I try to execute a query with parameters in postgreSQL? <p>The db is PostgreSQL. When I try to execute a query with parameters, such as this one</p> <pre><code>cursor.execute(""" SELECT u.username, up.description, ts_rank_cd(to_tsvector(coalesce(username,'')|| coalesce(descripti...
<p>ozgur,</p> <p>Try</p> <pre><code>to_tsquery(%s) </code></pre> <p>instead of</p> <pre><code>to_tsquery('%s') </code></pre>
Why does my SWT Shell always comes up in the background? <p>When I start my SWT Application from Eclipse, the Shell always starts up in the background, with the IDE in front of it. </p> <p>I tried everything, like setting the focus, activating the shell, etc. </p> <p>Did someone else experience the same behaviour and...
<p>When you activate a <a href="http://help.eclipse.org/stable/nftopic/org.eclipse.platform.doc.isv/reference/api/org/eclipse/swt/widgets/Shell.html" rel="nofollow">Shell</a> (usually via the <code>open()</code> method), SWT asks the window manager on your given platform to make the shell active. However, depending on...
How to calculate the inverse key matrix in Hill Cipher algorithm? <p>I am finding it very hard to understand the way the inverse of the matrix is calculated in the Hill Cipher algorithm. I get the idea of it all being done in modulo arithmetic, but somehow things are not adding up. I would really appreciate a simple ex...
<p>You must study the <a href="http://en.wikipedia.org/wiki/Linear_congruence_theorem" rel="nofollow">Linear congruence theorem</a> and the <a href="http://en.wikipedia.org/wiki/Extended_Euclidean_algorithm" rel="nofollow">extended GCD algorithm</a>, which belong to <a href="http://en.wikipedia.org/wiki/Number_theory" ...
SQL Server Job - The system cannot find the file specified <p>I am running a SQL Server Agent job which zips up my database backups. The application I run is a C# Windows Application which takes in the path of the database as an argument. When I run the application form a command prompt all works well. However when I r...
<p>The D: drive has to exist as a local drive, not a mapped drive. (Unless there's some way to force that to be mapped for other users who aren't logged on of which I am unaware)</p> <p>Also, as far as permissions, it could be just about anything related to the account that the agent is running under.</p> <p>You mig...
ASP.NET MVC Controller.OnException not being called <p>I have a base controller class where I'm overriding to the Controller.OnException handler method in order to provide a generic error handling for certain types of controllers that will inherit from this class (these are API controllers that will return JSON results...
<p>If I understand your question correctly - your Exception must be marked as "handled" in your OnException. Try this:</p> <pre><code>filterContext.ExceptionHandled = true; </code></pre>
connection of MATLAB 7.0 and MYSQL <p>I want to connect MATLAB with MYSQL.I dont know the procedure.In MATLAB help it says about some drivers which confuses me alot.Can someone please guide me!please tell me the complete process.I shall be very very thankful!!!</p>
<p>I use JDBC to connect from MATLAB to mySQL database. Works seamlessly.</p> <ul> <li>First download JDBC driver for mySQL from here: <a href="http://www.mysql.com/downloads/connector/j/" rel="nofollow">http://www.mysql.com/downloads/connector/j/</a></li> <li>Unpack mysql-connector-java-x.x.xx-bin.jar (the latest ver...
How to set Google App Engine java Content-Type to UTF-8 <p>It seems I cannot get UTF-8 encoding to be sent in the response headers. I tried using this to no avail:</p> <pre><code>resp.setHeader("Content-Encoding", "utf-8"); </code></pre> <p>Does anyone know when is this bug to be fixed or is <strong>there a workaroun...
<p>Per <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.5">the w3 reference</a>, <code>Content-Encoding</code> is for such things as gzip, deflate, compress -- <em>not</em> for "how is Unicode encoded in the body". What you need is e.g.</p> <pre><code>Content-Type: text/html; charset=utf-8 </code></...
Possible to adjust ClearType on Visual Studio 2010? <p>I just got VS 2010 beta 1, but the text in the text editor is thin, ie not anti aliased, smoothed or cleartyped. It's hard to read. Is there a setting to adjust it, similar to the one in the OS.</p>
<p>This is a known issue with the beta. See <a href="http://download.microsoft.com/download/7/A/0/7A023209-096F-4F7D-B2BC-831ECC68FF5B/VS2010Beta1Readme.htm" rel="nofollow">the readme</a>. Section 2.4.2.2 "Text may appear slighly blurry".</p> <p>They are working on a fix and recommend you stick with Consolas font for ...
Profiling Objective-C binary image size <p>I'm looking for tools and approaches to determining what parts of of my Cocoa and Cocoa-Touch programs are most contributing the the final binary image size, and ways to help reduce it. I'm not looking for a "magic bullet" compiler flag. I'm looking for profiling techniques fo...
<p>Apple has some awesome docs on <a href="http://developer.apple.com/documentation/Performance/Conceptual/CodeFootprint/">Code Size Performance Guidelines</a>, almost all of which applies to this question in some form. There are even tips for pedantic approaches like manually ordering symbols in the binary if desired....
How do you link .c and .h files of the same name? <p>I'm trying to figure this part of C out. I've read some tutorials given to me but I haven't found it yet.</p> <p>Trying to read libraries I see that there are .c and .h files of the same name. In the main sourcethe .h file is included but not the .c file. When I ...
<p>Typical <code>.h</code> files serve as a "table of contents" for the <code>.c</code> file, including such things as function prototypes, typedefs and the like. Programs include the <code>.h</code> so that they know about the functions and types.</p> <p>The <code>.c</code> files are compiled separately and product o...
Messaging platform <p>We're considering a messaging platform to integrate two core systems in a banking environment. We're looking at open source options. Which products have you used and can you share experiences?</p>
<p>If you're on Microsoft, I would start your search with MSMQ. I've used MSMQ at work quite a bit and never really had any serious problems with it. WCF has great support for MSMQ if you're using .NET.</p> <p>I've also used Apache ActiveMQ for Java JMS, and had mixed results. It has some really nice tools that com...
Pass a message to another exe from an exe C# <p>I have two exe running, c# console programs. From one, I need to tell the second exe to do something? How... ? I looked at</p> <p><code>(Remotable.CommonAssembly)Activator.GetObject(typeof(Remotable.CommonAssembly)</code> </p> <p>but from here i can call a method of the...
<p>For simple scenarios a plain old windows event would be enough - a program waits to be signaled to do something.</p> <p>Spawn a thread in the waiting program that waits for the event. </p> <pre><code>//Program 1 EventWaitHandle evt = OpenOrCreateEvent("Global\\MyEvent"); evt.WaitOne(); // this thread will block w...
Why when starting GWT in debug mode, my break points don't break <p>I am using Eclipse 3.4.2 with the latest GWT. The IDE doesn't even switch to Debug Perspective automatically.</p>
<p>I have found a different thread in groups discussing my problem.</p> <p><a href="http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/a9b553a6df5da5b8/65298c48c32deac0?lnk=raot&amp;pli=1" rel="nofollow">http://groups.google.com/group/Google-Web-Toolkit/browse_thread/thread/a9b553a6df5da5b8/65298c4...
How to validate database backups <p>I have a few remote databases, hosted at my web hosts. For mysql, I use periodic mysqldump and for MSSQL, I use bcp to back them up. How do I validate those backups? How do I make sure that the backup was not partial (its done over the public network).</p>
<p>In SQL Server you can use the RESTORE command with the option VERIFYONLY in order to validate the contents of a database backup file.</p> <p>See the following Books Online reference for details:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms188902.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/li...
JQuery form update listener <p>I want to trigger a javascript function when one of the elements in a specific form has been changed. Is this possible using jquery?</p> <p>Does anybody has an example how to do this?</p>
<p>If you have a text field like this:</p> <pre><code>&lt;input type='text' id='myInput'&gt; </code></pre> <p>You can do this:</p> <pre><code>function executeOnChange() { alert('new value = ' + $(this).val()); } $(function() { // wait for DOM to be ready before trying to bind... $('#myInput').change(exec...
How do RDBMS deal with stale connections? <p>Consider setting up a connection to a RDBMS, then yanking the network plug. (You'll get the same effect if the connection goes through a NAT gateway, and the gateway decides to purge that connection.)</p> <p>At that point the RDBMS server is waiting for a query, or whateve...
<p>It's a pretty broad question. Let me give you a broad answer.</p> <p>In the client/server days this would have been a bigger problem, since clients maintained persistent connections to the database. Nowadays, for scalability and other reasons, applications are generally written in a "disconnected" fashion, whereby...
How Can I Check To See If App was Started From A CD/DVD in C#? <p>How Can I Check To See If App was Started From A CD/DVD in C#?</p>
<p>Get the path where the exe was start from with Application.StartupPath property. then use new DriveInfo(driveletter_from_path).DriveType to determine whether it is a CD or harddisk.</p>
64-bits and Memory Bandwidth <p><a href="http://stackoverflow.com/users/32914/mason-wheeler">Mason</a> asked about <a href="http://stackoverflow.com/questions/607322/what-are-the-advantages-of-a-64-bit-processor">the advantages of a 64-bit processor</a>.</p> <p>Well, an obvious disadvantage is that you have to move mo...
<p>Whether your app should be 64-bit depends a lot on what kind of computation it does. If you need to process very large data sets, you obviously need 64-bit pointers. If not, you need to know whether your app spends relatively more time doing arithmetic or memory accesses. On x86-64, the general purpose registers are...
Fast Prime Number Generation in Clojure <p>I've been working on solving <a href="https://projecteuler.net">Project Euler</a> problems in Clojure to get better, and I've already run into prime number generation a couple of times. My problem is that it is just taking way too long. I was hoping someone could help me find ...
<p>Here's another approach that celebrates <code>Clojure's Java interop</code>. This takes 374ms on a 2.4 Ghz Core 2 Duo (running single-threaded). I let the efficient <code>Miller-Rabin</code> implementation in Java's <code>BigInteger#isProbablePrime</code> deal with the primality check.</p> <pre><code>(def certainty...
Secure login <p>If I'm trying to secure my login method. From an unsecured server the user enters their login credentials into a standard HTML form, which is POSTing to a script on a secure server. This script does all the necessary login functions, and sends the user back to the insecure server.</p> <p>My question ...
<p>If you post over SSL then the information will travel over the wire encrypted and will prevent packet sniffing. </p> <p>Is it possible to also host the actual login form page on the secure server? That way when the user goes to log in to your site they can see that the login page is secured and they can be confid...
Getting into Source Control <p>So I've decided it's probably best if I get some Source Control solution going to keep my hard work safe, and to help eradicate bugs between versions.</p> <p>I'm familiar with SVN as far as checking stuff out, but I have NFI about the committing side of things.</p> <p>What is a good Sou...
<p>I'd suggest using git and get <a href="http://sourceforge.net/projects/gitextensions" rel="nofollow">Git Extensions</a> for better Windows integration.</p>
CopyTo() to a directory that doesn't yet exist <p>I want to copy the file c:\a1\b2\c3\foo.txt to d:\a1\b2\c3\foo.txt. The subdirectories don't exist on the D drive, and if I try to do a direct CopyTo() I'll get an IO exception. I haven't been able to find any built-in c# function that does the dirty work of creating t...
<pre><code>Directory.CreateDirectory(@"c:\foo\bar\baz"); </code></pre> <p><a href="http://msdn.microsoft.com/en-us/library/54a0at6s.aspx">Documented</a> as creating all required directories, and works for me.</p> <blockquote> <p>Any and all directories specified in path are created, unless they already exist or...
Can't install zend debugger <p>I'm trying to install zend debugger in my Ubuntu 9.04 machine, I've done it in win. but not in linux, I hope you could help me, <strong>this is what I've done</strong>:</p> <p>1)Copied the file ZendDebugger.so to /etc/php5/apache2 (didn't choose this folder for anything in special).</p> ...
<p>I found much more easy to install <a href="http://xdebug.org/" rel="nofollow">Xdebug</a> in my Ubuntu machine.</p>
program for optimal performance and scalability from the start? <p>First question on stackoverflow. I have no previous experience of running a high traffic website and I would consider myself somewhere in between a novice and an intermediate programmer....please be gentle :)<br /> I am trying to make a social website ...
<p>Web development is a continual process. We may <em>think</em> we know what we want at the beginning, but it will inevitably change by the time we get there.</p> <p>I suggest that you start by getting the book by the 37 Signals Crew -- Getting Real: <a href="http://gettingreal.37signals.com/" rel="nofollow">http://...
executeQuery() not returning <p>Is there any condition under which PreparedStatement.executeQuery() does not return ro throw an exception ? </p>
<p>It depends on the database you're using and the configured isolation level. A common default is that a SELECT will block if you're trying to select records that have been updated in another transaction that hasn't committed yet.</p> <p>Are you trying to select uncommitted data? What database are you using?</p> <p>...
Dijkstra on "Software Engineering" <p>Edsger Dijkstra, who could be somewhat abrasive at times (he called "Carl Friedrich Gauss, the Prince of Mathematicians but also somewhat of a coward") said in his essay "On the cruelty of really teaching computing science" (<a href="http://www.cs.utexas.edu/~EWD/transcriptions/EWD...
<blockquote> <p>you will discover that software engineering has accepted as its charter "How to program if you cannot."</p> </blockquote> <p>I think I agree with this. At least when I reflect on what we were taught, and a lot of literature, I kinda realize that it's aimed to guide people who can't program.</p>
languages with functions that do not need parentheses? <p>IIRC, vb6 allowed function calls with no (). IIRC, it was allowed whenever the func didn't have a return value, and you could always use func(same, params, here).</p> <p>What other languages allow this? What do you think func with no parentheses should mean? W...
<p>Pretty much all functional languages from the ML lineage (Miranda, Haskell, OCML, F#, SML, etc.) don't require parentheses for function calls.</p> <p>For example, in Haskell:</p> <pre><code>Prelude&gt; (\x-&gt;x) 1 1 </code></pre> <p>The anonymous identity function is called with 1 and returns 1</p>
Expressions in hibernate criteria <p>Let's say I have a persistent class Item with a quantity field and a price field. Is there a way to build a Criteria that calculates the sum of quantity*price?</p>
<p>I think you can also use an SQL projection. It should be something like:</p> <pre><code>session.createCriteria(Item.class) .createAlias("item", "i") .setProjection( Projections.projectionList() .add( Projections.groupProperty("i.id") ) .add( Projections.groupProperty("i.p...
setting innerHTML for all browsers in javascript <p>I want to load contents of a DIV dynamically in javascript.I used this code</p> <pre><code> var strHtml="&lt;h3&gt;Test&lt;/h3&gt;"; var div = $("#divPrice"); div.innerHTML=strHtml </code></pre> <p>This works in IE. But not in firefox.Whats the alternative of th...
<p>Try it this way:</p> <pre><code>var strHtml="&lt;h3&gt;Test&lt;/h3&gt;"; $("#divPrice").html(strHtml); </code></pre>
How to catch hardware key press event on Windows Mobile 6? <p>I'm trying to catch hardware key press events on Windows Mobile 6.x with .NET 3.5 I have a form with buttons and other controls on it and I need to catch when keys left, right, up, and down are pressed. Unfortunately, with approach described in MSDN:</p> <p...
<p>If you set the form's KeyPreview property to true you can catch the form's KeyDown event.</p>
Which sorting algorithm is used in stl and .net base library default search? <p>I am now working on an imprived version of merge sort. I implemented it with C++ and C#. Then compared them with the stl sort and array.sort() algorithm respectively. In C++ I have got an equal (sometimes better) result. But in C#, I had to...
<p>.NET uses a variation of Quicksort (Sedgewick's median of 3 Quicksort).</p> <p>Unless you are an expert in sorting, I would be surprised if you can beat the built-in Sort over a wide range of data (including random, already ordered and reverse ordered sets). Resorting to unsafe code is usually a bad idea...</p>
Error while sorting filtered data from a GridView <p>I have an error I cannot solve, on a ASP.NET website. </p> <p>One of its pages - Countries.aspx, has the following controls:</p> <ul> <li>a CheckBox called "CheckBoxNAME":</li> </ul> <pre><code> &lt asp:CheckBox ID="CheckBoxNAME" runat="server" Text="Name" /&gt ...
<p>The problem was an error in the SelectCommand of the SqlDataSource... Pretty lame... If anyone would like to find out about it in full details, contact me. Other wise, I'll move on something else right now.</p> <p>This question can be considered answered, from my point of view, and closed.</p> <p>Thanks anyway.</p...
Security considerations behind this code snippet in PHP <p>I've reading some books on advanced PHP, and most of the time I find code like this:</p> <pre><code>$classes = array ("MyClass1", "MyClass2"); if (!in_array ($_GET['class'], $classes)) throw new Exception ("Class not found!"); $params = $_GET; $obj = ne...
<p>While the class name is being checked through the array, the method name isn't. You could, potentially, have something like</p> <pre><code>class Foo { function reset() { // rm -rf DocumentRoot } } </code></pre> <p>Which, while unlikely, could potentially be there.</p> <p>Put simply, never trus...
Flash SMS in Windows Mobile <p>How can i write code for send Flash SMS (Sms Class 0) in Windows Mobile? please guide me with .NET or C++ code also .Net is better.</p>
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/ms862960.aspx" rel="nofollow"><code>PROVIDER_SPECIFIC_MESSAGE_CLASS</code></a> enumeration's <code>PS_MESSAGE_CLASS0</code> value provided in a call to <a href="http://msdn.microsoft.com/en-us/library/aa455068.aspx" rel="nofollow"><code>SmsSendMessage</code></...
bar graph in vb.net? <p>i need to take user input and make a very simple bar graph from it in vb.net. anyone have suggestions on an easy way to accomplish this?</p>
<p>You didn't specify a framework but I'm guessing that you're using winforms?</p> <p>What you're looking for is a chart / bar control. By default WinForms doesn't have great bar / chart controls. This site has a breakdown of the various add ons Microsoft released for WinForms and ASP.Net in the area of chart contro...
Need regex to parse keyword='value' with single or double quotes <p>I'm having trouble writing a regular expression (suitable for PHP's preg_match()) that will parse keyword='value' pairs regardless of whether the &lt;value&gt; string is enclosed in single or double quotes. IOW in both of the following cases I need to ...
<p>In Perl this is a regular expression that would work. It first matched for the start of the line then matches for one or more non = characters and sets them to $1. Next it looks for the = then the a non parentheses with a choice of matching for " or ' and sets that to $2. </p> <pre><code>/^([^=]+)=(?:"([^"]+)"|'([^...
Hide X-Powered-By (nginx) <p>So is there any way to hide X-Powered-By on Nginx?</p>
<p>x-powered-by is given by the module, for instance php fastcgi module offers to set <code>expose_php=Off</code> in php.ini</p>
Capturing EAGLview content WITH alpha channel on iPhone <p>have been struggling with this issue for quite some time now and couldn't find an answer so far. Basically, what I want to do, is capturing the content of my EAGLview and then use it to merge it with other images. Anyway, the mainproblem is, that everything tra...
<p>Two places I can see that you might be losing your transparency: </p> <ol> <li>when you're drawing your scene: does your scene have a transparent background? make sure you're doing a glClear to something like (0,0,0,0) rather than (0,0,0,1).</li> <li>when you're drawing the image to flip it over: what is the defau...
Final initialization in java can be postponed, how does this prevent against returning null inadvertently? <p>In the "hidden features of java" question, someone mentions that final initialization can be postponed and provides an example:</p> <pre><code>public Object getElementAt(int index) { final Object element; ...
<p>The way you posted the question, the poster seems to be saying that if you did:</p> <pre><code> Object element = null; </code></pre> <p>And then set it via the if methods, you could return null by accident (if you didn't construct your else statement correctly), so take advantage of the fact that final initializat...
Constructor cannot access private members of its own class <p>I get the following error in Visual Studio 2008: error C2248: 'Town::Town' : cannot access private member declared in class 'Town'. It looks like the constructor is unable to access the members of its own class. Any idea what's going on? Here's the code: </...
<p>By default class access level is private. If you do not add a public: before the Town constructor it will be private.</p> <pre><code>class Town{ public: // &lt;- add this Town(int number):number(number){}; ... private: int number; }; </code></pre>
PyQt - QLabel inheriting <p>i wanna inherit QLabel to add there click event processing. I'm trying this code:</p> <pre><code>class NewLabel(QtGui.QLabel): def __init__(self, parent): QtGui.QLabel.__init__(self, parent) def clickEvent(self, event): print 'Label clicked!' </code></pre> <p>But a...
<p>There is no function <code>clickEvent</code> in QWidget/QLabel. You could connect that function to a Qt signal, or you could do:</p> <pre><code>class NewLabel(QtGui.QLabel): def __init__(self, parent=None): QtGui.QLabel.__init__(self, parent) self.setText('Lorem Ipsum') def mouseReleaseEven...
Error: Both DataSource and DataSourceID are defined on 'GridView2'. Remove one definition.? <p>when I write this query (using LINQ):</p> <pre><code> Dim hw22 = From hw In db.HWs _ Select hw </code></pre> <p>then:</p> <pre><code> GridView2.DataSource = hw22 GridView2.DataBind(...
<p>If you don't want to remove it in markup then do this:</p> <pre><code>GridView2.DataSourceID = "" GridView2.DataSource = hw22 GridView2.DataBind() </code></pre>
Does anyone know of a good guide to get Ninject 2 working in ASP.NET MVC? <p>I'm struggling with the documentation to figure out exactly what I need to. The documentation (to my understanding) is for 1.5 anyway.</p> <p><b>N.B:</b> I don't want to extend NinjectHttpApplication</p> <p>I've configured it to use the <b>N...
<p>Since you're already extending another HttpApplication-derived class, my thoughts are to just copy the relevant source code from the <strong>NinjectHttpApplication</strong> class into your extended HttpApplication class. Rather than cut and paste it, just look at the <a href="http://github.com/enkari/ninject.web.mv...
Avoid Database Dependency For Unit Testing Without Mocking <p>I've got many objects with methods that require database access. We're looking to get into unit testing but are keen to avoid the use of mock objects if possible. I'm wondering if there is a way to refactor the Validate method shown below so that it wouldn't...
<p>Personally I'd just go the mock object route. It's much more flexible and it sounds like you're wanting to go the route of putting test code in your actual object? </p> <p>Regarless, extract the validation code into a PersonValidator object with a method for boolean isValid(Person). Then in the test code use a...
Help me name this property (C#) <p>Imagine I created this class:</p> <pre><code> public class ColoredPolygon { public Point[] Vertices { get; set; } public Brush Brush { get; set; } } </code></pre> <p>Inside Visual Studio isn't difficult to see which "Brush" is the class and which is the property. But som...
<p>I would call it <code>Brush</code>. The <a href="http://msdn.microsoft.com/en-us/library/ms229042.aspx" rel="nofollow">Design Guidelines for Developing Class Libraries</a> actually says: </p> <blockquote> <p>Consider giving a property the same name as its type</p> </blockquote> <p>(in the <a href="http://msdn....
Equals method implementation helpers (C#) <p>Everytime I write some data class, I usually spend so much time writing the IEquatable implementation.</p> <p>The last class I wrote was something like:</p> <pre><code>public class Polygon { public Point[] Vertices { get; set; } } </code></pre> <p>Implementing IEquata...
<p>I use ReSharper to generate equality members. It will optionally implement <code>IEquatable&lt;T&gt;</code> as well as overriding operators if you want that (which of course you never do, but it's cool anyway).</p> <p>The implementation of Equals includes an override of <code>Object.Equals(Object)</code>, as well ...
SQL server managment studio Projects folder <p>Is there any easy way of changing the SQL Server Management Studio default 'Project' folder? I found one registry hack on the internet, but I'd rather not bother with that.</p> <p>I'm using SQL Server 2005 Express.</p>
<p>It doesn't look like it. There is no way of doing it from the options in management studio. You need to edit the paths stored in the registry at:</p> <p><code>HKCU\Software\Microsoft\Microsoft SQL Server\90\Tools\ShellSEM</code></p>
NHibernate Traversal Question - Creating a Fluent Interface <p>I'm stumped with NHibernate and my Domain Model right now. I'm imagining a nice API in my head but I'm having a really hard time making it a reality. Here's an example of what I'm trying to accomplish:</p> <pre><code>Trip trip = new Trip("Austria2009"); f...
<p>Assuming that Trip is an IQueryable, a fluent interface could be written fairly easily with Linq queries and extension methods. NOTE: The following hypothetical code is not tested. </p> <pre><code>public static class MyExtensions { public static IQueryable&lt;Person&gt; People(this IQueryable&lt;Person&gt; s...
variable is being redefined? <p>I'm currently using checkboxes to set permissions within my PHP application. On the user management page, if the user has the permission, defined by 1 or 0 in the database, the box with be checked or unchecked respectively. Below is the code that is being used to check whether if the box...
<p>I believe <code>=</code> is the assignment operator in php. You need to use <code>==</code>, the equality operator.</p> <p>Try changing the test from </p> <pre><code>&lt;? if ($currentperms['newapp'] = "1") {echo " checked ";}?&gt; </code></pre> <p>to</p> <pre><code>&lt;? if ($currentperms['newapp'] == "1") {ec...
How can I create a variable that is scoped to a single request in app engine? <p>I'm creating a python app for google app engine and I've got a performance problem with some expensive operations that are repetitive within a single request. To help deal with this I'd like to create a sort of mini-cache that's scoped to...
<p>What I usually do is just create a new attribute on the request object. However, I use django with AppEngine, so I'm not sure if there is anything different about the appengine webapp framework.</p> <pre><code>def view_handler(request): if hasattr(request, 'mycache'): request.mycache['counter'] += 1 ...
Redirects with Datamapper & Rails <p>I have a line in my routes.rb to map my Album model as a resource:</p> <pre><code> map.resources :albums </code></pre> <p>However, using Datamapper in place of ActiveRecord in Rails, why would this line:</p> <pre><code>format.html { redirect_to(@album) } </code></pre> <p>cause ...
<p>Does Datamapper support a <code>to_param</code> method or have you implemented one on your Album model? Until we have Rails 3 and an "ActiveORM" layer to cover up the differences between ORMs, you have to make sure your code conforms to an AR-like API.</p> <p>If there <em>is</em> a <code>to_param</code> method and...
Textbox Value not saving <p>For some reason anything I put into a textbox does not get saved. Could someone please tell me why this is happening? Here is the simplified code I am using:</p> <p>.aspx</p> <pre><code>&lt;body&gt; &lt;form id="form1" runat="server"&gt; &lt;div&gt; Try this: &lt;asp:...
<p>You need to check for Post Back in your Page_Load Event before setting. Otherwise, the Page_Load will always overwrite whatever you enter in the textbox.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { if(!IsPostBack) { TextBox1.Text = "Test 1"; } } </code></pre>
How can I migrate my data from Microsoft CRM 3.0 to 4.0.2? <p>hello guys i am new to data migration. My primary goal is to move the data from Microsoft CRM 3.0 to CRM 4.0.2. We are using SQL Server 2008 as our production server. Can anyone advise me on this?</p>
<p>I just saw Josh's Tweet. There are a few ways to tackle this. <hr /></p> <h1>1 Use the CRM Migration Tool</h1> <p>Can you make a copy of your 3.0 system and upgrade it to 4.0?</p> <p>If you can Upgrade your CRM 3.0 machine to 4.0 and make sure that it and your new system are at the same rollup level then you can ...
How do I get Mac system icons, as in the Finder? <p>I want to set the images in my outline view to the system icons, just like on the left in the Finder. I want to get icons like Application, Documents, Desktop, etc. How do I do this?</p>
<p>Use NSWorkspace's <a href="http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSWorkspace%5FClass/Reference/Reference.html#//apple%5Fref/occ/instm/NSWorkspace/iconForFile:">iconForFile</a>: method</p> <pre><code>NSImage *icon = [[NSWorkspace sharedWorkspace] iconForFile:@"/Applications/...
Should we store format strings in resources? <p>For the project that I'm currently on, I have to deliver specially formatted strings to a 3rd party service for processing. And so I'm building up the strings like so:</p> <pre><code>string someString = string.Format("{0}{1}{2}: Some message. Some percentage: {3}%", toke...
<p>I do think this is a necessary evil, one I've used frequently. Something smelly that I do, is:</p> <pre><code>// "{0}{1}{2}: Some message. Some percentage: {3}%" string someString = string.Format(Properties.Resources.SomeString ,token1, token2, token3, number); </code></pre> <p>....
How to add an extra language input to Android? <p>Is it possible to add extra languages to Android? My current Android phone only supports English and Chinese language input. I would like to have Dutch also, as I can use it for word completion. The question on top of that is, how to switch easily between these language...
<p>Don't agree with post above. I have a Hero with only English available and I want Spanish.</p> <p>I installed MoreLocale 2, and it has lots of different languages (Dutch among them). I choose Spanish, Sense UI restarted and EVERYTHING in my phone changed to Spanish: menus, settings, etc. The keyboard predictive tex...
Installing the SSRS Data Connector for CRM4 <p>I'm trying to install the SSRS data connector for my CRM4 implementation. I'm using the <a href="http://support.microsoft.com/kb/947060" rel="nofollow">Method 2: Modify the Install-config.xml file from this page</a>. But keep getting the same error message:</p> <blockquot...
<p>You may need to post more details regarding this issue: 1) The 2nd method described in this link : <a href="http://support.microsoft.com/kb/947060" rel="nofollow">here</a> is used when the Reporting Server database is installed using the SQL Server named instance. Are you installing the Reporting Server database in ...
How can I reduce the size of .wav audio files for iPhone apps? <p>I have some music that loops. The .wav file size is about 8 meg. I load this and just loop it... everything was working fine until I added another 4 meg .wav file. Now the game crashes... removing the additional audio file fixed the crashing.</p> <p>...
<p>If you're only playing one sound file at a time, just use mp3 or aac. That way you also get hardware decoding, for improved performance and battery life.</p> <p>Unfortunately, the iPhone can only play one hardware decoded sound file at a time. So if you're looking to ever play more than one at once, you'll need t...
Undo scaffolding in Rails <p>Is there any way to 'undo' the effects of a scaffold command in Rails?</p>
<p><strong>First</strong>, if you have already run the migrations generated by the <code>scaffold</code> command, you have to rollback it at first.</p> <pre><code>rake db:rollback </code></pre> <p>You can create scaffolding using:</p> <pre><code>rails generate scaffold MyFoo </code></pre> <p>(or similar), and <str...
How do I configure JUnit Ant task to only produce output on failures? <p>I am configuring JUnit in Ant so that unit tests will be run on each build. I would like the output of <em>failing</em> tests to be printed in the Ant console output whenever they are run. I don't need to see any output from succeeding tests.</p> ...
<p>One possibility would be to define your own xml formatter with the '<code>classname</code>' attribute (and extending <code>org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter</code>, potentially doing nothing on <a href="http://api.dpml.net/ant/1.6.5/org/apache/tools/ant/taskdefs/optional/junit/XMLJ...
Framework or library for creating user based rating systems such as in Digg, Reddit etc? <p>Looking for a good client side library using which I can create a reddit vote up / down, commenting, etc system? </p> <p>The more mature the framework the better as this will go on a production site immediately. </p>
<p><a href="http://www.reddit.com/" rel="nofollow">Reditt</a> is <a href="http://blog.reddit.com/2008/06/reddit-goes-open-source.html" rel="nofollow">open source</a>. Why don't you take a look?</p>
how to create sound from label text in iphone? <p>i want to play sound according to text of the label.is this possible to generate sound from text.?</p>
<p>It depends on what you mean by "generate sound from text."</p> <p>If you want to read aloud the text of a label, there's no built-in text-to-speech framework for iPhone developers. Some third-party companies (like <a href="http://www.acapela-group.com/" rel="nofollow">Acapela</a>) claim to offer TTS services for iP...
Web design process and thinking <p>I was wondering how to approach design of a website in terms of layout/design.What kind of process designers usually follow ?I am a developer who is taking first steps to develop a good looking website.What are the best practices - using divs, grid design etc.</p>
<h2>Step 1.</h2> <p>First is to identify which type of site you are designing for. If you are designing a site that will show products, or lots of pictures in general, think of an appropriate design. (ie, don't build a 3 column layout for such site, as it will look very cramped and pictures will have to be small to fi...
Leaking Memory on iPhone :( <p>I'm a beginner at C, Obj-C and the iPhone, and I'm trying getting to grips with a lot of terminology used. I hope one of ye can help with a problem I have been struggling with for a few days now.</p> <p>My code below is a method which call up a nib containing a search field and a table. ...
<p>This returns allocated NSNumber instance.</p> <pre><code>NSNumber *clientId = [[NSNumber alloc] init]; </code></pre> <p>This line overwrites the above clientId with another instance of NSNumber, numberWithInt returns autoreleased object, since you haven't allocated memory for it you should not call release, it wil...
How to translate and modify map.resources :document <pre><code>map.resources :document </code></pre> <p>After adding this route, I now have an automatic "<code>edit_document_path</code>". I wanted to change this to "<code>annotate_document_path</code>"? Will it automatically pick this up if I add a new view and contro...
<p>Jarrod is correct. <code>map.resources</code> by default only adds the RESTful routes. To get the route you want, the line should read</p> <pre><code>map.resources :document, :member =&gt; {:annotate =&gt; :get} </code></pre> <p>:member means this route will have an associated document_id, :annotate will be part o...
Handling Silverlight onerror callback <p>The silverlight object tag accept an 'onerror' parameter which calls back to a piece of javascript of your choice. The default implementation which is generated by the Visual Studio template assembles a descriptive message and throw it as an Error (which lets e.g. IE display the...
<p>I like a nice error reporting in the form of a "form" using SilverlightFX grab the source <a href="http://github.com/NikhilK/silverlightfx/tree/master" rel="nofollow">http://github.com/NikhilK/silverlightfx/tree/master</a> , check it out very cool framework otherwise basically would be just a summary of the error, t...
DataSet.GetXml not returning null results <p>whenever I convert a DatSet into an XML with DataSet.GetXml, any null value is ignored, so, where i expect this:</p> <pre><code>&lt;value1&gt;a&lt;/value1&gt; &lt;value2&gt;&lt;/value2&gt; &lt;value3&gt;c&lt;/value3&gt; </code></pre> <p>I get this instead:</p> <pre><code>...
<p>The problem is listed here in the Microsoft KB article:</p> <p><a href="http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q317961" rel="nofollow">http://support.microsoft.com/default.aspx?scid=kb;EN-US;Q317961</a></p> <p>The problem is that you have no schema attached to your dataset that specifies that that...
Zipping dynamic files in App Engine (Python) <p>Is there anyway I can zip dynamically generated content, such as a freshly rendered html template, into a zip file using zipfile?</p> <p>There seem to be some examples around for zipping static content, but none for zipping dynamic ones. Or, is it not possible at all?</p...
<p>The working code: (for app engine:)</p> <pre><code>output = StringIO.StringIO() z = zipfile.ZipFile(output,'w') my_data = "&lt;html&gt;&lt;body&gt;&lt;p&gt;Hello, world!&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;" z.writestr("hello.html", my_data) z.close() self.response.headers["Content-Type"] = "multipart/x-zip" self.r...
Repeat windows messages in Winforms <p>I want repeat sent windows messages to my winforms application. Now, I have class implementing "IMessageFilter" which saves the selected messages (WM _KEYDOWN, WM _LBUTTONDOWN, etc...) to the list.</p> <p>On key "Pause/Break" I copy the list of messages, clear original list, and ...
<p>Do you still have the message filter applied? Would that not interfere with sending the messages? Other possibility could be that the message in question should not be sent, but posted. Or, you may have to send the message from the correct thread for the target window.</p>
How do I automate a report on variance in the same SQL table fields on monthly basis? <p>I have a T-SQL view with integer fields. I need a report on a monthly basis regarding the difference from one month to the next, i.e. so many people were engaged in a particular activity on 8am of the 1st of this month, so many the...
<p>Can you add a UserCount table that stores each office's user count for each month? It could have columns like:</p> <ul> <li>id</li> <li>date</li> <li>user_count</li> <li>office_id</li> </ul> <p>You would insert a new row each month based on what the view tells you that month for each office. Then it's as simple as...
DataSet.WriteXml to string <p>I'm tring to get a string from a DataSet <em>without</em> using GetXml. I'm using WriteXml, instead. How to use it to get a string? Thanks</p>
<pre><code>StringWriter sw = new StringWriter(); dataSet.WriteXml(sw); string result = sw.ToString(); </code></pre>
C#: Creating a graphical screensaver <p>I am thinking about creating a screen saver. I have the whole thing, its graphics and the back-end kind of ready in my head. But I am not quite sure how to get the graphics out in code.</p> <p>What I would like is a slide show of images with a bit of movement (kind of like the s...
<p>I guess XNA works well. There's a sample screensaver in C# Express, by the way.</p>
Taking Images From Camera with Adobe Flash <p>I want to help user to take their pictures with a plugged in video camera and post it to the server by using Adobe Flash. is there any component can do it ? </p>
<p>Not a "component" but if you want to try making your own then this might get you started?</p> <p><a href="http://www.newgrounds.com/portal/view/326194" rel="nofollow">Webcam in flash tutorial</a></p>
struts 2 : use multiple message resources on jsp <p>I need to use multiple resource files on my jsp to show localised messages. Whats the way to include it in struts 2.</p> <p>I have seen <code>&lt;s:i18n name=""&gt;</code>, but this will make the code pretty messy as it need to be written and closed for each of the l...
<p>In struts.properties, reference your resource files:</p> <pre><code>struts.locale=xx_XX struts.custom.i18n.resources=global-errors, global-messages, ... </code></pre> <p>Make sure to put your resource files on the classpath and postfix the files with your locale (ie. global-errors_ xx _ XX.properties).</p> <p>The...