input
stringlengths
51
42.3k
output
stringlengths
18
55k
Is it really not possible to write a php cli password prompt that hides the password in windows? <p>I have spent several hours trying to find a means of writing a cross platform password prompt in php that hides the password that is input by the user. While this is easily accomplished in Unix environments through the ...
<p>There doesn't seem to be an IOCTL or STTY extension for PHP. I found the following trick <a href="http://www.usenet-forums.com/php-language/35386-hide-password-input-cli-php-script.html">here</a>:</p> <pre><code>&lt;?php echo 'Password: '; $pwd = preg_replace('/\r?\n$/', '', `stty -echo; head -n1 ; stty echo`); ec...
Hash Collision - what are the chances? <p>I have some code on my PHP powered site that creates a random hash (using <code>sha1()</code>) and I use it to match records in the database.</p> <p>What are the chances of a collision? Should I generate the hash, then check first if it's in the database (I'd rather avoid an e...
<p>If you assume that SHA-1 does a good job, you can conclude that there's a 1 in 2^160 chance that two given messages have the same hash (since SHA-1 produces a 160-bit hash).</p> <p>2^160 is a ridiculously large number. It's roughly 10^48. Even if you have a million entries in your database, that's still a 1 in 10^4...
Javascript libraries to extend built in data type objects <p>There are a number of great Javascript libraries\frameworks out there (jQuery, Prototype, MooTools, etc.), but they all seem to focus on DOM interaction and AJAX functionality. I haven't found any that focus on extending the built-in data types (String, Date,...
<p>There's a good reason the big javascript libraries steer clear of extending common object prototypes with functions which should really exist (String.trim, Array.shuffle !!)... If each library extended the String object to have a trim() function, then they'd overwrite each other - not good!</p> <p>Instead, what jQu...
Which command will executed first,If a stored procedure have individual multiple select commands; <p>Which command will executed first,If a stored procedure have individual multiple select commands;</p>
<p>Commands inside stored procedure are executed in the order in which they are written.</p>
Do I get a finished slot if a start QProcess using startDetached <p>Do I get a finished signal if I start a QProcess using startDetached()? I'm trying to start a process, but I need to be able to get an event when the process has terminated.</p>
<p>No you can't get a signal when you use startDetached because you have no object.</p> <p>startDetached is a static function and when you call it the process is started directly without creating a QProcess object. Therefore, even if there was a signal you would not be able to connect it to anything since you have no ...
How to show Vista style balloon hints in Delphi? <p>On input validation, I'm using balloon tips instead of message boxes. My problem is that on Vista, they have the old XP style with the rounded corners, not the newer more rectangle like appearance.</p> <p>I've tried creating them using CreateWindowEx and <code>toolti...
<p>If you're using Delphi 2009, then adding balloon hints is reasonably straightforward, although the documentation is poor. (surprise, surprise)</p> <ul> <li>Drop a TBalloonHint on your form</li> <li>Drop a TImageList to contain icons if needed.</li> <li>Link the TIMageList to the TBalloonHint</li> <li>Set the form's...
How do I verify that my LINQ-to-SQL model matches the database schema? <p>I am absolutely new to the .NET world, and started with C# on friday. I have some experience with database apps, though.</p> <p>We will go with LINQ-to-SQL for a medium scale project. I am used to generating my schema from classes and keep track...
<p>This <a href="http://blog.huagati.com/res/index.php/2008/07/17/tools-part-2-add-ins-dbml-synchronization-add-in-updated/" rel="nofollow">tool</a> will help sync them, but I'm unsure if it'll show differences...may be of some use though. (:</p> <p>EDIT: As <a href="http://stackoverflow.com/users/11241/kristofera">Kr...
Include ib_logfiles in backup? <p>The short question:<br/> Is it safe skip ib_logfile* files while creating custom-made backup of MySQL installation with InnoDB engine used?</p> <p>Custom-made backup is just copy all (or subset of) /var/lib/mysql + /etc/my.cnf to safe place.</p> <p>As I know ib_logfile* files are rec...
<p>It's not safe to back up a database in the manner you're describing.</p> <p>The reason is that you cannot know if some data pages are still in MySQL Server's memory, pending an I/O flush to disk. So copying the files has a good chance of copying garbage, whether or not you include the <code>ib_log</code> files.</p...
Changing java lookandfeel without modifying the application <p>Is it possible to change java lookandfeel without modifying the program in a real-world environment?</p> <p>I know that theoretically the answer is yes. I also created demo applications and changed the lookandfeel even at runtime and it worked. But when I ...
<p>Yes, there are different ways to start your application with a certain look and fell without modifying the code of your application. An easy way is to set a system property at startup of your application. E.g. if you have a shell script or batch file starting your application you just change the command from</p> <p...
How to manage frequently modified production code? <p>My project invovles me to make a lot of changes on the production code. The requirement keeps coming up and I need to make changes and deploy it as soon as possible. I sometimes end up creating patch work sort of code because some of the requirement would not fit in...
<p>I've seen this happen many times and it always ends in tears. The last time the customer lost millions of dollars before they improved their process.</p> <p>Users always want new requirements to be made available "as soon as possible," but they do not understand the risks of making the changes in the same way that ...
Dump hidden (or minimized) X11 window <p>I'd like to dump the contents of an X window. Like this:</p> <p>xwd -id | convert - capture.png</p> <p>... which works quite well as long as the target window is not hidden (totally or partially behind other windows) or minimized.</p> <p>Any idea on how to do this?</p> <p>I...
<p>Do you have an objection to bringing it to the front first? </p> <p>If not, you can use a tool like <a href="http://www.sweb.cz/tripie/utils/wmctrl/" rel="nofollow">wmctrl</a> to bring the window to the front (and maximize it, etc), use xwd to capture it, then send it back to where it came from with wmctrl.</p>
Firefox CSS: Given 2 divs, how can I float the *second* one to the right using static positioning? <p>I'm working on a <a href="http://userstyles.org/styles/12154" rel="nofollow">Youtube userstyle script</a> that displays comments side by side with the video so you can watch the video and read the comments at the same ...
<pre><code>#main { border: 1px solid; width: 50%; float: left; } #rightnav { background-color: yellow; opacity: 0.5; border: 1px dotted; width: 48%; float: right; } #footer { clear: both; } </code></pre> <p>that'll do it</p> <p>edit: if you say liquid that usually means percent based dime...
Host a WPF control in activex instead of Win32 App <p>I'm searching an example of an activex that contain a WPF control.</p> <p>I'm able to see the control during registration of activex in the test activex container but when I instantiate it i cannot see WPF but what is coded inside OnDraw.</p> <p>Any hint or exampl...
<p>check out the msdn article on Hosting Windows Presentation Foundation Content in a Win32 Application (<a href="http://msdn.microsoft.com/en-us/library/ms744829.aspx" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms744829.aspx</a>)</p>
How to get the current directory in a C program? <p>I'm making a C program where I need to get the directory that the program is started from. This program is written for UNIX computers. I've been looking at <code>opendir()</code> and <code>telldir()</code>, but <code>telldir()</code> returns a <code>off_t (long int)<...
<p>Have you had a look at <a href="http://pubs.opengroup.org/onlinepubs/9699919799/functions/getcwd.html"><code>getcwd()</code></a>?</p> <pre><code>#include &lt;unistd.h&gt; char *getcwd(char *buf, size_t size); </code></pre> <p>Simple example:</p> <pre><code>#include &lt;unistd.h&gt; #include &lt;stdio.h&gt; #inclu...
Subsonic Join issue <p>For those of you who are decent with subsonic!</p> <pre><code> TblNewsCollection col = new Select().From(Tables.TblNews) .InnerJoin(Tables.TblContent) .Paged(currentPage, pageSize) .OrderDesc(TblContent.Columns.PubDate) ...
<p>I found that joins work better using the TableColumnSchema as in the above Northwind example as opposed to the column name.</p>
Getting XML Schema from MS SQL Database <p>Is it possible to generate a XML Schema of a Database programatically with .Net and C#? I want to look into NDbUnit but for big databases it would not really be feasible to make a Schema manually? </p>
<blockquote> <p>Is it possible to generate a XML Schema from a Database?</p> </blockquote> <p>It sure is, <a href="http://www.altova.com/dev_portal_xml_schema.html">XMLSpy</a> can generate XML Schema from a database.</p> <p>There's <a href="http://dwightrau.blogspot.com/2008/02/generate-or-create-xsd-schema-from....
How do I select text nodes with jQuery? <p>I would like to get all descendant text nodes of an element, as a jQuery collection. What is the best way to do that?</p>
<p>jQuery doesn't have a convenient function for this. You need to combine <code>contents()</code>, which will give just child nodes but includes text nodes, with <code>find()</code>, which gives all descendant elements but no text nodes. Here's what I've come up with:</p> <pre><code>var getTextNodesIn = function(el) ...
How to make sure an application keeps running on Linux <p>I'm trying to ensure a script remains running on a development server. It collates stats and provides a web service so it's supposed to persist, yet a few times a day, it dies off for unknown reasons. When we notice we just launch it again, but it's a pain in th...
<p>I have used a simple script with cron to make sure that the program is running. If it is not, then it will start it up. This may not be the perfect solution you are looking for, but it is simple and works rather well.</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/bash #make-run.sh #make sure a proces...
How to do a jquery ajax call to a subdomain? <p>i could call a page inside the same domain, but its not working when i calling a page in a sub domain due to security issues. what i have to do? help me!!!</p>
<p>You can set the document.domain but if I remember correctly a few browsers (Opera) will not even allow this. I am afraid your answer is to create some sort of proxy on the subdomain that you can talk through</p>
Split string containing command-line parameters into string[] in C# <p>I have a single string that contains the command-line parameters to be passed to another executable and I need to extract the string[] containing the individual parameters in the same way that C# would if the commands had been specified on the comma...
<p>It annoys me that there's no function to split a string based on a function that examines each character. If there was, you could write it like this:</p> <pre><code> public static IEnumerable&lt;string&gt; SplitCommandLine(string commandLine) { bool inQuotes = false; return commandLine.Split...
XML Serialization issue for minoccurs <p>I have a .NET Web app which consumes a Java-based Web service. One of the objects, named Optional, contains search criteria fields. The schema is the following:</p> <pre><code>&lt;xsd:complexType name="Optional"&gt; &lt;xsd:sequence&gt; &lt;xsd:element name="FromAmount" nill...
<p>in .NET WS for non-nullable types (in .NET) that are marked optional in the schema have an additional specified property generated for them that control if the element appears. Very annoyingly, the setter for the value does not set the additional specified flag, so you need do this.</p> <pre><code>x.ToAmmount = 24....
javascript alerting from a c# class <p>I have a 5 aspx page "wizard". each one contains a "SaveAndExit" button that executes a c# function on a common static class. After saving , the c# code redirects to another page.</p> <p>Is there a way for running javascript: alert('Data Saved'); after the saving, and before new...
<p>You'll have to register a startup script on postback to do the alert. Then redirect via javascript after the alert.</p>
Custom namespace for code behind .aspx page <p>I am using .NET2.0. Let's say a have a simple aspx form with txtInput and btnSomeAction</p> <pre><code> &lt;asp:TextBox ID="txtInput" runat="server"&gt;&lt;/asp:TextBox&gt; &lt;asp:Button ID="btnSomeAction" runat="server" CommandName="SomeAction" Text="Do"/&gt; </cod...
<blockquote> <p>Do i need to modify the aspx page to include the namespace?, What about the partial class?</p> </blockquote> <p>Yes. At the top of your aspx file you should see something like </p> <blockquote> <pre><code>&lt;%@ Page AutoEventWireup="false" Inherits="Blah.Foo.Bar" %&gt; </code></pre> </blockquote> ...
Imitating SQL Server Profiler in a C# app? <p>I want to create a trace on a database server from my C# app, like what you do in SQL Server Profiler. I have found stored procedures (sys.sp_trace_create etc...) that dont seem to work for my SQL management studio. I was wondering if anyone could help with the coding, or w...
<p>Are you wanting this to be real-time, just like the Profiler itself? That'd be tough to do. You'd basically be re-creating the profiler. </p> <p>If that is not a requirement, I would recommend simply calling the sp_trace_create stored procs that you found to start a server-side trace, then use your application to o...
What metrics should we use to judge code quality? <p>I'm currently working on a large project, where many developers worked over time and the code was terrible. After many refactorings we now arrived a point, where the code is ok. Now I'm thinking what "ok" means - probably for everyone something different.</p> <p>Do ...
<p>I think for any non-trival project you should have coding guidelines in place (style, comments, etc.) and metrics to know if they are being followed or not. The list you've outlined is a very good start.</p>
WCF here to stay? <p>Currently reading quite a heavy WCF book. I have used it myself in production just the once, using tcp, worked a charm. Anyway what are your opinions on this technology, is it here to stay, is it worth the time invested learning all the complex features etc etc?</p>
<p>I think it is here to stay. It is easily configurable for moving endpoints, it seems robust and allows you to do (pretty much) everything you could do in web services and remoting without the overhead of separate implementations.</p> <p>I can see where you are coming from, with MS's recent leaks about ongoing supp...
jQuery .Net Deployment Issue <p>Just started getting into jQuery and have an issue with a jQuery Post call working perfectly on my local dev box (VS 2008 built-in web server), but failing when I deploy to a windows 2003 server (IIS 6) box.</p> <p>The post works and the page being posted to process things correctly, bu...
<p>The problem is probably due to caching.<br /> Try adding a random number to the post URL</p> <pre><code>$.post('CustomPostHandler.aspx?step=criteria&amp;random=' + Math.random().toString(), { selected: idString }, </code></pre>
In what situations is the ATL CSimpleArray a better choice than CAtlArray <p>The documentation says that CSimpleArray is for dealing with small numbers of objects. What is small in this context? Is CSimpleArray ever a good choice or should I always use a different collection class such as CAtlArray?</p>
<p>"Small" here is a rule of thumb, which stems from the way the two classes manage their memory internally. Basically, CAtlArray provides more fine-grained control of the memory it uses, and CSimpleArray deals with memory simply but naively. </p> <p>Specifically, when an element is added to a CSimpleArray, if the a...
Webkit/Safari/Firefox/API: Can I programmatically read/extract multiple tabs' URLs? <p>Topic: Programmatically manipulate web browser in OS X 10.4.x+ Tiger/Leopard. Subjects: Webkit, Safari, Firefox, APIs, Applescript, Automator, Javascript, Ruby, Ruby on Rails, OS X, Tiger Goal: Collect/Read/Extract URLs from Safari i...
<p>For Safari, this would be pretty trivial to do with Applescript. I'd suggest starting with something like <a href="http://www.macosxhints.com/article.php?story=20060227192533174" rel="nofollow">Bookmark all tabs</a> to get the basic tab-grabbing logic that you'll need, and maybe merge it into John Gruber's old <a h...
How to add a "driver" to javax.comm? Serial port programming in Java <p>I am trying to use a RS-232 serial port on my PC with javax.comm class. I am newby on that API, so first of all I go through the documentation and I find out that the first thing you should do is "list" all the ports from the class CommPortListener...
<p>Have you tried RXTX? I've had successf with that API on Windows/XP. I'n not sure what you mean by "starting to beat me".</p> <p>There has been a lot of recent activity on the RXTX project and a new release incorporating a number of fixes and additional support is imminent. The mailing list is also relatively act...
Web Service or DLL? <p>I'm creating an app that needs to be accessed by both a web front end hosted on an internal network and also run as a scheduled task. Nothing will need to be accessed outside of our internal systems and once the app is up and running we don't envision anything changing for some time.</p> <p>My i...
<p>Personally, I say go with the DLL. It will be fast and simple.</p> <p>With a web service, you will need to think about your network, firewalls, performance, etc. It also makes it harder to debug since you won't be able to step into the web service from your clients, you will have to set breakpoints on both sides of...
What do I have to do to make my WH_SHELL or WH_CBT hook procedure receive events from other processes? <p>I'm trying to use <code>SetWindowsHookEx</code> to set up a <code>WH_SHELL</code> hook to get notified of system-wide <code>HSHELL_WINDOWCREATED</code> and <code>HSHELL_WINDOWDESTROYED</code> events. I pass 0 for t...
<p>The problem is that your hook DLL is actually being loaded into several different address spaces. Any time Windows detects an event in some foreign process that must be processed by your hook, it loads the hook DLL into that process (if it's not already loaded, of course).</p> <p>However, each process has its own a...
How do I generically use KVC to update fields? <p>Say I have the following Objective-C class:</p> <pre><code>@interface Foo { int someNumber; NSString *someString; } </code></pre> <p>and for reasons I won't get into here, I want to use KVC to update, in a generic fashion, the values for those variables:</p>...
<p>The following code should handle the conversion automatically, as long as the <code>object</code> parameter is a member of a class that implements <code>integerValue</code>.</p> <p>Note that both <code>NSNumber</code> and <code>NSString</code> implement this method.</p> <pre><code>- (void)setValue:(id)object forKe...
How to best implement swear words handler (.NET preferred)? <p>For an ASP.NET application, what is the Best Practice implementation method for a custom swear word remover/replacer?</p> <p>If this is a data table solution, is there free resource to get the data? (Similar to finding a public dictionary table that you ca...
<p><a href="http://www.codinghorror.com/blog/archives/001176.html" rel="nofollow" title="Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?">Obscenity Filters: Bad Idea, or Incredibly Intercoursing Bad Idea?</a> ^_^</p> <p>Also see <a href="http://stackoverflow.com/questions/273516/how-do-you-implement...
How can I query users with an expired password in Active Directory? <p>I need to query Active Directory for a list of users whose password is about to expire. The obvious (and easy) way to do this is with:</p> <pre><code>dsquery user -stalepwd n </code></pre> <p>The problem is that I need to add additional filters t...
<p>You can write an LDAP Query that compares "stale" passwords by comparing the pwdLastSet attribute on the user object:</p> <pre><code>(&amp;(objectClass=person)(objectClass=User)(pwdLastSet&lt;=n)) </code></pre> <p>ActiveDirectory uses a very specific format for this time stamp. I believe it a file-time, but I woul...
Flash Screenshot <p>We're trying to send an image of a large SWF file to a server to have it mailed out and we're having a bit of trouble with transmission time. </p> <p>The SWF is about 900px x 600px and restricted to AS2 so we've been using this Bitmap Exporter class. We've tried using several different ways to tran...
<p>The reason you get such long upload times is that the image is barely compressed (or not at all depending on how the class is implemented). 900 by 600 pixels at 16 bpp (or whatever it now is flash uses) amounts to something like 1.5mb of raw data. </p> <p>I'm doubtful that there are any useful compression libraries...
How can I send an array to php through ajax? <p>I want to send an array constructed in javascript with the selected values of a multiple select. Is there a way to send this array to a php script using ajax?</p>
<p>You might do that with $.post method of jQuery (for example) :</p> <pre><code>var myJavascriptArray = new Array('jj', 'kk', 'oo'); $.post('urltocallinajax', {'myphpvariable[]': myJavascriptArray }, function(data){ // do something with received data! }); </code></pre> <p>Php will receive an array which will be ...
Is there an html css normalizer that works? <p>Long ago, I wrote a style 'normalizer' program to scan the ASP/HTML code of a big pile of classic ASP pages (most of which were originally generated from MS-Word documents, so naturally they were littered with superflous stylesheets and massive one-off styles). The style n...
<p>Well, I can't say definitively that this "works" for everything described, but Tidy does a bit more than clean up tags.</p> <p>See the <a href="http://tidy.sourceforge.net/docs/quickref.html" rel="nofollow">HTML Tidy Configuration Options</a>, especially those relating to Microsoft Word (like <a href="http://tidy.s...
Excel workbooks produced by POI don't work when linked <p>Here is what I'm doing :</p> <ol> <li>Create a workbook in memory (book = new HSSFWorkbook(), ...)</li> <li>Save it to disk (book.write(...))</li> <li>Open in Excel (ok)</li> <li>Create another workbook in Excel, which links to the first one (=PoiWorkbook?xls!A...
<p>This issue seems to be solved by newer version of POI (using 3.6 right now).</p>
How can I integrate Oracle BI into an existing application? <p>I have an existing application written in Perl. Now I need to integrate this application with OBI. The plan is having a button the user can click on to open OBI in an <em>iframe</em>. OBI resides on a different server from the running application.</p> <p>H...
<p>There are two ways to address the problem that I know of and tried out. According to your needs, one or the other might be more appropriate (or both, they're not mutually exclusive). In both cases, the documentation is good and readily available.</p> <h1>The "Go URL"</h1> <p>The Go URL is documented more thoroug...
Simple Oracle SQL date syntax question <p>I am trying to convert a working MS Access query to run on an Oracle database being accessed via VB Script (.asp). This is the last section of the WHERE clause:</p> <pre><code>sql = sql &amp; "WHERE (UAT.HB.MB_MODE = 'A' AND UAT.HB.PRINT_DATE &gt;= '" &amp; SD &amp; "' AND ...
<p>In Oracle, your date should be written as an ANSI date literal like this:</p> <pre><code>DATE '2008-11-11' </code></pre> <p>Or converted to a date from a string like this:</p> <pre><code>TO_DATE('11/11/2008', 'MM/DD/YYYY') </code></pre> <p>See <a href="http://download-west.oracle.com/docs/cd/B19306_01/server.102...
How to center an image horizontally and align it to the bottom of the container? <p>How can I center an image horizontally and aligned to the bottom of the container at the same time? </p> <p>I have been able to center the image horizontally by its self. I have also been able to align the bottom of the container by it...
<pre><code>.image_block { width: 175px; height: 175px; position: relative; } .image_block a { width: 100%; text-align: center; position: absolute; bottom: 0px; } .image_block img { /* nothing specific */ } </code></pre> <p><strong>explanation</strong>: an element positioned absol...
How should I set the default proxy to use default credentials? <p>The following code works for me:</p> <pre><code>var webProxy = WebProxy.GetDefaultProxy(); webProxy.UseDefaultCredentials = true; WebRequest.DefaultWebProxy = webProxy; </code></pre> <p>Unfortunately, <code>WebProxy.GetDefaultProxy()</code> is deprecat...
<p>For those who, unlike Brian Genisio, <em>are</em> able to set the contents of their application's config file:- don't do anything in code. Instead add this to your app.config / web.config.</p> <pre><code>&lt;system.net&gt; &lt;defaultProxy useDefaultCredentials="true" /&gt; &lt;/system.net&gt; </code></pre> <p>...
How do I create a Generic Linked List? <p>I am trying to use a Generic Linked List to hold some WorkFlow steps in my application. Here is how I'm persisting it to my database.</p> <p>OrderID&nbsp;&nbsp;WorkFlowStepID&nbsp;&nbsp;ParentWorkFlowStepID<br/> 178373&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nb...
<p>So do you mean you're using the <a href="http://msdn.microsoft.com/en-us/library/he2s3bh7.aspx" rel="nofollow">linked list class in the framework</a>?</p> <p>If so, the <code>Find</code> method doesn't really do what you want it to. Basically you want a version which takes a predicate. This would be easier if the c...
ASP.NET MVC fails at install <p>I need some help on asp.net mvc install.</p> <p>I got the below two errors when I try to install ASP.NET MVC Beta:</p> <p><em>Faulting application devenv.exe, version 9.0.21022.8, time stamp 0x47317b3d, faulting module unknown, version 0.0.0.0, time stamp 0x00000000, exception code 0xc...
<p>have you tried rebooting your machine then trying again?</p> <p>have you tried re-downloading the installer and trying again?</p>
Hosted subversion recommendations or suggestions <p>I'm investigating using hosted subversion for a new project at work and was wondering if anyone had any experiences they would share.</p> <p>I've personally used <a href="http://www.beanstalkapp.com/" rel="nofollow">Beanstalk</a> for small projects at home, but not w...
<p>wush.net has been awesome - great support I use it for personal projects as well as two freelance projects (one with a few hundred thousand lines of code) None have large number of developers, but that should not be a problem</p> <p>svnrepository is also good - but a lot less hand holding. I switched to wush only b...
Can I integrate checked out files into a different branch on perforce <p>We were working on a design, and for that we created the skeleton of the classes in our main branch. Now, we are starting to code, and for that we got a new branch. So, it would be nice if I can move all the new files in the main branch into the...
<p>The Perforce support web site explains how to do this: <a href="http://answers.perforce.com/articles/KB_Article/Branching-Work-In-Progress/" rel="nofollow">Perforce Knowledge Base: Branching work in progress</a>. It would be nicer if it was a single step that didn't require running eight different commands.</p>
How to embed a swf on top of a html page? <p>I want to embed a swf over a html page, like a floating video watching panel. I already have a swf file which will automatically adjust its size according to the browser size, and the swf file is partially transparent. I thought I can just add a div tag, make the position ab...
<p>Once you get your sizing to work properly you will need to set the <em>wmode</em> to <em>transparent</em> to be able to see what's behind the flash, if you don't it's background will be opaque.</p> <p>This is a quick copypaste from the <a href="http://code.google.com/p/swfobject/wiki/documentation">swfobject docs</...
HTML - xml data islands <p>I am designing a web app and I intent to embed data on an xml island so that I can dynamically render it on an HTML table on the client-side based on options the users will select.</p> <p>I have the broad concepts, but I need pointers on how to use DOM in navigating my xml. And how to update...
<p>In <em>W3C</em> HTML there are no XML data islands (unless you're referring to external XML file linked via frames loaded using Javascript), but you can re-use HTML elements and insert metadata in <code>class</code>, <code>title</code> (if you care about HTML4 validity), <code>data-*</code> (HTML5) or your custom at...
How to prevent text in a table cell from wrapping <p>Does anyone know how I can prevent the text in a table cell from wrapping? This is for the header of a table, and the heading is a lot longer than the data under it, but I need it to display on only one line. It is okay if the column is very wide.</p> <p>The HTML ...
<p>Have a look at the <a href="http://www.w3.org/TR/CSS21/text.html#white-space-prop"><code>white-space</code></a> property, used like this:</p> <pre class="lang-css prettyprint-override"><code>th { white-space: nowrap; } </code></pre> <p>This will force the contents of <code>&lt;th&gt;</code> to display on one l...
Create a button with an icon in actionscript <p>I want to create buttons with icons in Flex dynamically using Actionscript.</p> <p>I tried this, with no success:</p> <pre><code>var closeButton = new Button(); closeButton.setStyle("icon", "@Embed(source='images/closeWindowUp.png"); </code></pre>
<p>I found an answer that works for me. In my .mxml file, I create Classes for the icons I will use:</p> <pre><code>// Classes for icons [Embed(source='images/closeWindowUp.png')] public static var CloseWindowUp:Class; [Embed(source='/images/Down_Up.png')] public static var Down_Up:Class; [Embed(source='/images/Up_Up...
How to find slow-down in Javascript in IE6 <p>Something's slowing down my Javascript code in IE6 to where there's a noticeable lag on hover. It's fine in FF, so using firebug isn't that helpful. What tools are out there to help debug this in IE?</p> <p><strong>A little more info:</strong> I don't think there's actuall...
<p>Just a tip of what that "something" could be...</p> <p><strong>String concatenation</strong> in IE is (or at least was when I <a href="http://forums.thedailywtf.com/forums/p/8931/169331.aspx" rel="nofollow">tested</a>) very slow. Opera finished after 0.2s, Firefox after 4.1s and Internet Explorer 7 still hadn’t f...
How to find the index of the first char in a string that is not in a list <p>I know I can loop over the string or build a regex or invert the set (ASCII isn't that big after all) and search for the first instance of that, but Yuck.</p> <p>What I'm looking for is a nice one liner.</p> <p>fewer features is better, LINQ...
<p>This works:</p> <pre><code>public static char FindFirstNotAny(this string value, params char[] charset) { return value.TrimStart(charset)[0]; } </code></pre>
Force PHP integer overflow <p>We have some integer arithmetic which for historical reasons has to work the same on PHP as it does in a few statically typed languages. Since we last upgraded PHP the behavior for overflowing integers has changed. Basically we are using following formula:</p> <pre><code>function f($x1,...
<p>So I solved the problem, and discovered a lot about PHP (at least in the way it handles Integer overflow). </p> <p>1) It completely depended on a cross between which platform the machine was running on, which version of PHP, whether or not it had Suhosin Hardened PHP running, and how many bits it was compiled for ...
How can i make a reusable labelFunction for Flex Datagrid? <p>I have a label function like :</p> <pre><code>private function formatDate (item:Object, column:DataGridColumn):String { var df:DateFormatter = new DateFormatter(); df.formatString = "MM/DD/YY"; if (column.dataField == "startDate") { return...
<p>You can make the function generic using the dataField attribute of the column as the key into your item.</p> <pre><code>private function formatDate (item:Object, column:DataGridColumn):String { var df:DateFormatter = new DateFormatter(); df.formatString = "MM/DD/YY"; var value:object = item[column.data...
Pluggable edit component in JQuery <p>I'm developing an editing component (iframe-based) in JQuery.</p> <p>My intention is to make it easy to extend the functionality of the editor through plug-ins. So for example, you might make a plug-in that puts wavy underlines underneath spelling mistakes, or allows images to be ...
<p>You should take a look at <a href="http://docs.jquery.com/UI/Guidelines#Plugin_Extensions" rel="nofollow">jQuery.ui guidelines</a>. There mentions the draggable component as an example of a plugin with plugins.</p>
How to find recent sql update operations acting upon a certain table (SQL Server 2005) <p>say I want to find the latest added rows (UPDATE by any user, not necessarily the one which is executing UPDATE) in XX table.</p>
<p>You would need to use a Transaction Log reader tool. There are several free ones available as well as commercial offerings.</p> <ul> <li><a href="http://www.apexsql.com/sql_tools_log.asp" rel="nofollow">ApexSQL Log</a> </li> </ul> <p>You could also try <a href="http://www.mssqlcity.com/Articles/KnowHow/ViewLog.htm...
ASP.NET and Windows Workflow's (WF) - do we need to stick it in the Application state? <p>I've been trying to use WF in my ASP.NET application (actually, it's ASP.NET MVC ... but the fact that it's MVC instead of WebForms should not matter at all).</p> <p>Now, I can run the WF and it works fine, etc, but it kicks off ...
<p>I am not sure about your first question (although I <em>suspect</em> that they are equivalent). However, I am sure for the second question: You must definitely go with the <code>ManualWorkflowSchedulerService</code>. The main reasons are the following:</p> <ul> <li>It's the only way to block the execution of the ho...
What are the differences between various threading synchronization options in C#? <p>Can someone explain the difference between:</p> <ul> <li>lock (someobject) {}</li> <li>Using Mutex</li> <li>Using Semaphore</li> <li>Using Monitor</li> <li>Using Other .Net synchronization classes</li> </ul> <p>I just can't figure it...
<p>Great question. I maybe wrong.. Let me try.. Revision#2 of my orig answer.. with a little bit of more understanding. Thanks for making me read :)</p> <p><strong>lock(obj)</strong> </p> <ul> <li>is a CLR construct that for (intra-object?) thread synchronization. Ensures that only one thread can take ownership of th...
Using the greedy route parameter in the middle of a route definition <p>I'm trying to create routes which follow the structure of a tree navigation system, i.e I want to include the entire path in the tree in my route. So if I had a tree which looked like this</p> <ul> <li>Computers <ul> <li>Software <ul> <li>Developm...
<p>Routes ignore query string parameters. But at the same time, query string parameters are passed in to an action method as long as there isn't a route URL parameter of the same name. So I would use just the second route, and pass in title via the query string.</p> <p>Another option is more complicated. You write a c...
What's a PHP framework and what's a good one? <p>I am running a site about <a href="http://www.phpframeworks.com/" rel="nofollow">PHP Frameworks</a>, but I can't find a exact definition for it, and I am always thinking a question, how to make out a good PHP framework? Features? Manual? Efficiency? Or something?</p>
<p>Asking a programming forum what is a good framework is like asking a car forum what is a good car. The opinions vary wildly, and in 95% of cases, it really doesn't matter what you choose, as long as it's actively developed. Most of your replies will be based on religion and not subjective comparisons. :)</p>
Third Party Controls for ASP.NET with Ajax Support <p>Ours is an upcoming company, so we cannot buy two three third party controls and find out by ourselves which the best one is.(One of the better solutions) We have a budget to buy just one. So we would like to know which is third party control is the best to use in A...
<p>For all those requirements, there's only two companies to choose from: <a href="http://www.telerik.com/" rel="nofollow">Telerik</a> and <a href="http://www.devexpress.com/" rel="nofollow">DevExpress</a>. Both have fantastic support and incredible ASP.NET products. They release often, and are known to be constantly...
How can I/O priority of a process be increased? <p>I want to increase the I/O priority of a process. Answers for both .NET and Windows Vista would be nice. processexplorer is ok as well.</p>
<p>The relevant information seems to be a bit scattered compared to the usual MS documentation. There is this white paper that discusses <a href="http://www.google.co.nz/url?sa=t&amp;source=web&amp;ct=res&amp;cd=2&amp;url=http%3A%2F%2Fdownload.microsoft.com%2Fdownload%2Fa%2Ff%2F7%2Faf7777e5-7dcd-4800-8a0a-b18336565f5b%...
Determine if Type is a pointer in a template function <p>If I have a template function, for example like this:</p> <pre><code>template&lt;typename T&gt; void func(const std::vector&lt;T&gt;&amp; v) </code></pre> <p>Is there any way I can determine within the function whether T is a pointer, or would I have to use ano...
<p>Indeed, templates can do that, with partial template specialization:</p> <pre><code>template&lt;typename T&gt; struct is_pointer { static const bool value = false; }; template&lt;typename T&gt; struct is_pointer&lt;T*&gt; { static const bool value = true; }; template&lt;typename T&gt; void func(const std::vector&...
how to place YAML inside a YAML document <p>I am working with Rails fixtures for testing my rails application. It is all good except one of my database columns is supposed to hold YAML content. But, I am sure how to put the YAML markup I want to load into my database inside the YAML file. Here is an example:</p> <p...
<p>If you want to put YAML code inside a YAML document, you need to treat it like a string:</p> <pre><code>url: "src: test username: admin" </code></pre> <p>If you need a multiline string, you can do</p> <pre><code>mvnforum: name: mvnforum abstraction_type: SVN url: " src: test\n username: admin\n " sour...
Eclipse features in VisualStudio <p>This might of been asked elsewhere (seems like a useful topic) but searches turned up nothing.</p> <p>One feature I love in Eclipse when programming Java is that I don't have to worry about putting in the import statements and any missed functions from interfaces that I am implement...
<p>If you make a call to something from one of the standard libraries (or a library that is referenced by the project) which isn't "using", the intellisence will show a mark below the keyword, like so:</p> <p><img src="http://i89.photobucket.com/albums/k220/kipper_308/intelli1.png" alt="alt text" /></p> <p>Hover over...
Using extension methods within inline databinding context <p>I'm trying to use some extension methods that I use to apply consistent formatting to DateTime and Int32 - which works absolutely fine in code behind, but I'm having issues with databinding.</p> <p>I get:</p> <pre><code>'System.DateTime' does not contain a ...
<p>Found the issue! I was including the namespace correcly as I thought - but the real issue was that the app was only INCLUDING the .NET 3.5 assemblies and not being compiled using the 3.5 compiler, was missing some entries from web.config which I realised when I created an empty project and tried it (successfully) in...
Fastest way to calculate file hash? <p>A lot of files will be stored in the DB and I need file hashes to unique identify that the file was not changed. (In general, will be used as the Windows Personal Firewall part)</p>
<p>If I understand the "used as the Windows Personal Firewall" part right, MD5 is not a good choice as an algorithm.</p> <p>There exists a successful attack on the MD5 algorithm which lets you find a different message that produces the same hash with relatively little work (as compared to brute force). That attack <em...
Can (or should) I mock methods on the object being tested other than the method being tested? <p>I have a class like so:</p> <pre><code>public class ClassA { public bool MethodA() { //do something complicated to test requiring a lot of setup } public bool MethodB() { if (MethodA()) ...
<p>It's hard to say if this is doable without the context, but one solution could to extract MethodA() to its own class so that you could have MethodB() invoking MethodA() on a mock object that'll act as your unit test wish. </p> <p>Another possibility is to subclass ClassA in <strong>your unit tests</strong> and to o...
What is the easiest way to convert a simple form into an exe file? <p>I have an offline paper based form. I need to convert it into a software that people can use on their computers to fill and submit information. Since the form (it is a tax return) requires considerable time in filling, it is not convenient to have i...
<p>There are many Windows programs that can take paper forms and convert them to electronic forms people can fill out, including Acrobat, Form Pilot, and OmniForm.</p> <p><a href="http://www.nuance.com/omniform/" rel="nofollow">OmniForm</a> may be good for you, as it allows things like calculated fields, and can outpu...
Latex: hyperref to individual longtable rows <p>I have a few longtables that stretch several pages and I want to use pageref and hyperref to link to these rows.</p> <p>But whatever I try, the links always refer to the start of the table. When I look into the aux file, the labels all seem to be re-defined into table.[n...
<p>I solved this problem by introducing a custom counter and label command:</p> <pre><code>\newcounter{mycounter} \newcommand{\mylabel}[1]{\refstepcounter{mycounter} \label{#1}} </code></pre>
404 Hijacking <p>Certain <a href="http://www.avg.com/special-toolbar-404-dns-error-tlbrc.tpl-mcr1" rel="nofollow">malware such as AVG</a> hijack 404 pages in order to display a page in the browser riddled with their own ads. The only work around I've found is to abandon 404 http status codes for custom error pages in m...
<p>It’s not your fault and it’s certainly not your responsibility. Keep the HTTP status codes, they are useful. If some of your users decide to install a browser plugin which handles 404 status codes, don't try to work around it.</p> <p><a href="http://googlewebmastercentral.blogspot.com/2008/08/farewell-to-soft-4...
What is the format of xml context definition file that XmlApplicationContext(sFileName) will read? <p>All the examples that I can search online use the App.Config mode of specifying the context definition retrieved by </p> <pre><code>contextToGetSprungObjects = ContextRegistry.GetContext(contextname) </code></pre> <p...
<p>Finally cleared this hurdle. XmlApplicationContext doesn't read the intermediate mapping xml in app.config... it reads the contents pointed to be the resource element directly. It won't read the app.config format - which is used by ContextRegistry class in Spring.net. <em>Spring.net docs are a good exercise in pain....
Best way to know if a user has administrative privileges from a VBScript <p>I need to check whether the user executing the script has administrative privileges on the machine.</p> <p>I have specified the user executing the script because the script could have been executed with a user other than the logged on using so...
<p>By doing this you break scenarios where the user has the required privs for your script but does not belong to Administrators. Instead of checking for group membership, check for the specific abilities you require.</p>
SignalAndWait for lock-context <p>I have a manager class that produces tasks for a threadpool, and each thread is supposed to do a call back once they are finished.</p> <p>I use locks to handle variables and fields, and signals to handle interthread communications. What I'm looking for is a way of exiting the current ...
<p>Is there any reason for using the event primitives rather than <code>Monitor.Wait/Pulse/PulseAll</code>? <code>Monitor.Wait</code> atomically releases the lock and waits, reacquiring the lock before it returns. See <a href="http://pobox.com/~skeet/csharp/threads/deadlocks.shtml" rel="nofollow">my threading article</...
Source Control for different teams? <p>Need recommendations for this...</p> <p>I have 2 teams</p> <ol> <li>Enterprise SOA development with InfoPath 2003, BizTalk 2006, MSCRMv3, custom .net2 website and a bunch of webservices using VSStudio 2005 with TFS.</li> <li>Web Team focused on public facing websites - using Ado...
<p><a href="http://subversion.tigris.org/" rel="nofollow">svn</a> - can even keep your locking strategy (if you have to), also you can develop all sorts of pre/post commit hooks to automate deployments/tests etc etc. Easy to setup and manage.</p> <p>Some tools &amp; links</p> <ul> <li><a href="http://www.visualsvn.co...
What causes an application pool in IIS to recycle? <p>I have been searching for info on this to no avail. The context of why i need this is <a href="http://stackoverflow.com/questions/271944/storing-temporary-user-files-in-aspnet-in-medium-trust">another question I asked here</a>. More specifically, does creating/updat...
<p>The article you liked in the other post actually did a really good job of this.</p> <p>Immediate Recycle</p> <ul> <li>Web.config changes</li> <li>Machine.config changes</li> <li>Global.asax changes</li> <li>Bin directory changes</li> <li>App_Code changes</li> </ul> <p>Delayed Recycle</p> <p>Can occur with multip...
ASP.NET Globalization -- Displaying dates <p>Good morning,</p> <p>Apologies for the newbie question. I'm just getting started with ASP.NET internationalization settings.</p> <p>Background info:</p> <p>I have a website which displays a <code>&lt;table&gt;</code> HTML object. In that <code>&lt;table&gt;</code> HTML ...
<p>You can allow the browser to set your UI culture automatically if you wish, by opening up the web.config, like this:</p> <pre><code>&lt;configuration&gt; &lt;system.web&gt; &lt;globalization uiCulture="auto" /&gt; ... </code></pre> <p>And then the culture set by the browser will be automatical...
Microsoft SQL Server - What does it mean that a Transaction Log is Full? <p>What does it mean that a Transaction Log is Full? I have it the file set to grow 20% when needed. I have 4GBs left on the drive. How do I solve this issue permanently? Running these commands solves the issue temporarily:</p> <pre> DBCC SHRINKF...
<p>The Transaction Log is where SQL server 'Records' every change it makes so that if something goes wrong, (From software crash to Power failure, to an asteroid strike... well maybe not an an asteroid strike), it can "recover" by "undoing" all the changes it has made, since the last consistent "CheckPoint" - back to...
How do I display an icon in the System Tray? <p>I want to make my .Net application display a notification in the system tray. So I want to show an icon for that, can anyone tell how to do that?</p>
<p>Open the main Form for your application, go to the Toolbox, open the All Windows Forms section and drop a NotifyIcon on your form. Then add the icon you want to the NotifyIcon.</p> <p>You may also want to change the ShowInTaskbar property of your form to false when the form is minimized and handle the double click ...
Java Collections (LIFO Structure) <p>I am looking in the Collections framework of Java for a LIFO Structure (Stack) without any success. Basically I want a really simple stack; my perfect option would be a Deque, but I am in Java 1.5.</p> <p>I would like not to have to add another class to my structure but I am wonder...
<p>There's actually a Stack class: <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/Stack.html">http://java.sun.com/j2se/1.5.0/docs/api/java/util/Stack.html</a></p> <p>If you don't want to use that, the LinkedList class (<a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html">http://java....
Wix Custom Actions with WixUI_Minimal <p>So, I'm trying to, after an application finishes installing (though in truth, it really doesn't matter when the secondary application is run, since it doesn't interact with the installed files during installation), run another program which is bundled with the application. Pert...
<p>CostFinalize happens long before InstallFiles deferred action runs (that actually places the file). Thus the CustomAction is failing (because the file isn't available) silently (because Return is ignore)</p> <p>You need your CustomAction scheduled at least after InstallFiles and be deferred or if the CustomAction ...
Where can I find the Dojo XMLNS DTD? <p>I want to add some Dojo widgets to my XHTML pages, but Dojo uses some attributes that aren't part of the XHTML spec. For example:</p> <pre><code>&lt;input dojoType="ComboBox" type="text" dataUrl="/some_data.json" /&gt; </code></pre> <p>The <code>dojoType</code> and <code>dataU...
<p>I don't believe substituting a custom DTD will make your pages validate. Whatever the DTD they are still not valid XHTML. If validation is really important you could try using the Dojo JavaScript library to write out all your widgets instead: <a href="http://www.dojoforum.com/node/1182" rel="nofollow">http://www.doj...
Linq to Entity - can i get to another table in the model when in the list template MVC page <p>in the out of the project template solution (Dynamic Data Web Application), I have the model created and all is good. - Get the list of the tables, and the select edit etc.</p> <p>But my database has linking tables that just...
<p>you can reference the metaModel via the dataContext</p> <pre><code>MetaModel refMetaModel = MetaModel.GetModel(typeof(yourdataContextName)); MetaTable refMetaModel; refMetaModel = refMetaModel.GetTable("yourTableName"); </code></pre> <p>PS looked at your code and this works in your sceanrio. You can get the table...
custom dialog with a text field in winmobile <p>I'm looking to have a simple custom dialog box, like a message box, that has a label and a TextBox. If there's a simple way to do this, sorry! I'm really not well versed in the dialog stuff. </p> <p>Thanks for any help, guys!</p>
<p>Here is how to make a small custom dialog box in Windows Mobile that looks like this:</p> <p><img src="http://www.freeimagehosting.net/uploads/b8fb5421d6.jpg" alt="alt text" /></p> <p>Add a form to your project, and set its FormBorderStyle property to None. This allows the form to be resized and positioned, but a...
How to move a sql server express mdf file to a different sql sever express server? <p>I'm trying to move my database.mdf file from a development environment to a SQL Server Express server that is hosted on my VPS - but I can't figure out how to attach the file to my database server. Help!</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms179877.aspx" rel="nofollow"><code>sp_attach_db</code></a> (or CREATE DATABASE FOR ATTACH) - don't forget to bring the LDF (log) files, too.</p>
Visual Studio 2008 will not edit read only files <p>So, up until today, when I tried to edit a read only file in VS2008, a dialog popped up giving me three options:</p> <ul> <li>Edit in memory</li> <li>Make writable</li> <li>Save a copy</li> </ul> <p>There was also a checkbox which read "Never allow in memory edits"....
<p>In case anyone is interested, resetting the following registry entry to 0 will restore the previous behaviour: </p> <pre><code>HKCU\Sofware\Microsoft\Visual Studio\9.0\Source Control\UncontrolledInMemoryEditDialogSuppressed </code></pre>
How to delete child object in NHibernate? <p>I have a parent object which has a one to many relationship with an IList of child objects. What is the best way to delete the child objects? I am not deleting the parent. My parent object contains an IList of child objects. Here is the mapping for the one to many relationsh...
<p>You are getting the first error because, when you remove the items from the collection, NHibernate's default mode of operation is to simply break the association. In the database, NHibernate tries to set the foreign key column on the child row to null. Since you do not allow nulls in that column, SQL Server raise...
.NET 3.5 chart controls exception: Error executing child request for ChartImg.axd <p>Anyone getting this error when using the new free chart controls MS bought from Dundas?</p> <p>"Error executing child request for ChartImg.axd"</p> <p>On the MSDN forum they suggested it was my web.config: <a href="http://social.msd...
<p>I encountered the same problem: the chart would work on one page but not on the next. Turns out if the chart is initialized for the first time in a POST (i.e. a postback) the error is thrown because the handler is configured incorrectly. To fix the issue modify the httpHandler configuration that user LaptopHeaven re...
How can I redraw my degrafa background when scrolling? <p>I am using a canvas which has a degrafa background, so far so good. </p> <p>However, when scrolling, the background (degrafa grid) does not get redrawn. In the code the background strokes are linked to the container height. The container height does not chang...
<p>I just had to use the scroll position in the degrafa property binding</p> <pre><code> &lt;degrafa:VerticalLineRepeater count="{(blackBoard.width + blackBoard.horizontalScrollPosition)/ ApplicationFacade.settings.GRID_SIZE}" stroke="{whiteStroke}" ...
Need to generate a Persistent Transient Failure <p>Update: A 4.x.x vs a 5.x.x became the least of my worries when I discovered that not all mail servers return errors according to the "standard". I'm opting to handle all types of returned mail as failures now but I'm leaving this question here in case it gets an answer...
<p>Generating a transient failure isn't that hard. A few come to mind:</p> <ul> <li>Some sort of local alias expansion failure (this may be more of a Unix thing)</li> <li>DNS lookup timeout (change your nameserver to something silly, or set up a subdomain pointing to a non-existent nameserver)</li> <li>Run your mailse...
Old School vs New School Programmers Problems and/or Benefits <p>I am a recent college graduate working for a large corporation that has an aging workforce. I am curious for peoples experiences on working with an age gap preferably from both sides. </p> <p>Examples Issues I have encountered so far: </p> <ul> <li>Agil...
<p>When I was right out of college, I was a night owl, and I would roll into work in late morning, even though I stayed late for hours after everyone else left. It was really hard to build rapport with other people. It was no surprise that I also felt unwelcome when I tried to ask questions or work collaboratively.</...
Excel 2002 Web Query screwing up en-GB dates <p>Good afternoon,</p> <p>I have a web query in <code>Excel 2002</code> going against a web page that returns a date column. The dates are returned as <code>DD/MM/YYYY</code>, as I would like to show them in my spreadsheet. My machine running Excel has its regional settin...
<p>Can you modify the "web query"?</p> <p>The universal date format is the better way for Office products to recognise dates/times. I've had similar problems working with GB to US dates and found that coding your dates into this format saves you a lot of trouble.</p> <pre><code>Universal Date format is : "yyyy-mm-dd ...
How do I remove/delete a folder that is not empty with Python? <p>I am getting an 'access is denied' error when I attempt to delete a folder that is not empty. I used the following command in my attempt: <code>os.remove("/folder_name")</code>. </p> <p>What is the most effective way of removing/deleting a folder/direct...
<pre><code>import shutil shutil.rmtree('/folder_name') </code></pre> <p><a href="http://docs.python.org/library/shutil.html#shutil.rmtree">Standard Library Reference: shutil.rmtree</a>.</p>
How do you set the current directory of a debugged process? <p>I have an application that is sensitive to the directory it gets invoked from — it loads some files using relative paths.</p> <p>When I start the program through a debugger, how can I control what the initial current directory will be?</p> <p>I'd prefer...
<p>With GDB, the initial working directory is the directory you instantiate GDB from. So, just run GDB from whatever you want the working directory to be. Alternatively, while the program is running, you can change the current working directory just by doing:</p> <pre><code>(gdb) print chdir("new/working/directory")...
Is there a better StringCollection editor for use in PropertyGrids? <p>I'm making heavy use of PropertySheets in my application framework's configuration editor. I like them a lot because it's pretty easy to work with them (once you learn how) and make the editing bulletproof.</p> <p>One of the things that I'm storin...
<p>You can create your own string collection editor easily, following these simple steps. <em>This example uses C#.</em></p> <p>1) You must create an editor control and derive it from <code>System.Drawing.Design.UITypeEditor</code>. I called mine <code>StringArrayEditor</code>. Thus my class starts with</p> <pre><cod...
Ensuring only one user login using ASP.Net Membership Provider <p>How would you ensure that only one user is logged in per account at a time?</p> <p>Assuming cookies are persistent.</p>
<p>Typically the best way is to implement a customization on the provider that checks for last login, as well as adding methods to your code to keep track of user action.</p> <p>The key is that you must know at what point did the user last do something OR logout. From there you can determine if the account is actuall...
setting a:visited link to same state as a:link and a:hover <p>I'm working on a idea where my a:link have one state (blue, no underline etc) with a a:hover being white. I want my <strong>visited links to have the same state</strong> as <code>a:link</code> and <code>a:hover</code>. Is this possible? supported in most com...
<pre><code>a, a:link, a:hover, a:visited, a:active {text-decoration: none; color: blue;} </code></pre> <p>should work on all CSS-enabled browsers, although this is a <a href="http://www.useit.com/alertbox/20040503.html">bad idea</a> (currently offline, <a href="http://209.85.129.132/search?q=cache:WLLZPIH8XjoJ:www.use...
Proper ObjectDataSource Use <p>Greetings!</p> <p>I'm creating a User Control that will display data in a GridView control. We are using n-tier architecture and the data in question is retrieved from our database and returned to us as a ReadOnlyCollection. OurNewObject is a class containing several properties and an ...
<p>Normally, you would create a separate object that contains your data access method(s), rather than putting the methods in the code-behind. The separate object can be an instance or static, but the object itself must have a parameterless constructor (or no constructor at all).</p> <p>Also, the TypeName property on t...
How can I prevent XML::XPath from fetching a DTD while processing an XML file? <p>My XML (<strong>a.xhtml</strong>) starts like this</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; ... </code></pre> <p>My code starts like...
<p>XML::XPath is based on XML::Parser. There is an option in XML::Parser to NOT use LWP to resolve external entities (such as DTDs). And XML::XPath lets you pass an XML::Parser objetc, to use as the parser.</p> <p>So you can write this:</p> <pre><code>my $p = XML::Parser-&gt;new( NoLWP =&gt; 1); my $xp= XML::XPath-&g...