input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Need tips on how to prioritize and schedule a bunch of work items <p>It took me some time, but I've finally managed to write down all the tasks that need to go into Version 1.0 of the software product I'm working on. </p>
<p>The list is almost 1000 items long.</p>
<p>We are a 3-person team, and we've somehow managed ... | <p>Prioritize ruthlessly. 1000 action items is a lot, and the odds are that as you go you'll modify some, toss others, and add new ones. Your list will not survive the things you learn by actually building the software, and if you don't do the most important stuff first, you'll end up with a mess.</p>
<p>For every i... |
Which C++ Library for CGI Programming? <p>I'm looking at doing some work (for fun) in a compiled language to run some simple tests and benchmarks against php.</p>
<p>Basically I'd like to see what other people use for C++ CGI programming. (Including backend database, like mysql++ or something else)</p>
| <p>I'm not sure exactly what you're looking for, but there is a C++ web framework called wt (pronounced "witty"). It's been kept pretty much up to date and if you want robust C++ server-side code, this is probably what you're looking for.</p>
<p>You can check it out and read more at the <a href="http://www.webtoolkit.... |
What's the best way to expose multiple objects to a view in ASP.NET MVC? <p>I'm kind of new to ASP.NET MVC and to the MVC pattern in general but I'm really digging the concept and the rapidity with which I can compose an app. One thing that I'm struggling with is how to expose more than one object to a view. I use a ... | <p>You have two primary options and either could work well depending on your application.</p>
<p>1) Just put objects into the ViewData collecion. This works well if you have lots of different controllers that pass different data to different views. It also depends on how much boxing/unboxing you want from object as ... |
Is this a bug with PHP array accessing? <p>I ran into this bug where an element of an array, if its index is the string "0", is inaccessible. </p>
<p>It's not a bug with unserialize, either, as this occurred in my code without invoking it.</p>
<pre><code>$arr = unserialize('a:1:{s:1:"0";i:5;}');
var_dump($arr["0"]); ... | <p>Yes, it looks as though it is a bug, related to PHPs automatic conversion of strings to integers. More information is available here: <a href="http://bugs.php.net/bug.php?id=43614" rel="nofollow">http://bugs.php.net/bug.php?id=43614</a></p>
<pre><code>var_dump( $arr ); // => array(1) { ["0"]=> int(5) }
$arr... |
Can SQL Server Express be used to effectively administrate a SQL Server Standard/Enterprise installation? <p>We have a number of MS SQL Server 2005 installations (both Standard and Enterprise editions) on our webservers. From time to time I need to administrate them from home. Right now I'm using Remote Desktop to conn... | <p>See this question:<br />
<a href="http://stackoverflow.com/questions/117347/whats-the-difference-between-sql-server-management-studio-and-the-express-versi">http://stackoverflow.com/questions/117347/whats-the-difference-between-sql-server-management-studio-and-the-express-versi</a></p>
<p>Also, if you have any trou... |
How safe is Greasemonkey? <p>I've never actually used greasemonkey, but I was considering using it.
Considering that GreaseMonkey allows you to let random people on the Internet change the behavior of your favorite websites, how safe can it be?
Can they steal my passwords? Look at my private data? Do things I didn't wa... | <p><em>Considering that GreaseMonkey allows you to let random people on the Internet change the behavior of your favorite websites, how safe can it be?</em></p>
<p>It's as safe as you allow it to be - but you aren't very clear, so let's look at it from a few perspectives:</p>
<h2>Web Developer</h2>
<p>Greasemonkey c... |
Profiling Qt application that uses plugins <p>I have a medium sized application written in c++ using Qt. I wanted to profile things to see where my least performant code was so I compiled everything with <code>-pg</code>.</p>
<p>However, my application makes use of a <em>lot</em> of plugins using the QTPlugin mechanis... | <p>If you can use it, I think <a href="http://valgrind.org/" rel="nofollow">Valgrind's</a> callgrind only needs debug symbols (-g) to profile code. I'm not sure if it works with dynamically linked objects, though.</p>
|
Is there a good NumPy clone for Jython? <p>I'm a relatively new convert to Python. I've written some code to grab/graph data from various sources to automate some weekly reports and forecasts. I've been intrigued by the Jython concept, and would like to port some Python code that I've written to Jython. In order to ... | <p>I can't find anything that's a clone of numpy, but there's a long list of Java numerics packages <a href="http://math.nist.gov/javanumerics/">here</a> - these should all be usable from Jython. Which one meets your requirements depends on what you're doing with numpy, I guess.</p>
|
Is Flex ready for prime time? <p>I'm working on a project that currently has zero users but we would like to scale up to potentially hundreds. Currently we are running on a MySQL database with AMFPHP interacting with Flex. We used Flex because of its robust graphic features (important to this project) and because the... | <p>Short answer, Yes. There are already many prime-time Apps using Flex as their UI development platform. If you go to the Adobe site they showcase quite a few.</p>
<p>Speaking personally, I chose Flex for two reasons, first was that, although you probably can do much of what Flex does in HTML or with an appropriate... |
How to load viewController from a nib file <p>I have a Tab bar bases project (along with navigation control), inside a particular tab there is a tableViewLoaded , when i click on the table rows it shoud open another view , ie it pushes another controller , i have a view controller in the MainWindow.nib for this view al... | <p>You should generally use one view controller-per-nib file; it makes things much easier. A few things to check:</p>
<ol>
<li>Is your view controller object being created (set a break point in its init, loadView, or viewDidLoad methods)</li>
<li>Is your view being displayed (set a breakpoint in your viewWillAppear: o... |
What is the meaning of "..::." in C#? <p>I saw this signature on the ListView class:</p>
<pre><code>public ListView..::.ListViewItemCollection Items { get; }
</code></pre>
<p>When I saw that, "What?!"</p>
<p>I searched "dot dot colon colon dot" and "..::." on Google with no result.</p>
<p><img src="http://i.stack.i... | <p>That's not C#; that's JScript. In C#, it would be:</p>
<p>public ListView.ListViewItemCollection Items { get; }</p>
<p>It's a little different because ListViewItemCollection is an inner class of ListView.</p>
<p>I'm guessing that you saw this looking at <a href="http://msdn.microsoft.com/en-us/library/system.wind... |
XML Parsing <p>Hi All i want add the new node as parent node of the old nodes in XML using C#.for example node have the following XMl file</p>
<pre><code><bookstore>
<books>
<author>
</author>
</books>
</bookstore>
</code></pre>
<p>like that now i want add the ne... | <p>Try this:-</p>
<pre><code>XmlDocument doc = new XmlDocument();
doc.Load("BookStore.xml");
XmlElement newNode = doc.CreateElement("newnode");
doc.DocumentElement.AppendChild(newNode);
newNode.AppendChild(doc.SelectSingleNode("/bookstore/books"));
doc.Save("BookStore.xml");
</code></pre>
|
How to count lines of code including sub-directories <p>Suppose I want to count the lines of code in a project. If all of the files are in the same directory I can execute:</p>
<pre><code>cat * | wc -l
</code></pre>
<p>However, if there are sub-directories, this doesn't work. For this to work cat would have to have a... | <p>First you do not need to use <code>cat</code> to count lines. This is an <a href="http://en.wikipedia.org/wiki/Cat_%28Unix%29#Useless_use_of_cat">antipattern called Useless Use of Cat</a> (UUoC). To count lines in files in the current directory, use <a href="https://en.wikipedia.org/wiki/Wc_%28Unix%29"><code>wc</cod... |
Adjusting XML config files from a script <p>I'm working on automating the configuration of several JBoss servers, which involves editing a substantial number of XML files.</p>
<p>I'd like to script all these changes as much as possible. But the "standard" tools (sed, grep et al) do not work well with XML. Without nece... | <p>You'll find more answers in my <a href="http://stackoverflow.com/questions/91791/grep-and-sed-equivalent-for-xml-command-line-processing" rel="nofollow" title="Grep and Sed Equivalent for XML">previous question</a>. <a href="http://xmlstar.sourceforge.net/" rel="nofollow" title="XMLStarlet tool collection">xmlstar</... |
Dynamically updated graphs on a web page - howto? <p>I need to understand a good way to design a web page with dynamically updated graphs. It should be something close to what stock market graphs look like (e.g. <a href="http://finance.google.com/finance?q=NASDAQ%3AGOOG" rel="nofollow">Google Finance</a>), although wit... | <p>Try this: <a href="http://code.google.com/p/flot/" rel="nofollow" title="JQuery Flot">JQuery Flot</a></p>
<p>
Flot is a JQuery plugin to plot graphs. You keep replotting in-place with the latest data at the desired frequency to generate a dynamically updated graph. It is based on the <canvas> tag. We use it s... |
Schema for a multilanguage database <p>I'm developing a multilanguage software. As far as the application code goes, localizability is not an issue. We can use language specific resources and have all kinds of tools that work well with them.</p>
<p>But what is the best approach in defining a multilanguage database sch... | <p>What do you think about having a related translation table for each translatable table?</p>
<blockquote>
<p>CREATE TABLE T_PRODUCT (pr_id int, PRICE NUMBER(18, 2))</p>
<p>CREATE TABLE T_PRODUCT_tr (pr_id INT FK, languagecode varchar, pr_name text, pr_descr text)</p>
</blockquote>
<p>This way if you have mul... |
Dynamic Id's in JSF/Seam <p>Got a little problem with a Seam application I'm working on and I was wondering if anyone knows a way round it. I've got a form in my application that uses AJAX to show certain input boxes depending on an item in a dropdown box. The code works fine except for setting the ID's in my input b... | <p>You see why they don't let you set the ID, right? JSF takes over id creation because you're in a repeated loop of components and, if they let you just set the id, you'd end up with duplicate IDs, which wouldn't help you anyway.</p>
<p>Without knowing WHY you want to set the ID explicitly, it's hard to give you a w... |
How can I launch the default media player from a .NET application? <p>I need to launch a media file from a URL from within my c# .NET application. Is there any way to do this natively in .NET? I don't need an embedded player, I just need the default player to launch. I have tried </p>
<pre><code>System.Diagnostics.Pro... | <p>If you enter an URL it will be handled with the program registered to that URL format, in your case the default web browser.</p>
<p>What format are the media in? You can get associated program for an extension and then run that program with the url as parameter.
See:
<a href="http://stackoverflow.com/questions/2495... |
Drag'n'drop one or more mails from Outlook to C# WPF application <p>I'm working on a windows client written in WPF with C# on .Net 3.5 Sp1, where a requirement is that data from emails received by clients can be stored in the database. Right now the easiest way to handle this is to copy and paste the text, subject, con... | <p>I found a great <a href="http://www.codeproject.com/KB/office/outlook%5Fdrag%5Fdrop%5Fin%5Fcs.aspx">article</a> that should do exactly what you need to. </p>
<p><strong>UPDATE</strong></p>
<p>I was able to get the code in that article working in WPF with a little tweaking, below are the changes you need to make.</... |
Threaded loading (waiting) screen <p>I'm looking for a generic method to implement a wait screen during long operations. I have used threading a few times before, but I have the feeling that I implemented it either very poorly, or with way too much hassle (and copy/pasting - the horror!).</p>
<p>I want to keep this as... | <p>Your problem is that your getting a cross thread exception when your trying to pass your Worker thread data to your ui thread. what you need to do is check InvokeRequired and begininvoke before setting the controls on your ui so you don't get the error like so:</p>
<pre><code>Private Sub work_CrossThreadEvent(ByVal... |
Javascript: how do I determine if a link targets the same domain as the page it resides on? <p>For the purposes of tracking non-HTML documents via google analytics, I need the mentioned algorithm. It should:</p>
<ul><li>not hard-code the domain</li>
<li>ignore the protocol (i.e. http/https)</li>
<li>not worry about th... | <p>I would like to point out that, if you're on so.com, the following links are URLs within the same domain:</p>
<ul>
<li><a href="http://test.so.com" rel="nofollow">http://test.so.com</a></li>
<li><a href="http://so.com/index" rel="nofollow">http://so.com/index</a></li>
<li>index</li>
<li>/index</li>
<li>#</li>
<li>/... |
Get dimensions of JPEG in C++ <p>I need to get at the image dimensions of a JPEG in C++. I'm looking for either a fairly simple way to do it, or a smallish library that provides that functionality. I'm working in C++ on OpenVMS, so any external libraries may have to be adapted to compile on our systems - so please don'... | <p>You have this <a href="http://carnage-melon.tom7.org/stuff/jpegsize.html" rel="nofollow">C function</a> which may extract the relevant data for you.</p>
<blockquote>
<p>This is a C routine but should compile fine with C++.<br>
Pass it a normal FILE pointer (from fopen) to the beginning of a jpeg file and two in... |
How can I change HTML attribute names with jQuery? <p>I would like to change all the names of the attributes where <code>class="testingCase"</code> throughout all my whole html document.</p>
<p>e.g. Change:</p>
<p><code><a class="testingCase" href="#" title="name of testing case">Blabla</a></code>
<br/><... | <p>I don't think you can "rename" an attribute, but you can create new attributes and remove other ones...</p>
<pre><code>$('a.testingCase[title]').each(function() {
var $t = $(this);
$t
.attr({
newTitleName : $t.attr('title'),
})
.removeAttr('title')
;
});
</code></pre>... |
Using dates in the "where" clause of HQL query <p>I am using the <a href="http://www.sqlite.org/" rel="nofollow">SQLite</a> database and have the following persistent class (simplified):</p>
<pre><code>public class Project
{
public virtual int Id { get; set; }
public virtual DateTime StartDate { get; set; }
}
... | <p>If you're regularly querying against months, days, years, you shouldn't really be storing your date as a DateTime column - it makes the queries incredibly inefficient. You could easily create a "Month" column and query against that (and your DBA would love you again)</p>
|
How can I create multidimensional arrays in Perl? <p>I am a bit new to Perl, but here is what I want to do: </p>
<pre><code>my @array2d;
while(<FILE>){
push(@array2d[$i], $_);
}
</code></pre>
<p>It doesn't compile since <code>@array2d[$i]</code> is not an array but a scalar value.</p>
<p>How should I declare... | <p>To make an array of arrays, or more accurately an array of arrayrefs, try something like this: </p>
<pre><code>my @array = ();
foreach my $i ( 0 .. 10 ) {
foreach my $j ( 0 .. 10 ) {
push @{ $array[$i] }, $j;
}
}
</code></pre>
<p>It pushes the value onto a dereferenced arrayref for you. You should be abl... |
Do i need to dispose of this Image instance? <p>I'm making a simple Image Debugger Visualizer. Code is below. I'm not sure if i need to manually dispose of the Image instance? Because i'm making a windows Form window and the PictureBox inside that contains my dynamic image .. do i need to add some special code when the... | <p>Change your Show method to this:</p>
<pre><code>protected override void Show(IDialogVisualizerService windowService,
IVisualizerObjectProvider objectProvider)
{
Image image = (Image) objectProvider.GetObject();
using (Form form = new Form())
{
PictureBox pictu... |
Why override operator()? <p>In the <a href="http://www.boost.org/doc/html/signals.html">Boost Signals</a> library, they are overloading the () operator.</p>
<p>Is this a convention in C++? For callbacks, etc.?</p>
<p>I have seen this in code of a co-worker (who happens to be a big Boost fan). Of all the Boost goodnes... | <p>One of the primary goal when overloading operator() is to create a functor. A functor acts just like a function, but it has the advantages that it is stateful, meaning it can keep data reflecting its state between calls.</p>
<p>Here is a simple functor example :</p>
<pre><code>struct Accumulator
{
int counter ... |
Looking for network link speed determination algorithm <p>I'm looking for the best way to interpret the standard (well, standardish) Ethernet PHY registers, to determine the speed that an Ethernet link is actually running at. (e.g. 10/100/1000 and full/half-duplex)</p>
<p>I daresay that this is to be found in the sou... | <p>Thanks for the answer. It's intended as a language and platform agnostic question, because pretty much all MII/GMII Ethernet PHYs have the same basic registers. I happen to be on an embedded platform.</p>
<p>But I found a sensible sequence which was good enough for my restricted application by looking at various... |
phpmyadmin - save file to disk <p>when i point my browser to <code>http://localhost/phpmyadmin</code>, instead of showing me its front page, it comes up with save as dialog.</p>
<p>I'm running:
Apache/2.2.3 (Debian) PHP/5.2.0-8+etch13 Server </p>
<p>I've reinstalled both apache2 and php5.
After re-install i don't hav... | <p>Did you configure the php extension to send an http header?</p>
<p>In httpd.conf:
AddType application/x-httpd-php .php</p>
<p>EDIT<br />
The file is not necessarily named <code>httpd.conf</code>, that's just the default name. Try searching for other configuration files in the Apache directory -- the extension pro... |
prolog recursively find largest node <p>Just a simple binary tree and i want to find the the largest node.
<br>example tree: t(t(t(nil,1,nil),2,t(nil,3,nil)),4,t(t(t(nil,8,nil),5,nil),6,t(nil,7,nil)))</p>
<pre><code>int L(t,max) {
if(t=null) return max;
if(max<t.root) max = t.root;
LN(t,max);
RN(t,max);
return max;... | <p>Is this <a href="http://stackoverflow.com/questions/315944/prolog-problem-with-recursion">another homework assignment</a>?</p>
<p>In any case, I'll try to let you do the thinking since you seem to be learning Prolog. Not to mention the fact that I don't actually have Prolog running on my computer, so I couldn't be ... |
How to get Url Hash (#) from server side <p>I know on client side (javascript) you can use windows.location.hash but could not find anyway to access from the server side.</p>
| <p>We had a situation where we needed to persist the URL hash across ASP.Net post backs. As the browser does not send the hash to the server by default, the only way to do it is to use some Javascript:</p>
<ol>
<li><p>When the form submits, grab the hash (<code>window.location.hash</code>) and store it in a server-sid... |
MySQL efficient "select id else insert" query <p>I have a MySQL table consisting of:</p>
<pre><code>CREATE TABLE `url_list` (
`id` int(10) unsigned NOT NULL auto_increment,
`crc32` int(10) unsigned NOT NULL,
`url` varchar(512) NOT NULL,
PRIMARY KEY (`id`),
KEY `crc32` (`crc32`)
);
</code></pre>
<p>When ins... | <p>I would recommend ditching the <code>id</code> column and the <code>crc32</code> because they're not necessary.</p>
<p>You can use an <code>MD5()</code> hash to provide a fixed-length, virtually unique value computed from the lengthy URL data, and then use that hash as the primary key.</p>
<pre><code>CREATE TABLE ... |
Collection type for representing a hierarchial structure in .Net 3.5 <p>I been experimenting with the different methods for representing a hierarchical structures in memory that would allow for simple and efficient transversal both up and down to discover ancestor and descendant relationships. Does anyone have any sug... | <p>So you want a <a href="http://en.wikipedia.org/wiki/Tree_%28data_structure%29" rel="nofollow">Tree</a>? <a href="http://www.google.co.uk/search?q=c%23+tree&ie=utf-8&oe=utf-8&aq=t&rls=org.mozilla:en-GB:official&client=firefox-a" rel="nofollow">FGI</a></p>
|
How am I supposed to use the TortoiseSVN merge tool (TortoiseMerge)? <p>How am I supposed to use merge with the latest version of Tortoise SVN? I'm an old <a href="http://en.wikipedia.org/wiki/IBM_Rational_ClearCase" rel="nofollow">ClearCase</a> guy, and I've never understood it. When I merge a branch back into the tru... | <p>TortoiseSVN contains two notions of "merge":</p>
<ol>
<li>The TortoiseMerge tool, which is the graphical diffing tool that comes with TortoiseSVN</li>
<li>Merging, as in "branching and merging", which is a Subversion concept (which is what you appear to be referring to)</li>
</ol>
<p>The latter is a classic source... |
How do I reference a scalar in a hash reference in Perl? <p>Simple question:</p>
<p>How do I do this on one line:</p>
<pre><code>my $foo = $bar->{baz};
fizz(\$foo);
</code></pre>
<p>I've tried \$bar->{baz}, \${$bar->{baz}}, and numerous others. Is this even possible?</p>
<p>-fREW</p>
<p><strong>Update</strong>... | <pre><code>\$bar->{baz}
</code></pre>
<p>should work.</p>
<p>E.g.:</p>
<pre><code>my $foo;
$foo->{bar} = 123;
my $bar = \$foo->{bar};
$$bar = 456;
print "$foo->{bar}\n"; # prints "456"
</code></pre>
<p>In answer to the update in the OP, you can do:</p>
<pre><code>\@$row{qw(body data)};
</code></pr... |
What is the difference between the KeyCode and KeyData properties on the .NET WinForms key event argument objects? <p>The two key event argument classes <code>KeyEventArgs</code> and <code>PreviewKeyDownEventArgs</code> each have two properties, <code>KeyCode</code> and <code>KeyData</code>, which are both of the enume... | <p><code>KeyCode</code> is an enumeration that represents all the possible keys on the keyboard. <code>KeyData</code> is the <code>KeyCode</code> combined with the modifiers (Ctrl, Alt and/or Shift).</p>
<p>Use <code>KeyCode</code> when you don't care about the modifiers, <code>KeyData</code> when you do. </p>
|
Compare equality between two objects in NUnit <p>I'm trying to assert that one object is "equal" to another object. </p>
<p>The objects are just instances of a class with a bunch of public properties. Is there an easy way to have NUnit assert equality based on the properties?</p>
<p>This is my current solution but I ... | <p>If you can't override Equals for any reason, you can build a helper method that iterates through public properties by reflection and assert each property. Something like this:</p>
<pre class="lang-cs prettyprint-override"><code>public static class AssertEx
{
public static void PropertyValuesAreEquals(object act... |
Preparing a development tools machine <p>I am working on a small project with a few friends and need to set up a server to run our tools. I looked around at hosted solutions like <a href="http://unfuddle.com/" rel="nofollow">Unfuddle</a> but they don't provide a CI server.</p>
<p>I am now considering buying a <a href=... | <p>I'm not sure how much power you need, but what I've done in the past is grabbed an old desktop computer. Wiped the hard drive and installed an appropriate OS and then loaded my tools on that.</p>
<p>I setup port forwarding on my router to send incoming requests to it. And I got my hands a dynamic IP address URL (th... |
Create a DSL vs. Embed an Existing Language <p>This often comes up: your application has gotten extensive enough that it's time to add some programmability into it to make it flexible. One example might be a finance application - you want to add a formula editor so that you can create your own custom formulas without h... | <p>There are no trades offs -- embed a throughly tested, well documented interpretor. Otherwise, you'll end up with an abomination like MAXScript.</p>
|
Running numpy from cygwin <p>I am running a windows machine have installed Python 2.5. I also used the windows installer to install NumPy. </p>
<p>This all works great when I run the Python (command line) tool that comes with Python.</p>
<p>However, if I run cygwin and then run Python from within, it cannot find the... | <p>Cygwin comes with its own version of Python, so it's likely that you have two Python installs on your system; one that installed under Windows and one which came with Cygwin.</p>
<p>To test this, try opening a bash prompt in Cygwin and typing <code>which python</code> to see where the Python executable is located. ... |
ApplicationVerifier is not detecting handle leaks, what do I do? <p>I did select the executable correctly, because I can get it to respond to certain things I do. But I can't get ApplicationVerifier to properly detect a handle leak.</p>
<p>Here is an example:</p>
<pre><code>int APIENTRY _tWinMain(HINSTANCE hInstance... | <p>Is your code only creating handles through CreateFile? If so you can just macro these methods out to versions that do custom implemented leak detection. It's a lot of work but it will get the job done.</p>
<pre><code>#if DEBUG
#define CreateFile DebugCreateFile
#define CloseHandle DebugCloseHandle
#endif
// in an... |
Is It Possible to Use a String as an Index? <p>In other languages you can use strings as keys -</p>
<p>PHP:</p>
<pre><code>$array['string'] = 50;
$array['anotherstring'] = 150;
</code></pre>
<p>Is this possible in VBA?</p>
| <p>In VBA you can create a Collection object. Items in the collection can be accessed by index (Long integer) or by a string key.</p>
|
Is it possible to initialise a New System.Collections.Generic.Dictionary with String key/value pairs? <p>Is it possible to create and initialise a <a href="http://msdn.microsoft.com/en-us/library/6918612z(VS.80).aspx"><code>System.Collections.Generic.Dictionary</code></a> object with String key/value pairs in one state... | <p>Like this:</p>
<pre><code>Dim myDic As New Dictionary(Of String, String) From {{"1", "One"}, {"2", "Two"}}
</code></pre>
|
How to close a system dialog on a BlackBerry? <p>I have a BlackBerry app running in the background that needs to know when a "Missed call" system dialog is brought up by the system, and programmatically close it without user intervention. How can I do that?</p>
<p>I could actually almost know when the dialog is brough... | <p>Key press injection for device <em>Close</em> button looks like this: </p>
<pre><code>KeyEvent inject = new KeyEvent(KeyEvent.KEY_DOWN, Characters.ESCAPE, 0);
inject.post();
</code></pre>
<p>Don't forget to set permissions for device release:
Options => Advanced Options => Applications => [Your Application] =>Edi... |
Object-oriented or sequential? <p>I'm refactoring a 500-lines of C++ code in main() for solving a differential equation. I'd like to encapsulate the big ideas of our solver into smaller functions (i.e. "SolvePotential(...)" instead of 50 lines of numerics code). </p>
<p>Should I code this sequentially with a bunch of... | <p>Write it sequentially and then refactor if there's something you think you can reuse or would make it clearer.</p>
<p>Also, a SolvePotential class doesn't make a lot of sense since a class should be an Object with the method SolvePotential.</p>
|
Get real image width and height with JavaScript in Safari/Chrome? <p>I am creating a jQuery plugin.</p>
<p>How do I get real image width and height with Javascript in Safari?</p>
<p>Following works with Firefox 3, IE7 and Opera 9:</p>
<pre><code>var pic = $("img")
// need to remove these in of case img-element has ... | <p>Webkit browsers set the height and width property after the image is loaded. Instead of using timeouts, I'd recommend using an image's onload event. Here's a quick example:</p>
<pre><code>var img = $("img")[0]; // Get my img elem
var pic_real_width, pic_real_height;
$("<img/>") // Make in memory copy of ima... |
BLAS Library Benchmark <p>Is there a benchmark that compares the different BLAS (Basic Linear Algebra Subprograms) libraries? I am especially interested in sparse matrix multiplication for single- and multi-core systems?</p>
| <p>BLAS performance is very much system dependent, so you'll best do the benchmarks yourself on the very machine you want to use. Since there are only a few BLAS implementations, that is less work than it sounds (normally the <a href="http://www.netlib.org/blas/faq.html#5" rel="nofollow">hardware vendors implementation... |
asp.net sql timeout when not using sql <p>Im in the process of learning asp.net 3.5, currently on webparts and co.</p>
<p>Ive started a new project for webparts, not using a database with it, but when i go to view the website (dev server), i get an sql timeout??</p>
<blockquote>
<p>A network-related or instance-spe... | <p>The webparts infrastructure talks to a database.</p>
|
Does anyone know where there is a recipe for serializing data and preserving its order in the output? <p>I am working with a set of data that I have converted to a list of dictionaries</p>
<p>For example one item in my list is </p>
<pre><code>{'reportDate': u'R20070501', 'idnum': u'1078099', 'columnLabel': u'2005',
... | <p>So what's wrong with pickle? If you structure your data as a list of dicts, then everything should work as you want it to (if I understand your problem).</p>
<pre><code>>>> import pickle
>>> d1 = {1:'one', 2:'two', 3:'three'}
>>> d2 = {1:'eleven', 2:'twelve', 3:'thirteen'}
>>> d... |
Private module methods in Ruby <p>I have a two part question</p>
<p><strong>Best-Practice</strong></p>
<ul>
<li>I have an algorithm that performs some operation on a data structure using the public interface</li>
<li>It is currently a module with numerous static methods, all private except for the one public interfac... | <p>I think the best way (and mostly how existing libs are written) do this by making a class within the module that deals with all the logic, and the module just provides a convenient method, e.g.</p>
<pre><code>module GTranslate
class Translator
def perform( text ); 'hola munda'; end
end
def self.translate... |
Is there an easy way to determine the type of a file without knowing the file's extension? <p>I have a table with a binary column which stores files of a number of different possible filetypes (PDF, BMP, JPEG, WAV, MP3, DOC, MPEG, AVI etc.), but no columns that store either the name or the type of the original file. I... | <p>you can use these tools to find the file format.</p>
<p>File Analyser
<a href="http://www.softpedia.com/get/Programming/Other-Programming-Files/File-Analyzer.shtml" rel="nofollow">http://www.softpedia.com/get/Programming/Other-Programming-Files/File-Analyzer.shtml</a></p>
<p>What Format
<a href="http://www.jozy.nl... |
Anyone seen good embedded help in a web application? <p>I have a pretty simple app on the web (written in Flex) which is very straightforward to use once it has data inside it. The steps to get data inside it are themselves also pretty simple, but not at all obvious to my audience when they first log into my app. </p... | <p>Have you taken a look at:
<a href="http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html" rel="nofollow">http://www.askthecssguy.com/2007/03/form_field_hints_with_css_and.html</a></p>
<p>I believe there is a jquery or prototype or mootools or whatever framework that goes a couple steps beyond the a... |
Any tips on how to organize Eclipse environment on multiple monitors? <p>I can't find a good way of putting Eclipse windows on two monitors. Currently I just detached (clicked on a header and dragged) a few windows to a secondary monitor (package explorer, console, and outline) while leaving primary monitor with maximi... | <p>In the Eclipse Helios (currently 3.6.2) I found very useful the use of another window to bring up multiple documents in different screens.
in the main menu, go:</p>
<p>Window > New window, </p>
<p>and drag it to the screen you prefer. Double click in the filename on the editor and will maximize the editor's window... |
How to create an element without hardcoding the name <p>I tried this but it does not seem to be valid syntax.</p>
<pre><code><xsl:element name="$myElementName"></xsl:element>
</code></pre>
| <p>You may need to surround it with <code>{}</code> to ensure the value is evaluated rather than used as a verbatim string, e.g.</p>
<pre><code><xsl:element name="{$myElementName}"></xsl:element>
</code></pre>
|
How to access the layer of a view? <p>I would like to apply a transformation (rotation) to a <code>UIImageView</code>. I could just set the <code>transform</code> property of the view, but wouldn't setting the layer's <code>transform</code> make it faster? If so, how can I achieve this?</p>
<p>Assuming I have a <code>... | <p>If you're doing a simple rotation, the speed difference is probably insignificant, but you can get access to a view's layer by doing:</p>
<p><code>view.layer </code></p>
<p>So, you can just use </p>
<p><code>view.layer.affineTransform = newTranform; </code></p>
|
How do you use LINQ with Sqlite <p>Would someone explain how to get LINQ working with Sqlite.</p>
| <p><a href="http://code.google.com/p/dblinq2007/">Here you have an SQL Linq provider for SQLite, and some other DBs</a></p>
|
Cascading to a auto completing text box <p>I have a web page where the user will enter their address. They will select their country and region in cascading drop down lists. I would like to provide an auto completing textbox for their city, but I want to be context sensitive to the country and region selections. I woul... | <p>I just found the following <a href="http://blogs.technet.com/kirtid/archive/2007/05/17/cascading-autocomplete.aspx" rel="nofollow">blog</a> post that looks at least close to what you want.</p>
<p>They manage it using the following javascript functions:</p>
<pre><code> function initCascadingAutoComplete() {
... |
Postgresql Concurrency <p>In a project that I'm working, there's a table with a "on update" trigger, that monitors if a boolean column has changed (ex.: false -> true = do some action). But this action can only be done once for a row.</p>
<p>There will be multiple clients accessing the database, so I can suppose that ... | <p>Triggers don't handle concurrency, and PostgreSQL should do the right thing whether or not you use explicit transactions.</p>
<p>PostgreSQL uses <em>optimistic locking</em> which means the first person to actually update the row gets a lock on that row. If a second person tries to update the row, their update stat... |
How many dimensions in an array with no value <p>I'm a little lost (still working with Ron Jeffries's book). Here's a simple class:</p>
<pre><code>public class Model{
private String[] lines;
public void myMethod(){
String[] newLines = new String[lines.length + 2];
for (i = 0, i <= lines.len... | <p>lines will be null, so lines.length will throw an exception.</p>
<p>I believe your other class initializing "Model" won't help since Lines itself is private. In fact, whatever you are doing to Model is probably illegal in at least 30 states.</p>
|
RESTful Authentication <p>What does RESTful Authentication mean and how does it work? I can't find a good overview on Google. My only understanding is that you pass the session key (remeberal) in the URL, but this could be horribly wrong.</p>
| <p>How to handle authentication in a RESTful Client-Server architecture is a matter of debate.</p>
<p>Commonly, it can be achieved, in the SOA over HTTP world via:</p>
<ul>
<li>HTTP basic auth over HTTPS;</li>
<li>Cookies and session management;</li>
<li>Token in HTTP headers (e.g. <em>OAuth</em> 2.0);</li>
<li>Query... |
PHP Shipping Calculator <p>Does anyone know of a freeware shipping calculator for PHP? I do not want anything too fancy, and it can be compatible with any of the major US domestic shipping services.</p>
<p>If anyone knows of one that is a plugin for CodeIgniter that would be nice.</p>
<p>Travis</p>
| <p>Usually services like this are based on web services offered from the various couriers. You would send the weight and dimensions of the box you want to ship to their web service, and they would return a corresponding shipping price. Each couriers API would be different. I'm not sure if there are any libraries that... |
Postage Calculator for PHP <p>Could anyone point me in the right direction for a shipping calculator? I would like something simple and I don't want to sign up for too much stuff.</p>
<p>EDIT: I do not want to deal with all the registering and stuff the API would require... I think I may just try to make one using th... | <p>The USPS has rate calculator APIs available for both domestic and international. You can learn more about them at the following site. Hope that helps.</p>
<p><a href="https://www.usps.com/webtools/htm/Rate-Calculators-v1-3.htm" rel="nofollow">https://www.usps.com/webtools/htm/Rate-Calculators-v1-3.htm</a></p>
|
Escaping Bracket [ in a CONTAINS() clause? <p>How can I escape a bracket in a full-text SQL Server <code>contains()</code> query? I've tried all the following, <em>none</em> of which work:</p>
<pre><code>CONTAINS(crev.RawText, 'arg[0]')
CONTAINS(crev.RawText, 'arg[[0]]')
CONTAINS(crev.RawText, 'arg\[0\]')
</code></pre... | <p>You don't have to escape the [ as it has no special meaning in Full Text Search. If you do need to search for an exact match though, you can use "" marks. </p>
<p>Further, you can use multiple "" inside the single quotes:</p>
<pre><code>CONTAINS('"word1" or "word2" or "word3"')
</code></pre>
<p>This also works:</... |
SQLite C/C++ API unsigned char * <p>Why does the SQLite C/C++ API return <code>unsigned char *</code>s for text values as opposed to the more de-facto <code>char *</code> type?</p>
<p>This is somewhat related to <a href="http://stackoverflow.com/questions/75191/unsigned-char">the unsigned char</a> question, except tha... | <p>From the <a href="http://www.sqlite.org/capi3ref.html#sqlite3_column_blob">SQLite documentation</a>:</p>
<blockquote>
<p>(H13821) The sqlite3_column_text(S,N) interface converts the Nth column in the current row of the result set for the prepared statement S into a zero-terminated UTF-8 string and returns a point... |
how to translate the SQL code "having" condition into LinqToSQL or LinqToEntites? <p>Could you tell me how to translate the following SQL code to Linq To SQL or Linq To Entites?</p>
<p>The correct SQL code is: </p>
<blockquote>
<p>select CollectId,url,userid,pubtime
from Collect group by
url,collectid,userid,pu... | <p>Since your "having" condition isn't actually on an aggregated column, couldn't you just use the "where" clause?</p>
<pre><code>select distinct CollectId, url, userid, pubtime
from Collect
where pubtime >= (select max(pubtime) from collect d where d.url = collect.url)
order by Collect.pubtime desc
</code></pre>
... |
How do I effectively find duplicate blob rows in MySQL? <p>I have a table of the form </p>
<pre><code>CREATE TABLE data
{
pk INT PRIMARY KEY AUTO_INCREMENT,
dt BLOB
};
</code></pre>
<p>It has about 160,000 rows and about 2GB of data in the blob column (avg. 14kb per blob). Another table has foreign keys into th... | <p>You can always use a hashing function (<a href="https://en.wikipedia.org/wiki/MD5" rel="nofollow">MD5</a> or <a href="https://en.wikipedia.org/wiki/SHA-1" rel="nofollow">SHA1</a>) for your data and then compare the hashes.</p>
<p>The question is if you can save the hashes in your database?</p>
|
Is it possible to programmatically add a softkey shortcut to an application in Symbian <p>Is it possible for a Symbian S60 application to automatically add itself to one of the softkeys. The best would be if it could be done at installation time but if there is some API that can be used to add a shortcut the first time... | <p>I believe <a href="http://wiki.forum.nokia.com/index.php/ScShortcuts_Engine_Wrapper_API" rel="nofollow">this</a> is what you are looking for. I will not comment on Symbian best practices about that, but would like to say that were an application to override one of my defined shortcuts, I would be annoyed. If it is a... |
Integer division rounding with negatives in C++ <p>Suppose <code>a</code> and <code>b</code> are both of type <code>int</code>, and <code>b</code> is nonzero. Consider the result of performing <code>a/b</code> in the following cases:</p>
<ol>
<li><code>a</code> and <code>b</code> are both nonnegative.</li>
<li><code>... | <p>According to the May 2008 revision,</p>
<p>You're right:</p>
<blockquote>
<p>The binary / operator yields the quotient, and the binary % operator yields the remainder from the division of the first expression by the second. If the second operand of / or % is zero the behavior is undefined; otherwise (a/b)*b + a%... |
What should I teach a beginning Perl programmer? <p>I am going to spend 30 minutes teaching Perl to an experienced programmer. The best way to learn Perl is by writing code. In addition to CPAN, what would you show a programmer so they would understand the expressiveness of Perl, the amount of functionality provided ... | <p>We wrote a whole book on that called <a href="http://shop.oreilly.com/product/0636920018452.do" rel="nofollow">Learning Perl</a>. Check out the table of contents.</p>
<p>This book is a product of teaching people Perl since 1995. It's not geared to any particular application, and shows people the parts of Perl that ... |
create databases in ms-access, then delete a particular database. using any vb query or vb code <p>i want to create a number of databases in ms-access using a code or any option of ms-access, but i want delete databases also.
Please help me</p>
| <p>You could have an empty database named "db1.mdb", and then add this code inside a module <strong>in another</strong> Access database:</p>
<pre><code> Set fso = CreateObject("scripting.filesystemobject")
fso.CopyFile "c:\db.mdb", "c:\db_copy1.mdb", True
fso.CopyFile "c:\db.mdb", "c:\db_copy2.mdb", True
fso.Co... |
anyone know of a shared To-do list plugin for eclipse <p>Does anyone know of shared TODO list plugin for Eclipse that allows users in a a development team to all view and edit the same list of tasks?</p>
| <p><a href="http://www.eclipse.org/mylyn/" rel="nofollow">Mylyn</a> can be used to integrate issue tracking systems into the IDE.</p>
<blockquote>
<p>It does this by making tasks a first class part of Eclipse, and integrating rich and offline editing for repositories such as Bugzilla, Trac, and JIRA. </p>
</blockquo... |
How do I divide an ordered list of integers into evenly sized sublists? <p>Does anyone have a good algorithm for taking an ordered list of integers, i.e.:<br />
[1, 3, 6, 7, 8, 10, 11, 13, 14, 17, 19, 23, 25, 27, 28]</p>
<p>into a given number of evenly sized ordered sublists, i.e. for 4 it will be:<br />
[1, 3, 6] [7... | <p>Splitting the lists evenly means you will have two sizes of lists - size S and S+1.</p>
<p>With N sublists, and X elements in the original, you would get:</p>
<p>floor(X/N) number of elements in the smaller sublists (S), and X % N is the number of larger sublists (S+1).</p>
<p>Then iterate over the original array... |
sql - Using aggregate functions (min/max) as part of select statement <p>I am trying to return the minimum and maximum prices for a villa booking system. I have a look up table that stores the price for each week for each villa. </p>
<p>I am using the min and max functions to do this within the select but I'm having l... | <p>You don't elaborate on <em>what</em> problems you are getting, but this is probably one: you need to specify <strong>all</strong> the non-aggregate columns in the GROUP BY clause i.e.:</p>
<pre><code>GROUP BY tblVillas.name,
tblVillas.introduction,
tblVillas.italian_introduction,
tblVillas.uk_... |
threadPool.SetMaxThreads returning false <p>My understanding of SetMaxThreads() in C# was that it can not be set to less than the number of processors.</p>
<p>But in my code I am unable to set the number to less than 8, I have no idea why this is.</p>
<p>If I set it to lower it returns false!</p>
<p>(Running an Inte... | <p>I think I have solved this problem now (kinda!), if SetMinThreads() is first set to the minimum number, so in my case 2, then we are able to set the max number of threads to a value less than 8.</p>
<p>I am aware that this then ties of resources with idle threads, but for my purposes it is a suitable work around.</... |
How can I make log4perl output easier to read? <p>When using <a href="http://log4perl.sourceforge.net/" rel="nofollow">log4perl</a>, the debug log layout that I'm using is :</p>
<pre><code>log4perl.appender.D10.layout=PatternLayout
log4perl.appender.D10.layout.ConversionPattern=%d [pid=%P] %p %F{1} (%L) %M %m%n
log4pe... | <p>You can pad the single fields that make up your entries. For example [pid=%5P] will always give you at least 5 characters for the PID. </p>
<p>The <a href="http://search.cpan.org/~mschilli/Log-Log4perl-1.19/lib/Log/Log4perl/Layout/PatternLayout.pm#Quantify_placeholders">"Quantify Placeholders" section</a> in the do... |
Which is better apply two conditions in nested If or using single with And? <p>Nested If or single if with And operator, which is better approach?<br>
<strong>Single If with And</strong> </p>
<pre><code>if (txtPackage.Text != string.Empty && txtPackage.Text == "abc")
{
//
}
</code></pre>
<p><strong>Nes... | <p>Are you going to do something different in the 'nested if' example if, in fact, txtPackage.Text isn't empty but contains something other than "abc"?</p>
<p>If you aren't, I'd ask why are you checking for string.empty at all? </p>
<p>You could just write:</p>
<pre><code>if (txtPackage.Text == "abc")
{
//
}
</co... |
How do I generate a compiled lambda with method calls? <p>I'm generating compiled getter methods at runtime for a given member. Right now, my code just assumes that the result of the getter method is a string (worked good for testing). However, I'd like to make this work with a custom converter class I've written, se... | <p>Can you illustrate what (if it was regular C#) you want the expression to evaluate? I can write the expression easily enough - I just don't fully understand the question...</p>
<p>(edit re comment) - in that case, it'll be something like:</p>
<pre><code> ConverterBase typeConverter = new ConverterBase();
va... |
Viewing contents of a .jar file <p>What would be the easiest way to view classes, methods, properties, etc. inside a jar file?
I'm looking for something equivalent to the very useful <I> Lutz Roeder .NET Reflector </I> - for Java</p>
| <p>Using the JDK, <code>jar tf</code> will list the files in the jar. <code>javap</code> will give you more details from a particular class file.</p>
|
Best nntp to web gateway? <p>My company uses usenet groups on an internal nntp server and I would like to add a web server to this that would allow the usual browsing and searching but in addition provide an archive of old messages that may have expired on the server. This is mainly for searching the archives so abilit... | <p>Gmane seems to be nice. You could also look into a NNTP -> Email thing and use any of the available email web archive software.</p>
|
Regexps in Elisp to include newlines <p>I'm trying to add a special markup to Python documentation strings in emacs (python-mode).</p>
<p>Currently I'm able to extract a single line with:</p>
<pre><code>(font-lock-add-keywords
'python-mode
'(("\\(\"\\{3\\}\\.+\"\\{3\\}\\)"
1 font-lock-doc-face prepend)))
</code... | <pre><code>"\\(\"\\{3\\}\\(.*\n?\\)*?\"\\{3\\}\\)"
</code></pre>
<p>The "*?" construct is the non-greedy version of "*".</p>
|
How to automatically create a file with the latest compile time and include it into a library? <p>I have a library consisting of approx 100 source files. I want one of the sources to be always rebuilt if any of the other files have been compiled but I don't want it built every time I run the make/build.</p>
<p>Basical... | <p>Let the object file containing the build timestamp depend on all the other object files:</p>
<pre><code>version.o: $(OBJECTS)
</code></pre>
|
ASP.NET MVC Beta 1 - Will My Existing User Controls Work In My Views As-Is? <p>I understand that you can now create MVC-specific user controls, but will my existing standard ASCX user controls work in an MVC view? </p>
<p>I understand that MVC pages have a completely different lifecycle but will, for example, a Page_L... | <p>If your standard ASCX controls do not have control events. There is no viewstate in MVC so that'll have to change.</p>
<p>The normal page lifecycle is still executed. E.g. Page load, init, prerender, etc. The main thing is viewstate.</p>
|
What build tool do you use professionally? <p>At home, I use CTRL+SHIFT+B or F7 or whatever key sequence initiates the build for my build tool. At work, this doesn't quite cut it.</p>
<p>At my first job (an internship) we used a product called Visual Build, which I have come to like very much. It's the best build to... | <p>Not very sophisticated, but we use a set of batch files. And that works great.</p>
|
The ';' character, hexadecimal value 0x3B, cannot be included in a name <p>I have seen the error "The ';' character, hexadecimal value 0x3B, cannot be included in a name." in my log files for an ASP.NET Web App. The url that's logged looks something like this:</p>
<pre><code>mypage.aspx?paramone=one+two&amp;paramt... | <ol>
<li><p>Your web server should be able to log the "user agent" field from the HTTP Request, which should enable you to identify the culprit.</p></li>
<li><p>Don't fix it - there's a very well defined set of legal syntaxes for URI parameters, and this ain't one of them.</p></li>
</ol>
|
Steps in the memory allocation process for Java objects <p><strong>What happens in the memory when a class instantiates the following object?</strong> </p>
<pre><code>public class SomeObject{
private String strSomeProperty;
public SomeObject(String strSomeProperty){
this.strSomeProperty = strSomeProp... | <p>Let's step through it:</p>
<pre><code>SomeObject so1 = new SomeObject("some property value");
</code></pre>
<p>... is actually more complicated than it looks, because you're creating a new String. It might be easier to think of as:</p>
<pre><code>String tmp = new String("some property value");
SomeObject so1 = ne... |
What are the advantages of dynamic scoping? <p>I've learned that <a href="http://en.wikipedia.org/wiki/Static_scoping#Static_scoping_.28also_known_as_lexical_scoping.29" rel="nofollow">static scoping</a> is the only sane way to do things, and that <a href="http://en.wikipedia.org/wiki/Static_scoping#Dynamic_scoping" re... | <p>Like everything else, Dynamic Scoping is merely a tool. Used well it can make certain tasks easier. Used poorly it can introduce bugs and headaches.</p>
<p>I can certainly see some uses for it. One can eliminate the need to pass variables to some functions.</p>
<p>For instance, I might set the display up at the... |
Putting JVM arguments in a file to be picked up at runtime <p>I'm building a jar of my current application, which required several JVM arguments to be set.</p>
<p>Is there a way of setting these JVM arguments in a file rather than on the command line?</p>
<p>I've done some hunting and it looks like I might be able to... | <p>You could of course write a batch script to execute the JVM. The batch script could look into the file and call with the appropriate parameters. This would be OS dependent though.</p>
|
How do I test database-related code with NUnit? <p>I want to write unit tests with NUnit that hit the database. I'd like to have the database in a consistent state for each test. I thought transactions would allow me to "undo" each test so I searched around and found several articles from 2004-05 on the topic:</p>
<ul... | <p>NUnit now has a [Rollback] attribute, but I prefer to do it a different way. I use the <a href="http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx">TransactionScope</a> class. There are a couple of ways to use it.</p>
<pre><code>[Test]
public void YourTest()
{
using (TransactionS... |
VS2008 Navigate to class definition add-in <p>I am looking for a Visual Studio add-in that would analyze the text around the cursor position and navigate to the corresponding class definition.</p>
<p>For example I have this XML file that is currently open:</p>
<pre><code><object id="abc" type="MyProject.Foo.Bar, M... | <p>Well you could use the '<strong><a href="http://msdn.microsoft.com/en-us/library/f5yx24a6(VS.80).aspx" rel="nofollow">Code Definition Window</a></strong>' that comes with the VS2008 IDE. When you place your cursor, the Code Def window dynamically updates with the source code for that type. <em>Works with regular sou... |
Drop down list box with dynamic month and year in Date Prompt in Cognos <p>I want to add the current month and the last 2 months for user to select in prompt.
e.g. if this month is <code>2008 Nov</code>, then I wil see foowing in <code>ddlbox</code>:</p>
<pre><code>112008
102008
092008
</code></pre>
<p>May I know ho... | <pre><code><asp:DropDownList ID="DropDownList1" runat="server">
</asp:DropDownList>
for (int i = 0; i < 3; i++)
{
ListItem item = new ListItem(string.Format("{0: MM/yyyy}", DateTime.Now.AddMonths(-i)));
DropDownList1.Items.Add(item);
}
</code></pre>
<p>Try this :)</p>
|
Recommendations for column-oriented database <p>I've found databases typically come in two flavors, your traditional row-oriented RDBMS or an object oriented database (OODBMS). However, in the mid 90s I remember, a new breed of databases showing up that were column oriented. Some of these were given the term 4GL, but... | <p><a href="http://en.wikipedia.org/wiki/HBase">HBase</a> is an open-source column-oriented database system modelled on <a href="http://en.wikipedia.org/wiki/BigTable">Google's BigTable</a>.</p>
|
How can I convert a hex string to a byte array? <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/311165/how-do-you-convert-byte-array-to-hexadecimal-string-and-vice-versa-in-c">How do you convert Byte Array to Hexadecimal String, and vice versa, in C#?</a> </p>
<... | <p>Here's a nice fun LINQ example.</p>
<pre><code>public static byte[] StringToByteArray(string hex) {
return Enumerable.Range(0, hex.Length)
.Where(x => x % 2 == 0)
.Select(x => Convert.ToByte(hex.Substring(x, 2), 16))
.ToArray();
}
</code></pre... |
Unit Testing: Creating a 'mock' request to simulate a MVC page request <p>How do I go about creating a mock request for my asp.net-mvc application for unit-testing?</p>
<p>What options do I have?</p>
<p>I am using FormsCollection in my Actions so I can simulate form input data also.</p>
| <p>You just have to create a new instance of FormCollection and add the data inside of it.</p>
<p>So you can call something like this without mocking anything.</p>
<pre><code>var result = controller.Create(new FormCollection { { "InvoiceId", "-1" } }) as RedirectToRouteResult;
</code></pre>
<p>Otherwise if your code... |
How do I set a field value in an C# Expression tree? <p>Given:</p>
<pre><code>FieldInfo field = <some valid string field on type T>;
ParameterExpression targetExp = Expression.Parameter(typeof(T), "target");
ParameterExpression valueExp = Expression.Parameter(typeof(string), "value");
</code></pre>
<p>How do I ... | <p><strong>.Net 4.0</strong> : now that there's <code>Expression.Assign</code>, this is easy to do:</p>
<pre><code>FieldInfo field = typeof(T).GetField("fieldName");
ParameterExpression targetExp = Expression.Parameter(typeof(T), "target");
ParameterExpression valueExp = Expression.Parameter(typeof(string), "value");
... |
Building a database driven menu with ASP.NET, JQuery and Suckerfish <p>I'm attempting at creating a menu from a table using the Suckerfish css menu and Jquery. I'm using this as my reference: <a href="http://www.aspcode.net/Suckerfish-menu-with-ASPNET-and-JQuery.aspx" rel="nofollow">Suckerfish menu with ASP.NET and JQu... | <p>That method of representing hierarchical data is easy to understand for humans but difficult to extract data from, because it requires recursion to extract the full hierarchy. Some flavors of SQL have commands that will do this for you, but that is what is going on behind the scenes.</p>
<p>I suggest you read <a hr... |
Best practices for version control comments <p>There is a lot of conversation about commenting code, but how about commenting on check-ins?</p>
<p>I found this blog post:
<a href="http://redbitbluebit.com/subversion-check-in-comment-great-practices/" rel="nofollow">http://redbitbluebit.com/subversion-check-in-comment-... | <p>Every feature has a ticket/issue/bugreport/task/whatever-you-call-it, and the ticket number is always referenced in the check-in comment. This gives context.</p>
|
How to remove elements from xml using xslt with stylesheet and xsltproc? <p>I have a lot of XML files which have something of the form:</p>
<pre>
< Element
fruit="apple"
animal="cat"
/>
</pre>
<p>Which I want to be removed from the file.</p>
<p>Using an XSLT stylesheet and the Linux command-line uti... | <p>Using one of the most fundamental XSLT design patterns: "Overriding the <a href="http://www.w3.org/TR/xslt#copying"><strong>identity transformation</strong></a>" one will just write the following:</p>
<pre>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output omit-xml... |
CreateProcessAsUser not working correctly in my experiments <p>I am trying to do the following:
1. I am logged in as Administrator account in my XP with SP2 machine running VS.NET 2005
2. This machine also has another account user1 which is a guest account
3. I am running a program as Administrator, from this program i... | <p>See <a href="http://support.microsoft.com/kb/165194" rel="nofollow">CreateProcessAsUser() windowstations and desktops</a>.</p>
<p>But I suggest to do it in managed way:</p>
<pre><code>...
using System.Diagnostics;
using System.Security;
...
...
string progPath = @"c:\WINNT\notepad.exe";
ProcessStartInfo startInfo ... |
Powershell remoting with V1 <p>Do you know of any good remoting solutions using powershell V1 (I know the V2 stuff is awesome, but my organization doesn't like using pre-release software). I don't need anything spectactular, just a way to kick off powershell script on another box and get the results back when they're ... | <p>I think PrimalScript's Remote Script Execution Engine would do what you're after. It does require a small service to be installed on remote computers, but you get unlimited licenses for that when you buy PrimalScript (Enterprise edition).</p>
<p>There's also a PSHRemoting project someone did.</p>
<p>N Software's N... |
Does Java work with PCF fonts? <p>I am trying to make IBM jre to use PCF fonts from default X11 installation on my linux box. In particular adobe-helvetica font. I have toyed to modify fontconfig.properties in jre/lib folder but no matter what I do Java seams to use some other fonts. I guess there is some algorithm how... | <p>I've spent all morning learning about Java fonts. There's a lot of limitations, some of which are removed in Java 1.6. I don't have any answers, but here is some information I have that might be helpful.</p>
<p>Java distinguishes internally between system fonts and created fonts. (News flash to Sun: it'd be nice... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.