input
stringlengths
51
42.3k
output
stringlengths
18
55k
How do I drop to the IRB prompt from a running script? <p>Can I drop to an IRB prompt from a running Ruby script?</p> <p>I want to run a script, but then have it give me an IRB prompt at a point in the program with the current state of the program, but not just by running rdebug and having a breakpoint.</p>
<p><a href="http://pry.github.com">Pry</a> (an IRB alternative) also lets you do this, in fact it was designed from the ground up for exactly this use case :)</p> <p>It's as easy as putting <code>binding.pry</code> at the point you want to start the session:</p> <pre><code>require 'pry' x = 10 binding.pry </code></pr...
Description of datamodule in dll? <p>I created a costumer's database program. I have a problem in which I create a data module in a DLL and I compile it but then get some error below.</p> <p>My concept is </p> <blockquote> <p>The data module created in DLL and I insert ADO components in the data module. This data...
<p>TDataModule is just like a form but it's purpose is to be sort of a container form and is invisible to the end user. Although you can create a TDataModule in a DLL, it is not meant to be like that. TDataModules are there for the sake of simplifying your interaction with the whole app. Not to complicate it!!</p> <p>...
Unable to connect mysql from Sequel gem <p>When I try to connect to MySQL from Sequel. I am getting these errors:</p> <pre><code>require 'rubygems' require 'sequel' DB = Sequel.connect(:adapter =&gt; 'mysql', :user =&gt; 'root', :host =&gt; 'localhost', :database =&gt; 'scanty',:password=&gt;'xx') ...
<p>You need to install the native MySQL driver, the pure ruby one is not compatible with Sequel.</p> <p>Depending on your Ruby installation, just doing <code>gem install mysql</code> may be enough. However, if the pure Ruby mysql.rb file is already in your Ruby load path, you either need to remove it from the load pa...
How to make CSS column not be forced down <p>In the following example how do you 1) make the text "This is the second entry..." wrap and not have that .entry div forced down and 2) how do you make the the #right div not be forced down either?</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional/...
<p>Like <code>pegasus4747</code> said, use the <code>&lt;ol&gt;</code> tag for numbering</p> <p>If you want <code>#right</code> to take up 250px and <code>#left</code> to fill the rest do this</p> <pre><code>#left { padding-right: 250px; margin: 0; padding: 0; } #right { width: 250px; margin-left: -250px; margin: 0;...
Linq to SQL Templates in .NET 2.0 Projects <p>I can't find a template for a linq to sql class in .net 2.0 project, based on what i know you can work with linq in .NET 2.0 as long as you have 3.5 in your development machine and ship system.core.dll with your application? </p> <p>so based on that how can I add a Linq to...
<p>If you ship System.Core with your application, it won't pick up future security fixes and won't have the optimized build installed (MS internally uses and profiling NGEN for distributed framework libraries). Either require .NET 3.5, avoid using Linq, or implement your own extensions for a <a href="http://netpl.blogs...
Pad byte[] to 16-byte multiple for AES Encryption <p>I currently have a function [C#] which takes a byte[] and an alignment to set it to, but during encryption, an error is thrown every once in awhile.</p> <pre><code> private byte[] AlignByteArray(byte[] content, int alignto) { long thelength = content....
<p>Here's a simple solution:</p> <pre><code>private static void PadToMultipleOf(ref byte[] src, int pad) { int len = (src.Length + pad - 1) / pad * pad; Array.Resize(ref src, len); } </code></pre>
How to create database using SMO with everyone having permission? <p>I am trying to create a SQL Server Express database using SMO like so:</p> <pre><code>Database db = new Database(server, dataSource); ... db.Create(); </code></pre> <p>I am able to use the database fine. But, if someone else tries to copy the datab...
<p>I think, you basically only need to add access for the "public" role - never tried it myself, but try this:</p> <pre><code>Database db = new Database(server, dataSource); db.Roles.Add(new DatabaseRole(db, "public")); db.Create(); </code></pre> <p>Does that work? Can your coworkers access the database now?</p> <p>...
Can I drive a Crystal Report in a standalone application with .NET objects? <p>I'm trying to learn Crystal Reports (VS 2005, VB) and <a href="http://stackoverflow.com/questions/1140229/how-to-use-crystal-reports-without-a-tightly-linked-db-connection">per this question</a> I was trying to drive the report with my own d...
<p>Based on this <a href="http://msdn.microsoft.com/en-us/library/ms227609%28VS.80%29.aspx" rel="nofollow">step</a>, I think the report might have to be a strongly typed report. Where did it indicate it was only for the web?</p>
__OBJC__ equivalent for Objective-C++ <p>I'm compiling a .mm file (Objective-C++) for an iPhone application, and the precompiled header fails to include the base classes.</p> <p>I tracked it down to the following:</p> <pre><code>#ifdef __OBJC__ #import &lt;Foundation/Foundation.h&gt; #import &lt;UIKit/UIKit.h...
<p>If you invoke gcc with <code>-dM -E</code> it will stop after preprocessing, and list all <code>#defines</code> . This normally how I check what built-in defines are set; however I just tried this with a test <code>.mm</code> file and <code>__OBJC__</code> is defined for me, so I'm not sure why it isn't defined for ...
Is there (an automated) way to backup Hudson CI files? <p>Here at my company we have three Hudson CI servers with 100+ jobs configured. We are looking for an automated way to <strong>periodically</strong> backup job configurations and build history. </p> <p>Currently we have an ant script that we configure as a job bu...
<p>There is a <a href="http://wiki.hudson-ci.org/display/HUDSON/Backup+Plugin" rel="nofollow">Backup Plugin</a>.</p> <p>I don't believe that it supports scheduling of periodic backups, but you might be able to trigger it by accessing it through the URL (like some other Hudson remote APIs), in which case you might be a...
Get Appointment Body from a Room Resource Calendar <p>According to <a href="http://msdn.microsoft.com/en-us/library/bb508824.aspx" rel="nofollow">this article</a>, using a combination of FindItem and GetItem it should be possible to retrieve the notes section from an appointment.</p> <p>This seems to work fine for a U...
<p>I'm not sure if this is the same on Exchange 2007 but on 2010 you are able to control "Resource Privacy Options". As default, it will remove a lot of information when adding appointments into a resource calendar, but it can be configured as shown in this screenshot:</p> <p><img src="http://i.stack.imgur.com/02HwJ.g...
.Net Service and Windows App at the same time? <p>When you create a Windwows Service, you end up with a .exe file that you need to register, and you start it from the "Services" snap-in.</p> <p>If you try to execute this .exe file, you get the message: "Cannot start service from the command line or debugger. A Windows...
<p>Well it is possible but I'm not sure it is a beautiful solution:</p> <pre><code>static void Main() { bool your_condition = ReadRegistry or ReadConfigurationFile; if(your_condition) { ServiceBase[] ServicesToRun; ServicesToRun = new ServiceBase[] { new YourService() ...
SQLite3 in C#.NET <p>I'm trying to use SQLite3 in C#.NET. I've googled around and found some different API's. I also checked SQLite's website for wrappers. I like them, but want to write my own wrapper without using an added dependency. All wrappers I find that don't require an added dependency aren't free.</p> <p><st...
<p>Have you looked at the <a href="http://system.data.sqlite.org/" rel="nofollow">System.Data.SQLite</a> library? It's a free ADO.NET library to interact with SQLite and requires nothing else in order to run, since it has the engine built into it.</p> <p>I've been using it for a while now and find it really easy to wo...
some OVERLAPS using WSASend not returning in a timely manner using GetQueuedCompletionStatus? <p>Background: I'm using CreateIoCompletionPort, WSASend/Recv, and GetQueuedCompletionStatus to do overlapped socket io on my server. For flow control, when sending to the client, I only allow several WSASend() to be called w...
<p><code>WSASend()</code> can fail to complete in a timely manner if the TCP window is full. In this case the stack can't send any more data so your <code>WSASend()</code> waits and your completion doesn't occur until the TCP stack CAN send more data.</p> <p>If you happen to have a protocol between your client and ser...
"Validation of ViewState MAC failed" - What does this error mean? <p>Validation of viewstate MAC failed. If this application is hosted by a Web Farm or cluster, ensure that <code>&lt;machineKey&gt;</code> configuration specifies the same <code>validationKey</code> and validation algorithm. <code>AutoGenerate</code> can...
<p>By default, ASP.NET will attempt to validate the viewstate. If validation fails, it will throw this exception. Reasons that it might not validate include recompiling the site and then refreshing a form in your browser, or some sort of server farm/cluster (but if you're using localhost, I'd lean towards the former)...
Nib objects (subviews) accessing properties in ViewController <p>Edited for brevity: </p> <p><strong>How does a subview access properties in its superview and its superview's view controller?</strong> Easy enough to go down the chain. How do we go back up? </p> <p>Original (verbose) post:</p> <p>The immediate proble...
<p>It should work the other way round. </p> <p>The views only contain controls (text fields, etc.). The data lives in a <em>model</em>, and the view/window controllers mediate, accessing and setting the view controls values, synchronizing with the model.</p> <p>OK, sometimes you may need to have a dictionary shared b...
How do I grab all values from a JQuery menu <p><br /> I have a dropdown menu that is populated with key value pairs in php. Now I want to use JQuery to attach click handlers to each of those keys. </p> <p>How do I print out a list of the contents in a drop down menu in JQuery?<br /> (I know to get the current va...
<pre><code>$('select#idselect option').each(function() { $(this).click(function() { // do stuff }); }); </code></pre>
Handle multiple strongly typed objects in a controller <p>Not really a requirement or anything yet, but can you do this in a controller:</p> <pre><code>public ActionResult Edit(IEnumerable&lt;Contact&gt; contacts) { //Loop through and save all records return View(); } </code></pre> <p>This comes from wanting ...
<p>You need this:</p> <pre><code>&lt;form&gt; &lt;input type="text" name="contacts[0].FirstName" id="contacts[0].FirstName" value="Joe"/&gt; &lt;input type="text" name="contacts[0].LastName" id="contacts[0].LastName" value="Smith"/&gt; &lt;input type="hidden" name="contacts[0].PK" id="contacts[0].PK" value...
Connection refused when trying to open, write and close a socket a few times (Python) <p>I have a program that listens on a port waiting for a small amount of data to tell it what to do. I run 5 instances of that program, one on each port from 5000 to 5004 inclusively.</p> <p>I have a second program written in Python ...
<p>This sounds a lot like the anti-portscan measure of your firewall kicking in.</p>
Exception handling opens error page inside current page <p>In my ASP.NET MVC app, I'm handling errors by overriding OnException in the controller. What is happening is that if a runtime error happens on the page, the Error.aspx page opens <em>inside</em> the page on which the error happened. Here's the code (with some ...
<p><strong>Edit</strong></p> <p>In the case where the exception occurs while processing the result, replacing the result won't work since the result is already being rendered. In this case, you could try clearing the existing results and rendering the error result explicitly.</p> <pre><code>protected override void O...
How do I use bound controls and InsertItemTemplate to insert data on a page and then forward to another page? <p>I have a few simple asp.net pages forming sort of a wizard type interface. Each page has a form that uses an with form fields that bind to LINQ entities on the back end. So I'm letting asp/linq do the work ...
<p>You can use the <strong>ASP.net Wizard control</strong></p> <pre><code>&lt;asp:Wizard ID="AddEmployeeWizard" runat="server" CellPadding="5" Width="95%"&gt; &lt;WizardSteps&gt; &lt;asp:WizardStep runat="server" Title="Step 1" StepType="Start"&gt; ... Content for Step ... &lt;/asp:WizardStep&g...
Alternative to BackgroundWorker that accepts more than one argument? <p>The BackgroundWorker object allows us to pass a single argument into the DoWorkEventHandler. </p> <pre><code>// setup/init: BackgroundWorker endCallWorker = new BackgroundWorker(); endCallWorker.DoWork += new DoWorkEventHandler(EndCallWorker_DoWor...
<p>You could use a closure (Lambda):</p> <pre><code>backgroundWorker.DoWork += (s, e) =&gt; MyWorkMethod(userName, targetNumber); </code></pre> <p>Or with delegate (anonymous method) syntax:</p> <pre><code>backgroundWorker.DoWork += delegate(object sender, DoWorkEventArgs e) { MyWorkMethod(userName,...
How to get height of entire document with JavaScript? <p>Some documents I can't get the height of the document (to position something absolutely at the very bottom). Additionally, a padding-bottom on seems to do nothing on these pages, but do on the pages where height will return. Case(s) in point:</p> <p><a href="ht...
<p>Document sizes are a browser compatibility nightmare because, although all browsers expose clientHeight and scrollHeight properties, they don't all agree how the values are calculated.</p> <p>There used to be a complex best-practice formula around for how you tested for correct height/width. This involved using doc...
Pass parameter to WordPress plugin with pretty url, mod_rewrite, .htaccess <p>I told WordPress that I wanted urls to look like: <code>domain.com/postname.html</code></p> <p><strong>I want to pass a parameter to a WordPress plugin. So when I get domain.com/postname.html.2 it is supposed to be domain.com/postname.html?t...
<p>Try this rule:</p> <pre><code>RewriteRule ^(.*\.html)\.([0-9]+)$ $1?tubepress_page=$2 </code></pre>
Can autocapitalize be turned off with javascript in mobile safari? <p>Mobile safari supports an attribute on input elements called autocapitalize [<a href="http://developer.apple.com/safari/library/codinghowtos/Mobile/UserExperience/index.html#GENERAL-DISABLE%5FAUTOMATIC%5FCORRECTION%5FAND%5FAUTOMATIC%5FCAPITALIZATION%...
<p>This should be fixed in iPhone OS 3.0. What version of iPhone OS are you trying this on?</p> <pre><code>Email: &lt;input id="email" type="text"&gt;&lt;br&gt; URL: &lt;input id="url" type="text"&gt;&lt;br&gt; &lt;script&gt; //document.getElementById("email").autocapitalize = 'off'; //document.getElementById("url")....
How to test anonymous classes? <p>I believe you must be familiar with this idiom, which is sort of java's excuse for closures</p> <pre><code>//In the "Resource Manager" class public void process(Command cmd){ //Initialize ExpensiveResource resource = new ExpensiveResource(); //Use cmd.execute(resource); //Re...
<p>I think that anonymous classes should be so small and simple that testing the structure including/using them should be good enough. </p> <p>If you have something so complicated, big, important that you feel the need to test it make it a full class.</p>
Codeplex SVN $Author$ Property problem <p>I'm trying to setup a codeplex project, but I can't make the $Author$ property for the commit to work. Both $Author$ and $LastChangedBy$ returns "unknown" when committing to CodePlex.</p> <p>I enabled the property though AnkhSvn in Visual Studio 2008.</p> <p>Any idea if it's ...
<p>Keyword expansion is actually done by the client, not the server. I'd give it a shot with a different svn client (preferably the official command line one) to see if it works for you there. Don't forget to set your props on the project.</p> <p>If you're not getting responses for the queries used by the client to ge...
PHP Syntax Error in Setting Global Variable <p>Ok, so my PHP is, to say the least, horrible. I inherited an application and am having to fix errors in it from someone that wrote it over 7 years ago. When I run the page, there is no return, so I checked the logs to see the error and here is what i get:</p> <blockquot...
<p><a href="http://nl2.php.net/global"><code>global</code></a> is a keyword that should be used by itself. It must not be combined with an assignment. So, chop it:</p> <pre><code>global $x; $x = 42; </code></pre> <p>Also, as <a href="http://stackoverflow.com/questions/1145970/php-syntax-error-in-setting-global-variab...
Why can't I build a "hello world" for glib? <p>So here's the world's simplest glib program:</p> <pre><code>#include &lt;glib.h&gt; </code></pre> <p>I try to compile it with <code>gcc test.c</code> and I get:</p> <pre><code>test.c:1:18: error: glib.h: No such file or directory </code></pre> <p>So I make sure that I ...
<p>glib tends to hide itself... Your include statement doesn't work because GCC doesn't automatically search subdirectories, and so cannot see the glib.h in glib-1.2 or glib-2.0.</p> <p>Read the <a href="http://library.gnome.org/devel/glib/stable/glib-compiling.html">Compiling GLib Applications</a> page in the GLIB ma...
I'm missing functionalities on SubSonic 3 <p>I'm starting to do some test on SubSonic 3 and I'm missing some stuff.</p> <p>1st: Where's the Table names constants? The place where we could ask for the same of a certain table using intelisense...</p> <p>2nd: Same as the above but for the table columns... where are they...
<p>1st: Where's the Table names constants? The place where we could ask for the same of a certain table using intelisense...</p> <p>In Structs.tt find the following line of code at line 47:</p> <pre><code>&lt;# foreach(var col in tbl.Columns){#&gt; </code></pre> <p>Add the following code above it:</p> <pre...
Help with 301 redirects on outgoing links from my site <p>I work for company that links out to partners through a third party website that tracks them. So for example on our site there will be an outgoing link something like this (names changed to protect my work):</p> <pre><code>&lt;a href="link.php?link=chuckechees...
<p>You can't use a rewrite rule to redirect the user for this. The request has to be one processed by your webserver.</p> <p>You might try doing some javascript to achieve this. so the href is to chuckecheese, but onclick, you change the document.location to what you really want to do.</p> <p><b>Edited question for b...
Problem sending JSON object succesfully to asp.net WebMethod, using jQuery <p>I've been working on this for 3 hours and have given up. i am simply trying to send data to an asp.net web method, using jQuery. The data is basically a bunch of key/value pairs. so i've tried to create an array and adding the pairs to that a...
<p>In your example, it should work if your data parameter is:</p> <pre><code>data: "{'items':" + JSON.stringify(items) + "}" </code></pre> <p>Keep in mind that you need to send a JSON string to ASP.NET AJAX. If you specify an actual JSON object as jQuery's data parameter, it will serialize it as &amp;k=v?k=v pairs i...
Is it OK to use a macro to specialize std::swap? <p>So, I have a macro.</p> <pre><code>// swap_specialize.hpp #include &lt;algorithm&gt; #ifndef STD_SWAP_SPECIALIZE #define STD_SWAP_SPECIALIZE( CLASSNAME ) \ namespace std { \ template&lt;&gt; inline \ void swap( CLASSNAME &amp...
<p>I would say it's OK if it increases readability. Judge yourself. Just my two cents: Specializing <code>std::swap</code> isn't really the right way to do this. Consider this situation:</p> <pre><code>my_stuff::C c, b; // ... swap(c, b); // ... </code></pre> <p>This won't find <code>std::swap</code> if you haven't d...
Regex to match a URL pattern for a htaccess file <p>I'm really struggling with this regex. </p> <p>We're launching a new version of our "groups" feature, but need to support all the old groups at the same URL. Luckily, these two features have different url patterns, so this should be easy? Right?</p> <ul> <li>Old: ...
<p>Your design choices make a pure-htaccess solution difficult, especially since <code>group/123-another-old-group-456/a-module-inside-the-group/</code> is a valid old-style URL.</p> <p>I'd suggest a redirector script that looks at its arguments, determines if the first part is a valid <code>groupid</code>, and if so,...
load page acording to class names <p>I've got code like this on my page:</p> <pre><code>&lt;div class="item item_wall id1"&gt;&lt;/div&gt; &lt;div class="item item_wall id2"&gt;&lt;/div&gt; &lt;div class="item item_wall id3"&gt;&lt;/div&gt; &lt;div class="item item_wall id4"&gt;&lt;/div&gt; &lt;div class="item item_wa...
<p>For XHTML valid document, the easiest is to add invisible child DIV under your main DIV. E.g.: </p> <pre><code>&lt;div class="item"&gt; &lt;div class="variable type"&gt;item_wall&lt;/div&gt; &lt;div class="variable id"&gt;1&lt;/div&gt; &lt;/div&gt; </code></pre> <p>You can find the "custom attribute" using .fi...
Eclipse is trying to build the files in my .svn directories... how can I tell it to stop? <p>I'm storing my Android project in a Subversion repository. After recently shuffling a bunch of stuff around I started getting tons of errors like:</p> <pre><code>syntax error entries /project_name/src/.svn line 1 Android AI...
<p>Although you can solve this problem by installing a plugin such as <a href="http://www.eclipse.org/subversive/documentation/gettingStarted/aboutSubversive/install.php">Subversive</a>, which has already been mentioned, you can also solve this problem without the plugin.</p> <p>You can tell eclipse to ignore files st...
Is it good practice to trim whitespace (leading and trailing) when selecting/inserting/updating table field data? <p>Presuming that the spaces are not important in a field's data, is it good practice to trim off the spaces when inserting, updating or selecting data from the table ?</p> <p>I imagine different databases...
<p>If leading and trailing spaces are unimportant, then I'd trim them off before inserting or updating. There should then be no unnecessary spaces on a select.</p> <p>This brings some advantages. Less space required in a row means that potentially more rows can exist in a data page which leads to faster data retrieval...
Comparison of Vector Graphic Formats <p>From <a href="http://en.wikipedia.org/wiki/Image%5Ffile%5Fformats#Vector%5Fformats" rel="nofollow">Wikipedia:Vector Formats</a>, there are several vector graphic format, such as:</p> <ul> <li>CGM (Computer Graphics Metafile)</li> <li>SVG (Scalable Vector Graphics)</li> <li>ODG (...
<p>SVG and EPS are the only two I use (apart from PDF, but that's for documents not vector graphics, so irrelevant).</p> <p>I prefer to use SVG if I can, as I have found it to be the most widely supported, however, I use vectors on the web, not in .NET, so this may not apply.</p>
Intertesting problem with UITableViewCell and UITableView, Any solution? <p>I have a class inherited from <code>UITableViewController</code> and this is also the root class. This tableView contains three custom <code>UITableViewCell</code>s (loaded from NIB file and not subclassed) and each <code>UITableViewCell</code>...
<p>The <code>textField:shouldChangeCharactersInRange:replacementString:</code> method is part of the <code>UITextFieldDelegate</code> protocol, so you have to set a delegate for these <code>UITextField</code>s.</p> <p>For example, if you were creating the <code>UITextField</code>s in your table view contoller code, an...
To read SO's data dump effectively <p>I use currently Vim to read <a href="http://blog.stackoverflow.com/2009/06/stack-overflow-creative-commons-data-dump/" rel="nofollow">SO's data dump</a>. However, my Macbook slows down when I roll down just a few rows. This suggests me that there must be more efficient ways to read...
<p>I made my first ever python program to read them and output SQL insert statements for use with mysql (It's ugly but worked). You'll need to create the tables first though by hand.</p> <pre><code>import xml.sax.handler import xml.sax import sys class SOHandler(xml.sax.handler.ContentHandler): def __init__(se...
SSL Tomcat Configuration <p>I am using tomcat 5.5 and configured keystore and added this connector inside server.xml file</p> <pre><code>&lt;Connector port="443" minProcessors="5" maxProcessors="75" enableLookups="true" disableUploadTimeout="true" acceptCount="100" debug="0" scheme="https" secure="true";...
<p>Did you check Tomcat's logs? </p> <ul> <li>Perhaps the connector could not start up.</li> <li>Perhaps Tomcat could not read or find the .keystore you configured.</li> <li>Perhaps the .keystore has a password which Tomcat does not know about.</li> <li>Perhaps another process is already bound to that port.</li> </ul>...
Switch from Google AppEngine to another server <p>Currently I'm building my Java Web Application on Google AppEngine (GAE), but due to a lot of limitations they have I'm afraid that I'm going to have to switch from GAE to my own server which is running Glassfish (or I can setup any other server if needed). Also I'm pla...
<p>Why not follow the info given in the original Google campfire ? There was a presentation by IBM on how to run an AppEngine app using DB2. They simply dropped the datanucleus-rdbms jar in the CLASSPATH, changed the connection URL etc, and ran it. Like in this PDF <a href="http://download.boulder.ibm.com/ibmdl/pub/sof...
Problem detecting Newlines in JavaScript Range Object <p>I have some javascript that manipulates html based on what the user has selected. For real browsers the methods I'm using leverage the "Range" object, obtained as such:</p> <pre><code> var sel = window.getSelection(); var range = sel.getRangeAt(0); va...
<p>Editing my post:</p> <p>Experimenting a bit, I find that sel.toString() returns new lines in contenteditable divs, while range.toString() returns newlines correctly in normal non-editable divs, but not in editable ones, as you reported.</p> <p>Could not find any explanation for the behaviour though.</p> <p>This i...
Taking credit card information online without processing -- how best to do so? <p>I have had a number of requests from clients wanting to take a customer's credit card number online and then process the payment in store at a POS of terminal. I'm wondering what the best method of doing this is.</p> <p>I don't want to s...
<p>I solved this problem by building a frontend to GPG and allowing the website owner to generate their own GPG keys. Then, all credit card data is GPG encrypted and can only be decrypted with the website owner's private key, which for additional security could be kept off the server if desired.</p>
Can I use the same instance of IndexSearcher in Lucene.Net by multiple threads concurrently? <p>I want to be able to search by multiple clients and index at the same time in Lucene.Net</p> <p>Is it possible and thread safe?</p> <p>Can the same instance of IndexSearcher be shared across threads?</p>
<p>The index search CAN and SHOULD be shared across threads.</p> <p>The trick is deciding when to refresh your searcher with a new snapshot of the index.</p> <p>I wrote an article showing how I coded sharing a searcher across threads while at the same time making sure that the searcher was always using an up-to-date ...
How do I bipass the following foreach in an XML parse with PHP if the field doesn't exist? <p>I'm parsing a posted encrypted and posted XML file sent to my site from another server.</p> <p>Currently the XML(decrypted) sorta looks like so:</p> <pre><code>&lt;?xml version='1.0' encoding='UTF-8' standalone='yes'?&gt; &l...
<p>You should check the existence of $tx->custom_fields and $tx->custom_fields[0] first and then use it further.</p>
Does iPhone OS consume more memory when I display 5 times the same UIImage inside multiple UIImageViews? <p>I didn't notice much performance lost by doing this. So I wonder if it doesn't hurt when I re-use the same UIImage multiple times at the same time inside multiple UIImageViews?</p>
<p>OK, I haven't profiled this, but... It shouldn't consume more memory. When you use a UIImageView, what happens is the CALayer that provides the visual appearance of all UIView subclasses on the iPhone, has it's content property set to a CGImage object. When you set up multiple UIImageView objects with the same image...
Python xml.dom and bad XML <p>I'm trying to extract some data from various HTML pages using a python program. Unfortunately, some of these pages contain user-entered data which occasionally has "slight" errors - namely tag mismatching.</p> <p>Is there a good way to have python's xml.dom try to correct errors or someth...
<p>You could use <a href="http://utidylib.berlios.de/" rel="nofollow">HTML Tidy</a> to clean up, or <a href="http://www.crummy.com/software/BeautifulSoup/" rel="nofollow">Beautiful Soup</a> to parse. Could be that you have to save the result to a temp file, but it should work.</p> <p>Cheers,</p>
How to make a Swing application touchable? <p>We developed a Swing GUI system running on PC, and the boss wants it to run on a special tablet PC too. Does anyone know what else we can do to achieve it? How to make a Swing GUI support touch operation?</p> <p>The touch-support driver of the tablet PC is necessary, of co...
<p>Most touch screens convert touches to mouse events. If yours does so as well you can simply use java.awt.event.MouseListener. </p>
How to add the .entrypoint directive to a method (dynamic assembly) <p>I want to create a simple application using the classes in System.Reflection.Emit. How can I add the enrypoint directive to the Main method?</p> <pre><code>AssemblyName aName = new AssemblyName("Hello"); AssemblyBuilder aBuilder = AppDomain.Current...
<p>Try this (I've put comments on modified lines):</p> <pre><code>AssemblyName aName = new AssemblyName("Hello"); AssemblyBuilder aBuilder = AppDomain .CurrentDomain .DefineDynamicAssembly(aName, AssemblyBuilderAccess.Save); // When you define a dynamic module and want to save the assembly // to the disc you ...
Thickbox --> IE8 --> Google Map Problem <p>we are using the solution from mapmaker.donkeymagic.co.uk to create a google map that is then being embeded into a webpage.</p> <p>An example of it working is here</p> <p><a href="http://www.fairlieyachtclub.com/erracms/pages/contact.aspx?articleid=15&amp;zoneid=16" rel="nof...
<p>Bonjour,</p> <p>Même problème d'affichage sous IE8, une GoogleMap ouverte dans Thickbox ne s'affichait pas complètement, le lien suivant m'a permi de résoudre cela rapidement :</p> <p><a href="http://www.korben.info/bug-avec-google-map-et-thickbox-3.html" rel="nofollow">Bug avec Google Map et Thickbox 3</a></p...
Avoiding using the same subquery multiple times in a query <p>In an MMORPG server I am refactoring, I have two tables. One for items, and one for spells. Each item has up to 5 spells, so I went with a sparse-matrix format, having 5 columns for spell IDs.</p> <p>The original devisers of this structure chose to use MyIS...
<p>It would have been more elegant to design the tables so that you didn't have 5 spellid columns in the same table - i.e by having an item_spell table that would allow any number of spells per item. Apart from being more future-proof (when you find you now need 6 spells), your query would become:</p> <pre><code>SELE...
Creating an Inputbox in C# using forms <p>Hello I'm currently creating an application which has the need to add server IP addresses to it, as there is no InputBox function in C# I'm trying to complete this using forms, but am very new to the language so not 100% as to what I should do.</p> <p>At the moment I have my m...
<p>In your main form, add an event handler for the event <strong>Click</strong> of button Add Ip Address. In the event handler, do something similar as the code below:</p> <pre><code>private string m_ipAddress; private void OnAddIPAddressClicked(object sender, EventArgs e) { using(SetIPAddressForm form = new SetIP...
HTML table is bigger than the browser's window <p>I have something like this:</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td&gt;&lt;nobr&gt;hello&lt;/nobr&gt;&lt;/td&gt; &lt;td&gt;this column can contain a lot of text, for some rows&lt;/td&gt; &lt;td&gt;&lt;nobr&gt;world&lt;/nobr&gt;&lt;/td&gt; &lt;t...
<p>Your example definitely behaves well as Zyphrax says.</p> <p>The problem you report can only happen if, in the long column, there is a word which is very large or the content has no whitespace in it. Is that the case? May be you are using <code>&amp;nbsp;</code> instead of spaces, and it is preventing the normal wr...
what does this security warning mean (.Net Process class)? <p>I am using VSTS 2008 + .Net 2.0 + C#. And I am running Code Analysis after build. I got the following confusing security warning. Here is the warning and related code, any ideas what is wrong? If there is security warning, how to fix it?</p> <pre><code>Syst...
<p>Your method calls Foo that calls into a Process.Start which is protected by a link demand for Full Trust. In order to avoid the problem that FxCop is warning you about, you should add a link demand or full demand for the same permissions to your method.</p> <p>You can fix it by adding to your method</p> <pre><code...
GLSL extracting modelmatrix from modelviewmatrix and viewmatrix <p>since in GLSL the modelmatrix is not available, i was wondering if it is possible to get it programatically from the gl_ModelViewMatrix and the "viewmatrix" which i would pass as a uniform?</p> <p>if yes, how?</p> <p>thank you!</p>
<p>You can obtain the model matrix by multiplying the modelview matrix with the inverse of your view matrix.</p> <p>gl_ModelViewMatrix * myViewMatrixInverse</p>
WCF and Javascript: Not Found <p>this occured when I called my WCF Service </p> <p>as follows: </p> <ol> <li>hosted WCF Service in IIS in name <code>testWCF</code>.</li> <li>web application name is <code>webWCF</code>. </li> </ol> <p>gave scriptreference as: <code>http://localhost/testWCF/mywcf.svc</code></p> <p>I...
<p>Isn't this a cross domain issue? I see that your WCF web service is hosted in IIS and accessible through <code>http://localhost/testWCF/mywcf.svc</code> while your web application is using the ASP.NET development server which means it is hosted on <code>http://localhost:SOME_PORT/webWCF</code>.</p> <p>AFAIK, AJAX i...
correct way to use variables in the javascript DOM <p>What is the correct way to format the document.formToSubmit.submit() line?</p> <pre><code> var formToSubmit = 'postcomment' + id; alert( ''+ formToSubmit +'' ); document.formToSubmit.submit(); </code></pre> <p>The formToSubmit variable seems to be cor...
<p>Simply put:</p> <pre><code>document.getElementById('postcomment' + id).submit(); </code></pre>
GCC 4.2.1 darwin Avoid duplicate symbols <p>I'm building application for iPhone OS 3.0 Due to bug in GCC 4.2.1 I'm adding -all_load flag to linker, to build it on iPhone OS 3.0 But then I get duplicate symbol _fill_fopen_filefunc in /Users/TMC2/Programming/Client/test/build/Debug-iphoneos/test.a(ioapi.o) and /Users/TM...
<p>Rerun the linker command omitting one of the libraries and see what happens. This is fairly straight forward if you pipe the build output to a file and just edit the linker statement. </p> <p>Since you are building with source it is worth a try to replace one of the source files that generate ioapi.o with somethi...
Custom component with combobox-like behaviour <p>I am trying to create a custom component in flex that consists of a Button, and a TileList directly below that button. On button click event the TileList should open/close. The component works fine, but when I add it to my main flex app, inside a VBox, it simply opens an...
<p>Take a look at using the PopUpManager. That will allow you to place the TileList so that it floats above other components when it's placed on the stage. You'll still need to figure out where to position it on the stage, but you can use the localToGlobal() and globalToLocal() methods to help you position the popup Ti...
How do I preserve the form value after refresh browser? <p>I have one simple JSP having four buttons ( Button1 , Button2 , Button3 and Button4).</p> <p>The button value set into hidden field when I click on button. </p> <p>I need to get the latest button click value after refresh the page ( preserve the button value...
<p>You might try using cookies, for example:</p> <pre><code>function one(tab){ createCookie("savedvar",tab,1); } </code></pre> <p>and then accessing it by: <code>readCookie("savedvar")</code></p> <p>Using the code from: <a href="http://www.quirksmode.org/js/cookies.html" rel="nofollow">http://www.quirksmode.org/...
F# - What's the "it" keyword? <p>I am a newb to F#, just began learning it this afternoon.</p> <p>What I've noticed is that when getting type info via the fsi, I get the following info:</p> <pre><code>val it : (char list -&gt; string -&gt; string list) = &lt;fun:clo@0&gt; </code></pre> <p>If I understand correctly, ...
<p>In the F# interactive command line, "it" is an identifier that gets bound to the last expression evaluated. For example:</p> <pre><code>&gt; let a = 5;; val a : int = 5 &gt; a;; val it : int = 5 &gt; it;; val it : int = 5 &gt; </code></pre>
When Using FormView with Templates, Is It Possible to Reference Controls Statically? <p>Having:</p> <pre><code>&lt;asp:FormView ID="frmEmployee" runat="server"&gt; &lt;EditTemplate&gt; &lt;asp:TextBox ID="txtFirstName" runat="server" /&gt; &lt;/EditTemplate&gt; &lt;/asp:FormView&gt; </code></pre> <p>o...
<p>Not that I know of. Are you trying to reference statically so the compiler will validate you are referencing valid controls at compile-time, or trying to reference it statically so it is easier to work with?</p> <p>If it is the latter I ended up just creating a function that gets and sets values for me in a FormVi...
Understanding sha-1 collision weakness <p>According to various sources, attacks looking for sha-1 collisions have been improved to 2^52 operations:</p> <p><a href="http://www.secureworks.com/research/blog/index.php/2009/6/3/sha-1-collision-attacks-now-252/">http://www.secureworks.com/research/blog/index.php/2009/6/3/s...
<p>Well good hash functions are resistant to 3 different types of attacks (as the article states). </p> <p>The most important resistance in a practical sense is 2nd pre-image resistance. This basically means given a message M1 and Hash(M1)=H1, it is hard to find a M2 such that Hash(M2)=H1. </p> <p>If someone found a ...
Profiling a VxWorks system <p>We've got a fairly large application running on VxWorks 5.5.1 that's been developed and modified for around 10 years now. We have some simple home-grown tools to show that we are not using <em>too</em> much memory or <em>too</em> much processor, but we don't have a good feel for how much ...
<p>I've done a lot of performance tuning of various kinds of software, including embedded applications. I won't discuss memory profiling - I think that is a different issue.</p> <p>I can only guess where the "well-known" idea originated that to find performance problems you need to measure performance of various parts...
relocation R_X86_64_32 against a local symbol' error <p>I am trying to install Subversion with Apache support. I installed <code>apr</code>, <code>apr-utils</code>, <code>neon</code>, and <code>OpenSSL</code> with the <code>--enable-shared</code> flag. However, I get the following error when trying to install subversio...
<p>I figured out that the problem was with the openssl install. Reinstalling openssl with enable-shared worked.</p>
../ image path <p>im trying to reach an image that is located in a folder outside my site. I tried to go outside my folder by putting ../ but this end with an error. I also tried to give an absolute path but there are spaces in there (like "documents and settings\") and this also doesnt work</p> <p>does anybody have a...
<p>You can't access files outside your document root from the client side HTML. If you can't move the files under the document root, then you can either configure your server to allow access to that one directory, or write a server side script to relay the files.</p> <h2>Reconfigure server...</h2> <p>If you're using ...
How to create a form in a dll and have it show up in the taskbar? <p>I create a dll and insert in form i compile it successfully.</p> <p>I Need Help?</p> <p>The Form caption does not show in windows task bar. </p>
<pre><code>type TMyForm = class(TForm) protected procedure CreateParams(var Params: TCreateParams); end; implementation procedure TMyForm.CreateParams(var Params: TCreateParams); begin ExStyle := ExStyle or WS_EX_APPWINDOW; end; </code></pre>
Getting started in Symfony... flow of CLI operations, etc <p>I sure hope this is an ok question to ask here. I realize it isn't a specific programming Q, but hopefully it does have an answer.</p> <p>I've been trying to learn Symfony (PHP framework) and I've gone through the Jobeet tutorial as well as read through the...
<h1>Come up with a concept</h1> <p>First of all think of an interesting project that you would like to build. The default for this kind of project is usually a blog, but if that does not float your boat, how about something like a twitter clone or a reddit clone?</p> <h1>Build your model</h1> <p>In Symfony, the thin...
Alternatives to NativeWindow for subclassing <p>I am subclassing a Win32 window in managed code using NativeWindow. However, I'm encountering a bug in either my code or with NativeWindow that throws an exception when the parent is closed. The code I'm using is this:</p> <pre><code>public partial class ThisAddIn { ...
<p>It isn't exactly clear to me why it would crash. Use Debug + Exception, Thrown flag to find out where the ThreadAbort exception is coming from. One thing is definitely wrong, you should detach the handle when the window is destroyed. You could do this by watching for the WM_NCDESTROY message:</p> <pre><code>prot...
Routing Rule for ASP.NET Products Website <p>I am building a product catalog for a customer website under ASP.NET using .NET Framework 3.5 SP1. Each product has a part number and an OEM part number (all globally unique).</p> <p>For SEO purposes I would like the OEM part number to be as close as possible to the actual...
<p>If there are specific formats to the part numbers you can use regex constraints on the route like this:</p> <pre><code>routes.MapRoute( "Part number", "{partNumber}", new { controller = "Part", action = "Display" }, new { partNumber = @"\d+" // part number must be numeric } ); </code...
What's the max JSON data size that can be loaded by Dojo ComboBox/Filtering Select Component? <p>I'm developing a form using the Zend Framework and utilising dojo. One part of the form is gathering a users contact details and address. The issue I am hitting is using the FilteringSelect or ComboBox dojo component to s...
<p>Youch, that's a big list of data points. I'd say it's really dependent on the user's browsers and settings. And tolerance for waiting.</p> <p>If you are able, I'd say to put the data behind a web service and use the the <a href="http://docs.dojocampus.org/dojox/data/QueryReadStore" rel="nofollow">dojox.data.Query...
Unable to build SciPy on OS X 10.5.7 <p>I am trying to install SciPy following these instructions: <a href="http://www.scipy.org/Download" rel="nofollow">http://www.scipy.org/Download</a></p> <p>And constantly getting error to build them for OS X Lepeord 10.5.7:</p> <p>dyld: lazy symbol binding failed: Symbol not fou...
<p>Is it absolutely necessary for you to build SciPy from source? It seems like it would be much easier to install SciPy on Mac OS X Leopard by using the <a href="http://macinscience.org/?page%5Fid=6" rel="nofollow">SciPy Superpack Installer</a> (which is mentioned on the <a href="http://www.scipy.org/Download" rel="n...
Maven vs. AspectJ - Example? <p>MY aspect works great from Eclipse with AspectJ plugin, however if I try to use it with Maven I get .... nothing. </p> <p>I tried this <a href="http://mojo.codehaus.org/aspectj-maven-plugin/includeExclude.html">http://mojo.codehaus.org/aspectj-maven-plugin/includeExclude.html</a></p> <...
<p>Without seeing your POM it's hard to say, one thing to check is that Maven expects your aspects to be under src/main/aspect rather than src/main/java by default.</p> <p>You also need to ensure the aspectj runtime library is on your classpath (in Eclipse it is included by the AJDT classpath container.</p> <p>For ex...
How should I store product and product image data for an online store? <p>I'm working on a storefront application in PHP with MySQL. I'm currently storing my data in 4 tables: one for product lines, one for specific products within those product lines, one for product images, and one which specifies which images are li...
<p>Yes - just write a single query that will retrieve all that information in one shot.</p> <p>I'm a little rusty on this, but you can lookup the queries in mysql reference.</p> <ol> <li>create a query that joins these tables on the appropriate keys</li> <li>you need to select the first item from a subquery that retr...
Learning Win 32 API programming from theForger's Win32 API Programming Tutorial <p>Im trying to learn Win 32 API programming from theForger's Win32 API Programming Tutorial. Should I choose Visual C++ -> Win 32 Project or Windows Form Applicationto get started? Thanks</p>
<p>You should choose the Win32 option.</p> <p><a href="http://windowsclient.net/" rel="nofollow">Windows Forms</a> is a <a href="http://www.microsoft.com/net/" rel="nofollow">.NET</a> thing, completely different from the Win32 API. <a href="http://winprog.org/tutorial/" rel="nofollow">theForger's tutorial</a> is abou...
How to index and search .doc files <p>I have an application that needs to have .doc files uploaded to it. These documents should then be index and the whole collection of documents should be searchable. This will run on a Windows Server, without Word installed, using IIS and SqlServer, but I'd rather not be tied to Sql...
<p>As far as a solution that didn't require an external program, it looks like the iFilter solution is the way to go (even though you might count that as an external program).</p> <p>Here's a simple CodePlex article and code on how it can be done: <a href="http://www.codeproject.com/KB/cs/IFilter.aspx" rel="nofollow">...
How to set clipboard to copy files? <p>In my application, I allow the user to select items that correspond to files on a disk. When the user presses Ctrl+C, I want the file to be sent to the clipboard, where the user can then paste the file somewhere else.</p> <p>I want to implement it in a way so that the user can co...
<p>To catch the CTRL + C you can check the Keys Pressed on the KeyPress event. And to copy the file(s) use something similar to below:</p> <pre><code>private void CopyFile(string[] ListFilePaths) { System.Collections.Specialized.StringCollection FileCollection = new System.Collections.Specialized.StringCollection();...
Surprising software vulnerabilities or exploits? <p>What are the most strange/sophisticated/surprising/deeply hidden software vulnerabilities or exploits you have ever seen? Places in code where you thought that there is no danger hidden, but were wrong?</p> <p>[To clarify: Everybody knows SQL injections, XSS or buffe...
<p>My favorite and most impressive I've seen so far are a class of cryptography techniques know as <a href="http://en.wikipedia.org/wiki/Side-channel%5Fattack">Side Channel Attacks</a>.</p> <p>One type of a side channel attack uses power monitoring. Encryption keys have been recovered from smart card devices by carefu...
Second Frontmost App? <p>I'm looking for a way to determine the second frontmost app. Here's what I mean by that.</p> <p>Let's say I launch three apps in this order: Xcode, Interface Builder, and my application. If I press Command-tab, I should see four applications in the switcher: (from left to right) my applicat...
<p>At launch, wouldn't the second frontmost application be the last application run?</p>
AS3: Extending The Dictionary Class - Accessing Stored Data <p>So I want to extend the dictionary class. Everything works so far except that in some of my methods that need to reference the dictionary's content I make a call like:</p> <pre><code>this[ key ] </code></pre> <p>It doesn't like that. It just tells me that...
<p>from what you say, i am quite sure you did not declare <code>ArrayExtender</code> as <code>dynamic</code> in ECMAscript array access and property access are semantically equivalent ... #1069 happens, if you access an undefined property, on a <a href="http://www.adobe.com/devnet/actionscript/articles/actionscript%5Ft...
Empty set returned from query <p>Any help is greatly appreciated.</p> <p>I have a table hospital:</p> <p> Nurse + Year + No.Patients<br> A001 |2000 | 23 <br> A001 |2001 | 30 <br> A001 |2002 | 35 <br> <br> B001 |2000 | 12 <br> B001 |2001 | 15 <br> B001 |2002 | 45 <br> <br> C001 |2000 | 50 <br>...
<p>Try this:</p> <pre><code>SELECT nurse, (max(nopats) - min(nopats)) AS growth FROM hospital WHERE year BETWEEN 2000 AND 2002 GROUP BY nurse ORDER BY growth DESC LIMIT 1; </code></pre> <p>Result: B001 | 33 due to LIMIT 1; just leave it away if you want more results.</p>
ASP.NET MVC, autocomplete textbox, caching? <p>Using ASP.NET MVC, I've implemented an autocomplete textbox using the approach very similar to the implementation by Ben Scheirman as shown here: <a href="http://flux88.com/blog/jquery-auto-complete-text-box-with-asp-net-mvc/" rel="nofollow">http://flux88.com/blog/jquery-a...
<p>You have a couple things to ask yourself:</p> <ol> <li>Is the data I'm pulling back dynamic?</li> <li>If not, how often do I expect this call to occur?</li> </ol> <p>If the answers are, 1- not really and 2 - call to happen frequently, you should cache it.</p> <p>I don't know how your data access is setup, but I s...
How to get Selenium and TestNG to open one browser to run tests in multiple classes <p>I am using Selenium with TestNG to test a website. I have created tests using the Selenium IDE and exported them to TestNG with each test being a method in a class. Eg,</p> <p>For login tests there is a Login class which has methods...
<p>Today I have found the answer that works for me. Give me a few minutes to gather all code samples :)</p> <p>Init.java</p> <pre><code>//base class that will be called before all tests @Test(groups = "init") public class Init{ DefaultSelenium browser; public void start(ITestContext itc){ browser = ...
displaying errors in jsf fragment with <t:message> tag <p>I was just wondering if I could display errors on a separate jsp fragment.</p> <p>I have a requirement where I have to display hyperlink errors (i.e clicking any error would focus to respective input field)</p> <p>For example, if I have a form and there are 20...
<p>I take it that t:message is the <a href="http://www.jsftoolbox.com/documentation/tomahawk/09-TagReference/tomahawk-message.html" rel="nofollow">Tomahawk control</a>.</p> <p><hr /></p> <p>Perhaps a custom JSF control would fit the bill - sometimes you can't manipulate the existing tags to get the exact output you w...
Tail recursive method to multiple 2 numbers <p>Tail recursive method to multiple 2 numbers</p> <pre><code>public static int Multiply2(int x, int y) { return MulTail(x, y, x); } public static int MulTail(int x, int y, int result) { if (y == 0 || x == 0) return 0; if (y == 1) return result; ...
<p>A method for multiplication using only addition, subtraction, and doubling is called <a href="http://en.wikipedia.org/wiki/Ancient%5FEgyptian%5Fmultiplication" rel="nofollow">Ancient Egyptian Multiplication</a>. This method is more efficient than what you've proposed and can be formulated into a tail-recursive imple...
Google search API versus MS SQL Server Full Text Indexing? <p>We are working on websites for our clients and we want to adopt a search solution that can be easily reused. Which one should we go after ? Should we use Google Search API or should we use MS Sql Server Full Text Indexing and the CONTAINS &amp; FREETEXT pred...
<p>We use SQL Server full text indexing here on Stack Overflow and it works reasonably well -- but I can <em>only</em> recommend it for 2005 and 2008, the versions we use it on. I heard it's much worse in 2000. There are quirks (stopword lists, etc) but nothing serious. It's fast and does what it says on the tin, mostl...
How can I use Sphinx' Autodoc-extension for private methods? <p>I am using Sphinx for documenting my python project. I have the autodoc extension enabled and have the following in my docs.</p> <pre><code>.. autoclass:: ClassName :members: </code></pre> <p>The problem is, it only documents the <a href="http://sphin...
<p>if you are using sphinx 1.1 or above, from the sphinx documentation site at <a href="http://sphinx.pocoo.org/ext/autodoc.html">http://sphinx.pocoo.org/ext/autodoc.html</a>,</p> <pre><code>:special-members: :private-members: </code></pre>
ADO.NET Entity Framework - Pre-Generate Views - <p>We are using ADO.NET Entity for our ASP.NET application.</p> <p>I have read that the pre-generated views improves the performance. Referred to the blog post, </p> <p><a href="http://blogs.msdn.com/adonet/archive/2008/06/20/how-to-use-a-t4-template-for-view-generation...
<p>I've been wondering the same thing and been doing some digging.</p> <p>As far as I can tell the generated class file contains an assembly level attribute, <code>EntityViewGenerationAttribute</code>, which defines the class type that contains the pre-compiled view. Then, and here im only making educated guesses, at ...
Formatting associative array declaration <p>When declaring an associative array, how do you handle the indentation of the elements of the array? I've seen a number of different styles (PHP syntax, since that's what I've been in lately). This is a pretty picky and trivial thing, so move along if you're interested in m...
<p>Personally I always go:</p> <pre><code>$array = array( '1' =&gt; '2', 3 =&gt; 4, ); </code></pre> <p>The indent is one tab level (typically 4 spaces, sometimes 2). I detest excessive white-space. This works well with nested arrays.</p>
How do you include another js file in Google's v8? <p>How do you include another script file inside a .js script file in v8?<br /> There's the &lt;script&gt; tag in HTML but how can it be done inside a v8 embedded program?</p>
<p>You have to add this functionality manually, here is how I did it:</p> <pre><code>Handle&lt;Value&gt; Include(const Arguments&amp; args) { for (int i = 0; i &lt; args.Length(); i++) { String::Utf8Value str(args[i]); // load_file loads the file with this name into a string, // I imagine ...
Freeware pivot table component for Delphi? <p>Is there a pivot table component for Delphi that is opensource or freeware?</p>
<p>As far as I know there is no freeware pivot component for Delphi. Look up in Torry.net.</p> <p>The most known pivot component in delphi is ExpressPivotGrid Suite from Develop Express.</p>
concatenate string to char in C# <p>I need to concatenate '*', which is a string, to a character in an array.</p> <p>For example:</p> <pre><code> int count=5; string asterisk="*"; char p[0]='a'; char p[1]='b'; char p[2]='a'; char p[3]='b'; char p[4]='b'; for(int i=0;i&lt;count;i++) { asterisk=asterisk...
<p>You cannot concatenate a string to a character. A string is a collection of characters, and won't "fit" inside a single character.</p> <p>You probably want something like</p> <pre><code>char asterisk = '*'; string []p = new string[] { "a", "b", "a", "b" }; p[0] = p[0] + new string(asterisk, count); </code></pre>
Does PHP have an equivalent to the ||= operator? <p>I'm wanting to assign a variable only it hasn't already been assigned. What's the PHP way of doing the following?</p> <pre><code>$result = null; $result ||= check1(); $result ||= check2(); $result ||= "default"; </code></pre> <p>I checked the <a href="http://us3.ph...
<p><a href="http://au2.php.net/isset" rel="nofollow"><code>isset()</code></a> is the usual way of doing this:</p> <pre><code>if (!isset($blah)) { $blah = 'foo'; } </code></pre> <p><strong>Note:</strong> you can assign <code>null</code> to a variable and it will be assigned. This will yield different results with <c...
Filtering data in an NSPopUpButtonCell in an NSTableView <p>I have an NSTable which includes a column of NSPopUpButtonCells. I would like to filter the NSPopUpButtonCell based on the contents of another column in the table. This feels like something that should have a fairly easy solution, but at the minute the solutio...
<p>Turned out that there was an easy solution to this one. I was using an NSArrayController to control the rows in the table. Each row was an object of class InputCell. I added a method that returned an NSArray to the InputCell class and this method used [self valueForKey: ] to create a different array depending on th...
How to write to the Output window in Visual Studio? <p>Which function should I use to output text to the "Output" window in Visual Studio?</p> <p>I tried <code>printf()</code> but it doesn't show up.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/aa363362%28VS.85%29.aspx">OutputDebugString</a> function will do it.</p> <p>example code</p> <pre><code> void CClass::Output(const char* szFormat, ...) { char szBuff[1024]; va_list arg; va_start(arg, szFormat); _vsnprintf(szBuff, sizeof(szBuff), s...
Can I change the text of a label in a masterpage when loading a content page? <p>I have a label in a master page (sample.master) called lblHeading.</p> <p>I want to dynamically change the text of the label when I load the content page.</p> <p>I need to do this because I want to change the heading to something meaning...
<p>yes, you can in this very simple way........</p> <pre><code>((Label)Master.FindControl("lblHeading")).Text = "your new text"; </code></pre>
Using ASP.NET routing to serve static files <p>Can ASP.Net routing (not MVC) be used to serve static files?</p> <p>Say I want to route</p> <pre><code>http://domain.tld/static/picture.jpg </code></pre> <p>to</p> <pre><code>http://domain.tld/a/b/c/picture.jpg </code></pre> <p>and I want to do it dynamically in the s...
<p>Why not use IIS to do this? You could just create redirect rule to point any requests from the first route to the second one before the request even gets to your application. Because of this, it would be a quicker method for redirecting requests.</p> <p>Assuming you have IIS7+, you do something like...</p> <pre><c...
Entity framework: ObjectContext get generated SQL change script? <p>Is there a way to get all the SQL change script of the object context?</p> <p>Note: I am not talking about ObjectQuery.ToTraceString();</p>
<p>No unfortunately there isn't anything 'in' the product and available directly off the ObjectContext.</p> <p>However you should take a look at Jarek's TracingProvider, that injects a layer between the EF and SqlClient to do logging etc.</p> <p>Read about it <a href="http://blogs.msdn.com/jkowalski/archive/2009/06/1...
How to draw line of ten thousands of points with WPF within 0.5 second? <p>I am writing <a href="http://en.wikipedia.org/wiki/Windows%5FPresentation%5FFoundation">WPF</a> code to show a real-time plot which is a connected line containing about 10,000 points. It takes about 5 seconds to show a picture in my computer. Do...
<p><a href="http://msdn.microsoft.com/en-us/magazine/dd483292.aspx">Charles Petzold</a> does exactly that. It is even faster on my host (&lt; 0.3 secs), and the point's are even DataBound!! ;)</p> <p><a href="http://khason.net/blog/how-to-high-performance-graphics-in-wpf/">Tamir Khason</a> does this also, with lines a...