input
stringlengths
51
42.3k
output
stringlengths
18
55k
How do I make an onclientclick post back using jquery? asp.net <p>I need help. I want to recreate the the update panel postback without using a update panel to do the postback. What is the generic method for doing this?</p> <p>For example, on stackoverflow, when you vote up or down on a question it does a postback t...
<p>The way that Stack Overflow works differs in two important ways from that CodeProject article.</p> <ul> <li><p>Stack Overflow is making its AJAX request against an ASP.NET MVC controller action, not a standalone ASPX page. You might consider this as the MVC analogue of an ASP.NET AJAX page method. In both cases, t...
Accepting client certificates from any CA <p>I am setting up support for users to sign in with client certificates. Unfortunately IIS refuses to acknowledge any certificate not chained to an installed CA (<a href="http://support.microsoft.com/kb/257587" rel="nofollow" title="Description of the Server Authentication Pro...
<p>I think the normal way is for you to issue the certificates to them, and then for you to set up IIS to accept your cert as a root.</p>
Any Substitute API for Win32API? <p>I need an API that can make menus like Win32API,<br> But something simpler and better than WinAPI.<br> That can make GUI, with text zones, buttons etc...like an average Windows program.(Windows GUI Style)<br> Can anyone recommand on one like it? Thanks.</p>
<p><a href="http://www.wxwidgets.org/" rel="nofollow">wxWidgets</a>:</p> <blockquote> <p>wxWidgets lets developers create applications for Win32, Mac OS X, GTK+, X11, Motif, WinCE, and more using one codebase. It can be used from languages such as C++, Python, Perl, and C#/.NET. Unlike other cross-platform toolkits,...
Autostart spring app <p>So is there a way to initialize and start a command line Spring app without writing a main method. It seems like all such main methods have the same form</p> <pre><code>public static void main(final String[] args) throws Exception { ApplicationContext ctx = new ClassPathXmlApplicationContex...
<p>I'll try to answer the question as I understand it: </p> <blockquote> <p>How to package a jar containing a spring configuration such as I just need to use <code>java -jar myjar.jar</code>?</p> </blockquote> <p>The code snippet you have in your question simply works. You don't have to parameterise the <code>conte...
PHP access to iTunes tags in an RSS feed <p>I need to get access to the iTunes tags in an RSS feed using PHP. I've used simplepie before for podcast feeds, but I'm not sure how to get the iTunes tags using it. Is there a way to use simplepie to do it or is there a better way?</p> <p><hr /></p> <p>Okay I tried Simple ...
<p>This code works for me:</p> <pre><code>//$pie is a SimplePie object $iTunesCategories=$pie-&gt;get_channel_tags(SIMPLEPIE_NAMESPACE_ITUNES,'category'); if ($iTunesCategories) { foreach ($iTunesCategories as $iTunesCategory) { $category=$iTunesCategory['attribs']['']['text']; $subcat=$iTunesCategory['child...
Which is fastest in PHP- MySQL or MySQLi? <p>I'd like to know if anyone has any first-hand experience with this dichotomy. A few blogs say the mysql extension is faster than mysqli. Is this true?</p> <p>And I'm only asking about speed. I know mysqli has features that are not present in the older extension.</p>
<p>The MySQL extension is very slightly faster than MySQLi in most benchmarks I've seen reported. The difference is so slight, however, that this should probably not be your criterion for deciding between the two.</p> <p>Other factors dwarf the difference in performance between mysql and mysqli. Using mod_php or Fas...
RegEx: Grabbing values between quotation marks <p>I have a value like this:</p> <pre class="lang-none prettyprint-override"><code>"Foo Bar" "Another Value" something else </code></pre> <p>What regex will return the values enclosed in the quotation marks (e.g. <code>Foo Bar</code> and <code>Another Value</code>)?</p>
<p>I've been using the following with great success:</p> <pre><code>(["'])(?:(?=(\\?))\2.)*?\1 </code></pre> <p>It supports nested quotes as well.</p> <p>For those who want a deeper explanation of how this works, here's an explanation from user <a href="http://stackoverflow.com/users/20713/ephemient">ephemient</a>:<...
Getting 256 colors out of ruby-ncurses <p>I've got 256 colors working great in my terminal (<a href="http://www.frexx.de/xterm-256-notes/">test scripts here</a>), but it stops working when I use ncurses (via Ruby-ncurses). Printing the escape sequences given on that page works fine, but when I initialize ncurses 'puts'...
<p>I am not sure if this would be all the story, but make sure your terminal capabilities do indeed provide for the 256 colors description.</p> <p>What is the TERM environment variable value? Try setting it to xterm-256color and rerun it. ncurses should then get the proper color escape sequences.</p> <p>You can also ...
Best way to track page views <p>I'm working on a e-commerce system and I would like to track the product page views, but I'm not sure of the best way to do that... My boss suggested that I should count one view for the first time a user opens a product page and then store a cookie saying it was already viewed, but what...
<p>Is this something you want to build into your application, or could you achieve your goal by simply using one of the free web log statistics tools? (Such as <a href="http://awstats.sourceforge.net/" rel="nofollow">AWStats</a>)</p> <p>There is a round-up of free tools <a href="http://www.hongkiat.com/blog/top-14-fre...
Find out which remote branch a local branch is tracking <blockquote> <p><strong>See also:</strong><br> <a href="http://stackoverflow.com/questions/4950725/how-do-i-get-git-to-show-me-which-branches-are-tracking-what">how do I get git to show me which branches are tracking what?</a> </p> </blockquote> <p>How can...
<p>Here is a command that gives you the tracking branch:</p> <pre><code>$ git branch -vv main aaf02f0 [main/master: ahead 25] Some other commit * master add0a03 [jdsumsion/master] Some commit </code></pre> <p>You have to wade through the SHA and any long-wrapping commit messages, but it's quick to type and I get ...
Is it possible to deploy an already built Drupal site? <p>I'm a Drupal newbie. Is it possible to set up everything and deploy Drupal on the server? I mean things like putting in the content, setting up the modules, etc..., then you put it all up to the production server?</p>
<p>Ofcourse. </p> <ul> <li>copy all the files</li> <li>edit the database credentials (sites/default/settings.php)</li> <li>export the database content via mysqldump or phpMyAdmin (supposing you use MySQL)</li> <li>import the database content at the target server</li> </ul> <p>I've done it a several times.</p>
Coming up to speed on the programming environment <p>I'm not a full-time software guy. In fact, in the last ten years, 90 % of my work was either on the hardware or doing low-level (embedded) code.</p> <p>But the other 10% involves writing shell scripts for development tools, making kernel changes to add special feat...
<ul> <li>Ask developers you know that work in the environment that you are interested in.</li> <li>Search the web a lot.</li> <li>Ask specific questions in relevant IRC channels (Freenode is great).</li> <li>Ask specific questions on StackOverflow and other sites.</li> </ul> <p>There really isn't any substitue for bei...
Greasemonkey: love it or hate it? <p>As users, we love the power of Greasemonkey. As developers, it can complicate things.</p> <p>Some <a href="http://dean.edwards.name/weblog/2005/03/ungreased/" rel="nofollow">people</a> advocate defensively disabling user scripts; others are willing to die to defend them.</p> <p>Is...
<p>Any control you think you have over which user agents your site visitors use is illusory. However, the vast majority will be using vanilla IE/Firefox/Safari. But, if you've a site where the audience has adopted a Greasemonkey script en masse, then treat that as a strong vote from your users that the site needs to c...
Making locking easier in MTAs <p>In multi-threaded code, when an instance may be read or written by multiple threads, they need to be locked on to perform these operations safely.</p> <p>To avoid the repetition of creating an object to lock on and writing a bunch of lock statements through code, I've created a generic...
<p>That only locks for the duration of the get/set; of course, in many common cases this will be atomic anyway, simply due to to data size.</p> <p>However, in reality most locks need to span more than this, in the same way that collections locking over just the Add etc don't help much - a caller typically needs a sing...
Interface "recursion" and reference counting <p>I have a small problem with interfaces. Here it is in Pseudo code :</p> <pre><code>type Interface1 = interface end; Interface2 = interface end; TParentClass = class(TInterfacedObject, Interface1) private fChild : Interface2; public procedure AddCh...
<p>A reference-counted reference has two semantics: it acts as a share of ownership as well as a means of navigating the object graph.</p> <p>Typically, you don't need <strong>both</strong> of these semantics on all links in a cycle in the graph of references. Perhaps only parents own children, and not the other way a...
Double buffer child controls in custom control (C#) <p>I want to double buffer a custom control which contains buttons. I have tried various ways to double buffer the control; SetStyle, BufferedGraphicsContext, and drawing to a bitmap. These all work fine for the custom drawing of the control, but none of them handle...
<p>Technically you can't, and you really shouldn't need to if they're standard .NET WinForms buttons.</p> <p>The buttons themselves control that through the protected DoubleBuffered property. The only way to access this would be to derive a new class from S.W.F.Button, and implement code to enable the DoubleBuffered p...
Problem using the ASP.NET FileUpload control in an UpdatePanel? <p>I'm running into an issue where I have a FileUpload control in an UpdatePanel. When I attempt to save changes and upload the file, no file is found. If I remove the UpdatePanel everything seems to work fine. </p> <p>Any ideas why this might be happe...
<p>To upload a file you need to perform a full ASP.NET page postback, it does not operate over the partial postback method.</p> <p>You'll need to register the button which "uploads" your file as a PostBackTrigger of the UpdatePanel's triggers.</p> <p>There are lots of free (and non-free) AJAX file upload solutions, o...
How can I find the method that called the current method? <p>When logging in C#, how can I learn the name of the method that called the current method? I know all about <code>System.Reflection.MethodBase.GetCurrentMethod()</code>, but I want to go one step beneath this in the stack trace. I've considered parsing the st...
<p>Try this:</p> <pre><code>using System.Diagnostics; // Get call stack StackTrace stackTrace = new StackTrace(); // Get calling method name Console.WriteLine(stackTrace.GetFrame(1).GetMethod().Name); </code></pre> <p>It is from <em><a href="http://www.csharp-examples.net/reflection-calling-method-name/">Get Calling...
How do you develop against OpenID locally <p>I'm developing a website (in Django) that uses OpenID to authenticate users. As I'm currently only running on my local machine I can't authenticate using one of the OpenID providers on the web. So I figure I need to run a local OpenID server that simply lets me type in a use...
<p>The libraries at <a href="http://openidenabled.com/" rel="nofollow">OpenID Enabled</a> ship with examples that are sufficient to run a local test provider. Look in the examples/djopenid/ directory of the python-openid source distribution. Running that will give you an instance of <a href="http://openidenabled.com/...
GPSID - Poll Driver V2.0 <p>On the page <a href="http://msdn.microsoft.com/en-us/library/bb202066.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/bb202066.aspx</a></p> <p>If references something called "POLL Driver V2" however this is the only place I can see that talks about this. I'm extermely interes...
<p>According to MS, GPSID - Poll Driver v2.0 are not made available to ISV's in WM6.1. They are evaluating including this in a future version of the OS.</p> <p>My solution along the same lines was to create a Windows CE notification that fires at a predetermined interval. Then when my app receives the notification, ...
Why does FileSystemWatcher create multiple change events when I copy a file to the directory <p>I've written a small test application using the .Net FileSystemWatcher to keep an eye on a directory. When I copy a large-ish (a few Mb) file into that directory I get the following events listed (see screenshot - and ignore...
<p>According to the <a href="http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx" rel="nofollow">documentation</a> (see the first bullet point under <em>Events and Buffer Sizes</em>):</p> <blockquote> <p><strong>Common file system operations might raise more than one event.</strong> For example,...
How do I elegantly print the date in RFC822 format in Perl? <p>How can I elegantly print the date in RFC822 format in Perl?</p>
<pre><code>use POSIX qw(strftime); print strftime("%a, %d %b %Y %H:%M:%S %z", localtime(time())) . "\n"; </code></pre>
How to remove paths from tabs in Visual Studio 2008? <p>Is there a way to stop the path showing in a source code tab in Visual Studio 2008?</p> <p>Currently when developing an ASP.NET site, I get the path from the root plus the filename - truncated when it gets too long. So something like:</p> <blockquote> <p>MyDir...
<p>In my copy of VS 2008 I just get the filename, not the path. I wonder whether it's a "web site" vs "web application" thing. Which one are you working in? Can you create a project of the other type and see if it still happens? (I'm working in a web application where I get filename-only.)</p>
What is the state of the art user interface for browsing complex version control system history? <p>When using Mercurial I sometimes find that it is hard to understand the relationship between changesets when there are thousands of changesets, and sometimes ten or more active branches at any one time. Currently, I use...
<p>the <code>gitk(1)</code> tool for git is what I use at work. Note that it takes a <code>git rev-list</code> constraint so you can limit what you see. You definitely want to begin doing such selective picking in the long run when the amount of commits go up.</p>
Same class, different namespaces, a way to simplify? <p>I'm working with a webservice that offers almost duplicated code across two namesspaces. Lets say for example PigFeet and HorseFeet, both namespaces contain a Feet class and other code that works with the Feet class requires it to be part of that same namespace.<...
<p>In your namespace imports you can assign an <a href="http://msdn.microsoft.com/en-us/library/aa664765(VS.71).aspx" rel="nofollow">alias</a> to a specific namespace or member.</p> <pre><code>using PigFeet = PigFeet.Feet; using HorseFeet = HorseFeet.Feet; //now your sample code should look something like if( _anima...
Asp.net Project Ideas? <p>I've recently decided to step-up my knowledge in ASP.NET (I haven't coded in ASP.NET for about 2 years or so, and much has changed since then). I want to work with the new MVC framework, try jQuery, LINQ to SQL and basically just to catch up with most of the up-to-date features.</p> <p>To do ...
<p>A wiki-like/sof-like web site that <strong>allows people to consider the pros and cons of making a decision</strong>.</p> <p><strong>Brainstorming</strong></p> <p>The user sees a form with a field for the title of the decision, and two quick-entry text fields. One on the left side of the screen for pros, and the ...
How to track third-party sources with ClearCase without a headache? <p>First of all: I am not an experienced ClearCase user, but I have lots of experience with other VCS and *nix command-line tools. WIth ClearCase, I use command-line tool ("cleartool") working in a Unix shell.</p> <p>Problem: I have a small set of sou...
<p>I just want to be sure:</p> <p>You do know about <strong><a href="http://stackoverflow.com/questions/138321/how-can-i-use-clearcase-to-add-to-source-control-recursively#144310">clearfsimport</a></strong>, right ?</p> <p>Because after reading (may be too quickly) your question, that command may be what you are afte...
Typing generic values (C#) <p>When I try this with a generic class where this.value is T:</p> <pre><code>if (this.value.GetType() == typeof(int)) { ((int)this.value)++; } else { throw new InvalidOperationException ("T must be an int to perform this operation"); } </code></pre> <p>I get a compile-t...
<p>Unfortunately, it is very hard to convince the compiler about specific T implementations. One (nasty) approach is to cast to object in the middle (note this will box and unbox value-types):</p> <pre><code>int i = (int)(object)this.value; i++; this.value = (T)(object)i; </code></pre> <p>Ugly but it works. In .NET 3...
Speeding Up Python <p>This is really two questions, but they are so similar, and to keep it simple, I figured I'd just roll them together:</p> <ul> <li><p><strong>Firstly</strong>: Given an established python project, what are some decent ways to speed it up beyond just plain in-code optimization?</p></li> <li><p><str...
<p>Regarding "Secondly: When writing a program from scratch in python, what are some good ways to greatly improve performance?"</p> <p>Remember the Jackson rules of optimization: </p> <ul> <li>Rule 1: Don't do it.</li> <li>Rule 2 (for experts only): Don't do it yet.</li> </ul> <p>And the Knuth rule:</p> <ul> <li>"P...
Add (external) relationship (tagging) to existing Hibernate entities <p>I need to add a new many-to-many relationship to an existing Hibernate entity. I do not want to touch the original Hibernate entity bean or its configuration. What I am adding is a "tagging" feature that can be viewed as an external contribution an...
<p>The idea behind Hibernate is being able to traverse a Java object tree from a given starting point. If you want to define a many-to-many relationship from the original object to a tag object, you can still define it on the tag object, and it will properly allow you to get a list of the original objects that have th...
Can anyone think of some good reasons *not* to use an Object-Oriented DBMS to back a website? <p>Say you're coding some kind of web application. Something where people can contribute content, e.g. a simple photo-sharing site.</p> <p>How many good reasons can you think of to <em>not</em> go with an object-oriented data...
<p>An OODBMS is better if you only need to access your data through your objects. If your solution requires additional pathways to your data (e.g. ad-hoc queries, reporting, other applications that need data access but can't make use of your objects), then a traditional RDBMS system is better.</p> <p>Note: OODBMSes ...
2.9999999999999999 >> .5? <p>I heard that you could right-shift a number by .5 instead of using Math.floor(). I decided to check its limits to make sure that it was a suitable replacement, so I checked the following values and got the following results in Google Chrome:</p> <pre><code> 2.5 >> .5 == 2; 2.9999 >> .5 == ...
<p>Actually, you're simply ending up doing a floor() on the first operand, without any floating point operations going on. Since the left shift and right shift bitwise operations only make sense with integer operands, the JavaScript engine is converting the two operands to integers first:</p> <pre><code>2.999999 &gt;&...
C# .NET 3.0/3.5 features in 2.0 using Visual Studio 2008 <p>What are some of the new features that can be used in .NET 2.0 that are specific to C# 3.0/3.5 after upgrading to Visual Studio 2008? Also, what are some of the features that aren't available?</p> <p><strong>Available</strong></p> <ul> <li>Lambdas</li> <li>E...
<p>You can use any new C# 3.0 feature that is handled by the compiler by emitting 2.0-compatible IL and doesn't reference any of the new 3.5 assemblies:</p> <ul> <li>Lambdas (used as <code>Func&lt;..&gt;</code>, not <code>Expression&lt;Func&lt;..&gt;&gt;</code> )</li> <li>Extension methods (by declaring an empty Syste...
Apache POI HWPF - Output a table to Microsoft Word <p>I've been Googling for quite awhile and haven't found a definitive answer. Is it possible to output a table using Apache POI? It looks like it hasn't been implemented, since the main developer stopped working on it like 5 years ago.</p> <p>Is there an open source...
<p>I think you're right in that Apache POI is dead in the water. Clearly it wasn't glamourous enough.</p> <p>The only alternative that I'm aware of is <a href="http://itextdocs.lowagie.com/tutorial/rtf/index.php" rel="nofollow">iText</a>, which can generate RTF documents, which MS Word (and every other similar applica...
python dictionary update method <p>I have a list string tag.</p> <p>I am trying to initialize a dictionary with the key as the tag string and values as the array index.</p> <pre><code>for i, ithTag in enumerate(tag): tagDict.update(ithTag=i) </code></pre> <p>The above returns me {'ithTag': 608} <em>608 is the 6...
<p>You actually want to do this:</p> <pre><code>for i, tag in enumerate(tag): tagDict[tag] = i </code></pre> <p>The .update() method is used for updating a dictionary using another dictionary, not for changing a single key/value pair.</p>
How to check if PHP array is associative or sequential? <p>PHP treats all arrays as associative, so there aren't any built in functions. Can anyone recommend a fairly efficient way to check if an array contains only numeric keys?</p> <p>Basically, I want to be able to differentiate between this:</p> <pre><code>$seque...
<p>You have asked two questions that are not quite equivalent:</p> <ul> <li>Firstly, how to determine whether an array has only numeric keys</li> <li>Secondly, how to determine whether an array has <em>sequential</em> numeric keys, starting from 0</li> </ul> <p>Consider which of these behaviours you actually need. (I...
MinGW library converted to Windows library gives odd link in VC++6 <p>I used the MinGW <code>.a</code> to Windows <code>.lib</code> transformation process as detailed in a thread on the gmp-discuss list, as below (acting against a library created with --disable-shared --enable-static.) </p> <pre><code>cp libgmp.a gmp....
<p>Someone else had a similar problem and <a href="http://opensees.berkeley.edu/community/viewtopic.php?t=2267" rel="nofollow">the fix</a> was relatively simple.</p>
How can I change the 259 char limit inside WinForms Treeview LabelEdit? <p>My VB.Net Winforms app is a tool to allow hierarchical data to be edited in a tree, then stored in a database. I am using a treeview control.</p> <p>Content is drag-dropped from other documents onto the treenodes, or the nodes can be edited dir...
<p>I would recommend taking a different approach. You probably don't want to show your users all 10000 or characters of a document anyway in their TreeNode, so create an custom data storage class with properties like Name and Content to store the document and it's title. Add your content to the Content property and a...
Flush disk write cache <p>When the policy for a disk in Windows XP and Vista is set to enable write caching on the hard disk, is there a way to flush a file that has just been written, and ensure that it has been committed to disk?</p> <p>I want to do this programmatically in C++.</p> <p>Closing the file does perform...
<p>.NET FileStream.Flush() will NOT flush the Windows cache for that file content; Flush() only flushes the .NET internal file buffer. In .NET 4.0, Microsoft fixed the problem by adding an optional parameter to Flush() which if set true causes FlushFileSystemBuffers to be called. In .NET 3.5 and below your only choi...
Why is there no RAII in .NET? <p>Being primarily a C++ developer the absence of <a href="http://en.wikipedia.org/wiki/Resource_acquisition_is_initialization">RAII (Resource Acquisition Is Initialization)</a> in Java and .NET has always bothered me. The fact that the onus of cleaning up is moved from the class writer to...
<p>A better title would be "Why is there no RAII in C#/VB". C++/CLI (The evolution of the abortion that was Managed C++) has RAII in the exact same sense as C++. It's all just syntax sugar for the same finalisation pattern that the rest of the CLI languages use (Destructors in managed objects for C++/CLI are effectivel...
What ways are there of drawing 3D trees using Java and OpenGL? <p>I know how to draw basic objects using JOGL or LWJGL to connect to OpenGL. What I would like is something that can generate some kind of geometry for trees, similar to what SpeedTree is famous for. Obviously I don't expect the same quality as SpeedTree.<...
<p><a href="http://arbaro.sourceforge.net/" rel="nofollow">http://arbaro.sourceforge.net/</a></p> <p><a href="http://www.propro.ru/go/Wshop/povtree/povtree.html" rel="nofollow">http://www.propro.ru/go/Wshop/povtree/povtree.html</a></p> <p>Non java: <a href="http://www.aust-manufaktur.de/austt.html" rel="nofollow">htt...
Java: Serializing unknown Arraysize <p>If I safe an Array and reload it, is there a possibility to get the size if its unknown? Thanks</p>
<p>What do you mean by "unknown"? You can get the length of any java array with the length field.</p> <pre><code>int[] myArray = deserializeSomeArray(); int size = myArray.length; </code></pre>
AutoPostback with TextBox loses focus <p>A <code>TextBox</code> is set to <code>AutoPostback</code> as changing the value should cause a number of (display-only) fields to be recalculated and displayed.<br> That works fine.</p> <p>However, when the field is tabbed out of, the focus briefly moves on to the next field, ...
<p>This is "by design". If you are using ASP.NET 2.0+ you can try calling the Focus method of your TextBox once the postback occurs (preferably in the TextChanged event of the TextBox).</p> <p>I am not sure if there is any built-in way to track focus but I found <a href="http://www.codeproject.com/KB/aspnet/MainatinFo...
Why can't c++ ifstreams read from devices? <p>I knew I should never have started using c++ io, the whole "type safety" argument is a red herring (does anyone <em>really</em> find that it's one of their most pressing problems?). Anyhow, I did, and discovered a strange difference between ifstreams and FILE*s and plain ol...
<p>Works fine for me, its not a problem inherent to c++ stream file I/O as you seem to think.</p> <p>Maybe try adding <code>ios::in</code> to the openmode flags. According to 27.8.1.6 of the standard, it is required to or with ios::in so this probably won't do anything.</p> <p>Try checking which bit is actually set -...
Multiple instances of a java web application sharing a resource <p>I have a web service, that takes an input xml message, transforms it, and then forwards it to another web service.</p> <p>The application is deployed to two web logic app servers for performance, and resilience reasons.</p> <p>I would like a single we...
<p>This sounds like a good match for <a href="http://java.sun.com/javase/technologies/core/mntr-mgmt/javamanagement/" rel="nofollow">Java Management Extensions (JMX)</a></p> <ul> <li>JMX allows you to expose certain operations (eg: start/stop forwarding messages)</li> <li>JMX allows you to monitor certain performance ...
Incorporating shareware restrictions in C++ software <p>I wish to implement my software on a shareware basis, so that the user is given a maximum trial period of (say) 30 days with which to try out the software. On purchase I intend the user to be given a randomly-generated key, which when entered enables the software ...
<p>With regards to a random-generated key, how will you verify a key is legit or if a key is bogus if it is actually random? Have a look at the article "<a href="http://www.brandonstaggs.com/2007/07/26/implementing-a-partial-serial-number-verification-system-in-delphi/" rel="nofollow">Implementing a Partial Serial Numb...
JRE Upgrade <p>Is there anyway to upgrade the installed JRE in the system? We are having 1.5.0_08 installed in out HP Unix system.We have to upgrade this to 1.5.0_15.Is there a way to patch up the existing JRE and upgrade to a newer version.Or can this only be achieved by installing the newer JRE and set this in the sy...
<p>What's usually done is to have multiple JRE installed in separate directories (JRE_1_5_10, JRE_1_5_16, JRE_1_6_3, ...) and use some symlinks as references as JRE_1_5 that will point to the latest version of JRE 1.5, same for JRE_1_6, and eventually, JRE that will point to the latest version of the JRE.</p> <p>Doing...
Is abstracting data type (sometimes) a good idea? <p>There are numerous times you have an interface that accepts similar type arguments that have a separate domain logic meaning:</p> <pre><code>public static class Database { public static bool HasAccess(string userId, string documentId) { return true; } } </code></...
<p>I think you answered your own question - better data integrity and validation, better system</p>
Python - Py2exe can't build .exe using the 'email' module <p>py2exe does not work with the standard email module</p> <p>Hello. I am trying to use py2exe for converting a script into an exe. The build process shows this:</p> <p><hr /></p> <p>The following modules appear to be missing</p> <h2>['email.Encoders', 'emai...
<p>Have a look at this question <a href="http://stackoverflow.com/questions/169897/how-to-package-twisted-program-with-py2exe">how-to-package-twisted-program-with-py2exe</a> it seems to be the same problem.</p> <p>The answer given there is to explicitly include the modules on the command line to py2exe.</p>
Recursive Rails Nested Resources <p>I have a Rails application for project management where there are Project and Task models. A project can have many tasks, but a task can also have many tasks, ad infinitum.</p> <p>Using nested resources, we can have /projects/1/tasks, /projects/1/tasks/new, /projects/1/tasks/3/edit ...
<p>Going anywhere beyond a single nested route is generally considered a bad idea.</p> <p>From page 108 of <strong>The Rails Way</strong>:</p> <p><a href="http://weblog.jamisbuck.org/2007/2/5/nesting-resources">"*Jamis Busk a very influential figure in the Rails community, almost as much as David himself. In February...
Writing a language for the Windows Scripting Host (WSH) <p>Has anyone had any experience targetting <code>WSH</code> in the way that <code>VBScript</code>, <code>JScript</code>, <code>PerlScript</code>, <code>xbScript</code> and <code>ForthScript</code> (among other) do, such that the language can be used from the comm...
<p>These are called <a href="http://msdn.microsoft.com/en-us/library/xawadt95(VS.85).aspx">Windows Script Engines</a> and are implemented by exposing the engine via COM. There is a lot documentation on <a href="http://msdn.microsoft.com/en-us/library/t9d4xf28(VS.85).aspx">MSDN</a>, and the actual interfaces are fairly...
Spring webflow : Move through view states <p>Within a spring webflow, i need to implement a navigation bar that will allow to "step back" or resume the flow to one of the previous view.</p> <p>For example :</p> <ul> <li>View 1 = login</li> <li>View 2 = My informations</li> <li>View 3 = My messages</li> <li>View 4 = C...
<p>It depends how you're going about doing this. If you're doing this within a single flow, you'll have something like this:</p> <pre><code>&lt;view-state id="loginView" view="login.jsp"&gt; &lt;action-state bean="someBean" method="login" /&gt; &lt;transition on="success" to="informationView" /&gt; &lt;/view-...
Using VS 2005 to design abstract forms <p>There's a famous bug in Visual Studio that prevents you from using the form designer on a subclass of an abstract form. </p> <p>This problem has already been elucidated and solved most elegantly by <a href="http://www.urbanpotato.net/default.aspx/document/2001" rel="nofollow"...
<p>If it were me, I'd try attaching a debugger (maybe another instance of Visual Studio) to the instance that throws the error dialog, and see if the stack trace gives you any insights into what's causing the error.</p>
Log4Net "Could not find schema information" messages <p>I decided to use <a href="http://logging.apache.org/log4net/index.html">log4net</a> as a logger for a new webservice project. Everything is working fine, but I get a lot of messages like the one below, for every log4net tag I am using in my <code>web.config</code>...
<p>You can bind in a schema to the <code>log4net</code> element. There are a few floating around, most do not fully provide for the various options available. I created the following xsd to provide as much verification as possible: <a href="http://csharptest.net/downloads/schema/log4net.xsd">http://csharptest.net/dow...
Sharing Test code in Maven <p>How can you depend on test code from another module in Maven? </p> <p>Example, I have 2 modules:</p> <ul> <li>Base</li> <li>Main</li> </ul> <p>I would like a test case in Main to extend a base test class in Base. Is this possible?</p> <p>Update: Found an <a href="http://stackoverflow...
<p>I recommend using type instead of classifier. It tells Maven a bit more explicitly what you are doing (and I've found that m2eclipse and q4e both like it better).</p> <pre><code>&lt;dependency&gt; &lt;groupId&gt;com.myco.app&lt;/groupId&gt; &lt;artifactId&gt;foo&lt;/artifactId&gt; &lt;version&gt;1.0-SNAPSHOT...
How to set property to Guid in aspx page <p>I have the following code in one of my aspx pages:</p> <pre><code>&lt;% foreach (Dependency dep in this.Common.GetDependencies(this.Request.QueryString["Name"])) { %&gt; &lt;ctl:DependencyEditor DependencyKey='&lt;%= dep.Key %&gt;' runat="server" /&gt; &lt;% } %&g...
<p>The key property of the Dependency object may be a Guid, but is the DependencyKey Property of the DependencyEditor a Guid too? If not it should be, otherwise the correct TypeConverter won't be invoked upon assignment. </p> <p>If I'm not mistaken, you could also use dep.Key.ToString() also.</p>
Is there a way to disable a SQL Server trigger for just a particular scope of execution? <p>In SQL Server 2005, is there a way for a trigger to find out what object is responsible for firing the trigger? I would like to use this to disable the trigger for one stored prodecure.</p> <p>Is there any other way to disable ...
<p>I just saw this article recently highlighted on the SQL Server Central newsletter and it appears to offer a way which you may find useful using the Context_Info on the connection:</p> <p><a href="http://www.mssqltips.com/tip.asp?tip=1591">http://www.mssqltips.com/tip.asp?tip=1591</a></p> <p><hr /></p> <p>EDIT by ...
What is the best way to validate a credit card in PHP? <p>Given a credit card number and no additional information, what is the best way in PHP to determine whether or not it is a valid number?</p> <p>Right now I need something that will work with American Express, Discover, MasterCard, and Visa, but it might be helpf...
<p>There are three parts to the validation of the card number:</p> <ol> <li><strong>PATTERN</strong> - does it match an issuers pattern (e.g. VISA/Mastercard/etc.)</li> <li><strong>CHECKSUM</strong> - does it actually check-sum (e.g. not just 13 random numbers after "34" to make it an AMEX card number)</li> <li><stron...
LINQ - which layer should LINQ typically fall into, DAL? <p>just wanted to gather different ideas and perspectives as to which layer should (and why) LINQ fall into?</p>
<p>LINQ = Language INtegrated Queries. This is the query extensions that allows you to query anything from databases to lists/collections to XML. The query language is useful in any layer.</p> <p>However, a lot of people refer to LINQ to SQL as just "LINQ". In that context, a combined BLL/DAL makes sense when you're u...
How can I convert HTML to Textile? <p>I'm scraping a static html site and moving the content into a database-backed CMS. I'd like to use Textile in the CMS. </p> <p>Is there a tool out there that converts HTML into Textile, so I can scrape the existing site, convert the HTML to Textile, and insert that data into the...
<p>I know this is an old question, but I found myself trying to do this the other day and not finding anything useful, until I found <a href="http://johnmacfarlane.net/pandoc/" rel="nofollow">Pandoc</a>. It can convert loads of other markup formats as well - it's quite brilliant.</p>
Ratio of time spent on coding versus unit testing <p>What is a typical estimate for coding unit tests given an estimate for coding new functionality? Is this different for estimates to maintain code?</p>
<p>My time is about equal between time for unit testing and time for functional code.</p> <p>Some people would look at this and say that is a waste of time, but if your only other option is to run the app and step through all the possible paths the app can take, then the time spent on unit testing is actually less tha...
How to output CDATA using ElementTree <p>I've discovered that cElementTree is about 30 times faster than <code>xml.dom.minidom</code> and I'm rewriting my XML encoding/decoding code. However, I need to output XML that contains CDATA sections and there doesn't seem to be a way to do that with ElementTree.</p> <p>Can it...
<p>After a bit of work, I found the answer myself. Looking at the ElementTree.py source code, I found there was special handling of XML comments and preprocessing instructions. What they do is create a factory function for the special element type that uses a special (non-string) tag value to differentiate it from regu...
C++ thread/process identifier <p>Is there a <em>portable</em> way of getting thread and/or process identifier (string, int, ...) with C++?</p>
<p>You have a few ways, but all imply the use of an external library abstracting the thread for you.</p> <p>Among the popular choices, two are:</p> <ol> <li>The <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/thread.html">Boost.Thread</a> library. This is the most portable but imply working with Boost, which i...
How do I slice an array in Excel VBA? <p>What function can I use in Excel VBA to slice an array?</p>
<blockquote> <p><strong>Application.WorksheetFunction.Index(array, row, column)</strong></p> </blockquote> <p>If you specify a zero value for row or column, then you'll get the entire column or row that is specified.</p> <p>Example:</p> <blockquote> <p>Application.WorksheetFunction.Index(array, 0, 3)</p> </block...
Safe to Run LogParser Against Live Production IIS Log? <p>Is it safe to run LogParser against our live production IIS log file?</p> <p>Currently, I have been copying it over to another location and then running LogParser 2.2 against the log file.</p> <p>Instead, I would really like to run it against the live data so ...
<p>It shouldn't cause any problems as I don't believe it locks the file. Why would it be a problem to copy the file though just to make sure? Even if you just copy it to a local folder, a batch file could make that easy, to copy the file and run it through logparser.</p> <p>But it should be fine against live files.<...
How do I convert a file's format from Unicode to ASCII using Python? <p>I use a 3rd party tool that outputs a file in Unicode format. However, I prefer it to be in ASCII. The tool does not have settings to change the file format.</p> <p>What is the best way to convert the entire file format using Python?</p>
<p>You can convert the file easily enough just using the <code>unicode</code> function, but you'll run into problems with Unicode characters without a straight ASCII equivalent.</p> <p><a href="http://www.peterbe.com/plog/unicode-to-ascii">This blog</a> recommends the <code><a href="http://www.python.org/doc/2.5.2/lib...
I want to use an LDAP client here at work to talk to Active Directory. How can I discover on my own the IP I should be aiming at? <p>I know I could just ask, but that would involve bureaucratic entanglements.</p>
<p>Try ping or nslookup _ldap._tcp. with your AD Domain (e.g. _ldap._tcp.test.com) in a console (cmd.exe) - this should give you the AD Server IP.</p> <pre><code>_ldap._tcp.* </code></pre> <p>Is a general SRV entry made by your active directory server for locating LDAP (AD) servers in your domain. Your domain itself ...
Watch for addition of a referenced library to a project (Visual Studio 2008 plug-in) <p>I am hoping someone can help me with this. What I have been looking around for but can't seem to find is if there is someway to add an event, or anything else that will allow a visual studio plug-in to watch for an external referenc...
<p>Not exactly what you asked, but I've written a Visual Studio 2008 Integration Package, and if I recall correctly I could override the "add reference" method, as well as inherit the "reference node" and thus change its behavior, for example its constructor.</p> <p>This functionality might be missing from an add-in (...
Unmanaged Threads Spring Quartz Websphere Hibernate <p>It appears that our implementation of using Quartz - JDBCJobStore along with Spring, Hibernate and Websphere is throwing unmanaged threads. </p> <p>I have done some reading and found a tech article from IBM stating that the usage of Quartz with Spring will cause ...
<p>We have a working solution for this (two actually).</p> <p>1) Alter the quartz source code to use a WorkManager daemon thread for the main scheduler thread. It works, but requires changing quarts. We didn't use this though since we didn't want maintain a hacked version of quartz. (That reminds me, I was going to...
How is your Development Environment Set up? <p>Curious to know how people set up their personal and/or work development environment, in terms of:</p> <p>Do you just have all of your developer tools (for example Visual Studio, SSMS, etc.) installed on your main operating system;<br> Do you use Virtual Machines to have ...
<p>It all depends on the type of the job i guess. Here is how my setup is:</p> <ol> <li>The main PC. The one on my desk. Has everything on it.</li> <li>The secondary machine. Runs Vista.</li> <li>A bunch of "Clean" VMs for testing. Typically 2 machines of each OS we support.</li> <li>A build machine. VM with no instal...
Swing: Is there a way to differentiate between a user-caused ItemEvent and an application-caused one? <p>I'm working with a combobox in a Swing-based application, and I'm having a hard time figuring out what to do to differentiate between an ItemEvent that is generated from a user event vs one caused by the application...
<p>Whether the user selects Item 2, or the API calls setSelection(2), <b>the event will appear the same</b>.</p> <p>The solution to your problem might be in re-thinking what you want the itemStateChanged code to do when the selection changes. Why would your app work differently under each condition? Maybe there are ...
Flex : Filter a datagrid using a combobox value that is contained in a datafield <p>I have a filter in a combobox with a number of entries. Instead of filtering the datagrid with an exact match, I would like to take the selected value and only display records where the selected value is contained in the datafield. For ...
<p>Something like this should work:</p> <pre><code> public function filter(item:Object):Boolean{ var result:Boolean=false; if (item.name.toUpperCase().indexOf(cbo.selectedLabel.toUpperCase()) &gt;= 0) result=true; return result; } </code></pre> <p>This filter function will search...
What is the best way to create user help documentation for an Excel VBA solution? <p>VBA solutions can vary widely in size. </p> <p>I would like to add <strong>user help</strong> documentation to all solutions but the level of effort to create and deploy the <strong>help</strong> needs to match the size of the soluti...
<p>You should check the <a href="http://www.mztools.com/v3/mztools3.aspx" rel="nofollow">VBA version of MZ-Tools</a>. It is an add-in for VBA that can automatically generate documentation from your code (function name, parameters, comments, subject, etc.). You can also use it to automatically generate line numbers, onE...
Irregular shaped Windows Form (C#) <p>What is the easiest way to do this? Is it possible with managed code?</p> <p>Thanks for your time.</p>
<pre><code>this.BackgroundImage = //Image this.FormBorderStyle = FormBorderStyle.None; this.Width = this.BackgroundImage.Width; this.Height = this.BackgroundImage.Height; this.TransparencyKey = Color.FromArgb(0, 255, 0); //Contrast Color </code></pre> <p>This allows you to create a form based on an image, and use tran...
What's a good Web Crawler tool <p>I need to index a whole lot of webpages, what good webcrawler utilities are there? I'm preferably after something that .NET can talk to, but that's not a showstopper.</p> <p>What I really need is something that I can give a site url to &amp; it will follow every link and store the co...
<p>HTTrack -- <a href="http://www.httrack.com/">http://www.httrack.com/</a> -- is a very good Website copier. Works pretty good. Have been using it for a long time.</p> <p>Nutch is a web crawler(crawler is the type of program you're looking for) -- <a href="http://lucene.apache.org/nutch/">http://lucene.apache.org/nut...
Nano hacks: most useful tiny programs you've coded or come across <p>It's the first <a href="http://oreilly.com/catalog/opensources/book/larry.html" rel="nofollow">great virtue</a> of programmers. All of us have, at one time or another automated a task with a bit of throw-away code. Sometimes it takes a couple seconds ...
<p>i found this on dotfiles.org just today. it's very simple, but clever. i felt stupid for not having thought of it myself.</p> <pre><code>### ### Handy Extract Program ### extract () { if [ -f $1 ] ; then case $1 in *.tar.bz2) tar xvjf $1 ;; *.tar.gz) tar xvzf ...
NUnit assembly not found <p>I've used NUnit before, but not in a while, and never on this machine. I unzipped version 2.4.8 under Program Files, and I keep getting this error when trying to load my tests.</p> <blockquote> <p>Could not load file or assembly 'nunit.framework, Version=2.4.8.0, Culture=neutral, PublicK...
<p>Make sure you have added a reference to nunit.framework. If you have, then make sure the properties of that reference have the copy local property set to true.</p>
java 1.5 to 1.4 <p>What is the best way to convert existing jar (without source) written in java 1.5 into java 1.4.x?</p>
<p>Take a look at <a href="http://retroweaver.sourceforge.net/index.html">Retroweaver</a>. It will convert the classes or jar so that it can be run using a 1.4 JRE. Depending on the 1.5 features used, you won't need any additional retroweaver run-time.</p> <p>Retroweaver uses byte code enhancement. It sounds mysteriou...
Is it worthwhile to use a bit vector/array rather than a simple array of bools? <p>When I want an array of flags it has typically pained me to use an entire byte (or word) to store each one, as would be the result if I made an array of <code>bool</code>s or some other numeric type that could be set to 0 or 1. But now I...
<p>It's mostly about saving memory. If your array of bools is large enough that a 8x improvement on storage space is meaningful, then by all means, use a bitarray.</p> <p>Note that the memory access is pretty expensive compared to the shift/and, so the bitarray approach is slightly faster than the array-of-chars. Ba...
TCustomDataSet C++ Builder <p>I'm looking for an example of a TCustomDataSet implementation in C++ beyond the TTextDataset example that ships as an example project within C++ Builder.</p> <p>The TTextDataset is hard to learn from because the code is not documented very well and it only shows a single field example.</p...
<p>I have a couple of examples. but unfortunately they are in Delphi, but you should get the idea: <a href="http://dn.codegear.com/article/20587" rel="nofollow">Example 1</a> <a href="http://www.carterconsulting.org.uk/Articles/cdspt3.PDF" rel="nofollow">Example 2</a></p> <p>The second one goes into a bit more explana...
Ruby and duck typing: design by contract impossible? <p>Method signature in Java:</p> <pre><code>public List&lt;String&gt; getFilesIn(List&lt;File&gt; directories) </code></pre> <p>similar one in ruby</p> <pre><code>def get_files_in(directories) </code></pre> <p>In the case of Java, the type system gives me informa...
<p>What it comes down to is that <code>get_files_in</code> is a bad name <em>in Ruby</em> - let me explain.</p> <p>In java/C#/C++, and especially in objective C, the function arguments <em>are part of the name</em>. In ruby they are not.<br /> The fancy term for this is <a href="http://en.wikipedia.org/wiki/Method_ove...
Design Pattern for implementing plugins in your application? <p>What is the standard way for allowing and implementing a plugin system for your application?</p> <p>In my last application I made a simple interface for all plugins that they must implement. I then load all assemblies in the apps directory and toss out a...
<p>Check out the System.AddIn namespace as per <a href="http://stackoverflow.com/questions/14278/how-to-load-plugins-in-net#14305">this response</a> to a similar question.</p>
Skipping the 'CompressResources' build step for XCode iPhone apps <p>Is it possible to set an iPhone XCode project to skip the 'CompressResources' build step?</p> <p>Specifically, I want to skip the stage where it runs pngcrush on all of my .png files, many of which don't survive the experience in a form which my app ...
<p>You can add "IPHONE_OPTIMIZE_OPTIONS=-skip-PNGs" to your project settings to prevent the png mangling, but be careful with it, you might need to optimize the icon and Default.png separately then.</p>
How to use a function-based index on a column that contains NULLs in Oracle 10+? <p>Lets just say you have a table in Oracle:</p> <pre><code>CREATE TABLE person ( id NUMBER PRIMARY KEY, given_names VARCHAR2(50), surname VARCHAR2(50) ); </code></pre> <p>with these function-based indices:</p> <pre><code>CREATE I...
<p>The index can be used, though the optimiser may have chosen not to use it for your particular example:</p> <pre><code>SQL&gt; create table my_objects 2 as select object_id, object_name 3 from all_objects; Table created. SQL&gt; select count(*) from my_objects; 2 / COUNT(*) ---------- 83783 SQL&...
Any viewstate implementation for JSP-Servlet app? <p>Do you know any implementation / technique which would provide similar behavior as Viewstate provides in ASP.NET. (Serializing the data into hidden field within the HTML form).</p> <p>I am using only JSP, Servlet, and Spring MVC.</p>
<p>I think the <a href="http://www.stripesframework.org/" rel="nofollow">Stripes</a> framework provides that.</p>
What are the alternatives to using Expand in a LINQ to ADO.net Data Service Query? <p>I am wondering if there are any alternatives to using the Expand key word when performing an LINQ to ADO.net Data Services query. The expand method does get me the data I am interested in, but it requires me to know all of the sub-ob...
<p>Loading sub-objects via ADO.net Data Services seem to have two choices:</p> <h2>Eager Loading</h2> <p>Accomplished by .Expand("[MemberVariableName]") on the LINQ to Data Services example</p> <pre><code>var me = (from m in ctx.Member.Expand("MailingAddress") where m.MemberID == 10000 ...
How do I estimate SQL Server index sizes <p>While estimating straight row and table sizes are fairly simple math, we find it challenging to guess just how much space each index will occupy (for a given table size). What areas can we learn to calculate a better estimate and growth rate for indexes?</p>
<p>An index leaf has a preamble identifying the data page (7 bytes plus some directory information for variable length columns, if any) plus a copy of the key value (s) which will be the same size as the table data for those columns. There's one for each row in the table. The higher up levels of the index are much sm...
SecurityException thrown when app starts from remote folder <p>I have an app written in C# that lies on a network share. When I run it from a local drive, everything works fine. When I start it from the remote share, calls like</p> <pre><code>try { System.Reflection.Assembly.GetExecutingAssembly(); System.IO.D...
<p>This is due to <a href="http://msdn.microsoft.com/en-us/library/930b76w0.aspx" rel="nofollow">CAS</a>; code started from the local machine has much more trust than code in the intranet, which in turn has more trust that code from the internet.</p> <p>IIRC, with the latest SP (3.5SP1?) if you have <em>mapped</em> th...
Lock / Prevent edit of source files on Linux using C++ <p>How can I programmatically lock/unlock, or otherwise prevent/enable editing, a source file on Linux using C++.</p> <p>I want to be able to lock source file so that if I open it in an editor it will not allow me to save back to the same source file.</p> <p>I am...
<p>Try man fchmod:</p> <pre> NAME chmod, fchmod - change permissions of a file SYNOPSIS #include &lt;sys/types.h&gt; #include &lt;sys/stat.h&gt; int chmod(const char *path, mode_t mode); int fchmod(int fildes, mode_t mode); </pre>
Best language for a non-programmer tech support person to learn <p>I have a colleague that handles tech support, and her role involves a lot of transforming ASCII files from one format to another and occasionally reporting on them. The formats tend to be largely plain text with an occasional bit of XML. She regularly...
<p>I would recommend Python for tasks like this. </p> <p>Syntactically it is clear and it handles reading, manipulating test files well. Also it provides excellent support for XML. </p>
LINQ to XML gets no data with schema set <p>I am trying to get some XML data with LINQ, but running into a problem.</p> <p>I am using a schema, which is set in the attribute xmlns ...</p> <pre><code>&lt;CarsForSale xmlns="http://schemas.sharplogic.net/CarSales.xsd"&gt; &lt;CarForSale&gt; </code></pre> <p>There are...
<p>You need to prepend the namespace:</p> <pre><code>var ns = "http://schemas.sharplogic.net/CarSales.xsd"; var cars2 = from d in doc.Descendants(ns + "CarForSale") select d; </code></pre> <p>otherwise search by local name:</p> <pre><code>var cars2 = from d in doc.Descendants() ...
Questions about exporting and importing flatfiles (txt, csv) in SQL Server 2005 <ol> <li>What's the best delimiter to use when exporting data?</li> <li>What's the best way to work with NULL data if you have an INT field in the table?</li> </ol>
<p>I'm not sure what the asker (nice name, :JPnoui38f) is trying to do. Sql Server management Studio has the ability to dump your data in a number of different ways. You don't have to worry about how to handle nulls or what delimeter to use. The tools take care of that.</p> <p>Here's an <a href="http://www.database...
Accessing python egg's own metadata <p>I've produced a python egg using setuptools and would like to access it's metadata at runtime. I currently got working this:</p> <pre><code>import pkg_resources dist = pkg_resources.get_distribution("my_project") print(dist.version) </code></pre> <p>but this would probably work ...
<p>I am somewhat new to Python as well, but from what I understand: </p> <p>Although you can install multiple versions of the "same" egg (having the same name), only one of them will be available to any particular piece of code at runtime (based on your discovery method). So if your egg is the one calling this code, ...
Compiling in c++ with mysql, pthreads and gtk <p>Have someone ever done this before???</p> <p>I am trying to use MinGW to compile a program using the MySQL libraries. I keep getting the message that the function 'rint' is redefined. Ok it's true that the function is in both files config-win.h, from MySQL and math.h fr...
<p>Also a guess, but it appears as if math.h AND config-win.h have a function called rint, make sure that there aren't two functions with the same names. </p> <p>BTW, because I am not entirely sure, I'm making this community editable, feel free to edit this post if I am incorrect.</p>
Is there a way to get DateTime value from timestamp type column? <p>I need a select from table which does not have column that tells when row was inserted, only <code>timestamp</code> column (values like: 0x0000000000530278). Some data was imported to the table yesterday and now I need to find out what exactly was impo...
<p>The Transact-SQL timestamp data type is a binary data type with no time-related values.</p> <p>So to answer your question: <em>Is there a way to get DateTime value from timestamp type column?</em></p> <p>The answer is: <em>No</em></p>
How do I embed a Google map into a Flash website? <p>I would like to include a Google map in a Flash site I am building. I would like to retain as much of the zoom, print, copy/send url, direction functionality as is practically possible. Please could somebody advise the best way to do this? Thanks.</p>
<p>See <a href="http://code.google.com/apis/maps/documentation/flash/" rel="nofollow">Google Maps API for Flash</a></p> <blockquote> <p>This API lets Flex developers embed Google Maps in Flash applications. Similar to the JavaScript version, this ActionScript API provides a number of utilities for manipulati...
DDD and Asynchronous Repositories <p>We're working on a rich client (written in Flex) that is connected to a Java backend, using both RMI and JMS. I was thinking about implementing the client in a DDD fashion so that it has Repositories for the CRUD operations on the domain objects.</p> <p>The problem is however that ...
<p>Flex and Flash Remoting is inherently asynchronous so fighting against that paradigm is going to give you a ton of trouble. Our service delegates return AsyncToken from every method and we've never had a problem with it.</p> <p>If you want to ensure that the application doesn't render a new view or perform some ot...
What is the best way to remember technical knowledge in the organization <ul> <li>Do we use a company wiki?</li> <li>how about you save the technical documents as part of source control and then have links to them from various source files (to understand how this works see article ... in directory...)</li> </ul> <p>wh...
<p>I'd recommend using a wiki. It works extremely well as a central documentation source and has built-in revision control. Also you can reference the docs in the code via URLs.</p>
IP subnet verification in JSP <p>I have the following JSP code, that protects my web page and displays it only to know IP's</p> <pre><code>String ip_h = request.getRemoteAddr(); String host_h = request.getRemoteHost(); String iplist[] = new String[1]; iplist[0] = "127.0.0.1"; iplist[1] = "10.217.106.248"; i...
<p>IP addresses (at least, IPv4 addresses) are really intended to be represented as 32-bit integers. If you convert the IP address to an integer first, checking subnet ranges becomes a relatively simple matter of checking (in your example) whether the first 16 bits match the first 16 bits of the range. </p>
User configurable security in multi-tenant ASP.NET website <p>We are building a multi-tenant website in ASP.NET, and we must let each customer configure their own security model. They must be able to define their own roles, and put users in those roles. What is the best way to do this?</p> <p>There are tons of simpl...
<p>Perhaps put the configurable roles in a DB table, where you store the roles and tenant, and then the PagePermissions in another table, for example:</p> <pre><code>Table "Role" RoleId, TenantId, Role Table "PagePermissions" PageId, RoleId Table "UserRoles" UserId, RoleId </code></pre> <p>Then in the page load che...