input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Class library modification / migration <p>I have 3 class libraries. A BBL, a DAL, and a DATA (about 15 datasets). Currently 4 [major] applications utilize the functionality in these DLL's. I'm rewriting one of those applications and I need to (1) Use some of the existing functionality in the libraries (2) Change some o... | <p>You're being very general here (that's probably why you haven't received any answers yet). This is a typical real-world example of rewriting/refactoring code while maintaining compatibility with its surroundings. There is no easy answer to your question, but a few points spring to mind:</p>
<ul>
<li>Write tests fo... |
Dividing C++ Application into Libraries <p>My C++ project is growing larger. We are also moving to using cmake for building now. I want to divide the application into libraries so that they can be linked for testing, preparing the application package, etc. Right now I would divide my code into libraries as follows:</p>... | <p>Sit down with a piece of paper and decide your library architecture. </p>
<p>The library should be designed as a set of levels. </p>
<ul>
<li>A libary on level A (the base) should have dependencioes only on system libraries and only if it must on libraries on level A. </li>
<li>A library on level B can have dep... |
Getting a selected value from the drop down list inside a GridView on Update <p>I have a GridView, each row has Edit button. After it's clicked, one of the columns turns into a drop down list where users can select value. Edit button becomes Update - so very simple usual scenario.</p>
<p>Now, I don't seem to be able t... | <p>Looks like a databinding error, you are trying yo access data that is not present yet...</p>
|
JDT eclipse plugin <p>I want to develop a Java editor eclipse plugin which is slightly different than the normal Java Editor. Is it possible to extend the Normal Java Editor itself? Thanks in advance</p>
| <p>In eclipse you usually do not extend (subclass) an editor (or another feature) but use existing extension points to contribute additional functionality or behaviour.</p>
<p>The eclipse SDKs Help contains a book named 'JDT Plug-In developer guide' with a chapter 'Reference/Extension Points Reference'. There you can ... |
Matching records based on Person Name <p>Are there any tools or methods that can be used for matching by a person's name between two different data sources?</p>
<p>The systems have no other common information and the names have been entered differently in many cases. </p>
<p>Examples of non-exact matches:</p>
<p>Kin... | <p>I had to use a variety of techniques suggested. Thanks pointing me in the right direction(s). Hopefully, the following will help someone else out with this type of problem to solve.</p>
<p><strong>Removing excess characters</strong></p>
<pre><code>CREATE FUNCTION [dbo].[fn_StripCharacters]
(
@String NVARCHAR(M... |
How do I do geocoding (NOT reverse geocoding) on iPhone? <p>I am perplexed as to why there is an iPhone API for Reverse Geocoding (lat/long to address) but NOT for regular Geocoding (address to lat/long).</p>
<p>I want to be able to display an annotation on a map (MKMapView) at an address entered by the user. (As tex... | <p>Merrimack wrote an answer here with a useful example..</p>
<p><a href="http://stackoverflow.com/questions/1140404/forward-geocoding-from-the-iphone/2444249#2444249">Forward geocoding from the iPhone</a></p>
<p>There is a nice blog post of him</p>
<p><a href="http://blog.sallarp.com/ipad-iphone-forward-geocoding-... |
Is it possible to bind two separate functions to the same event <p>Basically I'd like to bind function A to all inputs. Something like this:</p>
<pre><code>$('input').bind('change', function() { bla bla bla });
</code></pre>
<p>And then later I would like to bind something different in addition like this:</p>
<pre><... | <p>The short answer to your question is YES.</p>
<p>If you wish to bind additional functionality to the change event of #inputName, your code sample should work.</p>
<p>If you wish to alter the function that handles the event you can unbind all handlers of the change event before you rebind any new event handlers lik... |
Oracle Syntax for Creating Database Link Owned by Another User <p>The typical syntax for creating a db link is as follows:</p>
<pre><code>create database link remote_db_link
connect to remote_user
identified by remote_password
using 'remote_db'
</code></pre>
<p>But I'd like my DB link owned by another account afte... | <p>Sathya is correct, in that the <strong><code>CREATE DATABASE LINK</code></strong> syntax does not allow creating a database link in another schema. HOWEVER...</p>
<p><b>WORKAROUND</b></p>
<p>It <b>IS</b> possible to create a database link in another user's schema, as long as <code>anotheruser</code> has <code>CREA... |
Populating a va_list <p>Is there a way to create a <code>va_list</code> from scratch? I'm trying to call a function that takes a <code>va_list</code> as a parameter:</p>
<pre><code>func(void **entry, int num_args, va_list args, char *key);
</code></pre>
<p>...from a function that doesn't take a variable number of ar... | <p>This is a <strong>bad idea</strong> because the va_list abstraction is there to hide some <strong>grim</strong> compiler/architecture specific details regarding stack-pointers and what not. And it is pretty much bound to the function's scope once initialized. If you wind the stack and reference a previous frames va_... |
Select random data with DataMapper <p>Im trying to select random datasets with DataMapper, but seems like there is no such function support. </p>
<p>For example, i have set of data: </p>
<pre><code>+-------------------+
| ID | Name | Value |
+-------------------+
| 1 | T1 | 123 |
| 2 | T2 | 456 |
| 3 | T3 ... | <p>A long time after the OP, but since this is the first google hit for "datamapper random row"...</p>
<p>Using pure DataMapper, and without making assumptions about continuous IDs, etc, you can do:</p>
<pre><code>Item.first(:offset => rand(Item.count))
</code></pre>
<p>which results in the queries:</p>
<pre><co... |
How to generate a fax and send it in code <p>I have a business requirement to generate a fax and send it to the recipient. I know the recipients name and fax number and there is a PDF that will be attached. This process will run daily and consist of 100 records to process each time. I was under the impression that t... | <p>Here is some code that may help. This is using the Right Fax COM API Library (rfcomapi.dll)</p>
<pre><code>RFCOMAPILib.FaxServerClass faxserver = new RFCOMAPILib.FaxServerClass();
faxserver.ServerName = "ServerName";
faxserver.Protocol = RFCOMAPILib.CommunicationProtocolType.cpNamedPipes;
faxserver.UseNTAuthenticat... |
Essential Dojo <p>I'm starting to use Dojo; this is (essentially) my introduction to AJAX. We have a Java backend (torque / turbine / velocity) and are using the <a href="http://jabsorb.org/" rel="nofollow">jabsorb</a> JSON-RPC library to bridge Java and Javascript.</p>
<p>What do I need to know? What is the big pic... | <p>The first thing to do is get familiar with the Dojo Object Model. JavaScript does not have a class system so the Dojo toolkit has created a sort of "by convention" object model that works rather well but is very different to how it works in Java for example. </p>
<p>The reason I suggest getting familiar with it is ... |
SliderExtender Reset <p>I would think this would be simple... or that atleast someone else would desire the same thing, but I am unable to find any documentation anywhere...</p>
<p>I have a form with 7 text boxes and 5 sliderextenders on 5 of them... im using jquery, and a client side input button to reset the form on... | <p>omg.. pretty easy actually.</p>
<pre><code>function ResetForm() { $find('behaviorID').set_Value(0); }
</code></pre>
|
Can the padding/margin on radio buttons in IE6/IE7 be reduced to 0-1px? <p>In Firefox and IE8 this isn't a problem, but in IE6, and IE7 I can't seem to reduce the padding/margin on radio buttons to anything reasonable (e.g. 0px or 1px).</p>
<p>In the included images, you can see that the red background is huge on IE6/... | <p>Use height to solve this problem.</p>
<p>I am using this on class on input:</p>
<pre><code>.radiobtn
{
border:0px;
height:14px;
}
</code></pre>
<p>on:</p>
<pre><code><input type="radio" class="radiobtn" name="radio" value=""/> Yes
</code></pre>
<p>It will work fine in I.E 6.0/7.</p>
|
Using a variable for table name in 'From' clause in SQL Server 2008 <p>I have a UDF that queries data out of a table. The table, however, needs to be definable as a parameter. For example I can't have:</p>
<p><strong>Select * From [dbo].[TableA]</strong></p>
<p>I need something like:</p>
<p><strong>Select * From [db... | <pre><code>SET @SQL = 'SELECT * FROM ' + @table
EXEC (@SQL) -- parentheses are required
</code></pre>
|
Accessing a dataProvider with indexOf <p>I have a list object and I'm adding items to it with addItem through the dataProvider.</p>
<p>Before adding an item to the list I want to make sure it's not a duplicate. I've tried using indexOf on the dataProvider and it returns null. I've tried casting it to an array and it w... | <p>Even though you are feeding an array into the dataProvider property, the underlying dataProvider is always of type ArrayCollection and NOT Array. It supports arrays as input but converts them to ArrayCollection using the constructor:</p>
<pre><code>ArrayCollection(source:Array)
</code></pre>
<p>You can use the fol... |
How can I get an OR in my Where clause? <p>I'm building an ad-hoc query to send to SQL doing the following:</p>
<pre><code>var data = from d in db.xxxx select d;
foreach (pattern in user_stuff)
data = data.Where(d=>SqlMethods.Like(d.item,pattern)==true);
</code></pre>
<p>The problem is that the <code>WHERE</cod... | <p>How about I answer my own question:
<a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="nofollow">PredicateBuilder</a></p>
|
Detect the number of unique values in an array <p>I am looking for an efficient way to detect the number of unique values in an array. </p>
<p>My current approach:</p>
<ol>
<li>Quicksort array of integers </li>
<li>Then run a loop to compare elements. </li>
</ol>
<p>In code:</p>
<pre><code> yearHolder := '';
for... | <p>Here is an example with the THashedStringList:</p>
<pre><code>hl := THashedStringList.Create; // in Inifiles
try
hl.Sorted := True;
hl.Duplicates := dupIgnore; // ignores attempts to add duplicates
for i := 0 to High(yearArray) do
hl.Add(yearArray[i]);
uniqueYearCount := hl.Count;
finally
hl.Free;
en... |
.NET: How to write a file with limited permissions for temporary data <p>I have a library I am using where the only way to pass in config data is by giving it a filename where it can go to read the data. I am writing another shared library to be used by all of our applications which consumes this, and so I need a way ... | <p>You can also look at <code>string tempPath = System.IO.Path.GetTempPath();</code> as the user should always have full access to that directory.</p>
|
In flex, how do I set a bitmap grid as a background for canvas <p>I've got a canvas in my app which I want to be backgrounded with a grid. I suppose, I need to create a <code>DisplayObject</code> with a single grid cell drawn on it and set it as a repeated bitmap fill for the canvas, but I can't figure out how to do th... | <p>Try this blog: He has source available.
<a href="http://www.flashcomguru.com/index.cfm/2006/12/6/Tiling-background-image-in-Flex2" rel="nofollow">Tiling background image</a></p>
|
BeforeClass using Spring transactional tests <p>I'm using the Spring transactional test classes to do unit testing of my DAO code. What I want to do is create my database once, before all the tests run. I have a @BeforeClass annotated method but that runs before Spring loads up the application context and configures t... | <p>my solution, a bit complicated but i needed it for an test framework :-)
do not be afraid of the german javadocs, the method names and bodies should be enough to get it</p>
<p><strong>FIRST</strong> create Annotation to mark Class or method for database work (create table and/or insert statements)</p>
<pre>
<code... |
Exposing Custom Control Properties <p>I am developing a new custom control in VisualStudio and wonder whether you can limit the property selection at design time.</p>
<p>To illustrate the problem, there are two properties that rely on each other â orientation and textside. The control itself is rectangular and the ... | <p>Not sure how to limit it at design time -- I've seen compile-time and run-time checking.</p>
<p>However, you may want to consider simplifying your enumerations by combining Orientation and TextSide.</p>
<p>For instance, System.Windows.Forms.TabControl has Alignment property (TabAlignment enum) which specifies Top,... |
Where to find volume mount icon on Leopard <p>I want to change the default icon of a dmg, I'ld like to do like skype or dropbox which use the default image volume icon, but I don't manage to find it with the finder. Do you have any idea where I could find it?</p>
<p>Thanks for your answer,
Boris</p>
| <p>Ok I didn't find the icon in the finder but you can download the full icon set here : <a href="http://rs110l33.rapidshare.com/files/85866864/4367342/iLeopard%5FIcon%5FPack%5FSE.zip">here</a></p>
<p>Also if you want to set the dmg icon from the cmd line :</p>
<ul>
<li><p><strong>cp < your file.icns > < your m... |
RSS Enclosure is ignored <p>I'm trying to create a Podcast RSS feed using WCF. The feed seems to be valid, but the enclosure tag is being ignored. Any ideas?</p>
<p>Fixed now ... don't use file file:/// urls even if you are feeding yourself the files.</p>
<pre><code><rss version="2.0">
<channel>
<... | <p>Two things:</p>
<ol>
<li>The enclosure should not be stored on your hard drive. This should be a world accessible URL. (This assumes that you are publishing this on the web.)</li>
<li>Run the feed through a <a href="http://beta.feedvalidator.org/" rel="nofollow">feed validator</a> to look for errors.</li>
</ol>
|
Webpage design with embedded flash flv videos <p>I need to create a webpage for a family website that has a video section in it. There are about 50 videos that the server will be hosting. I'm looking for an photo album like list where people can scroll through and click on a video and start watching it. Are there any ... | <p>How about <a href="http://www.zenphoto.org/" rel="nofollow">zenphoto</a>? <a href="http://www.zenphoto.org/support/topic.php?id=1126" rel="nofollow">http://www.zenphoto.org/support/topic.php?id=1126</a></p>
|
Python string find <p>I want to find a certain substring inside a string. The string is stored in a list of strings. How can i do it? </p>
| <p>So you're searching for all the strings in a list of strings that contain a certain substring? This will do it:</p>
<pre><code>DATA = ['Hello', 'Python', 'World']
SEARCH_STRING = 'n'
print [s for s in DATA if SEARCH_STRING in s]
# Prints ['Python']
</code></pre>
<p><strong>Edit</strong> at Andrew's suggestion: Yo... |
Visual Studio 2008 Express and jQuery <p>A very basic question.</p>
<p>I have just installed Visual Studio 2008 Express Edition and was was going to make some use of jQuery. </p>
<p>I heard that jQuery is now supported by Visual Studio, but my question is.</p>
<p>What do I need to do to use it? Is is already include... | <p>Download the Visual Studio version of jQuery (should have vsdoc in the name) <a href="http://docs.jquery.com/Downloading%5FjQuery#Download%5FjQuery" rel="nofollow">here</a>.</p>
<p>You can use <a href="http://code.msdn.microsoft.com/KB958502/Release/ProjectReleases.aspx?ReleaseId=1736" rel="nofollow">this hotfix</a... |
Maven Source Code Dependencies <p>I have a couple of projects that I'm working on in Eclipse (or any IDE, so I don't want to depend on specific eclipse dependency maven capabilities). Some projects depend on other projects. Typically in Eclipse I would add the projects as references to other projects, but I'm not sure ... | <p>The <a href="http://m2eclipse.codehaus.org/" rel="nofollow">maven 2 eclipse plugin</a> has 'workspace dependency resolution', where the dependencies are first looked up in the workspace, and then in the repository.</p>
|
How can I use LINQ to return a list of Countries but place a particular country aribitrarly at the top? <p>I have a table with a list of countries in it that I'm using to populate a dropdown.</p>
<p>How can I construct a LINQ query so it will return the list of countries from that table in alphabetical order, with the... | <p>You can use the country's name as a secondary ordering:</p>
<pre><code>return countries.OrderBy(c => GetPrimaryOrdering(c)).ThenBy(c => c.Name);
int GetPrimaryOrdering(Country country)
{
return country.Name == "USA" ? 0 : 1
}
</code></pre>
|
Asynchronous Callback method is never called to give results from web service from Silverlight <p>I'm calling off asynchronously to a web service (Amazon Web Services) from a Silverlight app and my callback method is never actually triggered after I start the asynchronous call.</p>
<p>I've set up another web service p... | <p>Well, there's your problem ;)</p>
<p>It looks like you're calling the ItemSearch method on the service, but you're wiring up and handling the ItemLookup method.</p>
<p>I do it all the time.</p>
|
A question on an example in PHP 5 in Practice <p>HI, I don't understand why the author of a php book used $disks = 1 in a public function __construct($disks = 1)?</p>
<p>I tried to replace $disks = 1 with $disks only, it also worked. Why would author doing that?</p>
<pre><code><?php
// Define our class for Compact... | <p>He is setting a default value for $disks, so if you instantiate the class without an argument, $disks will be set to 1.</p>
<p>Example:</p>
<pre><code>class Foo {
function __construct($var = 'hello') {
print $var;
}
}
f = new Foo('hi'); // prints 'hi'
f = new Foo(); // prints 'hello'
</code></pre>... |
Cocoa: Hide one application <p>Is it possible to hide one specific application using cocoa?</p>
<p>I know you can hide all other applications using the following code</p>
<pre><code>[[NSWorkspace sharedWorkspace] performSelectorOnMainThread:@selector(hideOtherApplications) withObject:NULL waitUntilDone:NO];
</code></... | <p>If you are targeting Mac OS 10.6+, you can use the new <a href="http://developer.apple.com/mac/library/documentation/AppKit/Reference/NSRunningApplication_Class/Reference/Reference.html"><code>NSRunningApplication</code></a> class:</p>
<pre><code>- (BOOL) hideAppWithBundleID:(NSString *)bundleID
{
NSArray *apps... |
Search Engine way to take .ASP pages to .PHP <p>I have basic .ASP pages running on a windows box. I want to migrate them over to a Linux host and of course have to convert them to .PHP and keep like Google happy.</p>
<p>If my site's fairly popular in the search engines how is the best way to do this?</p>
<p>There's ... | <p>Use mod_rewrite to keep your ASP extensions and point it to PHP files of the same name (except for the extension, of course)</p>
<p>Alternatively, use mod_rewrite to do a 301 redirect so that Google updates it's .asp references to the .php URLs.</p>
|
How to know when dismissModalViewControllerAnimated is initiated and also when it is done? <p>Is there a way to know when the dismissModalViewControllerAnimated is initiated and when it is completed (such as the idiom for viewWillAppear and viewDidAppear)? Unlike other animations, this one doesn't seem to have a delega... | <p>Yes, and easier than you think.</p>
<p>When dismissModalViewControllerAnimated: is called, the underlying view (the one about to appear) will receive a viewWillAppear message and a viewDidAppear message.</p>
<p>Caveat: make sure your view controllers are hooked up properly or these messages get lost.</p>
|
Microsoft Visual C# Express Edition 2008 Question <p>I completed a project, and after I finished it I saved and closed out.
When I reopen Microsoft Visual C# Express Edition it shows me all my recent projects. When I open one I can find the Form1.cs however I can not find the code that handles all my events and everyth... | <p>Try right-clicking the Form1.cs and select <em>View Code</em> (Pressing F7 should do the same).</p>
|
Help me out with this MySql full outer join (or union) <p>This is coming from converting MSSQL to MySql. The following is code I'm trying to get to work:</p>
<pre><code>CREATE TEMPORARY TABLE PageIndex (
IndexId int AUTO_INCREMENT NOT NULL PRIMARY KEY,
ItemId VARCHAR(64)
);
INSERT INTO PageIndex (ItemId)
SELECT P... | <p>A <code>FULL OUTER JOIN</code> can often be simulated with the <code>UNION</code> of both <code>LEFT JOIN</code> and <code>RIGHT JOIN</code>. i.e. it is all on the left and those on the right, matching where possible on the join criteria. It is usually extremely rarely used, in my experience. I have a large syste... |
Resize textarea to fit all content <p>I'm trying to resize a textarea to fit the content in it, as tightly as possible. Here's my current effort:</p>
<pre><code>function resizeTextarea(t) {
a = t.value.split('\n');
b = 1;
for (x = 0; x < a.length; x++) {
c = a[x].length;
if (c >= 75) b += Math.ceiling(c/75);
... | <p>Your code fails because there is no such method as Math.ceiling(), it's called <a href="https://developer.mozilla.org/en/Core%5FJavaScript%5F1.5%5FReference/Global%5FObjects/Math/ceil">Math.ceil()</a> instead.</p>
<p>Beside that...</p>
<p>All the variables inside your function are global. This is not a good practi... |
charting platform <p>Looking for options for a live, large data set charting platform to deal with large quantity of constantly evolving data and display it via browser in an usable manner. </p>
<p>Would need to be based off of a DB backend vs. the "reads XML file" approach of some of the Flash apps.</p>
| <p>JFreeChart is a free and scalable solution.</p>
<p><a href="http://www.jfree.org/jfreechart/" rel="nofollow">http://www.jfree.org/jfreechart/</a></p>
|
How do I determine the current timezone a machine is set to with Perl? <p>I had assumed it would be as simple as <code>$ENV{TZ}</code>, but the <code>TZ</code> environment variable is not set, and yet the <code>date</code> command still knows I am in EDT, so there must be some other way of determining timezone (other t... | <pre><code>use POSIX;
print strftime("%Z", localtime()), "\n";
</code></pre>
|
How can I make the following code dry? <p>How can I make my following code "DRY" (Dont Repeat Yourself)</p>
<pre><code>- (void)updateLetterScore { // NOT DRY... Must fix
if (percentScore < 60.0)
letterLabel.text = [NSString stringWithFormat:@"F"];
if (percentScore > 59.0 && percentScore <... | <p>One way (pseudo-code since I don't know objective C):</p>
<pre><code>grades = ["F", "D-", "D", ...]
scores = [60.0, 64.0, 67.0, ...]
for(i = 0; i < grades.count; i = i + 1)
{
if(score < scores[i])
{
letterLabel.text = [NSString stringWithFormat:@"%@", grades[i]]
break;
}
}
</code></pre>
|
Database Refresh <p>How often do you refresh your development database from production database?Since there are many types of projects (targeting different domains) I would like to know how it is being done and at what intervals(days/months/years) it is being done ?</p>
<p>thanks</p>
| <p>While working at Callaway Golf we had an automated build that would completely refresh the database from a baseline. This baseline would be updated (from production) almost daily. We had a set up scripts (DTS) that would do this for us. So if there was some new and interesting information we could easily do it a ... |
Is P2P or client-server architecture better for my game? <p>I'm about to develop a simple 2D game something like chess, checkers, or reversi. There are only simple animations of the players pieces. No complicated math nor graphics therefore I'm wondering if it is better to go with P2P over a client/sever approach.</p>
... | <p>To some extent, it depends on your desired feature set. For example: are you going to have "high scores" or "saved games"? Are you certain your players are going to be near enough to always play via bluetooth? If not -- how will you "connect" them to each other if they're just using the internet? Do you have ser... |
How do you handle command line options and config files? <p>What packages do you use to handle command line options, settings and config files? </p>
<p>I'm looking for something that reads <strong>user-defined options</strong> from the command line and/or from config files. </p>
<p>The options (settings) should be di... | <p>At Google, we use <a href="http://code.google.com/p/google-gflags/">gflags</a>. It doesn't do configuration files, but for flags, it's a lot less painful than using getopt.</p>
<pre><code>#include <gflags/gflags.h>
DEFINE_string(server, "foo", "What server to connect to");
int main(int argc, char* argv[]) {
... |
Simple 2d physics tutorial for terrain collision detection <p>I am looking for a tutorial which will show me how to do simple 2d physics like the ones in <a href="http://www.teagames.com/games/tgmotocross/play.php" rel="nofollow">this</a> (<a href="http://www.teagames.com/games/tgmotocross/play.php" rel="nofollow">http... | <p>I suggest that you take a look at the <a href="http://www.codeplex.com/FarseerPhysics" rel="nofollow">Farseer Physics Engine</a> which is a 2d engine for .NET written in C#. You can look <a href="http://www.farseergames.com/" rel="nofollow">here</a> for some examples of this package in use. Very easy to use and un... |
video storage <p>I am working on an .net client server application, a new requirement is to allow user upload/copy videos into the system, there will be about 50 videos (500 MB each) per year. The application stores data in SQL 2005, but obviously storing the half GB video in SQL server is not great idea.
Any suggestio... | <ol>
<li>Create a header record in a table, grab back the ID of the inserted field.</li>
<li>Create a file in your 'storage' directory with this id.</li>
<li>To retrieve, for an arbitrary row, get the id, then retrieve the file with that id.</li>
</ol>
<p>Works for me, and lots of others. I think this is the most com... |
24MB PHP file upload fails silently <p>I'm writing an app that accepts .mp4 uploads.</p>
<p>So I've a 24.3MB .mp4 that is posted to the server, but it fails silently.</p>
<p>The next smallest file I have is a 5.2MB .flv. It's not the file type of course, but file size.</p>
<p>I wonder if anybody could shed some ligh... | <p>You should also set post_max_size. Files are sent using HTTP POST.</p>
|
Differences between Java interfaces and Objective-C protocols? <p>I know Java, and now I'm learning Objective-C. What exactly are the differences between Java interfaces and Objective-C protocols?</p>
| <p>First off, a little <a href="http://www.virtualschool.edu/objectivec/influenceOnJava.html">historical perspective on the topic</a>, from one of the creators of Java. Next, Wikipedia has a moderately helpful <a href="http://en.wikipedia.org/wiki/Objective-C#Protocols">section on Objective-C protocols</a>. In particul... |
g++ searches /lib/../lib/, then /lib/ <p>According to <code>g++ -print-search-dirs</code> my C++ compiler is searching for libraries in many directories, including ...</p>
<ul>
<li>/lib/../lib/:</li>
<li>/usr/lib/../lib/:</li>
<li>/lib/:</li>
<li>/usr/lib/ </li>
</ul>
<p>Naively, <code>/lib/../lib/</code> would appea... | <p>An attempt at an answer (which I gathered from a few minutes of looking at the <code>gcc.c</code> driver source and the Makefile environment).</p>
<p>These paths are constructed in runtime from:</p>
<ol>
<li>GCC exec prefix (see <a href="http://sunsite.ualberta.ca/Documentation/Gnu/gcc-3.0.2/html%5Fnode/gcc%5F53.h... |
How can I perform a 'dry run' of MSBUILD for a Delphi project? <p>if I launch the RAD Studio command prompt and run</p>
<p>msbuild /t:Rebuild</p>
<p>in the project directory, msbuild will show the full command line to invoke dcc32, including all path settings. (see <a href="http://stackoverflow.com/questions/970994">... | <p>You can replace dcc32.exe with your own application which will log the command line and exit.</p>
|
Trigger to prevent infinite loop in a sql tree <p>I have node table with (NodeId, NodeName) and structure table (ParentNodeId, ChildNodeId). How can I write a trigger that check if an insert update or delete statement can cause infinite relation?</p>
| <p>Here is my solution, and so far it works as expected.</p>
<pre><code>CREATE TRIGGER [dbo].[CheckNodeDependence] ON [dbo].[ObjectTrees]
AFTER INSERT
AS
BEGIN
SET NOCOUNT ON
DECLARE @CTable TABLE(ChildId INT NOT NULL,
ParentId INT NOT NULL,
[Level] INT NOT ... |
Using doctest "result parser" within unit-tests in Python? <p>I recently faced a problem about combining unit tests and doctests in Python. I worked around this problem in other way, but I still have question about it.</p>
<p>Python's doctest module parses docstrings in a module and run commands following ">>> " at th... | <p>See <a href="http://docs.python.org/library/doctest.html#doctest.OutputChecker.check%5Foutput" rel="nofollow"><code>doctest.OutputChecker.check_output()</code></a></p>
|
iPhone - save image at higher resolution without pixelating it <p>I am using the image picker controller to get an image from the user. After some operations on the image, I want the user to be able to save the image at 1600x1200 px, 1024x1024 px or 640x480 px (something like iFlashReady app).</p>
<p>The last option i... | <p>This is non-trivial. Your image just doesn't have enough data. To enlarge it you'll need to resample the image and interpolate between pixels (like photoshop when you resize an image).</p>
<p>Most likely you'll want to use a 3rd party library such as:</p>
<p><a href="http://code.google.com/p/simple-iphone-image-pr... |
Is there a Form.Showdialog equivalent for Gtk# Windows? <p>Using Windows Forms or WPF I can open a dialog window by calling ShowDialog. How can I do that using Gtk#?</p>
<p>I tried just making the Window modal, but although it prevents the user from interacting with the calling window it does not wait for the user to ... | <p>Instead of using a Gtk.Window, use <a href="http://www.go-mono.com/docs/index.aspx?tlink=22@ecma%3a836%23Dialog%2f">Gtk.Dialog</a>, then call dialog.Run (). This returns an integer value corresponding to the ID of the button the user used to close the dialog.</p>
<p>e.g.</p>
<pre><code>Dialog dialog = null;
Respon... |
ASP.NET MVC 1 and 2 on Mono 2.4 with Fluent NHibernate <p>I'd like to create an application using ASP.NET MVC, that should run under mono 2.4 (compiling will be done on a Windows box). Has anyone getting luck with this? Here is what I've already tried:</p>
<ol>
<li>ASP.NET MVC on mono without any persistence model sup... | <p>I am using mono 2.4 to run a asp.net mvc app + windows service.
Compatibility is very good. There are some bugs and differences than with windows but once you learn what they are it gets easier (there can be pain at the start!)</p>
<p>I am using NHibernate (2.1) FluentNhibernate, StructureMap, NBehave, Moq and open... |
MyISAM Tables getting Corrupt <p>sometimes i get an error like "table is marked as corrupt and shld be repaired". that DB (tables) is using MyISAM. recently that keeps happening. what could be the causes? most recently i am executing a batch insert </p>
<p><code>INSERT INTO table (..., ..., ...) VALUES (...), (...), (... | <p>If your tables get corrupt, you can use the repair table command to fix them:</p>
<pre><code> REPAIR TABLE table;
</code></pre>
<p>If you run myisamchk while the server is still running (and inserts/selects are hitting the table), it could be what is corrupting your tables. Most of the corruption issues I run into... |
Handling touches inside UIWebview <p>I have created a subclass of <code>UIWebView</code> , and have implemented the
<code>touchesBegan</code>, <code>touchesMoved</code> and <code>touchesEnded</code> methods.</p>
<p>but the webview subclass is not handling the <code>touch</code> events.</p>
<p>Is there any method to ... |
<p>No subclassing needed, just add a <code>UITapGestureRecognizer</code> :</p>
<pre><code>UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(didTapMethod)];
[tap setNumberOfTapsRequired:1]; // Set your own number here
[tap setDelegate:self]; // Add the <UIGestureRec... |
Angle at corner of two lines <p>I search for the fastest or simplest method to compute the outer angle at any point of a convex polygon. That means, always the bigger angle, whereas the two angles in question add up to 360 degrees.</p>
<p>Here is an illustration:</p>
<p><img src="http://fopref.meinungsverstaerker.de/... | <p>Use the inner-product (dot product) of the vectors describing the lines to get the inner angle and subtract from 360 degrees?</p>
<p><hr /></p>
<p>Works best if you already have the lines in point-vector form, but you can get vectors from point-to-point form pretty easily (i.e. by subtraction).</p>
<p>Taking <cod... |
Difference between Barrier in C# 4.0 and WaitHandle in C# 3.0? <p>I am picking up C# 4.0 and one of the things which is confusing me, is the barrier concept.</p>
<p>Is this not just like using the <a href="http://msdn.microsoft.com/en-us/library/system.threading.waithandle.waitall.aspx"><code>WaitAll</code></a> method... | <p>It sounds like you are curious as to why a Barrier would be preferred over a WaitHandle + WaitForAll derivative? Both can achieve a similar goal if structured properly. </p>
<p>I'm not extremely familiar with Barrier but one advantage that jumps out at me is a resource issue. To synchronize N threads with a Bar... |
Fill a Textbox from a File <p>I am making a Help-form for my application. A Help-form normally has a ListView on the left and a RichTextbox on the right. When you click on a Help topic in the ListView, the text in the RichTextbox is supposed to change accordingly. The text file is part of the application's resources.</... | <p>I got it.</p>
<p>Since the text file is in Resources, I can do this:</p>
<p>Richtextbox1.Text = My.Resources.Textfile</p>
|
How to make my font bold using css? <p>I'm very new to HTML and CSS and I was just wondering how I could make my font bold using CSS.</p>
<p>I have a plain HTML page that imports a CSS file, and I can change the font in the CSS. But I don't know how to make the font bold, can anyone help me?</p>
| <p>You can use the CSS declaration <code>font-weight: bold;</code>.</p>
<p>I would advise you to read the CSS beginner guide at <a href="http://htmldog.com/guides/cssbeginner/">http://htmldog.com/guides/cssbeginner/</a> .</p>
|
ASP.NET Datagrid : How to style? <p>Can any one tell me how to do styling for an asp.net datagrid control.I have the following requirements. I want to know to which proprties these style classes to be applied </p>
<p>1 . Header Row should have border in top and bottom.No Left and Right borders.
2 . Want to have a line... | <p>You can add a section in the <code><asp:DataGrid></code> tag like this:</p>
<pre><code><HeaderStyle Font-Bold="True" HorizontalAlign="Center" VerticalAlign="Top" BackColor="SaddleBrown" ForeColor="Ivory" />
</code></pre>
<p>Or you can set the style in the column templates ike this:</p>
<pre><code><... |
an error in taking an input in python <p>111111111111111111111111111111111111111111111111111111111111</p>
<p>when i take this as input , it appends an L at the end like this </p>
<p>111111111111111111111111111111111111111111111111111111111111L</p>
<p>thus affecting my calculations on it .. how can i remove it?</p>
... | <p>It's being input as a Long Integer, which should behave just like any other number in terms of doing calculations. It's only when you display it using <a href="http://docs.python.org/library/functions.html#repr" rel="nofollow"><code>repr</code></a> (or something that invokes <code>repr</code>, like printing a list)... |
Counting repeated characters in a string in Python <p>I want to count the number of times each character is repeated in a string. Is there any particular way to do it apart from comparing each character of the string from A-Z
and incrementing a counter?</p>
<p><strong>Update</strong> (in reference to <a href="http://s... | <pre><code>import collections
d = collections.defaultdict(int)
for c in thestring:
d[c] += 1
</code></pre>
<p>A <code>collections.defaultdict</code> is like a <code>dict</code> (subclasses it, actually), but when an entry is sought and not found, instead of reporting it doesn't have it, it makes it and inserts it... |
Error when trying to consume WCF service returning file <p>One of my methods returns byte[], of a file. All other methods return either string objects or custom objects</p>
<p>I can view the WSDL via a browser and as i have used WCfExtras, I can even view the documentation. </p>
<p>In my test app, C# web application,... | <p>I have the same problem. I was hosting the wcf on remote win2008 server on IIS. The solution that has worked for me was setting the host name when adding web site and don't leave it blank after setting all other data for hosting! </p>
|
How can I avoid repeating myself in LinqToEntities? <p>I find myself repeating business-rules too much in my LinqToEntities when querying. That's not good. ;)</p>
<p>Say I have two tables: </p>
<h3>Member</h3>
<ul>
<li>Id </li>
<li>Name</li>
</ul>
<h3>MemberShip</h3>
<ul>
<li>Id </li>
<li>MemberId (fk to member... | <p>It looks like you're using VB.NET. I apologize for answering with some C# code, but hopefully you can translate.</p>
<p>I can think of a couple ways of tackling this. The first idea is to create a function that returns a predicate of type Func. This allows EF to reverse engineer the predicate into a query. For exam... |
Apache VirtualHost with mod-proxy and SSL <p>I am trying to setup a server with multiple web applications which will all be served through apache VirtualHost (apache running on the same server). My main constrain is that each web application must use SSL encryption. After googling for a while and looking other question... | <p>You don't need to configure SSL in both Apache and Tomcat.</p>
<p>The easiest way to accomplish that is configure SSL just on Apache and proxy to tomcat using http.</p>
|
APC results blank page after MySQL root password change <p>I have APC installed via cPanel everything worked just fine until I set new MySQL root password.</p>
<p>After MySQL root password changed my web sites hosted on this box resulting blank page.</p>
<p>When I disable APC everything works fine, so I guess problem... | <p>APC and MySQL are not related to each other, and neither should affect the other.</p>
<p>You might want to look into your error logs for more information. Alternatively you can turn display_errors on and error_reporting to E_ALL | E_STRICT</p>
|
.NET MVC View question <p>I have this cute little progress bar looking thing in a dashboard page. Once it is started up, it updates itself every minute via ajax, javascript, blah, blah. Since some of my viewers are looking at it on older Blackberries, I normally figure out how big the bar should be for the initial rend... | <p>The simplest way - creating HtmlHelper extension:</p>
<pre><code>public static class Html
{
public static string ProgressBar(this HtmlHelper html, int width)
{
StringBuilder sb = new StringBuilder();
sb.AppendFormat("img src=\"/content/images/blue_1px.png\" class=\"productionBar_variableBar... |
Extracting File Extension in PHP (image upload script) <p>Can anyone tell me what is wrong with this? The file is renamed using a time stamp but the extension doesn't get extracted and placed in the new name.</p>
<pre><code> $filenameext = pathinfo($filename, PATHINFO_EXTENSION);
$today = getdate();
$uniqu... | <p>This should work fine - can you print your $filename right before pathinfo()?</p>
<p>Edit after you posted your code: so let me get this straight</p>
<pre><code>$imageFile = $_FILES['image']['tmp_name'];
$filenameext = pathinfo($filename, PATHINFO_EXTENSION);
</code></pre>
<p>You read in $imageFile but parse an u... |
Where can I find, or how can I create an elegant C++ member function template wrapper mechanism without resporting to boost? <p>I want to be able to templatize a class on a member function without needing to repeat the arguments of the member function -- i e, derive them automatically.
I know how to do this if I name t... | <p>The C++ standard library provides <code>mem_fun_ref</code> which sort of works how you want, though it only works for nullary and unary functions. Of course, you can use a struct with all the parameters as your one argument.</p>
|
Anyone know of a good free patch creator? <p>Does anyone know of a good patching program that is free? You know, one that can take a directory with your old program in it and compare it to a directory with your new version, and spit out a patch that is only the difference between the two?</p>
<p>Also, I am looking for... | <p>There is <a href="http://www.daemonology.net/bsdiff/" rel="nofollow">Binary patch and diff</a>, which is free, Windows port available.</p>
|
Removing image background in UIImageView at runtime <p>I have a ball assigned to a UIImageView in Interface Builder. An IBOutlet from the UIImageView is wired to a corresponding UIViewController. The image has a white background. When I assign it to the UIImageView in IB, the background is transparent. In IB, I hav... | <p>Make sure you set <code>self.ball.opaque = NO;</code> in addition to setting the background color to clear. Otherwise, a white background will still be drawn. I believe you have to set both of these whether you use IB or Xcode to create the view - but IB may have set them both for you.</p>
|
how do I change persistence.xml at run time <p>I am new to openJPA. </p>
<p>I have a scenario where, depending upon the server where my application is running, I need to change the settings to persistance.xml.
For eg. if its running on Server A, then it should use different database(different url), different password ... | <p>You're using an application server so you don't need to set database connection settings in the persistence.xml file. You should be able to create a JNDI data source in your appserver and then use that. EAch server could have the data source have the same JNDI name and then there'll be no need for any persistence.xm... |
Why doesn't Ruby automatically execute to_s? <p>I have an author class:</p>
<pre><code>class Author < ActiveRecord::Base
def to_s
name
end
end
</code></pre>
<p>Defining <code>to_s</code> allows me to do <code>puts Author.first</code>, but not <code>puts Author.first.rjust(10)</code>:</p>
<pre><code>NoMeth... | <p>First off, no, it wouldn't. I don't want ruby to just say "Hey, maybe this is a string method, let me see if I can run it after running <code>to_s</code>" on an arbitrary object. That being said, there are two solutions to what you want to do:</p>
<p>If you want to say "On any <code>Author</code> instance, if som... |
Fail-proof method to get external (non-private) IP address on CakePHP? <p>The <a href="https://trac.cakephp.org/browser/branches/1.2.x.x/cake/libs/controller/components/request%5Fhandler.php#L404" rel="nofollow">getClientIP( )</a> method that comes with CakePHP is returning private IPs sometimes. For example IPs like 1... | <p>Try calling <code>getClientIp(false)</code>. If that doesn't work, you could just use <code>$_SERVER["REMOTE_ADDR"]</code> directly instead. It will always contain the external IP that actually connected to the server. This address can't be manipulated, unlike http headers intended for proxies.</p>
|
Function/Class Comment Formatting Conventions <p>Who has the most readable and useful function/class commenting convention?
I'm not looking for something that generates docs, but I'm considering adopting something like JavaDoc because all the info is there.</p>
<pre><code>/**
* This function processes data
*
* @pa... | <p>For the comment style, I would definitely go for multiline, as that's what they are for - it just looks cleaner overall.</p>
<p>For the params, the first one is more powerful, as you can specify the type of each information: '@type name description', vs 'name description' and it's what I usually see in C type langu... |
Edit .htaccess from within Django admin <p>I block certain referers in my .htacccess file to avoid serving images to warez sites. The images are served directly so Django doesn't touch them and I'd like to keep it that way because of performance.</p>
<p>But I would like to be able to add more blocked sites to the list... | <p>You could create a model that defines all the configurable part of .htaccess; then, add a signal (<a href="http://docs.djangoproject.com/en/dev/topics/signals/#topics-signals" rel="nofollow">django doc</a>) on each save, to call a function that will write a new .htaccess based on what has been defined on the databas... |
Checking passwords against word database on server or use a web service? <p>If I want to check passwords in my application for the inclusion of English words, should I store a database of English words locally (is there a free database?) or is there a (free) web service I can use to check them remotely? </p>
<p>Ideall... | <p>/usr/share/dict/words contains a massive wordlist if you working on unix<br />
Otherwise <a href="http://www.deveiate.org/projects/Ruby-WordNet/" rel="nofollow">here</a> is a ruby gem for something called wordnet which could easily solve your problem and probably include names of famous cities and people as well<br ... |
About c arrays <p>I know that you can declare an array in C like this:</p>
<pre><code>int nums[5] = {0,1,2,3,4};
</code></pre>
<p>However, can you do this?</p>
<pre><code>int nums[5];
// more code....
nums = { 0,2,5,1,2};
</code></pre>
<p>In other words, can I initialize the array using the bracket notation at any ... | <p>It's not possible in C89 (what most C compilers target). C99 is supported by a few, and has compound literals:</p>
<pre><code>int nums[5];
memcpy(nums, (int[5]){1, 2, 3, 4, 5}, 5 * sizeof(int));
</code></pre>
<p>You however cannot assign to an array. You can only copy to its memory. You would need another array th... |
How to send an alert message to a friend in the same network? <p>I would like to send some messages to my friend who is in the same network as mine, but I do not want him to confirm any password or registration. Just a pop up windows appears on his screen. Any suggestion, please? Windows Vista is my OS, however If you ... | <p>The only built-in tool I know for Windows is the "NET SEND" command.</p>
|
Best approach for integrating data between two SQL databases? <p>I am writing an events calendar, and the data for the calendar I will need to pull from another database and make some changes to before committing to mine.</p>
<p>What are some basic approaches for this that you would suggest?</p>
<p>This data is not s... | <p>There are a bunch of options. 2 pretty easy solutions to implement are:</p>
<ol>
<li>You can use SSIS (Sql Server Integration Services) to transport data to and from data sources</li>
<li>You can also use SQL Server Replication and set up a publisher / subscriber scenario.</li>
</ol>
|
c++ open source project recommend <p>I have learned c++ about three years and I have not used c++ in an actual project. I only used it to write some small program and example, I have read many books about c++ and algorithm, "c++ primer", "effective c++" "exceptional c++" "c++ common knowledge" " introduction to algorit... | <p>There are many. My suggestion would be to pick a project where you would be a user too. Then you'll have a better stakeholding in the results.</p>
|
Design patterns for managing results of large operations <p>We frequently have objects that perform multi-part operations/tasks. An example would be refreshing internal state of a list of objects based on a query of the file system and reading data from the found files. These things are also often long running, and t... | <p>Why not just log the errors, and when the operation is done let the user know that an error occurred and that the sysadmin should look at the event log?</p>
<p>Any technical errors will probably not be understood by a casual user. Non-casual users should be savvy enough to look at a log file and interpret the resul... |
How do you talk to a BerkeleyDB database from Ruby or Ruby on Rails? <p>I have no idea how I would set up a BerkelyDB database in a Ruby or Rails project.</p>
<p>Does anyone have any experience configuring one, that they could talk about?</p>
<p>Maybe using ActiveRecord or Datamapper?</p>
| <p>I would use Moneta, which provides a unified interface for key/value stores:
<a href="https://github.com/minad/moneta" rel="nofollow">https://github.com/minad/moneta</a></p>
|
Static constructor equivalent in Objective-C? <p>I'm new to Objective C and I haven't been able to find out if there is the equivalent of a static constructor in the language, that is a static method in a class that will automatically be called before the first instance of such class is instantiated. Or do I need to ca... | <p>The <a href="http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/occ/clm/NSObject/initialize"><code>+initialize</code></a> method is called <strong>automatically</strong> the first time a class is used, before any class methods are used or i... |
What is a better way to store status updates in a database? <p>I'm developing a web application that will enable users to post short status updates similar to Twitter. The only way I can think of storing these posts is to have a large "status_updates" table that stores EVERY user's status updates:</p>
<pre><code>-----... | <p>Build a user table, and have the <code>user_id</code> be an integer foreign key to that user table. Then, build an index on the <code>user_id</code> field to allow for rapid retrieval.</p>
<p>In short:</p>
<pre><code>status_updates:
--------------------------------------
| status_id | user_id | status |
---... |
What do you believe to be the best CSS Grid system and why? <p>I've been using Nicole Sullivan's "Object Oriented" CSS grid for a while now (hate the term, though) and have found it to be quite good. However, as I get more experience with grids, I'm noticing a lot of other frameworks out there; in particular the <a hr... | <p>I think <a href="http://blueprintcss.org/" rel="nofollow">Blueprint</a> is the best.</p>
<p>Also review comments posted at: <a href="http://stackoverflow.com/questions/589184/help-me-choose-a-css-framework-960-vs-blueprint-vs">http://stackoverflow.com/questions/589184/help-me-choose-a-css-framework-960-vs-blueprint... |
Using extract <p>I'm new to OOP and want to revamp this function to get rid of using globals.</p>
<pre><code> function CatchListing() {
$parseform = array('itemnum','msrp','edprice','itemtype','box','box2','box25','box3','box4','box5','box6','box7','itemcolor','link');
foreach ($parseform as $globalName)... | <p>Be VERY careful about using extract with externally inputted values as from $_GET and $_POST.</p>
<p>you're much better off extracting the values manually to known values.</p>
<p>It's far too easy for an extract from _GET or _POST to clobber existing variables.</p>
|
Google App Engine HTTP header Content-Type not correct once application is deployed <p>I am writing an app on GAE and I have a URL that will always return XML and set the Content-Type to <code>"text/xml; charset=utf-8"</code>. </p>
<p>I am using the built in webapp framework and using the following code to set content... | <p>Use <code>self.response.headers['Content-Type'] = "text/xml; charset=utf-8"</code>, so that you override the content-type rather than adding another homonymous header.</p>
|
WAFL: Write Anywhere File Layout <p>I wonder if anyone knows about WAFL (Write Anywhere File Layout), or a link to the topic of interest (not wikipedia), or a good bibliography online because I am investigating about operating systems, thanks to all.</p>
| <p>The wikipedia page has links to a PDF from Network Appliance on the system as well as the patent link. If that's not going to satisfy you then you need to be more specific as to what kind of information you want.</p>
|
django for loop counter break <p>This is hopefully a quick/easy one. I know a way to work around this via a custom template tag, but I was curious if there were other methods I was over looking. I've created a gallery function of sorts for my blog, and I have a gallery list page that paginates all my galleries. Now, I ... | <p>Use:</p>
<pre><code>{% for photos in gallery.photo_set|slice:":3" %}
</code></pre>
|
Can operators be used as functions? (C++) <p>This is similar to another question I've asked, but, I've created an expression class that works like so:</p>
<pre><code>expression<int, int> exp(10, 11, GreaterThan);
//expression<typename T, typename U> exp(T val1, U val2, oper op);
//where oper is a pointer t... | <p>I'm not sure if this is what you are asking, but the C++ standard library provides function objects for many of C++'s operators, declared in the header <code><functional></code>. This includes <code>std::plus</code> (+), <code>std::minus</code> (-), <code>std::multiplies</code> (*), <code>std::divides</code> (... |
How does the backend look for AjaxLink() call in Zend Framework <p>I'm trying to make some ajax-functionality in my web application, but I cannot get all puzzle pieces to fit:</p>
<p>I want to add a link that, when clicked upon, will open a new input (text) field that can be filled by the user. In the back-end, I want... | <p>You need to turn off the ViewRenderer for this particular action. ZF by default enables an Action Helper called ViewRenderer which assigns a conventionally named view script (in your case, action1.phtml) to a particular action method. Since you're only trying to return a small snippet of text, rather than a full sit... |
SimpleXML: Selecting Elements Which Have A Certain Attribute Value <p>In an XML document, I have elements which share the same name, but the value of an attribute defines what type of data it is, and I want to select all of those elements which have a certain value from the document. Do I need to use XPath (and if so,... | <p>Try this XPath:</p>
<pre><code>/object/data[@type="me"]
</code></pre>
<p>So:</p>
<pre><code>$myDataObjects = $simplexml->xpath('/object/data[@type="me"]');
</code></pre>
<p>And if <code>object</code> is not the root of your document, use <code>//object/data[@type="me"]</code> instead.</p>
|
How to do this in PowerShell? Or : what language to use for file and string manipulation? <p>What language should I use for file and string manipulation?</p>
<p>This might seem objective, but really isn't I think. There's lot to say about this. For example I can see clearly that for most usages Perl would be a more ob... | <p>This is actually pretty easy in <a href="http://en.wikipedia.org/wiki/Windows_PowerShell" rel="nofollow">PowerShell</a>:</p>
<pre><code>function Number-Lines($name) {
Get-Content $name | ForEach-Object { $i = 1 } { "{0:000}. {1}" -f $i++,$_ }
}
</code></pre>
<p>What I'm doing here is getting the contents of th... |
t-sql udf, get the data type of a parameter <p>is it possible to get a numeric parameter to my udf
and do stuff according to its type, like:</p>
<p>if type of @p1 is decimal(10,3)
...
else if type of @p1 is decimal(15,3)
...
else if type of @p1 is integer
...</p>
| <p>Try out the sql_variant_property function...</p>
<p>Some examples...</p>
<pre><code>Declare @Param Int
Set @Param = 30
Select sql_variant_property(@Param, 'BaseType')
Select sql_variant_property(@Param, 'Precision')
Select sql_variant_property(@Param, 'Scale')
Declare @ParamTwo float
Set @ParamTwo = 30.53
Select ... |
Tracking workflow compilation error source from msbuild output <p>When building a solution on a machine without VS installed, and getting workflow compilation errors I would like to track down the source of the errors, but the msbuild output is not very helpful:</p>
<blockquote>
<p>C:\Program Files\MSBuild\Microsoft... | <p>Can you build it on the command line using MSBuild on a machine in which it builds successfully using Visual Studio, or does it fail there as well?</p>
|
Write to registry in Windows Vista <p>I am trying to write to the registry from my application, but when I do I get access denied. Of course, it works if i run the app as Administrator. However, with my applcation, it is not initiated by the user. It start automatically.</p>
<p>So, the question is, how do i read/wr... | <p>Write to <code>HKEY_CURRENT_USER</code></p>
<p>And check out this posts</p>
<p><a href="http://stackoverflow.com/questions/698193/vista-vb-net-access-denied-while-writing-to-hkeylocalmachine">Vista + VB.NET - Access Denied while writing to HKEY_LOCAL_MACHINE</a></p>
<p><a href="http://stackoverflow.com/questions/... |
What's the easiest frame by frame animation technique in the iPhone sdk? <p>i've been developing for the iphone platform for about 3 weeks now, and I'm trying to set up a frame by frame animation with 16 1000x1000 png images (with transparency) and plan on animating with around 100 later, so first I tried using imageNa... | <p>One major difference between imageNamed: and imageWithContentsOfFile: is that imageNamed returns an image that has been pre-decompressed.</p>
<p>You can create your own "optimized" version without requiring the images to be cached by looking at <a href="http://stackoverflow.com/questions/924740/dispelling-the-uiima... |
Can SyndicationFeed.Load be made more robust? <p>I am trying to read a handful of Rss / Atom feeds with</p>
<pre><code>var synFeed = SyndicationFeed.Load(reader);
</code></pre>
<p>But it throws on the slightest problem. For instance, when one Item contains a few HTML tags in the description field, it's not possible t... | <p>Henk, the reason you can't read the feeds from Slashdot is because it uses RSS 1.0. The .NET Framework only includes built-in support for RSS 2.0 and Atom 1.0 feeds.</p>
<p>However, it is possible to create your own class that extends the SyndicationFeedFormatter class and parses RSS 1.0 feeds. Check out my article... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.