input
stringlengths
51
42.3k
output
stringlengths
18
55k
Can i get the key of a style in code-behind? (WPF) <p>If I have the following code:</p> <pre><code>Style defaultStyle = (Style)FindResource("MyTestStyle"); </code></pre> <p>Is there a way to get the name of the style (i.e. reverse-lookup)? Something like:</p> <pre><code>string name = defaultStyle.SomeMagicLookUpFunc...
<p>I've created a small helper class with a single method to do the reverse lookup that you require.</p> <pre><code>public static class ResourceHelper { static public string FindNameFromResource(ResourceDictionary dictionary, object resourceItem) { foreach (object key in dictionary.Keys) { ...
IsAjaxRequest is always false after upgrade to RC MVC <p>I updated the AJAX scripts and assembly referenced as per release notes. However, IsAjaxRequest still always returns false despite it actually being such a request. How do I resolve this?</p>
<p>As I understand you are using MS Ajax library. You should update your MicrosoftMvcAjax.js too. It was changed. </p>
How do I get the current mouse position in C++ / OpenGL? <p>I know that I can use a Mouse callback function for when a user clicks the mouse, but what if I want to know the current x/y position without the user clicking?</p> <p>Will I have to use a different callback that gets called on any mouse movement and keep tra...
<p>Register a glutPassiveMotionFunc callback function</p> <p>See info about <a href="http://titanium.mountunion.edu/cs/cs480/sp07/glutcallbackhints.html" rel="nofollow">callbacks</a></p>
Deploying Ruby on Rails with Apache and Mongrel <p>I'm fairly new to ruby on rails and web development. Here is my setup which I followed from this link <a href="http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with-mongrel.html" rel="nofollow">http://tonyrose023.blogspot.com/2007/01/multiple-rails-apps-with...
<p>I would advise you to look into <a href="http://www.modrails.com/" rel="nofollow">Passenger</a>. It's really easy to set up, lets Rails apps share memory, removes the burden of managing a cluster of mongrels and requires virtually no configuration. All you need are a special 'config.ru' file with a <a href="http://w...
Should private helper methods be static if they can be static <p>Let's say I have a class designed to be instantiated. I have several private "helper" methods inside the class that do not require access to any of the class members, and operate solely on their arguments, returning a result.</p> <pre><code>public class ...
<p>I prefer such helper methods to be <code>private static</code>; which will make it clear to the reader that they will not modify the state of the object. My IDE will also show calls to static methods in italics, so I will know the method is static without looking the signature.</p>
StarTeam view/branching approach <p>We're looking for some advice on our StarTeam configuration. We have a project that is used by two main customers. We share a common code base but we want to be able to do development for one customer at a time. Does anyone know what the best way to do this is using StarTeam?</p> ...
<p>You may not want to hear this, but there is no single best way. Having said that, I will tell you what we do.</p> <p>We do nearly all development in the default view. When we are close enough to releasing one version of a product that we want to start working on the next version, whenever that happens to be, we mak...
How can I report on files with pending changes in TFS? <p>I'd like to create a simple report that shows files that currently have pending changes (checked out) from a TFS 2008 server. I know that I can use the "Find in Source Control" option from Team Explorer, but I would rather generate a reporting services report. I...
<p>If you're looking for some easy to read data and not too worried about print outs, have a look at the TFS sidekick application by Attrice. Very helpful and if you have the correct permissions, you'll be able to see all the checked out files.</p> <p><a href="http://www.attrice.info/cm/tfs/" rel="nofollow">http://ww...
Unable to access bluetooth device via COM port on dell axim pda with J2ME <p>I'm trying to write part of a J2ME application and I'm responsible for reading NMEA data from a GPS device attached via bluetooth (to a Dell Axim X51 PDA).</p> <p>I've paired the gps device with the PDA and I can run the sample program that c...
<p>There is a good chance the j2me implementation on your device doesn't support bluetooth COM ports at all. I would suggest confirming that first. It could be worth comparing the result of the system property call on other (recent) handsets.</p>
Is there a simple way to change the text of the 'Open' button on the windows file dialog to 'Select'? <p>We're using the file picker dialog to allow users to add documents into our application. The word 'Open' doesn't make a lot of sense in this case.</p> <p>Thanks.</p>
<p>I would browse the <a href="http://www.codeproject.com/KB/dialog/OpenFileDialogEx.aspx" rel="nofollow">code found here</a>, which shows how someone extended the OpenFileDialog. Admittedly, this is overkill for you. But I think there is code within to change the button label.</p>
Connecting to MS SQL Server using python on linux with 'Windows Credentials' <p>Is there any way to connect to an MS SQL Server database with python on linux using Windows Domain Credentials?</p> <p>I can connect perfectly fine from my windows machine using Windows Credentials, but attempting to do the same from a lin...
<p><strong>As pointed out in one of the comments, this answer is quite stale by now. I regularly and routinely use GSSAPI to authenticate from Linux to SQL Server 2008 R2 but mostly with the EasySoft ODBC manager and the (commercial) EasySoft ODBC SQL Server driver.</strong></p> <p>In early 2009, a colleague and I man...
MGTwitterEngine - Status updates <p>I find that randomly I get a EXC_BAD_ACCESS error on the iPhone when updating the status. This occurs pretty randomly.</p> <p>Anyone have any idea to how this make be fixed?</p> <pre><code>#import "TwitterViewController.h" NSString *_testUID = nil; NSString *sImageName; @implemen...
<p>You have a few leaks (twitterEngine (you are retaining it when alloc/init does the job fine) and arrayEmotes (never gets released) to name the two I spotted right away), and you could have another issue related to sImageName when you send the update (notice how it isn't defined on a scope other than inside the switc...
How to get a window handle to a COM Single-Threaded Apartment (STA)? <p>CoInitialize(NULL) creates an STA by creating a hidden window. How to get an HWND handle for this window?</p> <p>Function EnumThreadWindows does not work, in an example I tried:</p> <pre><code>... CoInitialize(NULL); EnumThreadWindows(GetCurren...
<p>This hidden window is Message-Only Window, It is not visible, has no z-order, cannot be enumerated, and does not receive broadcast messages. The window simply dispatches messages.</p> <p>To find message-only windows, specify HWND_MESSAGE in the hwndParent parameter of the FindWindowEx function. In addition, FindWi...
Can we publish two versions of an iphone application? <p>HI,</p> <p>I am developing an application for an esteemed client in Australia. They have certain copyright issues when it comes to uses outside Australia accessing the content via the app.</p> <p>Is it possible to have a local and an international version of th...
<p>Yes, you can create two versions of the application with different SKUs. The best way to do this would by by using a wildcard certificate and using a different project identifier in the application's plist file.</p> <p>Using the administrative panel on iTunes Connect you can then restrict the sale of the SKUs to di...
What can cause a UIView to be arbitrarily removed from the hierarchy? <p>I have an iPhone app that, for some users, sometimes behaves as if with the main UIView has been removed from the view hierarchy. It always happens coincident with a significant event in the game. Other Core Graphics-drawn UIViews that are above...
<p>Yes, infact one of my applications very occasionally exhibits this problem and it does seem to be memory related.</p> <p>I have had no success tracking it down either by debugging or analyzing the program flow. I have verified that the view in question is destroyed and not just hidden in some way.</p> <p>It happen...
why can't i change my regional settings? <p>for about 2 hours i've been trying to find solutions on how to change my advanced regional settings(the one for language used in non-unicode programs) ..because everytime i try to change the language ...the system gives me an error that says: Setup was unable to install the c...
<p>Sounds to me like you may need to be an admin to do that. Have you tried that?</p>
OCI connection string... need help <p>Does anyone know the OCI connection string used for the dbname parameter in the function OCILogon() for the oracle 10g C API ?</p> <p>I know you can specify the tnsnames.ora entry for the service, but does it have the ability to take something like: oci:connect:myserver.com:1521/m...
<p>You may use the following format for dbname:</p> <p><code>[//]host[:port][/service name]</code></p> <p>You can read more on subject here: <a href="http://download.oracle.com/docs/cd/E11882_01/appdev.112/e10646/oci01int.htm#LNOCI16167" rel="nofollow">Database Connection Strings for OCI Instant Client</a></p>
Google Bookmark Export date format? <p>I been working on parsing out bookmarks from an export file generated by google bookmarks. This file contains the following date attributes:</p> <p>ADD_DATE="1231721701079000"</p> <p>ADD_DATE="1227217588219000"</p> <p>These are not standard unix style timestamps. Can someone po...
<p>Chrome uses a modified form of the Windows Time format (“<a href="http://blogs.msdn.com/b/oldnewthing/archive/2009/03/06/9461176.aspx">Windows epoch</a>”) for its timestamps, both in the <code>Bookmarks</code> file and the history files. The Windows Time format is the number of 100ns-es since January 1, 1601. Th...
What is the best way to clean a string for placement in a URL, like the question name on SO? <p>I'm looking to create a URL string like the one SO uses for the links to the questions. I am not looking at rewriting the url (mod_rewrite). I am looking at generating the link on the page.</p> <p>Example: The question name...
<p>As you pointed out already, urlencode() is not needed in this case and neither is trim(). If I understand correctly, step 4 is to avoid multiple dashes in a row, but it will not prevent more than two dashes. On the other hand, dashes connecting two words (like in "large-scale") will be removed by your solution while...
How does .NET make use of IO Threads or IO Completion Ports? <p>We have a .NET application that makes several concurrent calls to various web services, collects their responses and then makes a few calculations off those responses. In attempting to derive additional performance, I've been investigating the use of appro...
<p>Chances are that you don't have to do anything if you are using the asynchronous methods already. Depending on the technology that you are using for the call to the web service, ultimately, it's going to drop down to the Win32 API to make the call to get bytes from the network, and to that end, it will use I/O Comp...
Questions about Php and Mysql Hash Table <p>I am a new php and mysql programmer. I am handling quite large amount of data, and in future it will grow slowly, thus I am using hash table. I have couple of questions:</p> <ol> <li><p>Does mysql have hash table built in function? If yes, how to use that?</p></li> <li><p>Af...
<p>(sorry about the italics, underscores can trigger them but I can't find a good way to disable that in the middle of a paragraph. Ignore the italics, I didn't mean to put them there)</p> <p>You don't need to worry about using a hashtable with MySQL. If you intend to have a large number of items in memory while you o...
Scrum: Unfinished products and sprint velocity <p>Let’s say product X is worth 10 story points. Development starts in sprint Y, but is not completed in time. What do you with the story points when calculating sprint Y’s velocity?</p> <p>Would you:</p> <p>a. Allocate 0 story points for sprint Y and 10 points for...
<p>Depends on whether you care about your "instantaneous" or "average" velocity. Personally, I wouldn't make it more complicated than necessary and just add it into the sprint where it was completed. Calculate your average velocity by looking at the average number of points completed per sprint over the last 3, 6, an...
Script SQL Server login with Windows authentication without machine name <p>I want to write a SQL 2005 script to create a new login that uses Windows authentication. The Windows user is a local account (not a domain one). A local account with the same name exists on many SQL Server machines and I want to run the same s...
<p>Looks like sp_executesql is the answer, as beach posted. I'll post mine as well, because @@SERVERNAME doesn't work correctly if you use named SQL instances, as we do.</p> <pre><code>DECLARE @loginName SYSNAME SET @loginName = CAST(SERVERPROPERTY('MachineName') AS SYSNAME) + '\MyUser' IF NOT EXISTS (SELECT * FROM s...
What is the best way to meditate to increase programming productivity? <p>Recently, I've added regular exercise to my life. It has given me more overall energy and I have been more productive at work. However, I have also heard that meditation can help you be more focused, and, consequently, more productive. There is a...
<p>The Pragmatic Programmers wrote a great book <a href="http://www.pragprog.com/titles/ahptl/pragmatic-thinking-and-learning">Pragmatic Thinking and Learning</a> which suggests the Vipassana meditation technique:</p> <blockquote> <p>What you want to attain here is not a trance or to fall asleep or to relax or to...
XmlSerializer can't find EntityObject even though its referenced <p>I hope that someone can help me with this problem that I've been having with XmlSerializer. </p> <p>I've already looked through this thread: <a href="http://social.msdn.microsoft.com/Forums/en-US/asmxandxml/thread/551cee76-fd80-48f8-ac6b-5c22c234fecf/...
<p>If you don't have any code that requires a reference at compile time then that reference won't be included in the built assembly. You can use a tool like <a href="http://www.red-gate.com/products/reflector/" rel="nofollow">Reflector</a> to check whether the reference is making it into your assembly.</p> <p>One thi...
Good Domain Driven Design samples <p>I'm learning about Domain Driven Design and enjoying every minute of it. However, there are some practical issues that are confusing to me that I think seeing some good samples might clear up.</p> <p>So being at peace with those issues, does anyone know of some good working code sa...
<p>The difficulty with DDD samples is that they're often very domain specific and the technical implementation of the resulting system doesn't always show the design decisions and transitions that were made in modelling the domain, which is really at the core of DDD. DDD is much more about the process than it is the co...
What is the conventions for headers and cpp files in C++? <p>In C++, what is the convention for including headers for class files in the "main" file. e.g.</p> <pre><code>myclass.h class MyClass { doSomething(); } myclass.cpp doSomething() { cout &lt;&lt; "doing something"; } run.cpp #include "mycla...
<p>You don't include the .cpp file, only the .h file. The function definitions in the .cpp will be compiled to .obj files, which will then be linked into the final binary. If you include the .cpp file in other .cpp files, you will get two different .obj files with the same funciton definition compiled, which will lead ...
Java Class Loaders <p>Can anyone point me a good resource or explain me about the concept behind Class Loaders? I found the following resource on class loaders <a href="http://www.onjava.com/lpt/a/5586">http://www.onjava.com/lpt/a/5586</a> but still no help. The following questions may look silly but trying to answer t...
<p>I found the following, valid reasons to create custom classloaders:</p> <ol> <li><p>You want to load a class from an unconventional source (For example, the bytecode for one class is stored in a database, across the network or <a href="http://www.ietf.org/rfc/rfc1149.txt?number=1149">carried as 0 and 1s by pidgeons...
Eclipse RCP Plugin development - Can't get new menuContribution option <p>I am using Eclipse 3.2. For an RCP application, I am trying to extend from org.eclipse.ui.menus. When I right-click and pick new option, "menu Contribution" isn't appearing. I only see options 'item', 'menu', 'group', 'widget' under 'New'. There ...
<p>I confirm it can not work.</p> <p>Consider the <strong>Extension Points Reference</strong> help from:</p> <ul> <li><p><a href="http://help.eclipse.org/help32/index.jsp?topic=/org.eclipse.platform.doc.isv/reference/extension-points/org_eclipse_ui_menus.html" rel="nofollow">org.eclipse.ui.menus in 3.2.1</a></p> <p>...
Fix for 'return' in cakePHP to return Value from view controller function <p>I have a function inside of a view function inside of a model class in the model.php file that looks like this</p> <pre><code>function sqlToUnix($date){ $YMDThenHMS = explode(" ", $date); $YMD = explode("-", $YMDThenHMS[0]); $HMS ...
<p>If you want to call this function from anywhere, i.e. in models, controllers, views, behaviors, components and helpers, you can put it in your app/config/bootstrap.php file. That's what it's for. Once the it's available globally simply as sqlToUnix();</p>
jquery sortable - how to prevent item from dragging from one list to another <p>There are two sortable UL elements which are linked to each other via 'connectWith' options so that items from one list can be moved to another list and vice versa. I'm in need to prohibit from moving/dragging some items to another list whi...
<p>The way I was able to get around this is by using the <code>li</code> elements <code>onMouseDown</code> and <code>onMouseUp</code> events. When the mouse is clicked, I changed my CSS class (or whatever else) so that it falls out of the items list.</p>
WCF Recommend approaches for serializing multiple objects <p>I am attempting to optimise around a possible bottleneck.</p> <p>I have a server application that is serving objects from a database to applications remotely, who can work with 1 - n objects of 1 - n different types (where n can be a relatively high number) ...
<p>How high is "relatively high"?</p> <p>For example, one option that occurs is to use a wrapper object:</p> <pre><code>[DataContract] public class Wrapper { [DataMember(Order = 1)] public List&lt;Foo&gt; Foos {get {...}} [DataMember(Order = 2)] public List&lt;Bar&gt; Bars {get {...}} [DataMembe...
dynamically generate textboxes using JavaScript <p>I want generate textboxes dynamically according to user input. If user enter the integer value in the textbox, if he/she enter 5 i want generate 5 textboxes. This code is working in Firefox but not working in IE and Netscape; please help me how to do this or point out ...
<pre><code>for(var i =1;i&lt;=tot;i++) { tbl.innerHTML = 'Mobile No'+i+' &lt;input type="text" size = "20" maxlength= "20" name= hoardingregister.mobileno&gt; &lt;br&gt; \n'; } </code></pre> <p>should be</p> <pre><code>for(var i =1;i&lt;=tot;i++) { tbl.innerHTML += 'Mobile No'+i+' &lt;input type="text" size =...
How can I turn off current line highlighting in Netbeans? <p>I've been looking for half an hour over all the options several times but I can't find it; googling also fails me at the moment. This is on Netbeans 6.0.1</p>
<p>Tools > options > highlighting > highlight caret row : [change background to inherited]</p> <p><img src="http://i.stack.imgur.com/tjZcP.png" alt="enter image description here"> Screenshot : <a href="http://d.pr/wZpr">http://d.pr/wZpr</a></p>
assembly.GetExportedTypes() show different result <p>Why does assembly.GetExportedTypes() show different result in C# and VB.NET?</p> <p>These two give different results </p> <pre><code>var v = from a in AppDomain.CurrentDomain.GetAssemblies() from b in a.GetExportedTypes() select b; v.Count(); Dim v = From a In A...
<p>When you compile a VB.NET assembly, it includes some extra "helper" types. Use <a href="http://www.red-gate.com/products/reflector/" rel="nofollow">Reflector</a> to have a look at your compiled assembly to see what I mean.</p> <p>I'm pretty sure you'll find that the only assembly with any differences in is the one ...
When is it acceptable to break CLS compliance? <p>I was wondering which edge cases exist that could make <a href="http://www.devarticles.com/c/a/C-Sharp/Making-Your-Code-CLS-Compliant/" rel="nofollow">Common Language Specification compliance</a> acceptable. Even when not intending to be accessed from other languages, I...
<p>Well, "params" arrays on attributes are sometimes just so tempting (but non-compliant). But I'd recommend using CLS-compliant approaches whenever possible.</p>
Remote database connection with my iPhone application using Cocos2d <p>MCPResult *theResult; MCPConnection *mySQLConnection;</p> <pre><code>//initialize connection string vars NSString *dbURL = @"192.168.0.16"; NSString *userName = @""; NSString *pass = @""; int port = 3306; //open connection to database mySQL...
<p>A little more info is needed, specifically, what is the IP of your iPhone? The reason I ask is because unless it's IP address is in a private C network (192.168.x.x) it's not going to be able to find the DB.</p> <p>I would recommend setting the dbUrl to a publicly accessible IP address. This may take a little wor...
How can I install a CPAN module into a local directory? <p>I'm using a hosted Linux machine so I don't have permissions to write into the <code>/usr/lib</code> directory.</p> <p>When I try to install a CPAN module by doing the usual:</p> <pre><code>perl Makefile.PL make test make install </code></pre> <p>That module...
<p>Other answers already on Stackoverflow:</p> <ul> <li><a href="http://stackoverflow.com/questions/102850/how-can-i-install-cpan-modules-locally-without-root-access-dynaloader-pm-line-22">How do I install modules locally without root access...</a></li> <li><a href="http://stackoverflow.com/questions/251705/how-can-i-...
Runtime dependency for std::string concatenation <pre><code>std::string sAttr(""); sAttr = sAttr+VAL_TAG_OPEN+sVal-&gt;c_str()+VAL_TAG_CLOSE; </code></pre> <p>else where in the code I have defined</p> <pre><code>const char VAL_TAG_OPEN[] = "&lt;value&gt;"; </code></pre> <p><code>sVal</code> is a variable that is r...
<p>Why the <code>-&gt;c_str()</code>? If <code>sVal</code> is a <code>std::string</code>, try removing this call. Remember that the order of evaluation is undefined, so you may end up adding pointers instead of concatenating strings, because <code>VAL_TAG_OPEN</code>, <code>sVal-&gt;c_str()</code> and <code>VAL_TAG_CLO...
MonoRail redirect to # anchor <p>I'm using <a href="http://www.castleproject.org/monorail/" rel="nofollow">Castle Monorail</a> with <a href="http://docs.jquery.com/UI/Tabs" rel="nofollow">jQuery tabbed navigation</a>.</p> <p>When handling a controller action, I would like to redirect to a view, and control which tab i...
<p>It does not only encode the '#' sign, it simply refer to it as another query string parameter (adds '&amp;' and '=')</p> <p>I'd advise you to post this question to the <a href="http://groups.google.com/group/castle-project-users" rel="nofollow">users group of Castle Project</a>, and even better - open issue on <a h...
ListView MouseClick Event <p>I have a ListView whereby I want to display one context menu if an item is right-clicked, and another if the click occurs in the ListView control. The problem I'm getting is the MouseClick event is only firing when an item is right-clicked, not the control. What's causing this and how can I...
<p>Use MouseUp instead of MouseClick! Sorry about that. Should have googled harder.</p>
Multi-level grouping using a CollectionViewSources <p>When databinding a <code>TreeView</code>, how would you create multiple levels of grouping for the items displayed?</p> <p>Imagine you are binding to a Shop class which, among others, has the properties <code>Region</code> and <code>RetailChain</code>. The desired ...
<p>The answer to my problem turned out to be this:</p> <p>Add multiple groupings (via PropertyGroupDescriptor) to the CollectionViewSource, then use a ListBox / DataGrid with multiple GroupStyles. The nett effect of this is that the leaf items (in my example, the stores) are grouped at two distinct levels. </p> <p>Sw...
Which version of safe_delete is better? <pre><code>#define SAFE_DELETE(a) if( (a) != NULL ) delete (a); (a) = NULL; </code></pre> <p>OR</p> <pre><code>template&lt;typename T&gt; void safe_delete(T*&amp; a) { delete a; a = NULL; } </code></pre> <p>or any other better way</p>
<p>I would say neither, as both will give you a false sense of security. For example, suppose you have a function:</p> <pre><code>void Func( SomePtr * p ) { // stuff SafeDelete( p ); } </code></pre> <p>You set p to NULL, but the copies of p outside the function are unaffected.</p> <p>However, if you must do this...
Variable initial value in delphi <p>I believe that local integer variables are not initialized to zero in delphi. The initial value is whatever happens to be at that memory location. So in the code below the first time the button is clicked the first message shows a integer value. How come the second time it's clicked ...
<p>kjack, </p> <p>It contains whatever value is in the stack frame at that time. In your case, this will be Sender. If you'd take the integer and typecast it to an object you'll notice the "pattern".</p> <pre><code>procedure TForm1.Button1Click(Sender: TObject); var int1 : integer; begin ShowMessage(TObject(int...
Finding top-level xml comments using Python's ElementTree <p>I'm parsing an xml file using Python's ElementTree, like that: </p> <pre><code>et = ElementTree(file=file("test.xml")) </code></pre> <p>test.xml starts with a few lines of xml comments. </p> <p>Is there a way to get those comments from et?</p>
<p>For ElementTree 1.2.X there is an article on <a href="http://effbot.org/zone/element-pi.htm" rel="nofollow">Reading processing instructions and comments with ElementTree </a> (<a href="http://effbot.org/zone/element-pi.htm" rel="nofollow">http://effbot.org/zone/element-pi.htm</a>).</p> <p><hr /></p> <p><em>EDIT:</...
Entire website hijacked! How to prevent from being hijacked? <p><em>The technical solution can be found here</em>: <a href="http://stackoverflow.com/questions/548355/entire-website-hijacked-part-2-how-to-configure-virtual-hosting">Entire website hijacked! Part 2: How to configure name-based virtual hosting?</a> <hr /><...
<p>In Apache, set up <a href="http://httpd.apache.org/docs/2.2/vhosts/" rel="nofollow">virtual hosting</a>. You can disallow access to your site from <code>http://kitchen.co.jp/</code> or disallow from anything except <code>http://neteditr.com/</code>.</p>
Connect two Line Segments <p>Given two 2D line segments, A and B, how do I calculate the length of the shortest 2D line segment, C, which connects A and B?</p>
<p>Consider your two line segments A and B to be represented by two points each:</p> <p>line A represented by A1(x,y), A2(x,y) </p> <p>Line B represented by B1(x,y) B2(x,y)</p> <p>First check if the two lines intersect using this algorithm. </p> <p><strong>If they do intersect</strong>, then the distance between th...
Migrating applications from Dev to QA to Prod <p>I have a number of webservices and clients (click-once deployment) that I am wondering how to deploy efficiently. We have a QA department that reviews and tests releases as well as an operations group that currently does the 'deployment' which basically consists of copyi...
<p>I use TFSDeployer for the push to production as well, as you can set TFSDeployer up to push so you don't have to install it on the production boxes (it just means that you need to configure permissions for you build account/machine to access production).</p> <p>One useful tip is to restrict permissions on who can c...
Entity Framework: Model doesn't reflect DB <p>I'm probably thinking about this all wrong but I have the following db tables:</p> <p><img src="http://1ponbw.bay.livefilestore.com/y1pUw3xaKZ7RhtNS3GiC5F1NYMad5ZeYI8Wh-jZ8CDajt7MiKO-6vhVmEm8VhlXMkDZTQz9t5gP4gnskgbvDtAYTA/DBImage.jpg" alt="alt text" /></p> <p>When I run t...
<p>Yes, the entity framework hides foreign key ID properties and shows navigation properties instead. There is a lengthy discussion about why it does that, <a href="http://blogs.msdn.com/efdesign/archive/2008/10/27/foreign-keys-in-the-conceptual-and-object-models.aspx" rel="nofollow" title="Foreign Keys in the Conceptu...
XSLT - How to select XML Attribute by Attribute? <p>this is the structure of my source xml:</p> <pre><code>&lt;root&gt; &lt;DataSet Value="A"&gt; &lt;Data Value1="1" Value2="anythingA1" /&gt; &lt;Data Value1="2" Value2="anythingA2" /&gt; &lt;Data Value1="3" Value2="anythingA3" /&gt; &lt;Data Value1="4" Value2="anythin...
<p>Just remove the slash after <code>Data</code> and prepend the root:</p> <pre><code>&lt;xsl:variable name="myVarA" select="/root/DataSet/Data[@Value1='2']/@Value2"/&gt; </code></pre>
Extracting extension from filename in Python <p>Is there a function to extract the extension from a filename?</p>
<p>Yes. Use <a href="https://docs.python.org/2/library/os.path.html#os.path.splitext"><code>os.path.splitext</code></a>:</p> <pre><code>&gt;&gt;&gt; import os &gt;&gt;&gt; filename, file_extension = os.path.splitext('/path/to/somefile.ext') &gt;&gt;&gt; filename '/path/to/somefile' &gt;&gt;&gt; file_extension '.ext' <...
How to I access an attached property in code behind? <p>I have a rectangle in my XAML and want to change its <code>Canvas.Left</code> property in code behind:</p> <pre class="lang-xml prettyprint-override"><code>&lt;UserControl x:Class="Second90.Page" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentatio...
<pre><code>Canvas.SetLeft(theObject, 50) </code></pre> <p></p>
How do I read any request header in PHP <p>How should I read any header in PHP?</p> <p>For example the custom header: <code>X-Requested-With</code>.</p>
<pre><code>$_SERVER['HTTP_X_REQUESTED_WITH'] </code></pre> <p><a href="http://www.faqs.org/rfcs/rfc3875.html">RFC3875</a>, 4.1.18:</p> <blockquote> <p>Meta-variables with names beginning with <code>HTTP_</code> contain values read from the client request header fields, if the protocol used is HTTP. The HTTP header ...
PHP readdir() not returning files in alphabetical order <p>I am reading through a directory with some pictures and such using a pretty simple implementation of readdir() like the following:</p> <pre><code>if ($handle = opendir($path)) { while (false !== ($szFilename = readdir($handle))) { if ($szFilename[0] !=...
<p>Alphabetical order :: I think you misread the snippet you quoted...</p> <blockquote> <p>Returns the filename of the next file from the directory. The filenames are returned in the order in which they are stored by the filesystem.</p> </blockquote> <p>The fact that 'ls' would display the files in (usually) alphab...
Focus issues, focus sometimes goes to unknown object <blockquote> <p>[FocusEvent type="focusIn" bubbles=true cancelable=false eventPhase=3 relatedObject=null shiftKey=false keyCode=0]</p> </blockquote> <p>When I click with a mouse an TextField, I would like that another (editable) field gets focus, but currently foc...
<p>Since you list a "FocusEvent" in your example, I will focus on Flex solutions. That is not a Flash AS3 class.</p> <p>I will wager that Flex is trying to manage the focus by itself and that is screwing with your attempts to set it. There are, however, a number of ways around this.</p> <p><strong>Is Flex trying to...
How to get a regular expression to match items with spaces <p>The following regular expression works if there is no space character, but if the input has a space character, it doesn't work (it seems like a link but JavaScript doesn't work).</p> <p>How can I change it? </p> <p>The regular expression should work for bo...
<p>Actually, there is a space 'character'. It is a '\s' (minus the quotes).</p>
SQL Injection in .NET <p>Hi I was wondering if anyone knew of some good websites detailing prevention for SQL injection for .NET web applications. Any resources would be greatly appricated, thank you.</p>
<p>I think that, if you google a bit on 'preventing sql injection in .NET', you'll find lots of good resources. :)</p> <p>Anyway, one very important thing, is to not use string-concatenation in order to build your queries. Instead, use parametrized queries. ADO.NET allows to do this, in a very easy way:</p> <pre><co...
Return day int value from function <p>I try to write any code about days:</p> <pre><code>function xyz("13.02.2009") { return value= 6; } function xyz("12.02.2009") { return value= 5; } function xyz("14.02.2009") { return value= 7; } </code></pre> <p>But how?</p> <p>This method is good but I need C# tim...
<p>Note that DateTime.DayOfWeek depends on your regional settings.</p>
problems once uploaded to server <p>This all works fine in MAMP but i've uploaded and now the problems start.</p> <p>heres an image of the code for the link and a grab of the result</p> <p><a href="http://dl.getdropbox.com/u/236383/link-to-file.tiff" rel="nofollow">First image</a></p> <p><a href="http://dl.getdropbo...
<p>You seem to be POSTing to a static HTML file. Try changing the file extension to php, asp, jsp etc. depending on what you're using on the server-side.</p> <p>Also, for textual content like this, you could simply copy-paste the text intead of capturing screenshots.</p>
Velocity named parameters for a macro <p>I have a macro taking several parameters. Some of these are optional and if a parameter is left empty it will replaced with default.</p> <p>Now the question is how to make this as easy as possible for ordinary web designer. Is there any other possibity apart from my examples to...
<p>As of Velocity 1.6, optional or named parameters are not supported. There was a recent patch submitted with this feature so we might see it available in a future release.</p> <p>In the meantime, consider passing in a list or a map of values. For example you can pass in a map of params as follows (requires Velocit...
Is it possible manage developers with high turnover if you can't lower the turnover rate? <p>I lead a small group of programmers in a university setting, having just moved into this position last year. While the majority of our team are full time employees, we have a couple of people who are traditionally graduate ass...
<p>Why don't you ask the students what they find difficult and make cheat sheets, lectures, etc. for the parts of the job that they have trouble with? Maybe you need to create some introductory Perl lectures or purchase some dead trees. How about a Safari subscription at O'Reilly? I'd ask the students how they prefe...
XML XSL Transform From Stream <p>Hi I have a memory stream in which I use XMLTextWriter to write out some XML. What I want to do is transform this XML using the XSL.transform feature. The thing is I don't want to create a temp. XML file, I want to somehow use the stream to Transform it into the XSL. Thank you for an...
<p>Just use an XmlReader and pass it to the Transform method. You'll need to seek to the start of the stream first.</p> <pre><code> stream.Seek(0, SeekOrigin.Begin); XmlReader reader = XmlReader.Create(stream, settings); XslCompiledTransform transform = new XslCompiledTransform(); transform.Load(...load your tr...
Multiple line code example in Javadoc comment <p>I have a small code example I want to include in the Javadoc comment for a method. </p> <pre><code>/** * -- ex: looping through List of Map objects -- * &lt;code&gt; * for (int i = 0; i &lt; list.size(); i++) { * Map map = (Map)list.get(i); * System.out....
<p>In addition to the already mentioned <code>&lt;pre&gt;</code> tags, you should also use the <code>@code</code> JavaDoc annotation, which will make life much easier when it comes to HTML entities issues (in particular with Generics), e.g.:</p> <pre><code>* &lt;pre&gt; * {@code * Set&lt;String&gt; s; * System.out.pri...
Create a cache dependancy on a folder and its sub-folder <p>In ASP.NET I would like to store an object in the cache which has a dependancy on all the files in specific folder and its sub-folders. Just adding the object with a dependancy on the root folder doesn't work. Is there in any reasonable way to do this other ...
<p>I believe you can roll your own cache dependency and use FileSystemMonitor to monitor the filesystem changes.</p> <p>Update: Sample code below</p> <pre><code>public class FolderCacheDependency : CacheDependency { public FolderCacheDependency(string dirName) { FileSystemWatcher watcher = new FileSys...
Apple's Singleton example <p>Used the MyGizmoClass example in a iPhone app where I have an object that sets and maintain db info. </p> <p>How do I eliminate the 'MyGizmoClass' may not respond to '+sharedManager'</p> <p>Warning</p> <p>The offending line of code is: NSString *databasePath = [[MyGizmoClass sharedMana...
<p>It sounds like the +sharedManager method is not declared in the header. You've mentioned importing the header a couple of times but haven't said whether +sharedManager is part of that header. The error you're seeing indicates that either (a) the header's not being imported (and you've said that it is) or (b) the h...
inheritance in controllers <p>I use inheritance in my model. An event has different types:</p> <pre><code>Event &lt; activity Event &lt; training Event &lt; game </code></pre> <p>I want to set session data to every event type like</p> <pre><code>game.user_id = session[:user_id] training.user_id = session[:user_id] a...
<p>Perhaps you are looking for a before_filter that resides in your ApplicationController? Then in each controller, you can set the before_filter to run on create actions.</p> <pre><code>ApplicationController def set_user_ids game.user_id = session[:user_id] training.user_id = session[:user_id] activity....
How do I intercept a NotImplementedException in a WPF application? <p>How do I intercept a NotImplementedException in a WPF application?</p> <p>I'll occasionally throw a NotImplementedException while testing my in-progress WPF application:</p> <pre><code>Private Sub ButtonDoSomething_Click(...) Handles ButtonDoSometh...
<p>You can attach to the DispatcherUnhandledException event on the Application class, which will be raised anytime an unhandled exception occurs. In there, you can check the Exception property on the DispatcherUnhandledExceptionEventArgs instance passed to the event handler to see if it is of type NotImplementedExcept...
JSP - Saving a collection <p>[Warning] I'm new to JSP/Struts/JSTL. This is probably a newbie question :)</p> <p>I have a form that contains a collection:</p> <pre><code>public class ServiceForm extends AbstractForm { private List&lt;SrvDO&gt; allSrv = new ArrayList&lt;SrvDO&gt; (); } </code></pre> <p>I can ...
<p>Found the answer on <a href="http://forum.springframework.org/showthread.php?t=54509" rel="nofollow">the spring forum</a>: </p> <blockquote> <p>Your form:input tag doesn't and shouldn't know anything about the fact that it is used inside another tag. That is why you need to include the index.</p> </blockq...
Webpart Connections asp.net VB <p>Im having the following problem with vb.net asp.net webparts. Im trying to create a static connection between webparts but im running into a problem, namely: </p> <blockquote> <p>Could not find the connection provider Web Part with ID 'Ucl_Diary_Summary1'</p> </blockquote> <p>I hav...
<p>I didn't have a chance to look at your message in detail but the issue appears to be with your provider. It should be returning an object that implements the interface used for communication to the consumer (usually a reference to itself).</p> <p>Check out the following resource for more info:</p> <p><a href="http...
How to troubleshoot Oracle database server errors? <p>My team inherited an Oracle-based web application and they are fairly inexperienced with Oracle database servers.</p> <p>The Oracle 10g server is running on a Windows 2003 Server with plenty of disk space and from time to time, all connectivity is lost, the applica...
<p>On the server you should have an environment variable called ORACLE_HOME which indicate the root of the Oracle install. Most likely the Oracle trace/dump folders will be under there. Search for a folder called "bdump" (background dump). That's where the main log file, knows as the alert log, will be, as well as t...
flash interaction with javascript internet explorer <p>I have a flash object interacting with a javascript function. The interaction works fine in every browser except in IE (all versions) I have tried with swfobject and with classic embeding. AllowScriptAccess is set to "always". Is there any cause for this flaw ? Tha...
<p>If you're using ExternalInterface, the problem may be related to the way you're attempting to reference the object in JavaScript. <a href="http://stackoverflow.com/questions/472026/problem-with-flash-externalinterface-on-google-app-engine#472184">Take a look at my answer to this question</a> -- it might not be exac...
Create GUI from Windows Service with a Network Log on <p>I have been reading a lot about executing a GUI application from a Windows Service. The "Allow service to interact with desktop" check box worked for me when the Service runs as the SYSTEM user (I am using Windows XP). Now I need the Service to run as a User defi...
<p>Your approach is completely wrong, and will not work when deployed on Vista.</p> <p>Services should NEVER assume a login session with a desktop to interact with.</p> <p>Rather, you should have a second application which is run when the user logs in (or some other point in time) which communicates with the service ...
ASP.NET: Pass value from User Control to page? <p>I am creating a user control in ASP.NET (using VB) that uses the autocomplete ajax control on a textbox to get a value. Then I want the page to post back and run some code according to whatever value is passed to it from this control. Problem is, I'm not exactly sure h...
<p>In your user control expose a property for the value</p> <pre><code>Public Property SomeValue() As String Get Return textbox1.Text End Get End Property </code></pre> <p>Then in your aspx page load, just reference the user control's value. </p> <pre><code>userControl1.SomeValue </code></pre> <p>Edit, I just t...
Need advice on attribution/copyright of heavily modified OSS code (BSD, Apache, etc) in source headers <p>I've got a question about use of permissive-licensed (BSD, Apache, MIT, etc) source where the line may be heavily blurred between original code and borrowed code. </p> <p>We are more than happy to disclose a copyr...
<p>The BSD family of licenses expressly forbid you from modifying or removing their headers.</p> <p>Edit: I suppose I should go more into depth on this.</p> <p>Essentially, you used their code as a basis for your own. Due to that influence, you are still bound by the original license, and thus have to keep the origi...
How do I create a parameterized SQL query? Why Should I? <p>I've heard that "everyone" is using parameterized SQL queries to protect against SQL injection attacks without having to vailidate every piece of user input.</p> <p>How do you do this? Do you get this automatically when using stored procedures?</p> <p>So my...
<p>Your EXEC example would NOT be parameterized. You need parameterized queries (prepared statements in some circles) to prevent input like this from causing damage:</p> <blockquote> <p>';DROP TABLE bar;--</p> </blockquote> <p>Try putting that in your fuz variable (or don't, if you value your bar table). More sub...
How to reset or kill JVM context? <p>I am running a simple java client through <code>java &lt;class file&gt;</code> command. The java command is actually invoked by a system process. This is on Unix.</p> <p>We were facing problem with X11 Display. So we added <code>export DISPLAY=:0.0</code> in the startup file and th...
<p>If you have previously executed the export command in the current shell (from the startup file, even), then the value is in your environment. Unsetting it (or getting a new shell with a clean environment) is the only way to get rid of the environment setting.</p> <p>I would suggested adding a line to your startup ...
Where should I set compiler options like {$STRINGCHECKS OFF}? <p>If I place it in the .dpr or any other unit will it be considered globally?</p>
<p>I dont think so. IIRC the rule is that anything in the dpr or unit is local to that file. If you put it into the project options (under conditionals) then it is global. Many writers put such stuff into a text file and then do a {$I MyConditionals.txt} at the top of each unit.</p>
Is this bad oop design? <p>Imagine I have an interface called IVehicle.</p> <p>From this interface, I derive several concrete types such as bus and car (all can move, slow down, switch off engine, etc). My interface has no fields.</p> <p>Would it be bad design to have one class which has fields (e.g. top speed of veh...
<p>You're talking about an abstract class, and no, it's not bad design. That's what they're for (basically, interfaces, but with some basic implementation).</p> <p>State wouldn't have to be stored statically. There will be a full implementation of this class (in the form of one of the derived classes) each time you cr...
Need a custom currency format to use with String.Format <p>I'm trying to use String.Format("{0:c}", somevalue) in C# but am having a hard time figuring out how to configure the output to meet my needs. Here are my needs:</p> <ol> <li>0 outputs to blank</li> <li>1.00 outputs to $1.00</li> <li>10.00 outputs to $10.00</l...
<p>If you use </p> <pre><code>string.Format("{0:$#,##0.00;($#,##0.00);''}", value) </code></pre> <p>You will get "" for the zero value and the other values should be formatted properly too.</p>
Who calls this function? <p>At my last job (legacy FORTRAN 77 code), we had files of cross references that list what subroutines called other subroutines, in what files subroutines were defined, what common blocks held what variables, what subroutines included what common blocks, etc. These were then used by shell scr...
<p>You might want to consider using <a href="http://www.stack.nl/~dimitri/doxygen/" rel="nofollow">Doxygen</a>. It can produce web pages that show you the entire call tree and class structure, as well as pulling out properly formatted comments to document the classes and methods just like Javadocs do for java.</p> <p...
What is wrong with my WINAPI call to handle long file paths? <p>I've been trying to figure out the best way to copy files in Windows with deep paths (files, not folders so robocopy is out of the question). The best solution I've been able to come up with is writing my own solution. I've been able to write the code to...
<p>Should you call the function CopyFileW instead? Note the W at the end. Also, i don't know if you are using UNC paths. If so you need to prefix with "\\?\UNC\" instead.</p> <p>This is a good article for long path handling </p> <p><a href="http://blogs.msdn.com/bclteam/archive/2007/02/13/long-paths-in-net-part-1-of...
I have StartDate and EndDate for each record. Should I give NULL a special meaning when used in these 2 fields? <p>So, I have a table where StartDate and EndDate's are used to determine the activeness of a record. I thought of using NULLs to relieve the maintainers from having to manufacture some crazy dates for some o...
<p>If either <code>StartDate</code> or <code>EndDate</code> of your record will be <code>NULL</code>, then the following condition:</p> <pre><code>BETWEEN StartDate AND EndDate </code></pre> <p>will never match this record.</p> <p>You'll need to do following:</p> <pre><code>BETWEEN IFNULL(StartDate, '01.01.1000') A...
Text replacement efficiency <p>An extension to my previous question:<br /> <a href="http://stackoverflow.com/questions/542226/text-cleaning-and-replacement-delete-n-from-a-text-in-java">Text cleaning and replacement: delete \n from a text in Java</a></p> <p>I am cleaning this incoming text, which comes from a database...
<p>My first suggestion is to measure the performance of the simplest way of doing it (which is probably multiple replace/replaceAll calls). Yes, it's potentially inefficient. Quite often the simplest way of doing this is inefficient. You need to ask yourself: <strong>how much do you care?</strong></p> <p>Do you have s...
Get just the Date from grouping in select from DateTime column in SQL Server <p>I need to group some records based on a date but it is a date and time field and I need to ignore the time part of is and just group by the date part - here is my SQL as it stands:</p> <pre><code>SELECT AutoShipItems.CustomerID,Auto...
<p>You can group by this:</p> <pre><code>cast(floor(cast(AutoShipItems.NextOrderDate as float)) as datetime) </code></pre> <p>I put this into a scalar user-defined function to make it easier:</p> <pre><code>create function [dbo].[xfn_TrimTimeFromDateTime] ( @date as datetime ) returns datetime with schemabinding...
How can I insert an image into a RichTextBox? <p>Most of the examples I see say to put it on the clipboard and use paste, but that doesn't seem to be very good because it overwrites the clipboard.</p> <p>I did see <a href="http://www.codeproject.com/KB/edit/csexrichtextbox.aspx">one method</a> that manually put the im...
<p>The most straightforward way would be to modify the RTF code to insert the picture yourself. </p> <p>In RTF, a picture is defined like this:</p> <p>'{' \pict (brdr? &amp; shading? &amp; picttype &amp; pictsize &amp; metafileinfo?) data '}' A question mark indicates the control word is optional. "data" is simply t...
IE hosted windows control with dependent assemblies <p>I am working with a windows forms user control that needs to be hosted in Internet Explorer. Info about the technique I am trying to duplicate can be found <a href="http://www.15seconds.com/issue/030610.htm" rel="nofollow">here</a> and <a href="http://www.c-sharpc...
<p>I also use this method to host WinForms-Controls on a html page. I found out that the internetexplorer tries to find the dependant dll in the root of the webserver. Cave: the internetexplorer does not look for the dlls in the root of the webapplication.</p> <p>Let me tell you a example. I built a audio-recorder con...
Flex app embedding and communicating with older Flash 8 app <p>I currently maintain an application that's written in Flash 8 (AS2) which is used to embed and control some auto-generated SWFs. The auto-generated SWFs are also Flash 8 (actually, they work at least in 7, possibly even older), so my current app is able to...
<p>Not sure I get exactly how the application works so excuse me if I'm wrong. If the flex instance must load the AVM1 proxy wouldn't it be possible to inject a flash-var via the URL containing a generated ID for the LocalConnection to use ?</p> <p>In addition to your comment, just added how to send variables to the A...
Delphi : How to create MP3 file with certain number of seconds of silence? <p>I need to create a mp3 file with certain number of seconds of silence? </p> <p>What would be way to do it programatically?</p> <p>Edit: It doesn't need to be re inserted in mp3, just a single mp3 file that contain silence x seconds long.</p...
<p>Do you just want an MP3 of X seconds long that is just silence, or do you want to inject silence into an existing MP3?</p> <p>This is a bit more complicated. Windows XP by default has a low quality MPEG encoding codec installed. You can find some informant about <a href="http://www.efg2.com/Lab/Library/Delphi/Gra...
I would like a separate process to when django starts - is there an accepted way of doing this? <p>I was thinking of making settings.py start the process but this seemed slightly ugly.</p> <p>I don't really want to make make custom start up scripts, nor can I really make the starting of this process lazy.</p>
<p>You might be able to register a listener to the "class-prepared" signal on one of your model classes and fire your process from there. However, I think the need to do this is most likely a design smell, or a case of the tail wagging the dog. </p> <p><a href="http://docs.djangoproject.com/en/dev/ref/signals/#class-...
My SQL triggers <p>Is it possible to set up a mysql trigger that fires back the id number of that record when ever there is an insert into the database AND how do i capture that using php?</p>
<p>Unless I don't fully understand your question, you don't need a trigger for this - just use the "last inserted ID" functionality of your database driver.</p> <p>Here's an example using the basic mysql driver in PHP.</p> <pre><code>&lt;?php $db = mysql_connect( 'localhost', 'user', 'pass' ); $result = mysql_query...
Silverlight sockets or db requests? <p>I am currently coding an online turn based rpg for an assignment. In the game players can chat with each other and send their actions once they complete a turn. What is the best way to take care of the data exchange between the players. Sockets or storing all information in a data...
<p>In Silverlight, you can only connect back to the host that served the Silverlight app, so that rules out client-client sockets. Everything in your game (including chat) will have to go via a server.</p> <p>Windows Communication Foundation (WCF) is quite nice to work with in Silverlight2. Having your game turn-based...
Java 2D and resize <p>I have some old Java 2D code I want to reuse, but was wondering, is this the best way to get the highest quality images?</p> <pre><code> public static BufferedImage getScaled(BufferedImage imgSrc, Dimension dim) { // This code ensures that all the pixels in the image are loaded. Image scale...
<p>Chris Campbell has an excellent and detailed write-up on scaling images - see <b><a href="http://today.java.net/pub/a/today/2007/04/03/perils-of-image-getscaledinstance.html" rel="nofollow">this article</a></b>.</p> <p>Chet Haase and Romain Guy also have a detailed and very informative write-up of image scaling in ...
Granularity of Paradigm Mixing <p>When using a multi-paradigm language such as Python, C++, D, or Ruby, how much do you mix paradigms within a single application? Within a single module? Do you believe that mixing the functional, procedural and OO paradigms at a fine granularity leads to clearer, more concise code be...
<p>Different paradigms mix in different ways. For example, Using OOP doesn't eliminate the use of subroutines and procedural code from an outside library. It merely moves the procedures around into a different place.</p> <p>It is impossible to purely program with one paradigm. You may think you have a single one in...
Visual Studio Setup Project-- adding prebuild step <p>I want to make my build process for producing a setup project to be a single click. However, I also want to add {smartassembly} to the build step to obfuscate the build, but only on our build machine. How can I add a pre-build step to a visual studio 2008 vdproj?<...
<p>yeah, it turns out I'm a moron. The UI is different, but the pre- and post- build items are in the properties as if it were a UI property, not a project property.</p>
Which is more usable, outputting dates relative to now or relative to the main action's point in time? <p>I was just reading the <a href="http://blog.objectmentor.com/articles/2009/02/06/on-open-letter-to-joel-spolsky-and-jeff-atwood" rel="nofollow">"Open Letter to Joel and Jeff"</a> and I noticed the dates on the comm...
<p>As Steve Krug recommends in <a href="http://rads.stackoverflow.com/amzn/click/0321344758" rel="nofollow">Don't Make Me Think</a>, get rid of the question marks that pop in the user's head when they come to your site. If it is confusing it isn't likely to be helpful.</p> <p>Although an interesting concept, in this c...
is flex actionscript? <p>I've been using flash for a long time, mostly as an animation tool with a little dabbling in actionscript. Over the years I've moved from mostly making animations to mostly making small flash games or proof of concepts in my spare time. I've been very reluctant to learn as3 as I am not much of ...
<p>Both Flash and Flex use the ActionScript language — Flash CS3 and Flex 2 both support ActionScript 3 (which is compliant with the ECMAScript Edition 4), whereas the older version of Flash supports only ActionScript 2.</p> <p>The differences between the two are:</p> <p>1) Flash has been designed to facilitate the...
getopt() in VC++ <p>I'm quite fond of using GNU <a href="http://www.gnu.org/software/libtool/manual/libc/Getopt.html"><b>getopt</b></a>, when programming under <strong>Linux</strong>. I understand, that getopt(), is not available under MS VC++.</p> <p><strong>Note:</strong></p> <ul> <li>Win32 environment</li> <li>usi...
<p>This may help, it's also very easy to integrate</p> <p><a href="http://www.codeproject.com/KB/cpp/xgetopt.aspx">http://www.codeproject.com/KB/cpp/xgetopt.aspx</a></p>
Equals(=) vs. LIKE <p>When using SQL, are there any benefits of using <code>=</code> in a <code>WHERE</code> clause instead of <code>LIKE</code>?</p> <p>Without any special operators, <code>LIKE</code> and <code>=</code> are the same, right?</p>
<p>The equals (=) operator is a "comparison operator compares two values for equality." In other words, in an SQL statement, it won't return true unless both sides of the equation are equal. For example:</p> <pre><code>SELECT * FROM Store WHERE Quantity = 200; </code></pre> <p>The LIKE operator "implements a patter...
How to map 2+ entities to same table in .NET Entity Framework? <p>I'm trying to create 2 entities that operate as different views on the same underlying db table. When I create these in Visual Studio's entity model and place an association between them, I get a "Association is not mapped" error. I read an article (<a...
<p>From the error, I'd guess that there wasn't an Association created for the storage schema in the edmx (the SSDL of the edmx XML). A conceptual association has been created if you can see it in the designer, but there's no storage definition behind the scenes. I'm guessin'. =)</p>
When to upgrade libraries <p>I work with a lot of open source libraries in my daily tasks (java FYI). By the time a project comes close to maturing, many of the libraries have released newer versions. Do people generally upgrade just to upgrade, or wait until you see a specific bug? Often the release notes say things l...
<p>The rule for us is to stay up to date before integration testing but to permit no changes to any library once we're past this point. Of course, if integration testing reveals flaws that are due to an issue with a library that has been fixed, then we'd go back and update. Fortunately, I cannot remember a situation ...
How to display 1 instead of 01 in ToString(); <p>I am using the format ToString("0,0") to display a number like <pre>5000 as 5,000</pre> but if the number is 0 - 9, it displays 01, 02, 03, etc. Does anyone know the correct syntax so it does not display the leading 0?</p> <p>Thanks, XaiSoft</p>
<pre><code>ToString("#,0") </code></pre> <p>Also, <a href="http://acodingfool.typepad.com/blog/dotnet-string-formatting-cheat-sheet.html">this</a> may help you further</p>