input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
How should I get started learning about ADO.NET Entity Framework? <p>So here I am just about to start a big project using LINQ to SQL and then I read this:</p>
<p><a href="http://www.infoq.com/news/2008/11/DLINQ-Future" rel="nofollow">Is LINQ to SQL Truly Dead?</a> by Jonathan Allen for InfoQ.com</p>
<p>Well, I don't... | <p>How Do I...? Videos</p>
<ul>
<li><a href="http://blogs.msdn.com/adonet/archive/2008/05/20/how-do-i-new-entity-framework-videos.aspx">How Do I Get Started with the Entity Framework?</a> </li>
<li><a href="http://blogs.msdn.com/adonet/archive/2008/05/20/how-do-i-new-entity-framework-videos.aspx">How Do I Use the new... |
How to serialize an object to XML without getting xmlns="..."? <p>Is there a way for me to serialize an object in .NET without the XML Namespaces automatically serializing also? It seems that by default .NET believes the XSI and XSD namespaces should be included, but I don't want them there.</p>
| <p>Ahh... nevermind. It's always the search after the question is posed that yields the answer. My object that is being serialized is <code>obj</code> and has already been defined. Adding an XMLSerializerNamespace with a single empty namespace to the collection does the trick.</p>
<p>In VB like this:</p>
<pre><cod... |
Phone number normalization: Any pre-existing libraries? <p>I have a system which is using phone numbers as unique identifiers. For this reason, I want to format all phone numbers as they come in using a normalized format. Because I have no control over my source data, I need to parse out these numbers myself and format... | <p>You could use <code>libphonenumber</code> from Google. Here's a blog post: </p>
<p><a href="http://blog.appharbor.com/2012/02/03/net-phone-number-validation-with-google-libphonenumber" rel="nofollow">http://blog.appharbor.com/2012/02/03/net-phone-number-validation-with-google-libphonenumber</a></p>
<p>Parsing numb... |
Why would I choose Powershell over WMI to develop management interfaces? <p>We are discussing development of an improved management infrastructure for our distributed system.
We use COM, web services and .NET components. Since we're based on Microsoft Windows Server XP/2003, I guess, we basically have two options:</p>
... | <p>I would choose PowerShell over WMI for the following reasons:</p>
<ol>
<li>Writing a cmdlet is only adding a .NET Class.</li>
<li>The PowerShell runtime provides command line parsing built in.</li>
<li>Writing your management interface in PowerShell allows administrators the ability to integrate management of your ... |
Scanning Java annotations at runtime <p>What is the best way of searching the whole classpath for an annotated class?</p>
<p>I'm doing a library and I want to allow the users to annotate their classes, so when the Web application starts I need to scan the whole classpath for certain annotation.</p>
<p>Do you know a l... | <p>Use <a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.html">org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider</a> </p>
<p>API</p>
<blockquote>
<p>A component provider that scans the cla... |
How to cut out a part from a stream in Delphi7 <p>I have an incoming soap message wich form is TStream (Delphi7), server that send this soap is in development mode and adds a html header to the message for debugging purposes. Now i need to cut out the html header part from it before i can pass it to soap converter. It ... | <p>Another solution, more in line with Lars' suggestion and somehow more worked out.<br />
It's faster, especially when the size of the Stream is above 100, and even more so on really big ones. It avoids copying to an intermediate string.<br />
<strong>FilterBeginStream</strong> is simpler and follows the "specs" in re... |
Why is tomcat looking for JSF classes? <p>I am trying to get my development environment up and running, and I am having trouble with Tomcat trying to load JSF classes for some reason. My application does not use JSF; in fact, I haven't even deployed my application to tomcat yet. I am getting a number of stack traces ... | <p>Is your tomcat installation totally clean, or is it one you have inherited?</p>
<p>Check if the webapps contains existing wars/directories which may be referencing JSF classes?</p>
<p>UPDATE: Ah -- I see you found this was the case :-)</p>
<p>Not sure why tomcat doesn't include all its dependencies. Perhaps you d... |
iterator adapter to iterate just the values in a map? <p>I'm just getting back into C++ after a couple of years of doing a lot of C#, and recently Objective C.</p>
<p>One thing I've done before is to roll my own iterator adapter for std::map that will deref to just the value part, rather than the key-value pair. This ... | <p>Replacing the previous answer, in case anybody else finds this like I did. As of boost 1.43, there are some commonly used range adaptors provided. In this case, you want boost::adaptors::map_values. The relevant example:
<a href="http://www.boost.org/doc/libs/1_46_0/libs/range/doc/html/range/reference/adaptors/refer... |
Disappearing bullet points <p><a href="http://biochrom.fivesite.co.uk/catalogue4.asp" rel="nofollow">http://biochrom.fivesite.co.uk/catalogue4.asp</a></p>
<p>On the page above there is an image floated to the left. To the right of it is a list, titled "features". The list items have a background image, however, it isn... | <p>I know this is a year old post but others may want to know...</p>
<p>What happens if you are using a content management system and some pages have images & some don't you wouldn't want your list items to be 200px in the content?</p>
<p>You can add this CSS to your UL/OL element:</p>
<pre><code>overflow:hidden... |
How to display image in grails GSP? <p>I'm still learning Grails and seem to have hit a stumbling block.</p>
<p><strong>Here are the 2 domain classes:</strong></p>
<pre><code>class Photo {
byte[] file
static belongsTo = Profile
}
class Profile {
String fullName
Set photos
static hasMany = [ph... | <p>If you have a url for the image, you just have to make sure you return the appropriate anser in the controller:</p>
<pre><code> def viewImage= {
//retrieve photo code here
response.setHeader("Content-disposition", "attachment; filename=${photo.name}")
response.contentType = photo.fileType //'image/jpeg... |
What do you use to test the handheld css on your website? <p>I've been adding css support for <strong>handheld</strong> to my website but haven't been able to find a good tool for testing. </p>
<p>I tried using the webdeveloper plugin for Firefox but it doesn't work for me. Maybe that is because all my css is in the h... | <p>With a bit of hunting I found what I was looking for, thanks for the leads guys.</p>
<p>Opera will display the <strong>handheld</strong> css if you select "Small Screen" from the View menu.</p>
|
Calling internal methods in Medium Trust <p>I have the requirement to call an internal method of a 3rd party object (I cannot make it public for example). I can do that via reflection. Unfortunately this does not work in ASP.NET Medium trust due to insufficient rights:</p>
<pre><code><IPermission class="ReflectionP... | <p>I don't see a way to call it. The .NET security/trust model is designed to prevent exactly this sort of thing. If you could somehow circumvent it, you would have to file a security bug with Microsoft which would then (hopefully) be fixed and make your solution useless again ;-)</p>
<p>Can't you negotiate a higher t... |
How do I best display CheckBoxes in SQL Server Reporting Services? <p>One of the many quirks of Reporting Services we've run across is the complete and utter lack of a CheckBox control or even something remotely similar.</p>
<p>We have a form that should appear automatically filled out based on information pulled from... | <p>I, along with others in my shop, have used images, toggling the hidden attribute based on the field value (true or false). We haven't had any problems with blurring or scaling, unless we tried to increase the scale of the image beyond 100% obviously.</p>
<p>Another option I've used is similar to the wingdings idea... |
Using nullable types in C# <p>I'm just interested in people's opinions. When using nullable types in C# what is the best practice way to test for null:</p>
<pre><code>bool isNull = (i == null);
</code></pre>
<p>or</p>
<pre><code>bool isNull = !i.HasValue;
</code></pre>
<p>Also when assigning to a non-null type is t... | <p>I would use this:</p>
<pre><code>long? i = 1;
...some code...
long j = i ?? 0;
</code></pre>
<p>That means, if <em>i</em> is <strong>null</strong>, than 0 will be assigned.</p>
|
<base target="FrameName"> doesn't work on IE7 <p>It seems that the following piece of HTML is ignored in IE7 but works ok in IE6/FF. It supposes to override all the html links to be opened in the desired frame</p>
<pre><code><HEAD>
<title>LeftPane</title>
<base target="rightFrame">
&l... | <p>The <code>href=""</code> attibute is <a href="http://www.w3schools.com/TAGS/tag_base.asp" rel="nofollow">mandatory on the base tag</a> - that's one possible explanation. You don't say what doctype you're using, but <a href="http://www.devguru.com/Technologies/xhtml/quickref/xhtml_base.html" rel="nofollow">target is... |
Is this the correct step-by-step and organization for creating an SVN repo with multiple projects and vendors? <p>I've read quite a bit of the Red Bean Software SVN Book, and some of the questions here on SO, but I want to make sure I'm going about this in the right way the first time around step-by-step before I begin... | <blockquote>
<p>Create folders through command line for repository organization (including projects and vendors).</p>
</blockquote>
<p>Do you mean creating the repository structure by making directories inside the subversion intallation directory? That's very wrong.</p>
<p>You have to create the necessary folders ... |
Is there danger of corruption in SQL Server 2000 databases when using SQL Server 2005 Management Studio? <p>In an interview for a SQL DBA position a while back, I mentioned I prefer the SQL 2005 Management Studio app vs. the old 2000 versions of Enterprise Manager / Query Analyzer. The DBA who was interviewing me said ... | <p>Sounds like he was just was using that as an excuse for lack of experience with SQL 2005 Management Studio. DBA's hate change. lol.</p>
|
Painless 'Analysis of Algorithms' Training? <p>I had a painful experience with the "Analysis of Algorithms" classes back in college but have recently found a need for it in the <em>real world</em>. -- Anyway, I'm looking for a simple-yet-effective crash course. Any ideas?</p>
<p><em>Related Sidenote:</em> It sure w... | <p>There are a lot of good books on the subject. I like <a href="http://rads.stackoverflow.com/amzn/click/020140009X">An Introduction to the Analysis of Algorithms</a>. Also check out the algorithms course on <a href="http://ocw.mit.edu/OcwWeb/Electrical-Engineering-and-Computer-Science/6-046JFall-2005/CourseHome/">M... |
Exposing inherited members of a COM vb.net class <p>I have two vb.net class:</p>
<pre><code>Public MustInherit Class Class1
Private m_sProperty1 As String = ""
Public Property sProperty1() As String
Get
Return m_sProperty1
End Get
Set(ByVal value As String)
m_sPr... | <p>This seems to answer your question:</p>
<p><strong>Exporting Inheritance Hierarchies</strong></p>
<p>Managed class hierarchies flatten out when exposed as COM objects. For example, if you define a base class with a member, and then inherit the base class in a derived class that is exposed as a COM object, clients ... |
Is there a built in .NET exception that indicates an illegal object state? <p>What exception should I throw if I encounter an illegal state - for instance, an initialization method that should only be called once being called a second time? I don't really see any built-in exception that makes sense. This seems like s... | <p><a href="http://msdn.microsoft.com/en-us/library/system.invalidoperationexception.aspx">InvalidOperationException</a> maybe?</p>
<blockquote>
<p>The exception that is thrown when a method call is invalid for the object's current state. </p>
</blockquote>
|
Javascript - multiple client-side validations on same event <p>I am performing two validations on the client side on the samve event.
I have defined my validations as shown below</p>
<pre><code>btnSearch.Attributes["OnClick"] = "javascript:return prepareSave(); return prepareSearch();"
</code></pre>
<p>Pseudo code fo... | <p><code>return</code>, as the name implies, returns control back to whatever called the code in question. Therefore, anything that's after a return statement</p>
<pre><code>return prepareSave(); return prepareSearch();
// ^^^^^^^^^^^^^^^^^^^^^^^ e.g. this part
</code></pre>
<p>never executes. Try ... |
Oracle single-table constant merge with CLOB using JDBC <p>As a follow-up to <a href="http://stackoverflow.com/questions/167471/">this question</a>, I need help with the following scenario:</p>
<p>In Oracle, given a simple data table:</p>
<pre><code>create table data (
id VARCHAR2(255),
key VARCHAR... | <p>You haven't mentioned specifically in your post, but judging by the tags for the question, I'm assuming you're doing this from Java.</p>
<p>I've had success with code like this in a project I just finished. This application used Unicode, so there may be simpler solutions if your problem domain is limited to a stan... |
OpenGL glDrawPixels on dynamic 3D arrays <p>How do you draw the following dynamic <strong>3D</strong> array with OpenGL <strong>glDrawPixels()</strong>?
You can find the documentation here: <a href="http://opengl.org/documentation/specs/man_pages/hardcopy/GL/html/gl/drawpixels.html" rel="nofollow">http://opengl.org/doc... | <p>Uh ... Since you're allocating <i>each single pixel</i> with a separate <code>malloc()</code>, you will have to draw each pixel with a separate call to <code>glDrawPixels()</code>, too. This is (obviously) insane; the idea of bitmapped graphics is that the pixels are stored in an adjacent, compact, format, so that i... |
.NET bug when converting float to integer? <p>Check it out: this little .NET Console Program yields interesting results...notice how I'm converting a float to an integer in two different ways:</p>
<pre><code>using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace CastVsConvert
... | <p>Its not a bug, <code>cast</code> truncates, <code>convert</code> rounds.</p>
<p>See <a href="http://stackoverflow.com/questions/104063/systemconverttoint-vs-int">this</a></p>
|
HttpWebRequest, known problems with canceling requests? <p>Are there any known issues with canceling HttpWebRequest HTTP requests? We find that when we cancel 4-5 requests, the next request hangs indefinitely.</p>
<p>If there are no known problems with this, then I'm probably doing something wrong... where is a good r... | <p>After you cancel the request, take care to close the response stream, otherwise you will have leaks.</p>
<p>I usually use "using" when obtain the response from the web request to ensure that the response is closed:</p>
<pre><code>WebRequest request = WebRequest.Create("http://google.com");
using (WebResponse resp... |
Updating a Database from DataBound Controls <p>I'm currently creating a WinForm in VB.NET bound to an access database.</p>
<p>Basically what i have are two forms: one is a search form used to search the database, and the other is a details form. You run a search on the searchForm and it returns a list of Primary Keys ... | <p>The site is down, so use the google cached version of the following link:</p>
<p><a href="http://www.paulstovell.com/blog/binding-oriented-programming" rel="nofollow">http://www.paulstovell.com/blog/binding-oriented-programming</a></p>
<p>It's near exact to what you're trying to do.</p>
|
Is it possible to get the matching string from an SQL query? <p>If I have a query to return all matching entries in a DB that have "news" in the searchable column (i.e. <code>SELECT * FROM table WHERE column LIKE %news%</code>), and one particular row has an entry starting with "In recent World news, Somalia was invade... | <pre><code>select substring(column,
CHARINDEX ('news',lower(column))-10,
20)
FROM table
WHERE column LIKE %news%
</code></pre>
<p>basically substring the column starting 10 characters before where the word 'news' is and continuing for 20.</p>
<p>Edit: You'll need to make sure that ... |
How to make the group-box text background transparent <p>I want to make a transparent dialog. I capture the OnCtlColor message in a CDialog derived class...this is the code:</p>
<pre><code>HBRUSH CMyDialog::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
... | <p>You have two options.</p>
<p>You can not use Common Controls v6 (the XP-Styled controls), which will make your app lose the fanciness of newer windows versions. However IIRC the groupbox will respect the CTLCOLOR issue. If you are not using that anyway, and it is still not respecting your color, then you only have ... |
Download file with Resume capability for windows servers <p>I am building an Auto Updater for a winforms desktop application.</p>
<p>When the update is downloading, how can I provide a <b>Resume download</b> capability in case the customers internet connection breaks?</p>
| <p>If you are doing a windows-only application, and you are targeting windows XP and later OSes, you can use BITS: the Background Intelligent Transfert Service.</p>
<ul>
<li><a href="http://msdn.microsoft.com/en-us/library/bb968799%28v=VS.85%29.aspx" rel="nofollow">MSDN page on BITS</a></li>
<li><a href="http://msdn.m... |
How should I treat strings of digits in XML::RPC and Drupal? <p>I am trying to use an XML-RPC server on my Drupal (PHP) backend to make it easier for my Perl backend to talk to it. However, I've run into an issue and I'm not sure which parts, if any, are bugs. Essentially, some of the variables I need to pass to Drup... | <p>The number <code>9876352345</code> is too big to fit in a 32bit integer. That might cause the problem.</p>
|
How to justify more ram for SQL Server 2005 <p>We have SQL Server 2005 running on Win2003/64, and we push it hard. We generate real time reports on several tables with a couple million records using asp.net 3.5, and they will periodically time out.</p>
<p>I'd like to increase our memory from 8GB to 16GB or even 32GB ... | <p>First find out what is really the problem and that the server is properly tuned for the queries you are running. It's very sad to waste the money on RAM to find out you are I/O bound.</p>
<p>After you gather data about the cause of the timeouts you should be able to convince the pencil wielders easily.</p>
<p>Some... |
Is anybody using OBIEE (formerly Siebel Analytics) ? What is your experience <p>We are in the process of selecting BI stack for our data warehouse. The top contenders are OBIEE = Oracle BI Enterprise Edition (formerly Siebel Analytics) and Microstrategy.</p>
<p>Has anyone worked with OBIEE? Lessons learned? General im... | <p>I've been involved in 20 OBIEE projects for the past 6 years. It's a good ROLAP product. It has a flexible, mostly intuitive UI that end users typically like. HTML, Javascript, and some Flash (charts) is used for presentation. There is a presentation server that runs under a web server (or app server) and the co... |
After clicking the nth item, how do I manipulate another nth element? <p>I'm using jQuery and wanting to target the nth <li> in a list after clicking the nth link.</p>
<pre><code><ul id="targetedArea">
<li></li>
<li></li>
<li></li>
<li></li>
</ul&g... | <p>how about something like this:</p>
<pre><code>$('#clickedItems a').click(function() {
// figure out what position this element is in
var n = $('#clickedItems a').index($(this) );
// update the targetedArea
$('#targetedArea li:eq('+n+')').html('updated!');
return false;
});
</code></pre>
<p>assuming a 1:1 ... |
import data from a webpage to excel <p>I'm in need of a macro that will enter data into a webpage search field and than copy the results to excel.</p>
| <p>It's just a simple "File Open". No need for a macro.</p>
<p>Excel can open URLs directly. If the URL contains any tables, those will be formatted appropriately.</p>
<p>Try this: </p>
<ul>
<li>Run Excel</li>
<li>File | Open</li>
<li>Type <code>http://finance.yahoo.com/q?s=MSFT</code> as the file name</li>
<li>Igno... |
Display HTML in an Actionscript 3 project <p>Folks,</p>
<p>I am pulling all my Flash (pure AS3 project, not Flash CS3) content from a Drupal back-end for SEO purposes. This works great, except the HTML rendering built into the TextField object leaves a lot to be desired. Could anyone recommend any libraries that wou... | <p>you might also want to try:
<a href="http://code.google.com/p/htmlwrapper/" rel="nofollow">http://code.google.com/p/htmlwrapper/</a></p>
<p>I haven't used it but it looks like it does what you want.</p>
|
How to get partition ranges in SQL 2005 <p>I have a partitioned table in SQL Enterprise 2005. I need to query the PARTITION FUNCTION to find it's partition ranges. What SQL query will give me those values?</p>
| <p>Got this from the SQL profiler watching the management studio generate the script for creating the function</p>
<p>SELECT
sprv.value AS [Value],
sprv.boundary_id AS [ID]
FROM
sys.partition_functions AS spf
INNER JOIN sys.partition_range_values sprv ON sprv.function_id=spf.function_id
WHERE
(spf.name=N'fnPartitionLa... |
Are non-pure virtual functions with parameters bad practice? <p>I have a base class with an optional virtual function</p>
<pre><code>class Base {
virtual void OnlyImplementThisSometimes(int x) {}
};
</code></pre>
<p>When I compile this I get a warning about the unused param x. Is there some other way I should ha... | <p>Ignoring the design issues you can get around the compiler warning about an unused variable by omitting the variable name, for example:</p>
<pre><code>virtual void OnlyImplementThisSometimes(int ) { }
</code></pre>
<p>Mistakenly implementing the wrong method signature when trying to override the virtual function i... |
How do you scrape AJAX pages? <p>The title says it all. Please advise how to scrape AJAX pages.</p>
| <p><strong>Overview:</strong></p>
<p>All screen scraping first requires manual review of the page you want to extract resources from. When dealing with AJAX you usually just need to analyze a bit more than just simply the HTML. </p>
<p>When dealing with AJAX this just means that the value you want is not in the init... |
Required Field Validator Not Firing <p>I'm having an issue with a standard ASP.NET page that has a TextBox and a RequiredFieldValidator. The steps to reproduce are quite simple:</p>
<ol>
<li>Place a TextBox on a page</li>
<li>Place a RequiredFieldValidator on the page</li>
<li>Point the RequiredFieldValidator at the ... | <p>A follow-up to my previous answer:</p>
<p>Validation occurs in the onchange event, rather than the onblur. onchange fires when the focus is lost AND the control value has changed.</p>
<p>To trigger validation in the onblur event, I added the following code in the Page_Load():</p>
<pre><code>ScriptManager.Register... |
Resizable Java component <p>I would like to have a Java component which has a resize icon on the bottom right of the component so that when I drag that icon, the component will automatically resize with it.</p>
<p>By resize icon, I mean the following:</p>
<p><img src="http://lh5.ggpht.com/%5F7dfPdX2BP6o/SQ%5FsPvvHpTI... | <p>You will find in this article how to add an icon looking like the resize icon you are referring to.</p>
<p><img src="http://i.stack.imgur.com/uyYo4.gif" alt="PixelPushing"> <a href="http://today.java.net/pub/a/today/2005/06/07/pixelpushing.html" rel="nofollow">PixelPushing</a></p>
<p><img src="http://i.stack.imgur... |
conditional formating in rails partials <p>I am rendering a rails partial and I want to alternate the background color when it renders the partial. I know that is not super clear so here is an example of what I want to do:</p>
Row One grey Background
Row Two yellow background
Row Three grey Background
Row Fou... | <p>You could use the Cycle helper. Something like this:</p>
<pre><code><tr class="<%= cycle("even", "odd") %>">
<td><%= row.name %></td>
</tr>
</code></pre>
<p>Or in your case use bgcolor instead, although i would recomend using css classes.</p>
<p>You can cycle through more tha... |
Userland autoboxing? <p>Is it possible to implement autoboxing for your own classes?</p>
<p>To illustrate my example, this is what I might want to write:</p>
<pre><code>Foo foo = "lolcat";
</code></pre>
<p>And this is what Java would do (as per my own definitions, somewhere, somehow), under the hood:</p>
<pre><code... | <p>No, java does not support operator overloading (<a href="http://en.wikipedia.org/wiki/Operator_overloading">http://en.wikipedia.org/wiki/Operator_overloading</a>).</p>
<p>Autoboxing is a compiler feature and not available for your own classes.</p>
<p>The reasoning is explained here:
<a href="http://www.cafeaulait.... |
How do I use MSTest without Visual Studio? <p>Does MSTest have standalone GUI similar to nUnit that lets me use it and run test without visual studio? What is the official site for MSTest where I can learn more about how to use it?</p>
| <p>MSTest can be used without installing Visual Studio. You will need to install Visual Studio Test Agent, which is a free download from Microsoft:
<a href="http://www.microsoft.com/download/en/details.aspx?id=1334">http://www.microsoft.com/download/en/details.aspx?id=1334</a>.</p>
<p>I think this approach is better f... |
MDI Parent Menu and Child Menu <p>I am using VB.Net on Winforms Development developing an MDI application.</p>
<p>In my Parent form, I have a menu strip. In my child forms, I also have a menu strip attached to each form, which invokes a different set of command when accessed. Is it possible then that in an MDI form,... | <p>It's easy. Just add a MenuStrip to the parent but leave it empty. The built-in support for menu merging ensures that the active child's menu appears in the empty parent strip.</p>
|
start specific iis 6.0 website via script <p>I've googled around and can't find a clear answer.</p>
<p>I simply want to start some of my iis 6.0 websites via a script that will be run on start up.</p>
<p>anyone got any tips for that?</p>
| <p>Well, I've googled around, and <a href="http://windowsitpro.com/article/articleid/22971/iis-scripting-solutions.html" rel="nofollow">this is what I've found</a>.
Snippet :</p>
<pre><code>cd \inetpub\adminscripts
Cscript.exe adsutil.vbs START_SERVER W3SVC/1
</code></pre>
|
Detect whether adobe reader is installed using VB code <p>I want to detect whether adobe reader is installed using VB6. Also if detected that it's not installed, what would be the best solution?</p>
| <p>There are crude ways (checking for files on Program files directory), but I'd recommend you declare full-registry functions (not getSetting from vb) as in <a href="http://www.windowsdevcenter.com/pub/a/windows/2004/06/15/VB_Registry_Keys.html" rel="nofollow">http://www.windowsdevcenter.com/pub/a/windows/2004/06/15/V... |
What's the best way to perform system tasks from Ruby on Rails? <p>I am building a small system administration web application (think Web-Min, but in RoR) and I need to be able to access system parameters from my Ruby code. For instance, I want to allow the user to change the hostname, time zone, or network config of ... | <p>You can use <a href="http://backgroundrb.rubyforge.org/" rel="nofollow">BackgrounDRb</a>. Its purpose is to offload tasks from rails apps, and you can run the server under a different user.</p>
|
How to build Python C extension modules with autotools <p>Most of the documentation available for building Python extension modules
uses distutils, but I would like to achieve this by using the appropriate
python autoconf & automake macros instead.</p>
<p>I'd like to know if there is an open source project out the... | <p>Supposing that you have a project with a directory called <code>src</code>, so let's follow the follow steps to get a python extension built and packaged using autotools:</p>
<h2>Create the Makefile.am files</h2>
<p>First, you need to create one Makefile.am in the root of your project, basically (but not exclusive... |
IPC with Message Passing <p>I'm looking for suggestions on possible IPC mechanisms that I can implement in my self-made OS for an AVR32 board. </p>
<p>My current choice is implementing the massage passing mechanism described in the books written by Tanenbaum. </p>
<p>Is this a good choice? Are there easier way to imp... | <p>My suggestion is to review the message passing primitives that QNX RTOS (www.qnx.com) supports before making any decisions. I spent several years programming a complex multi-process system in that environment, and it stands out as the best message-based O/S I have ever encountered.</p>
<p>Some specific points that... |
Overflow when calculating a const in VBA <p>This declaration causes an overflow in VBA:</p>
<pre><code>Const OVERFLOWS As Long = 10 * 60 * 60
</code></pre>
<p>whereas setting the value directly is fine:</p>
<pre><code>Const COMPILES_OK As Long = 36000
</code></pre>
<p>How do you persuade VBA to treat literal intege... | <p>Add the <code>long</code> suffix <code>&</code> to at least one number:</p>
<pre><code>Const OVERFLOWS As Long = 10& * 60 * 60
</code></pre>
<p>Note that using the <code>CLNG</code> function to convert the values to <code>long</code> will not work, because VBA does not allow assigning the return value of a... |
How do I set an image for some but not all nodes in a TreeView? <p>I have a <code>TreeView</code> windows forms control with an <code>ImageList</code>, and I want some of the nodes to display images, but the others to not have images.</p>
<p>I <em>don't</em> want a blank space where the image should be. I <em>don't</... | <p>You need to set <code>ImageIndex</code> and <code>SelectedImageIndex</code> to a number that is higher than the number of values in your <code>ImageList</code>. For example, if you create this node and add it to your <code>TreeView</code>:</p>
<pre><code>TreeNode node1 = new TreeNode(string.Empty, 12, 12); // image... |
NSDateFormatter won't parse dates using locale settings? <p>I'm trying to parse dates using the user's date preferences</p>
<pre><code>[NSDateFormatter setDefaultFormatterBehavior:NSDateFormatterBehavior10_4];
NSDateFormatter *dateFormatter = [[[NSDateFormatter alloc] init] autorelease];
[dateFormatter setDateStyle:NS... | <blockquote>
<p>It looks like the NSDateFormatter is insensitive to the change of regions.</p>
</blockquote>
<p>No, it is using the locale in both directions.</p>
<p>You can see how the formatter interpreted the date by looking at the date's description (the first <code>%@</code> in your <code>NSLog</code> format).... |
rollover effect using Jquery <p>Would you please help me in making a rollover effect using jquery, what i want to do is when someone hover over any of the menu items the text slide down and disappear and a picture slides from the top down to the center (e.g. you could see this effect here <a href="http://www.iviewcom.c... | <p>Instead of doing it for you, I'll offer some places to start looking.. </p>
<p>Here is an example that could be easily modified to use 'rollover' instead of 'click': <a href="http://css-tricks.com/examples/MenuFader/">http://css-tricks.com/examples/MenuFader/</a></p>
<p>Details on how the above example was put tog... |
ASP.NET removing an item from Session? <p>Which method is preferred?</p>
<pre><code>Session.Remove("foo");
Session["foo"] = null;
</code></pre>
<p>Is there a difference?</p>
| <blockquote>
<p>Is there a difference?</p>
</blockquote>
<p>There is.
<code>Session.Remove(key)</code> deletes the entry (both key & value) from the dictionary while <code>Session[key] = null</code> assigns a value (which happens to be null) to a key. After the former call, the key won't appear in the <code>Ses... |
Best algorithm to check whether a vector is sorted <p>What would be the best way to check that a <code>std::vector</code> is sorted? Is there something faster than a loop checking that <code>v[i]<=v[i+1]</code>? Is it faster/cleaner with iterators? Or is it actually better to just call <code>sort</code> every time (... | <blockquote>
<p>Is there something faster than a loop
checking that v[i]<=v[i+1] ?</p>
</blockquote>
<p>No.</p>
<p>If this is something you wish to check often, you might want to make a wrapper class that keeps a "sorted" flag which starts out False, is set to False whenever an item is added, and add a member ... |
Find JPEG resolution with PHP <p>Calling all PHP gurus!</p>
<p>I understand that you can use getimagesize() to get the actual pixel height and width of an image in PHP. However, if you open an image in photoshop and look at the image size dialog, you notice that there is a resolution value that determines the print si... | <p>You could just read the JPEG file directly, bytes 14-18 specify:</p>
<ul>
<li>byte 14: 01, X and Y density unit specifier (00: none, pixel ratios, 01: DPI,02: DPC)</li>
<li>bytes 15-16: horizontal pixel density,</li>
<li>byte 16-18: vertical pixel densit</li>
</ul>
<p>Also see: <a href="http://www.obrador.com/esse... |
Addicted to LINQ <p>Ok, the more I use LINQ, the more I like it! I recently found myself working in some legacy code at work. It is your classic DataSet and DataTable rich application. Well, when adding a bit of functionality I found myself <em>really</em> wanting to just query the rows of a DataTable for the results I... | <p>One other observation; if you aren't using typed datasets, you might also want to know about the <code>Field<></code> extension method:</p>
<pre><code> var customerOrderIds = table.Rows.Cast<DataRow>()
.Where(x => x.Field<string>("CUSTOMER_ID") == customerId)
.Select(x => x.... |
Good Javascript Combo Box replacement for combo boxes with tons of elements? <p>I have a page where my combo box has hundreds of elements which makes it very hard to pick the one item I want. Is there a good Javascript replacement that would do better than</p>
<pre><code><select id="field-component" name="field_com... | <p>In HTML 5 there's standard combo box. </p>
<p>Currently only Opera supports it, but if you happen to be time traveller or writing Opera-only application, it's a nice solution :)</p>
<pre><code><input type=text list=listid>
<datalist id=listid>
<select><option>1<option>2</select&g... |
how to keep inline items from wrapping? <p>I've got menu items that look like this</p>
<pre><code><ul>
<li>Item1<span class="context-trigger"></span></li>
<li>Item2<span class="context-trigger"></span></li>
<li>Item3<span class="context-trigger">&... | <p>try using </p>
<pre><code>white-space: nowrap;
</code></pre>
<p>in the css definition of your context-trigger class.</p>
<p>Edit: I think patmortech is correct though, putting nowrap on the span does not work, because there is no "white space" content. It might also be that sticking the style on the LI element do... |
How can I know if a process is running? <p>When I get a reference to a <code>System.Diagnostics.Process</code>, how can I know if a process is currently running?</p>
| <p>This is a way to do it with the name:</p>
<pre><code>Process[] pname = Process.GetProcessesByName("notepad");
if (pname.Length == 0)
MessageBox.Show("nothing");
else
MessageBox.Show("run");
</code></pre>
<p>You can loop all process to get the ID for later manipulation:</p>
<pre><code>Process[] processlist = P... |
Negotiating a common "network-channel" in a peer-to-peer system <p>Is there a common or established algorithm for peer-nodes in a network to decide on a unique "network-channel" (or any other form of semi-secret identifier)?</p>
<p>The environment I'm working in is SecondLife. I am trying to figure out how to get man... | <p>How would a new object know which network to join (new or existing)? Depending on what exactly you need, there are number of approaches.</p>
<h2>First method</h2>
<p>You can use less precise timer than every second, for example something like this:</p>
<pre><code>integer time = llGetUnixTime();
integer channel = ... |
Qt: how to make a shadow to main window widget? <p>How to make a shadow to main window widget on windows using Qt?</p>
| <p>Applications normally do not create shadows, that is up to the window manager. You could fake it by all sorts of evil hacks such as creating another borderless window that is the shadow color and put it under your main window.</p>
|
Secure file transfers <p>We are using a custom FTP application (which encrypts the files) for secure transfers. We send the application to end users and they use it to send us confidential data. We also use it to send information back to the end users.</p>
<p>The application is in need of an update - some things are... | <p>I've had good results using <a href="http://www.freesshd.com/" rel="nofollow">Free SSHd</a> on windows machines; it runs on the standard SSH port (22), supports SFTP, and is encrypted end to end. It also lets you set up authorization systems in parallel with your windows permissions, so you can exercise pretty fine-... |
Why is using '*' to build a view bad? <p>Why is using '*' to build a view bad ?</p>
<p>Suppose that you have a complex join and all fields may be used somewhere.</p>
<p>Then you just have to chose fields needed.</p>
<pre><code>SELECT field1, field2 FROM aview WHERE ...
</code></pre>
<p>The view "aview" could be <co... | <p>I don't think there's much in software that is "just bad", but there's plenty of stuff that is misused in bad ways :-)</p>
<p>The example you give is a reason why * might not give you what you expect, and I think there are others. For example, if the underlying tables change, maybe columns are added or removed, a ... |
making a programme run indefinitely in python <p>Is there any way to make a function (the ones I'm thinking of are in the style of the simple ones I've made which generate the fibonnacci sequence from 0 to a point, and all the primes between two points) run indefinitely. E.g. until I press a certain key or until a ti... | <p>The simplest way is just to write a program with an infinite loop, and then hit control-C to stop it. Without more description it's hard to know if this works for you.</p>
<p>If you do it time-based, you don't need a generator. You can just have it pause for user input, something like a "Continue? [y/n]", read from... |
what's the quickest way to extract a 5 digit number from a string in c# <p>what's the quickest way to extract a 5 digit number from a string in c#. </p>
<p>I've got </p>
<pre><code>string.Join(null, System.Text.RegularExpressions.Regex.Split(expression, "[^\\d]"));
</code></pre>
<p>Any others?</p>
| <p>The regex approach is probably the quickest to implement but not the quickest to run. I compared a simple regex solution to the following manual search code and found that the manual search code is ~2x-2.5x faster for large input strings and up to 4x faster for small strings:</p>
<pre><code>static string Search(str... |
SourceSafe Label Search <p>Is there a way to search Microsoft Visual SourceSafe 6.0d for all files tagged with a specific label?</p>
| <p>AJ had the right idea, but you just need to use the "dir" command instead of get:</p>
<pre><code>ss dir -v"LABEL" $\PROJECT -R
</code></pre>
<p>This will output each file with version that is at that label in the format of:</p>
<pre><code>someFile.c;23
someOtherFile.h;3
<filename>;<version>
</code></p... |
.Net 2.0 Winform Label Tool Tip <p>This has got to be something I just missed, but how do I add a tool tip to a label?</p>
<p>I saw something on the web about handling the mouse hover event, but how would I even handle it in code?</p>
| <p>Add in your form the TooTip from the ToolBox than click once in your label and you'll see ToolTip in the property box.</p>
|
Variable opacity within a WPF application <p>My problem is:</p>
<p>I have a Canvas which covers part of my Window. The Opacity of the canvas is set to less than 1, i.e. I can view the controls under the Canvas. What I would like to do is place a control, any control, say a Button, on the canvas and not have that Butto... | <p>Try the alpha in the color of the canvas.</p>
|
Javascript onHover event <p>Is there a canonical way to set up a JS onHover event with the existing onmouseover, onmouseout and some kind of timers? Or just any method to fire an arbitrary function if and only if user has hovered over element for certain amount of time.</p>
| <p>How about something like this?</p>
<pre><code><html>
<head>
<script type="text/javascript">
var HoverListener = {
addElem: function( elem, callback, delay )
{
if ( delay === undefined )
{
delay = 1000;
}
var hoverTimer;
addEvent( elem, 'mouseover', function()
{... |
Agile 40-hour week <p>Have you ever worked on a (full-time) project where using Agile methodologies actually allowed you to accomplish a 40-hour work-week? If so, what were the most valuable agile practices?</p>
| <p>Yes, I'm on a 40 hour (actually it's 37.5 hours or so, that's what my contract says) on a project that was run with SCRUM from the beginning. That was about 2 years ago and the first time we implemented SCRUM. It's the project with the least amount of overtime for me personally, and it's also a PC game we're develop... |
openbd cfloop over a date <p>I'm trying to convert my sites from CF8 to openBD. I have a cfloop in a site that loops over a date range.</p>
<p>In essence, I want to insert a new record into the db for every 2 weeks (step) of a date range (from and to)</p>
<p>my loop looks like this... </p>
<pre><code><cfloop
... | <p>Your problem lies in not checking for ambiguous locale dependent date strings from your FORM.</p>
<p>A more robust version would be this:</p>
<pre><code><cfset SetLocale("English (US)")> <!--- set expected input locale here --->
<cfif LSIsDate(form.startDate) and LSIsDate(form.endDate)>
<cf... |
Can my web server be at one hosting company, and my email hosted by a 3rd party? <p>I have a web server that runs my web application.</p>
<p>If I want to outsource my email to another provider, is it possible if they are on their on network/data center?</p>
| <p>Yes. To do this, you will need access to the DNS records for your domain. The MX record allows you to set up a mail server that's separate from the web server.</p>
<p>Google offers a service that will manage your domain's email through GMail, and the instructions on how to reconfigure your DNS for this service can ... |
What's your favorite cross domain cookie sharing approach? <p>I see iframe/p3p trick is the most popular one around, but I personally don't like it because javascript + hidden fields + frame really make it look like a hack job. I've also come across a master-slave approach using web service to communicate (<a href="htt... | <p>My approach designates one domain as the 'central' domain and any others as 'satellite' domains.</p>
<p>When someone clicks a 'sign in' link (or presents a persistent login cookie), the sign in form ultimately sends its data to a URL that is on the central domain, along with a hidden form element saying which domai... |
range for integer values of chars in c++ <p>I'm reading <em>The C++ Programming Language</em> and in it Stroustrup states that the int value of a char can range from 0 to 255 or -127 to 127, depending on implementation. Is this correct? It seems like it should be from -128 to 127. If not, why are their only 255 possib... | <p>You're stuck in <a href="http://en.wikipedia.org/wiki/Two%27s_complement">two's complement</a> thinking - The C++ standard does not define the representation used for negative numbers!</p>
<p>If your computer (god forbid) uses <a href="http://en.wikipedia.org/wiki/Ones_complement#Ones.27_complement">ones's compleme... |
Showing too much 'skin' detection in software <p>I am building an ASP.NET web site where the users may upload photos of themselves. There could be thousands of photos uploaded every day. One thing my boss has asked a few time is if there is any way we could detect if any of the photos are showing too much 'skin' and au... | <p>Your best bet is to deal with the image in the HSV colour space (see <a href="http://www.cs.rit.edu/~ncs/color/t_convert.html">here</a> for rgb - hsv conversion). The colour of skin is pretty much the same between all races, its just the saturation that changes. By dealing with the image in HSV you can simply search... |
What is the best algorithm for an overridden System.Object.GetHashCode? <p>In .NET <code>System.Object.GetHashCode</code> method is used in a lot of places, throughout the .NET base class libraries. Especially when finding items in a collection fast or to determine equality. Is there a standard algorithm/ best practic... | <p>I usually go with something like the implementation given in Josh Bloch's <em>fabulous</em> <a href="http://rads.stackoverflow.com/amzn/click/0321356683">Effective Java</a>. It's fast and creates a pretty good hash which is unlikely to cause collisions. Pick two different prime numbers, e.g. 17 and 23, and do:</p>
... |
We have a graphical designer, now they want a text based designer. Suggestions? <p>I'm sorry I could not think of a better title.</p>
<p>The problem is the following:</p>
<p>For our customer we have created (as part of a larger application) a
graphical designer which they can use to build "scenario's".</p>
<p>These ... | <p>From what i think i've understood you have two options</p>
<p>you could either use an XML style "markup" to let them define entities and their groupings, but that may not be best.</p>
<p>Your alternatives are yes, yoou could embedd a language, but do you really need to, wouldnt that be overkill, and how can you co... |
Is there a performance hit when "Windows" authentication is enabled on an anonymous website? <p>I've been having performance issues with a high traffic ASP.NET 2.0 site running on Windows 2000. While editing the web.config file I noticed that the authentication mode was set to 'Windows'. I changed it to 'None'. The ... | <p>There is a small potential, but if you are not securing any folders, it shouldn't be an issue.</p>
<p>In reality it would mostly be an issue if you needed to secure a folder path. </p>
<p>There might be a SMALL performance hit but I can't imagine it would be that bad.</p>
|
launching VS2008 build from python <p>if I paste this into the command prompt by hand, it works, but if I run it from python, I get <code>The filename, directgory name, or volume label syntax is incorrect</code>.</p>
<pre><code>os.system('%comspec% /k ""C:\Program Files\Microsoft Visual Studio 9.0\VC\vcvarsall.bat"" x... | <p>I think the backslashes are messing you up. You need to use an R string (raw)</p>
<p>r"string"</p>
<p>See <a href="https://docs.python.org/2/reference/lexical_analysis.html#string-literals" rel="nofollow">https://docs.python.org/2/reference/lexical_analysis.html#string-literals</a> for reference</p>
|
fragment was not found at expected path (eclipse jsp) <p>In eclipse, I have a javaproject (not a web project), though it does provide reusable tag files.</p>
<p>layout</p>
<p>+src<br>
+++META-INF<br>
----my.tld<br>
+++++++++++tags<br>
---------------include.jsp<br></p>
<p>I keep on getting Fragment "/META-INF/tags/i... | <p>Josh, if you're working with .jsp and .tld files, then you really shouldn't be doing this as a "Java Project", but instead a "Dynamic Web Project" in Eclipse. Nonetheless, I'll try to answer your question.</p>
<p>Based on the diagram of your file system, your files are laid out incorrectly. If you're trying to cr... |
What is the best way to add user ID to RubyOnRails log entries? <p>I am looking for the best way to customize my Rails log entries (I want to add the user ID in there). I am using Rails 2.1.2. The only way I've found so far is to override method "add" of class BufferedLogger (as defined in active_support/lib/active_sup... | <p>Have you seen the <a href="http://github.com/ffmike/user_event_logger/tree/master" rel="nofollow">user_event_logger</a> plugin?</p>
|
How to move documents and list items in Windows SharePoint Services? <p>I need to provide users with an easy way to move documents and lists items in WSS 3.0. They want to be able to move across lists, sites and site collections without loss of version history, metadata, and author/date info. This functionality is unfo... | <p>None of the products out there can do it and even if they do, all of them would modify the dates and the by's (modified by). We developed a custom solution to do that.</p>
|
launching vs2008 build from python <p>The first batch file launches a command prompt, i need the second command to be in the ccontext of the first. how can I do this in python?</p>
<p>As is, it launches the batch, and blocks until the batch (with its command prompt context) terminates, and then executes <code>devenv<... | <p>I think that the proper way for achieving this would be running this command:</p>
<pre><code>%comspec% /C "%VCINSTALLDIR%\vcvarsall.bat" x86 && vcbuild "project.sln"
</code></pre>
<p>Below you'll see the Python version of the same command:</p>
<pre><code>os.system('%comspec% /C "%VCINSTALLDIR%\\vcvarsall.... |
How do you create a Distinct query in HQL <p>Is there a way to create a Distinct query in HQL. Either by using the "distinct" keyword or some other method. I am not sure if distinct is a valid keywork for HQL, but I am looking for the HQL equivalent of the SQL keyword "distinct".</p>
| <p>Here's a snippet of hql that we use. (Names have been changed to protect identities)</p>
<pre><code>String queryString = "select distinct f from Foo f inner join foo.bars as b" +
" where f.creationDate >= ? and f.creationDate < ? and b.bar = ?";
return getHibernateTemplate().find(query... |
How do I find the width & height of a terminal window? <p>As a simple example, I want to write a CLI script which can print '=' across the entire width of the terminal window.</p>
<pre><code>#!/usr/bin/env php
<?php
echo str_repeat('=', ???);
</code></pre>
<p>or</p>
<pre><code>#!/usr/bin/env python
print '=' * ??... | <ul>
<li><code>tput cols</code> tells you the number of columns.</li>
<li><code>tput lines</code> tells you the number of rows.</li>
</ul>
|
Fastest possible XML handling in Delphi for very large documents <p>I need recommendations on what to use in Delphi (I use Delphi 2009) to handle very large XML files (e.g. 100 MB) as fast as possible. </p>
<p>I need to input the XML, access and update the data in it from my program, and then export the modified XML a... | <p>If I understood your question correctly, you have known data structure and you are modifying data - not XML structure of file. </p>
<p>Under these condition <em>and if performance is crucial</em>, then you could try with direct text manipulation - skip XML parsing. </p>
<p>Read from stream, use some fast text sear... |
Have you used a traveling salesman algorithm to solve a problem? <p>I studied TSP in college in the context of NP Completeness. I have never actually had a situation where it would apply to a practical problem. A little bit of research shows that it has been used to pick the cheapest path to move a drill around, t... | <p>I was once given the task of writing a program to fill a rectangular area fairly uniformly with a "squiggle" - a curved line which doesn't self-intersect. My first attempt was to generate random points within the rectangle and try to find a tour of them (not necessarily the absolute shortest). Unfortunately this app... |
How do I calculate the closest power of 2 or 10 a number is? <p>What is the most efficient way to cacluate the closest power of a 2 or 10 to another number? e.g.</p>
<p>3.5 would return 4 for power of 2 and 1 for power of 10</p>
<p>123 would return 128 for power of 2 and 100 for power of 10</p>
<p>0.24 would return ... | <pre><code>n^round(log_n(x))
</code></pre>
<p>where log_n is the logarithm to base n. You may have to modify the round() depending on how you define "closest".</p>
<p>Note that <code>log_n(x)</code> can be implemented as:</p>
<pre><code>log_n(x) = log(x) / log(n)
</code></pre>
<p>where <code>log</code> is a logarit... |
In SQL, how to delete a row from one table if it doesn't have a corresponding row in another table? <p>How can I make:</p>
<p>DELETE FROM foo WHERE id=1 AND <strong>bar not contains id==1</strong></p>
<p>To elaborate, how can I remove a row with <code>id = 1</code>, from table <code>foo</code>, only if there is not a... | <pre><code>DELETE FROM foo WHERE id=1 AND NOT EXISTS (SELECT * FROM bar WHERE id=1)
</code></pre>
<p>I'm assuming you mean that foo and bar are tables, and you want to remove a record from foo if it doesn't exist in bar.</p>
|
How to move build task into parent POM <p>I have a POM for my ejb project. In it I have added a maven-antrun-plugin execution step to build websphere ejb stubs during the verify phase. This works but is quite verbose, and as I need to add similiar steps to a number of other ejb projects I want to move the common sectio... | <p>If you put the configuration inside a pluginManagement section of your parent, then it won't run there. Then in the children you just need to bind the antrun plugin and it will inherit the execution config and run. This is nice because you can then control which of the children inherit the values.</p>
<p>You can se... |
How do I make HTTP post request for getting JSON object in response for iPhone application? <p>I've a web service running on server which return data either in XML format or JSON format.
I wanted to request a JSON format but using HTTP Post method.</p>
<p>any help greatly appreciated.</p>
<p>thanks in advance.</p>
| <p>This is the code which work for JSON post request,
TouchJSON Framework is used for parsing the JSON, thanks 'schwa'.</p>
<pre><code>NSArray *keys = [NSArray arrayWithObjects:@"username", @"password", @"preference", @"uid", nil];
NSArray *objects = [NSArray arrayWithObjects:@"accuser", @"accpass", @"abc_region", @"... |
Are real-time linux extensions obsolete? <p>Do the new real-time and low latency patches from Ingo Molnar render previous real-time extensions for Linux (such as RTAI, Xenomai) obsolete?</p>
| <p>Doesn't look like it to me, although I've not endeavoured to build a real-time system on Linux (yet). RTAI look like APIs. POSIX.4 would be similar (and of course <em>infinitely superior</em> in my humble opinion as the former vice-chair of that committee and author of the book :) .</p>
<p>Molnar's work looks to ... |
Spell checking city names? <p>I figure this problem is easier than just a regular spell checker since the list of U.S cities is small compared to all known English words.</p>
<p>Anyhow, here's the problem:
I have text files with full of city names; some of which are spelled correctly and some which aren't. </p>
<p>Wh... | <p>Do you actually need to correct the misspellings or just flag them as with a normal spell checker? If the latter, you just need to obtain a list of correct spellings and make sure each name is the same as one in your list.</p>
<p>If you want to actually correct them, you probably want to use the concept of <a href... |
How to discover what Linux distribution is in use <p>Sometimes I need to access some servers running Linux (or maybe another Unix-like SO), but I don't know how to verify which <a href="http://en.wikipedia.org/wiki/Linux_distribution">distribution</a> is in use on the server (there are times that even the "responsible"... | <p><code>lsb_release -i</code> may work for you.</p>
<p>More detail is available with <code>lsb_release -a</code></p>
<p>Some discussion at <a href="http://etbe.coker.com.au/2007/08/30/identifying-the-distribution-of-a-linux-system/">http://etbe.coker.com.au/2007/08/30/identifying-the-distribution-of-a-linux-system/<... |
Is there an alternative for sleep() in C? <p>In traditional embedded programming, we will give a delay function like so:</p>
<pre><code>for(i=0;i<255;i++)
for(j=0;j<255;j++);
</code></pre>
<p>In the microprocessor's view, is this how the sleep() function works?</p>
<p>Is there an alternative for the sleep()... | <p>The kind of loop you describe is called a "busy wait". In real operating systems, sleeping does not cause a busy wait; it tells the operating system to not schedule the process in until the sleep period is over.</p>
|
DataList, Conditional statements in <ItemTemplate>? <p>I am trying to do the following in ASP.NET 3.5. Basically, I am binding a LINQDataSource to a DataList. There is a property called "Deleted" and if it is true, I want to display different markup. The following code throws errors:</p>
<pre><code><asp:DataList... | <p>I might suggest keeping the code-front lean and writing out the desired text via a function result:</p>
<pre><code><asp:DataList runat="server">
<ItemTemplate>
<%# GetText(Container.DataItem) %>
</ItemTemplate>
</asp:DataList>
</code></pre>
<p>And the code-behind:</p>... |
How can I get a list of the differences between two JavaScript object graphs? <p>I want to be able to get a list of all differences between two JavaScript object graphs, with the property names and values where the deltas occur. </p>
<p>For what it is worth, these objects are usually retrieved from the server as JSON ... | <p>Here is a partial, naïve solution to my problem - I will update this as I further develop it.</p>
<pre><code>function findDifferences(objectA, objectB) {
var propertyChanges = [];
var objectGraphPath = ["this"];
(function(a, b) {
if(a.constructor == Array) {
// BIG assumptions here: That bo... |
Converting plist to binary plist <p>Apple strongly recommends using the binary plist format when reading large XML-based data sets into iPhone apps. Among their reasoning is the fact that XML parsing is very taxing on the iPhone. However, this requires that files residing on the remote web server be converted first.</p... | <p>Yes. All the plist code is part of CoreFoundation, which is opensource. CoreFoundation can be directly built and run on Linux and Windows, so you can write a CF tool using the normal APIs you would use on Mac OS X, but build and run it on other platforms.</p>
<p>The particular API you want to be looking at is <a hr... |
PHP removing a character in a string <p>My php is weak and I'm trying to change this string:</p>
<p><a href="http://www.site.com/backend.php?/c=crud&m=index&t=care">http://www.site.com/backend.php?/c=crud&m=index&t=care</a></p>
<p>to be:</p>
<p><a href="http://www.site.com/backend.php?c=crud&m=in... | <p>I think that it's better to use simply <a href="http://www.php.net/str_replace">str_replace</a>, like the manual says:</p>
<blockquote>
<p>If you don't need fancy replacing
rules (like regular expressions), you
should always use this function
instead of ereg_replace() or
preg_replace().</p>
</blockquote>... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.