input
stringlengths
51
42.3k
output
stringlengths
18
55k
Changing the MaxArrayLength property on the XmlDictionaryReaderQuotas object used when creating the XML reader <p>I'm getting the following exception while sending ( or receiving ) a byte array to a C# service. </p> <pre><code>There was an error deserializing the object of type System.Byte[]. The maximum array lengt...
<p>Is it a WCF service? If so, you can change the maxarraylength in the binding as seen on this SO post:</p> <p><a href="http://stackoverflow.com/questions/688988/configuring-a-web-service-endpoint-and-contract-from-c-code">post</a></p> <p><strong>P.S.</strong> Why would you use a custom Service when there are OOTB S...
Jasper report: two detail sections? <p>I've got a jasper report to do, with data like this:</p> <pre><code>Item | Quantity | Color ------+-----------+-------- A001 | 1 | Red A001 | 1 | Green B002 | 3 | Red B002 | 3 | Purple </code></pre> <p>The report is grouped by Item/Quantity,...
<p>Hmm, interesting. </p> <p>Here is what you could do:</p> <p>Using this source data (MySQL):</p> <pre><code>create table items ( item varchar(4), quantity number, color varchar(10), ); </code></pre> <p>(insert data...)</p> <pre><code>create table numbers (i integer) </code></pre> <p>(insert data 0, 1, 2 .....
How Can I Verify A Download Has Been Completed? <p>We're using ASP.NET MVC and our action does this:</p> <ul> <li>pull records from DB</li> <li>mark records as downloaded</li> <li>push zipped download to browser</li> </ul> <p>Now the problem comes when the download doesn't complete for some reason - maybe the user cl...
<p>I don't believe there is. If this is necessary you may need to utilize a Silverlight (Or flash) control in conjunction with your application.</p> <p>Basically the approach with either one would be to open a socket connection to the HTTP url and save it to the appropriate path on the User's drive. Once the download ...
SQLSERVER: How to alter an existing table int primary key to become an identity column? <p>My database has a table with thousands of records. The primary key is an integer. There's a lot of foreign key constraints associated with this column.</p> <p>I want to change this column to become an identity key. What's the be...
<p>There's a great feature in SQL Server Management Studio that saved my day.</p> <p>In SSMS go to Options -> Designers -> Table and Database Designers, check "Auto generate change scripts" and uncheck "Prevent saving changes that require table re-creation".</p> <p>In object explorer, go to you table and select the c...
SQL Server - how to set (nolock) hint as a default? <p>is there some way to tell sql server to use the (nolock) hint or every select in a stored procedure?</p> <p>is pretty tiresome to add it to each an every select....</p>
<p>As others quite rightly say, a global (nolock) is done using READ UNCOMMITTED.</p> <p>However, before going down that route, it's worth trying READ COMMITTED SNAPSHOT first. This means your reads won't be locked by in progress inserts / updates and means that the data isn't dirty, just out of date.</p>
Console_init Causes Kernel paniC <p>System Details:</p> <p>OS: Debian/5.0 kernel 2.6.26-2 i686 SMP </p> <p>Hardware: IBM Thinkpad T40 Type 2373 Pentium M 1.5GHz, 512MB RAM</p> <p>Sources: sudo apt-get install linux-source-2.6.18 linux-patch-debian-2.6.18 linux-support-2.6.18-5</p> <p>Toolchain: arm-linux-gcc3.4.cs-...
<p>It appears that QEMU does not emulate the VGA device in its Arm integrator emulation.</p> <p>Check out <a href="http://909ers.apl.washington.edu/~dushaw/ARM/" rel="nofollow">this link</a> for a possible workaround.</p>
What is the equivalent to $? in Windows? <p>Does anybody know what is the equivalent to <strong><code>$?</code></strong> in Windows command line? Is there any?</p> <p><em>EDIT:</em> <code>$?</code> is the UNIX variable which holds the exit code of the last process</p>
<p>You want to check the value of <a href="http://www.robvanderwoude.com/errorlevel.php"><code>%ERRORLEVEL%</code></a>.</p>
How do I specify the selected tab with dijit.layout.TabContainer? <ul> <li>How do you specify the selected tab at startup?</li> <li>How do you programmatically select tabs?</li> </ul>
<p>HTML - Use <strong>selected</strong> attribute.</p> <pre><code>&lt;div id="tabContainer" dojoType="dijit.layout.TabContainer" tabStrip="true" style="width: 100%; height: 20em;"&gt; &lt;div id="tab1" dojoType="dijit.layout.ContentPane" title="Tab 1"&gt;Tab 1&lt;/div&gt; &lt;div id="tab2" dojoType="diji...
CD to directory, where the path is in a file <p>I have a directory path stored in a text file, and I need to CD to that directory in a script but don't know how. I was hoping it would be something like</p> <pre><code>cat FILE | cd </code></pre> <p>but its not that easy.</p> <p>This is a windows environment btw, in u...
<pre><code>set /p dirname=&lt;FILE cd %dirname% </code></pre> <p>The documentation for <code>set</code> (for XP) can be found <a href="http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/set.mspx" rel="nofollow">here</a>.</p> <blockquote> <p><strong>/p</strong> : Sets the value of variabl...
Update timestamp when row is updated in PostgreSQL <p>In MySQL, we can execute this where it updates the column <code>changetimestamp</code> every time the row is changed:</p> <pre><code>create table ab ( id int, changetimestamp timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTA...
<p>Create a function that updates the changetimestamp column of a table like so:</p> <pre><code>CREATE OR REPLACE FUNCTION update_changetimestamp_column() RETURNS TRIGGER AS $$ BEGIN NEW.changetimestamp = now(); RETURN NEW; END; $$ language 'plpgsql'; </code></pre> <p>Create a trigger on the table that calls t...
How do I implement a real time *financial* statistics engine from SQL server data for dashboard display? <p>We currently use excel automation to calculate time series statistics and store the results in our SQL Server 2008 database for easy display/sorting/etc. later.</p> <p>I'm currently redesigning the home screen o...
<p>Server-side, same as you have now with results stored in the database, but replace the Excel automation with CLR procedures/functions, or even vanilla SQL procs for the simple stuff.</p> <p>CLR assemblies written in F# might make a lot of sense.</p> <p>Also, by doing it server-side, when it does need to be real-ti...
Method peaking my processor <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1035765/how-do-i-start-optimising-my-java-code-cpu-is-at-100">How do I start optimising my Java code? - CPU is at 100% </a> </p> </blockquote> <p>I have a method isReset() that's execut...
<p>Nothing wrong with that <code>isReset</code>, but won't this loop just call it over and over and over (and over and over...)?</p> <pre><code> while (true) { for (i=0; i &lt; alg.length; i++) if (execPanel[i].isReset()) { alg[i].terminate(); createProgram(i); alg[i].sta...
Compiling my own PHP extension on Windows with Visual Studio 2008 <p>I wrote a PHP extension and it could be compiled and run under linux successfully. But on windows, I met some problems.</p> <p>I did the compiling on windows according to <a href="http://blog.slickedit.com/?p=128" rel="nofollow">http://blog.slickedit...
<p>Wamp is compiled using VC6 and it requires your module to be compiled with VC6.</p> <p>Reporting Romain Bourdon (author of WampServer) words : Because Apache is compiled with VC6, if you want to run PHP as a module (as in WampServer) you must compile the module with VC6.</p> <p>If you want to compile your module w...
How do you change a div with another div, onmouseover? <p>I have the following code</p> <pre><code>&lt;div class="item" id="item1"&gt;Text Goes Here&lt;/div&gt; &lt;div class="admin_tools" id="tools1"&gt;Link 1 | Link 2 | Link 3&lt;/div&gt; &lt;div class="item" id="item2"&gt;Text Goes Here&lt;/div&gt; &lt;div class="...
<p>I changed a couple of things, but what about something like this? </p> <pre><code> &lt;?xml version='1.0' encoding='UTF-8'?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"&gt; &lt;h...
PHP - PDO SQLite3 Prepared Statements <p>I'm trying to use prepared statements in a PHP script that accesses an SQLite3 database using PDO.</p> <p>The normal version of this query works as expected:</p> <pre><code>$q1 = "SELECT COUNT(*) FROM fruits WHERE name='apple'"; echo $db-&gt;query($q1)-&gt;fetchColumn(); </cod...
<p>I think you don't need additional apostrophes before and after the ? and you should use an array: $s->execute(array("apple"));</p>
Powershell output <p>I'm having a little issue with controlling output in ps. Here's the line of code in question;</p> <pre><code>$result|sort-object cn | format-table -wrap -autosize </code></pre> <p>If I append</p> <pre><code>| out-file $logfile </code></pre> <p>the last column of my output is truncated. Now I...
<p>You can use the -width parameter for the out-file cmdlet. You might try out-file -width 500 so nothing gets truncated.</p>
HTML question: Percentage-sized elements with minimum pixel dimensions <p>I have a page with elements that I want to be dynamically resizeable with the browser window, but I don't want certain elements squishing shorter than certain dimensions. Without Javascript, is there a good way to do this?</p> <p><strong>Edit:<...
<p>min-width and min-height might accomplish this, but I don't believe IE6 supports them.</p>
Can I still develop 32-bit applications using a 64-bit machine? <p>I'm wondering if I can still develop 32-bit apps using a 64-bit machine (64-bit Windows Vista with Visual Studio 2008 SP1)? Because I am planning to buy a laptop with 64-bit Vista. Im asking just to make sure. Thanks!</p>
<p>64-bit Windows runs 32-bit Visual Studio just fine. Unless you specify you wish you use the x64 development tools, it will still compile 32-bit applications.</p> <p>Straight from the page:</p> <blockquote> <p>Visual Studio uses the 32-bit cross compiler even on a Windows 64-bit computer. You can, however, us...
Zend Many to Many Relationship <p>I want to retrieve all the data from 3 tables</p> <p>users , properties and users_properties.</p> <p>So I decided I would use the manytomanyRowset. But to my surprise I get the data from the properties and users_properties table but no data from the users table. Why is that? I need s...
<p>I designed and coded the table-relationships features in Zend Framework.</p> <p>The answer to your question is no, the <code>findManyToManyRowset()</code> method only fetches rows from the related table, it does not merge them into the corresponding Row object. The reason is that a Row object in ZF can <code>save(...
How do you obtain the anchor part of a URL in JavaScript? <p>How to obtain anchor part of URL after <code>#</code> in JavaScript? This is related with <a href="http://stackoverflow.com/questions/1032242/php-question">http://stackoverflow.com/questions/1032242/php-question</a></p>
<p>To get the "anchor part" of the current page, you can use:</p> <pre><code>var hash = window.location.hash; </code></pre> <p>Then, based on your question link, you want to send it to a PHP script. You can do this with a JavaScript redirect like so:</p> <pre><code>window.location = "myscript.php?hash=" + encodeURI...
Doubt using session variable in asp.net(c#) web site Application <p>Actually i am new in asp.net, i am using 5 different session variable in one of my web application. My question: <strong>Is there is any performance differs?</strong> If yes please tell the reason and what should i use instead of session variable becau...
<p>There should be no performance problem unless the objects you are storing are huge or you have to scale to a very large number of users. The ASP.NET session is very efficient. Here's a <a href="http://msdn.microsoft.com/en-us/library/ms998549.aspx" rel="nofollow">decent article</a> on improving ASP.NET performance...
Delphi: TImage.Create causes Access violation <p>I apologize in advance for a newbie question, but why do I get "Access violation" error with the code below (on the "Create(SelectorForm);" line)? I tried using the main form as the owner, but it didn't make any difference.</p> <pre><code>var SelectorForm: TSelectorFo...
<p>The problem is that you are effectively doing this:</p> <pre><code>var imageVariable: TImage; begin imageVariable.Create (ParentForm); end; </code></pre> <p>Which is wrong because "Create" method is being called on the variable which hasn't been assigned yet.</p> <p>You should do this:</p> <pre><code>var i...
Python Web-based Bot <p>I am trying to write a Python-based Web Bot that can read and interpret an HTML page, then execute an onClick function and receive the resulting new HTML page. I can already read the HTML page and I can determine the functions to be called by the onClick command, but I have no idea how to execut...
<p>The only tool in Python for Javascript, that I am aware of is <a href="http://code.google.com/p/python-spidermonkey/" rel="nofollow">python-spidermonkey</a>. I have never used it though.</p> <p>With Jython you could (ab-)use <a href="http://httpunit.sourceforge.net/index.html" rel="nofollow">HttpUnit</a>. </p> <p>...
Split java strings in Rhino <p>I'm trying to split a java string in a Rhino javascript program</p> <pre><code>var s = new java.lang.String("1 2 3"); s.split(); </code></pre> <p>which give me the error</p> <pre> js: Can't find method java.lang.String.split(). </pre> <p>The Rhino docs mentioned that all the javascrip...
<p>Take a look at the Java docs: <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html" rel="nofollow">http://java.sun.com/j2se/1.5.0/docs/api/java/lang/String.html</a></p> <p>Doesn't seem to be a 0 parameter constructor for the split method. You gotta pass it a regular expression.</p> <p>Also, for ...
How to return List from c# and use it in vc++ through com <p>How to return List from c# method and Use the List return values in c++ can u give guidance how to do it??<br> I going like following way my complete scenario:</p> <p>in c# DemoLib.cs</p> <pre><code>usng System;using System.Collections.Generic; public inte...
<p>I did it using the object type of c#</p> <p>C# exported as COM</p> <pre><code>public void GetList(ref object list) { String[] dummy = { "1" }; Array.Resize(ref dummy, 3); list = dummy; } </code></pre> <p>Native C++</p> <pre><code>_variant_t list; GetList(list); const VARTYPE type (static_cast&lt;VARTYPE&gt...
iPhone Download application <p>I want to ask you whether it is simple to download data from URLs engind such as .php etc. or not. Downloading from direct urls, such as this one <a href="http://www.rarlab.com/rar/wrar380.exe" rel="nofollow">http://www.rarlab.com/rar/wrar380.exe</a> is really simple using NSURLConnection...
<p>Server's like download.cnet.com will redirect the user to a mirror closer to them. You have to allow redirects with you NRURLConnection. </p> <p>See <a href="http://developer.apple.com/documentation/Cocoa/Conceptual/URLLoadingSystem/Tasks/UsingNSURLConnection.html#//apple_ref/doc/uid/20001836-160106" rel="nofollo...
iphone general <p>hai, when i see sales and trend report throughitunes connect for my application, it shows fileds like artist ,title . units etc... does units represents no of downloads of my application in particular country? how can i know.how many times my applications have been downloadad?</p>
<p>Important Data are :</p> <ul> <li>Artist / Show = YOU (Developper)</li> <li>Title / Episode / Season = YOUR APP</li> <li>Units = NUMBER OF DOWNLOAD </li> <li>Royalty Price = MONEY YOU'LL GET </li> <li>Country Code = COUNTRY OF APPSTORE USER</li> </ul> <p><img src="http://img155.imageshack.us/img155/5405/image39.pn...
Saving to a subversion repository from Java <p>I want to save to a subversion repository.</p> <p>I am using the command - svn commit -m \"\" ./cms_test/www</p> <p>My class is: </p> <pre><code>public int doBackup(){ int exitVal=-99; try { Runtime rt = Runtime.getRuntime(); Process proc = ...
<p>Why don't you use something like <a href="http://svnkit.com/" rel="nofollow">SVNKit</a>?</p> <blockquote> <p>SVNKit is a pure Java toolkit - it implements all Subversion features and provides APIs to work with Subversion working copies, access and manipulate Subversion repositories - everything within your Java a...
Filter input from keyboard in Textbox, C# <p>I want to filter the keyboard inputs into textbox based on the type of input I allow. e.g.</p> <p>0 for Digits only 1 for Alphabets only 2 for Alphanumerics</p> <p>So if 0 is configured and a character 'a' is pressed on the keyboard, it is not shown in the textbox. How do ...
<p>Not sure I understood your question correctly but you can use <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.maskedtextbox.aspx" rel="nofollow">masked text box</a> for creating many types of input filters.</p>
Asp.net crashing in mscorlib <p>This is related to <a href="http://stackoverflow.com/questions/1023562/asp-net-caching-and-w3p-memory-usage">another question of mine</a></p> <p>After eliminating the obvious (or so I thought) and biggest memory consumer (images in asp.net cache), not much has changed. We use Enterprise...
<p>Problem solved - one of developers was storing whole datatables in session and that ate up the memory (and didn't bother to ask others if it's ok).</p> <p>Only thing that puzzles me is that it has to crash so ugly instead of throwing YouIdiotYoureOverUsingSessionObjectException :)</p> <p>Oh well, live and learn......
Windows 7 logo testing <p>We are using msxml4 as a merge module with our installer. We successfully used it with Windows XP and Vista. However it generates warning in Windows 7 logo tesing. Test case 3, succeeds with a warning "File C:\WINDOWS\SYSWOW64\MSXML4.DLL was written to an incorrect location."</p> <p>any sugge...
<p>Switch to the current version (MSXML6 IIRC). MSXML4 has been deprecated.</p> <p>See <a href="http://support.microsoft.com/kb/269238/" rel="nofollow">MS KB</a> and <a href="http://blogs.msdn.com/xmlteam/archive/2007/09/13/we-are-not-killbit-ing-msxml4.aspx" rel="nofollow">XML Team</a>.</p>
undefined error with ajaxcall to receive json data <p>my problem is that I can not solve this problem</p> <p>If I call the php script, all I get is an undefined error</p> <p>this is the code I use for testing AND</p> <p><a href="http://anantgarg.com/2009/05/13/gmail-facebook-style-jquery-chat/" rel="nofollow">this i...
<p>I recreated with your code and figured it out. The object being returned is of type XMLHttpRequest. Its got a property called responseText holding a json string with the data.</p> <p>so this works..</p> <pre><code>var decodedData = eval("(" + data.responseText + ")"); username = decodedData.usernam...
bing video implementation <p>I just see the <a href="http://www.bing.com/?scope=video" rel="nofollow">bing Video</a> search , it is very good looking,</p> <p>I am planning to make some thing like that,</p> <p>I have different source of video (like Youtube, uploded video etc) </p> <p>I just want to implement the "mo...
<p>This is done through Flash. Each "video" listed is a Flash movie showing a static image, when you move the mouse over it an event handler in the Flash script fires and starts playing a snippet. When it detects a "mouse out" it stops playing the movie.</p> <p>So you'll need to do something similar. A Flash movie tha...
Is it bad to use a Sql Server Scalar UDF in this scenario? <p>I'm trying to generate some sql that is used to calculate some final scores -> think kids at school and their end of year scores.</p> <p>I was going to have about 5 or so Scalar UDF's that, accept some simple values (eg. current score, subjectid, whatever) ...
<p>Sure, no problem - performance will be almost the same as if when you would do it inline at every SELECT. I don't think this should be any problem at all - quite the contrary, putting this into an UDF seems like a really good idea! (to keep your T-SQL code clean and simple).</p> <p>Marc</p>
Any Rails-Migration-like framework suggestions for .NET? <p>The idea of "rails migration" is awesome and I'm going to use this way in my coming new project on .NET platform for db schema version control.</p> <p><a href="http://code.google.com/p/migratordotnet" rel="nofollow">MigratorDotNet</a> seems like something I n...
<p>There's a similar question, which incidentally shows up as one of the top google results (wooo, gogo stackoverflow!) with a nice roundup in the top scoring post:</p> <p><a href="http://stackoverflow.com/questions/313/net-migrations-engine">http://stackoverflow.com/questions/313/net-migrations-engine</a></p>
Php script running as scheduled task hangs - help! <p>I've built a php script that runs from the command line. It opens a connection into a pop3 email account and downloads all the emails and writes them to a database, and deletes them once downloaded. I have this script being called from the commandline by a bat file....
<p>The timeout value can be set using <code>socket_set_timeout()</code> if you're using sockets directly. You can have a look at <a href="http://stackoverflow.com/questions/983746/php-socket-define-the-max-time-to-wait">this other question</a> for details. If you're using a library, you should check its docs. But I wou...
Swing versus SWT <p>What criteria should I use to choose between SWT and Swing? I assume they both provide satisfactory GUI performance and platform availability.</p> <p>My personal criteria currently include:</p> <ul> <li>layouts/layout managers;</li> <li>data binding;</li> <li>pre-built controls;</li> <li>ease of d...
<p>My criteria to choose between SWT and Swing:</p> <ol> <li>quality and availibility of documentation (docs, books, tutorials, snippets) </li> <li>number of custom components (both commercial and free)</li> <li>quality and availibility of development tools like RAD window builder, platform for automate gui testing..e...
Simple Image Metrics with PIL <p>I want to process uploaded photos with PIL and determine some "soft" image metrics like:</p> <ul> <li>is the image contrastful or dull?</li> <li>colorful or monochrome?</li> <li>bright or dark?</li> <li>is the image warm or cold (regarding light temperature)?</li> <li>is there a domina...
<p>I don't think there are methods that give you a metric exactly for what you want, but the methods that it has, like RMS, takes you a long way there. To do things with color, you can split the image into one layer per color, and get the RMS on each layer, which tells you some of the things you want to know. You can a...
Does MSCRM web-service support database transactions? <p>One would assume with any web-based data application that database transactions would be an integral part of the design. Looking around at CrmService, I can't find anything that suggests that transactional 'CRUD's are available. Is it the case that this is not su...
<p>No, there is no database-like transaction support in CRM. About the closest thing would be registering a plugin/callout that runs PreCreate of a record... if something in there fails, the record itself will not be created, but there could still be steps that did succeed before one that failed.</p>
linux: where's the "real" segmentation fault handler? <p>If I read/write/jump to an ummapped address ie.</p> <pre><code>.text .global _start _start: movl $1,%edx jmp *%edx </code></pre> <p>this causes a segmentation fault. </p> <p>I wonder, what's the actual part of the system (kernel) that inter...
<p>Everything flows from the architectures trap table. This is usually called entry.S (split on x86 between entry_32 and entry_64.S) and has assembler linkage that does a number of things (depending on config) before heading into the C code of the kernel proper.</p> <p>So an invalid memory access should enter through ...
MCRYPT in .Net <p>I have a PHP decryption algorithm at one end, and a .Net encryption algorithm at another. I am using <code>mcrypt_decrypt</code> for decrypt purpose in PHP code, and looking for an equivalent of <code>mcrypt_encrypt</code> in .Net. More specifically, the PHP code that I want to convert to .Net is the ...
<p>I have come out with <a href="http://itscommonsensestupid.blogspot.com/2009/06/how-to-encrypt-string-in-net-and.html" rel="nofollow">a solution in my blog</a>. </p> <p>Here is an excerpt :</p> <pre><code> private static string CreateEncryptedString(string myString, string hexiv, string key) { Rijnda...
how to generate pseudo-random positive definite matrix with constraints on the off-diagonal elements? <blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="http://stackoverflow.com/questions/1040324/how-to-generate-pseudo-random-positive-definite-matrix-with-constraints-on-the-of">how to generate pseudo...
<p>There are MANY issues here.</p> <p>First of all, are the pseudo-random deviates assumed to be normally distributed? I'll assume they are, as any discussion of correlation matrices gets nasty if we diverge into non-normal distributions.</p> <p>Next, it is rather simple to generate pseudo-random normal deviates, giv...
IIS redirect rules for static content domains <p>I've written some rules for our static content subdomains so that, when they come into IIS, they are redirected to our www. subdomain.</p> <p>The reason for this is that we have several subdomains being indexed by Google. However, when I create the urls, I am still able...
<p>The question has now been answered.</p> <p>It appears that I was missing the logicalGrouping flag, which was setting my rules to "MatchAll".</p> <pre><code>&lt;rule name="Redirect to WWW" stopProcessing="true"&gt; &lt;match url=".*" /&gt; &lt;conditions logicalGrouping="MatchAny"&gt; &lt;add input="{HTTP_H...
JavaScript animate resizing div <p>I'm trying to put a small animation on a page. I've got 2 divs side by side, the second of which has its content called via Ajax, so the div height varies without page refresh.</p> <pre><code>&lt;div id="number1" style="float:left; padding-bottom:140px"&gt;Static content, 200px or so...
<p>OK, I've just put together a very quick and dirty example.</p> <p>Here's the HTML:</p> <pre><code> &lt;body&gt; &lt;a href="####" id="addContent"&gt;Add content&lt;/a&gt; &lt;div id="outerContainer"&gt; &lt;div id="left" class="col"&gt; &lt;p&gt;Static content&lt;/p&g...
div object flashing repeatedly <p>i tried to create a fade-in/out effect for one of my divs but the fade-in effect on its own was working fine but when coupled with the fade-out effect, it makes the whole div continue to flash in the viewport area. take a look at the code:</p> <pre><code> hover.addEventListener('mous...
<p>You should be using the hover method.</p> <pre><code>$('your item').hover(function(){$("#cpanel").fadeIn("slow")},function(){$("#cpanel").fadeOut("slow");}); </code></pre> <p>The hover method takes two functions - one is activated on mouse in, the other on mouse out.</p> <p>See <a href="http://docs.jquery.com/Eve...
What memcached for Win32 .net api do you use and recomend? <p>What memcached for Win32 .net api do you use and recomend?</p>
<p>We have been using <a href="http://jehiah.cz/projects/memcached-win32/" rel="nofollow">memcached for Win32</a> (v1.2.1) for about a year with no problems.</p>
Mocking problem, public function calling private function <p>I’m having a mocking problem. I know only public methods should be mocked. But what do I do when a private method is called in a public method, and this private method is getting data from a file? I want to mock this private method so I could go on in with ...
<p>If you put the functionality that does the file reading into a class e.g </p> <pre><code>FileReader : IFileReader </code></pre> <p>Then pass in IFileReader as an arg to the constructor. you can then mock that</p>
What is the correct color notation in XAML: #555 or #555555? <p>Doing <strong>CSS</strong> throughout the last couple years, I eventually learned that the standard way to represent a gray color shade (or any color which repeated its first three characters) was to use only three characters instead of six, I assume for t...
<p><strong>Neither notation is truly <em>more correct</em> than the other.</strong> It's largely just a matter of preference.</p> <p>The 3-digit format, or <strong><code>#rgb</code></strong>, is simply a short-hand format that expands to <strong><code>#rrggbb</code></strong>, giving you an option to leave out a few re...
Which Cipher Suites to enable for SSL Socket? <p>I'm using Java's SSLSocket to secure communications between a client and a server program. The server program also serves up HTTPS requests from web browsers.</p> <p>According to "<a href="http://www.wrox.com/WileyCDA/WroxTitle/productCd-0764596330.html">Beginning Crypt...
<p>Below is the Java class I use to enforce cipher suites and protocols. Prior to <code>SSLSocketFactoryEx</code>, I was modifying properties on the <code>SSLSocket</code> when I had access to them. The Java folks on Stack Overflow helped with it, so its nice to be able to post it here.</p> <p><code>SSLSocketFactoryEx...
Logout or signout problem in asp.net c# using Master page and windows authentication <p>I am new in asp.net, My problem is facing logout problem in myappication using master page and window authentication. After i signout from my application if i use browser back button it again goes back to signed page after that i cl...
<p>Easiest way to resolve this problem is to disable the cache of the page.</p> <p><a href="http://www.codeguru.com/csharp/.net/net_debugging/debugging/article.php/c12891" rel="nofollow">This</a> should help you out.</p>
Does DDD support Perl? <p>Can DDD (Data Display Debugger) be used for Perl data structures? </p>
<p>Quoting the <a href="http://www.gnu.org/software/ddd/" rel="nofollow">DDD manual</a>:</p> <blockquote> <p><strong>What is DDD?</strong></p> <p>GNU DDD is a graphical front-end for command-line debuggers such as GDB, DBX, WDB, Ladebug, JDB, XDB, the <strong>Perl debugger</strong>, the bash debugger bash...
Adding Tasks programmatically into the taskList in sharepoint <p>I have Task List on URL, what I want , when the page loads, the Task list should be loaded with all the aggregated tasks of its sub sites.</p> <p>I want to do it in C#</p>
<p>You may not need to develop this yourself as there are out-of-the-box solutions available.</p> <p><strong>Out-of-the-box</strong></p> <p>If you have Office SharePoint Server 2007 (not just WSS 3.0) just add the Content Query Web Part do the page where you'd like to add the aggregated data. Then configure it to dis...
Extract keywords/tags from string using Preg_match_all <p>I have the following code</p> <pre><code>$str = "keyword keyword 'keyword 1 and keyword 2' another 'one more'".'"another keyword" yes,one,two'; preg_match_all('/"[^"]+"|[^"\' ,]+|\'[^\']+\'/', $str, $matches); echo "&lt;pre&gt;"; print_r($matches); echo "&lt;...
<pre><code>preg_match_all('/"([^"]+)"|[^"\' ,]+|\'([^\']+)\'/',$str,$matches); </code></pre> <p>and use <code>$matches[1]</code> and <code>$matches[2]</code>.</p>
Is sub-domain better or sub-folder? <p>I have a classifieds site and I want to know whether creating subdomains or sub-folders is better, as I am in state of confusion.</p> <p>If we need to take sub-domains then what are the benefits which we can get from sub-domains?</p> <p>If we need to take sub-folders then what a...
<p>Search engines will treat subdomains more like separate domains, so it many cases using sub-folders is the way to go, so that you are not spreading yourself to thin.</p> <p>using both is a bad idea, as search engines will try to index both, and one will get flagged as duplicate content. </p> <p>Here's an article f...
Date Filtered Collections without Functions <p>I have an entity similar to the below:</p> <pre><code>public class Entity { public List&lt;DateItem&gt; PastDates { get; set; } public List&lt;DateItem&gt; FutureDates { get; set; } } public class DateItem { public DateTime Date { get; set; } /* * Ot...
<p>I'm not certain, but I don't think the <code>Where</code> string ever gets parsed; it's just pure SQL and gets injected directly into the query. I could be wrong though, so it might be worth looking at something like <a href="http://ayende.com/Blog/archive/2007/04/27/Paged-data--Count-with-NHibernate-The-really-easy...
Parts in pdflatex Table of Contents <p>I have a thesis in which I want to group some chapters together, using the \part command.</p> <p>What I would like is to have the following:</p> <ul> <li>Chapter 1</li> <li>Part I <ul> <li>Chapter 2</li> <li>Chapter 3</li> </ul></li> <li>Part II <ul> <li>Chapter 4</li> <li>Chapt...
<p>The fact that LaTeX does it wrong probably means that something is wrong with the structure of your document: \part is not meant to group chapters, but to devide the document in parts. The difference is that every chapter should be in a part. </p> <p>Try 'introduction' or 'preliminaries' as a name for the part cont...
Bug : Dojo Dialog + Flash in Firefox 3 <p>i have a flash component on a dijit.Dialog.In Firefox 3, i cant click on the flash button.When i right click on the flash i get the tooltip(settings) far away from where i clicked.It's working on all other browsers.</p> <p>I had to update dojo from 1.1 to 1.3 for IE 8 issue.Af...
<p>I gave the class .dijitDialogUnderlay an overflow:auto.</p> <p>Now works fine.</p>
How are different TCP connections in HTTP requests identified? <p>From what I understand, each HTTP request uses its own TCP connection (please correct me if i'm wrong). So, let's say that there are two current connections to the same server. For example, client side javascript code triggering a couple of AJAX POST r...
<p>When your browser creates a new connection to the HTTP server, it uses a different source port. </p> <p>For example, say your browser creates two connections to a server and that your IP address is 60.12.34.56. The first connection might originate from source port 60123 and the second from 60127. This is embedded i...
didSelectRowAtIndexPath not working on sdk 3.0 <p>I was working on an app in SDK 2.x and everything was working fine, but now I have updated my SDK to 3.0 and found:</p> <pre><code>didSelectRowAtIndexPath </code></pre> <p>of tableview is not working.</p> <p>Anyone know why this is happening?</p>
<p>The <a href="http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/TableView%5FiPhone/ManageSelections/ManageSelections.html#//apple%5Fref/doc/uid/TP40007451-CH9" rel="nofollow">Table View Programming Guide</a> says:</p> <p>"You can control whether rows are selectable when the table view...
Retrieving DLL name, not calling application name <p>I've written two COM classes in C++, contained in a single MFC DLL. They're being loaded as plugins by a 3rd party application.</p> <p>How can I get the file name, and version number, of the DLL from within those classes?</p>
<pre><code>TCHAR fileName[MAX_PATH + 1]; GetModuleFileName(hInstance, fileName, MAX_PATH); </code></pre> <p>Where <code>hInstance</code> is the one you get in the <code>DllMain</code> function. Don't use <code>GetModuleHandle(0)</code>, because that returns the <code>HINSTANCE</code> of the host application.</p>
Clicking relative link goes to about:<relative link> which does not show wanted page <p>I am using version 14.67.9 of TembeddedWB in a project in delphi 2007. I use TembeddedWB in combination with loadfromstring. That all works like I want it to but when clicking on a link in the page it goes to a page I am not expecti...
<p>It looks like the browser's current URL is not updated and the default "about:blank" is used. I guess this may happen when you don't navigate to the web site directly by <code>Navigate</code> or <code>Navigate2</code> method but load the HTML from a local file or stream.</p> <p>Edit: I see, you are using LoadFromSt...
Data structure for maintaining tabular data in memory? <p>My scenario is as follows: I have a table of data (handful of fields, less than a hundred rows) that I use extensively in my program. I also need this data to be persistent, so I save it as a CSV and load it on start-up. I choose not to use a database because ev...
<p>Having a "table" in memory that needs lookups, sorting, and arbitrary aggregation really does call out for SQL. You said you tried SQLite, but did you realize that SQLite can use an in-memory-only database?</p> <pre><code>connection = sqlite3.connect(':memory:') </code></pre> <p>Then you can create/drop/query/upd...
MySQL select into outfile /tmp no output <p>I cannot get the following code to generate any output. The MySQL user has "all" grant level, /tmp is writable, the query returns a results set. </p> <pre><code>mysql&gt; SELECT field FROM test_table WHERE condition='test' -&gt; INTO OUTFILE '/tmp/test.csv' -&gt; FIE...
<p>The files generate by the outfile clause are created on the mysql server host. Please make sure you are looking on the mysql server host as it seems you are on the client host which most likely isn't the mysql server host.</p> <p>See <a href="http://dev.mysql.com/doc/refman/5.0/en/select.html" rel="nofollow">http:/...
How to produce documentation for vars only with JSDoc? <p>I have javascript file which contains a lot of global vars that are commented, but JSDoc keeps telling there is "Nothing to document, exiting".</p> <p>Here is a sample:</p> <pre><code>/** * Name of the clients list * @type String * @final */ var CLIENTS_LI...
<p>It looks like you are using my old Perl-based project named JSDoc.pm. I would recommend for you to upgrade to my newer project named JsDoc Toolkit. The syntax of the newer project is mostly a superset of the tags used in the older project, but have a look at the <a href="http://code.google.com/p/jsdoc-toolkit/w/list...
Is there a way to get field => value pairs from a subselect in MySQL? <p>I'm considering how to best implement an Audit Trail in an app, which is backed by MySQL. A few systems access the same database and tables, so I thought triggers would be the best solution.</p> <p>However, I don't want to manually write a trigge...
<pre><code>SELECT CONCAT('id = ', id, ', name = ''', name, ''', another_field = ''', data, '''') FROM NEW </code></pre>
Populating Values For DataGridView from DataBase based on the condition <p>I am creating an application where in I want to display the rows in DataGridView based on the values entered by the user in the textbox.</p> <p>For Eg. If the User enters the BookName in the textbox all the details regarding that book should be...
<p>You're opening yourself up to SQL injection by directly accepting user input, although that's a side issue. Why are you calling <code>objSqlDataAdapter.Update(objDataTable);</code> in this section?</p> <p>Although everything else looks fine I would try 2 things:</p> <ol> <li><p>Remove the <code>objSqlDataAdapter.U...
Dependency Injection with Guice: Something that isn't covered by any tutorial <p>i just tinkered around with <a href="http://code.google.com/p/google-guice/" rel="nofollow">Google Guice</a> for Dependency Injection and started integrating it into my existing application. So far, so good. I have many classes which need,...
<p>It might help to split <strong>dependencies</strong> from <strong>data</strong>.</p> <ul> <li>Dependencies are often services: databases, clocks, and RPC stubs. Plus all of the application code layered on these: <code>UserAuthenticator</code>, <code>PaymentHandler</code>, and <code>EmailGateway</code>.</li> <li>Dat...
Many-to-Many Cascading Delete <p>I have defined a many to many relationship between two classes. Event and Person (defined in a separate database table person_event). Now, suppose I want to delete a person, so all its related associations with events must also get deleted from the person_event table. In other words, ...
<p>I think if you set the Cascade setting to none on the many to many map, you should be able to get what you want.</p> <p>It will only delete entries pertaining to event, but not cascade the delete effect to Person.</p>
Unexpected ArrayStoreException <p>Why does the following code throw <code>ArrayStoreException</code>?</p> <pre><code>double[] a = {2.0,3.4,3.6,2.7,5.6}; int[] b = {2,3,4,5}; System.arraycopy(b,0,a,1,4); </code></pre>
<p>From the docs for <a href="http://java.sun.com/javase/6/docs/api/java/lang/System.html"><code>System.arraycopy</code></a>:</p> <blockquote> <p>Otherwise, if any of the following is true, an ArrayStoreException is thrown and the destination is not modified:</p> <p>[...]</p> <p>The src argument and de...
In Python, how do I easily generate an image file from some source data? <p>I have some some data that I would like to visualize. Each byte of the source data roughly corresponds to a pixel value of the image.</p> <p>What is the easiest way to generate an image file (bitmap?) using Python?</p>
<p>You can create images with a list of pixel values using <a href="http://python-pillow.github.io/">Pillow</a>:</p> <pre><code>from PIL import Image img = Image.new('RGB', (width, height)) img.putdata(my_list) img.save('image.png') </code></pre>
How can I convert an Integer to localized month name in Java? <p>I get an integer and I need to convert to a month names in various locales:</p> <p>Example for locale en-us:<br /> 1 -> January<br /> 2 -> February</p> <p>Example for locale es-mx:<br /> 1 -> Enero<br /> 2 -> Febrero</p>
<pre><code>import java.text.DateFormatSymbols; public String getMonth(int month) { return new DateFormatSymbols().getMonths()[month-1]; } </code></pre>
SQL - Check table for new rows? <p>I have two tables, for example:</p> <pre><code>Table A Table B ======= ======= Name | Color Name | Color ---------------------- ---------------------- Mickey Mouse...
<p>I would use a NOT EXISTS structure.</p> <pre><code>SELECT Name, Color FROM TableA WHERE NOT EXISTS ( SELECT 1 FROM TableB WHERE TableA.Name = TableB.Name AND TableA.Color = TableB.Color) </code></pre>
Datatype conversion in IBM DB2: BIGINT to VARCHAR <p>I'm writing a query to do some stuff. But its not working the way I want it to:</p> <pre><code>select CORR_ID from TABLE1 where CORR_ID not in (select id from TABLE2) </code></pre> <p>The problem is, TABLE2.id is a long, while TABLE1.CORR_ID is a string.</p> <p>So...
<p>Okay, I found a method:</p> <pre><code>select CORR_ID from TABLE1 where CORR_ID not in (select CAST( CAST(id AS CHAR(50)) AS VARCHAR(50) ) from TABLE2) </code></pre> <p>This is pretty intriguing: You can't cast a BIGINT to VARCHAR, but:</p> <ul> <li>you can cast a BIGINT to CHAR</li> <li>and you can cast a CHAR ...
Dynamic Paths in Helper <p>I'm trying to create a helper method for my admin links. In quite a few views I have the code</p> <pre><code>&lt;% if current_user %&gt; &lt;%= link_to "Edit", edit_model_path(model) %&gt; &lt;%= link_to "New", new_model_path %&gt; &lt;%= link_to "Delete", model, :confirm =&gt; "You're a Noo...
<p>basically you need to transform the class name of the model into something pointing to the correct path.</p> <pre><code>model_name = m.class.to_s.underscore </code></pre> <p>And then use it to call the appropriate path methods</p> <pre><code>link_to "edit", send("edit_#{model_name}_path", m) </code></pre> <p>As ...
unit testing a method that returns a non trivial object <p>how would one test a method that returns a complicated object that does not allow access to its fields. Consider this snippet--</p> <pre><code>public ResultState getResultState(){ ResultState resultState = new ResultState(); // logic // this.resultState...
<p>Well, what's important about the result? Presumably it can do <em>something</em> or it would be a useless result. What would differentiate working code from broken code in this case?</p> <p>(I'm not trying to make light of the problem - sometimes it really is very hard to keep tight encapsulation but test effective...
PHP Session Confusion <p>Alright, I'm confused as hell. I have an object that I store in a session. I can add items to this object. Pretty simple so far. I initialize the object like this:</p> <pre><code>$template = new Template($mysqli); $_SESSION['template'] = serialize($template); </code></pre> <p>Now this should ...
<p>I'm not sure if that's the issue, but this is what jumps out when i read your code:</p> <p>Your serialized object relies on a mysql connection </p> <blockquote> <p>$template = new Template($mysqli);</p> </blockquote> <p>while your object (maybe) can be serialized and un-serialized without problems, the mysql co...
Is there a way to detect a click anywhere on a page except for a certain region? <p>Here is my problem, I'm designing a website that allows you to select a certain item from a list by clicking on it using the onClick attribute. I would like to be able to deselect the item by clicking anywhere else on the page. I tried ...
<p><strong>onblur is not going to cut it as this isn't a standard HTML input element.</strong></p> <p>You want to inspect what <code>this</code> refers to when the onclick event is called. If it refers to an item in your list, then you can select the item in the list. If it refers outside of the list, then deselect al...
parentNode.parentNode.rowindex to delete a row in a dynamic table <p>I am creating my rows dynamically when the user clicks on "Ajouter".</p> <pre><code> &lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transition...
<p>Check below url : <a href="http://www.tek-tips.com/viewthread.cfm?qid=1232357&amp;page=1" rel="nofollow">http://www.tek-tips.com/viewthread.cfm?qid=1232357&amp;page=1</a></p>
How to make an item "draggable" using html? <p>Is there a way to just use html to make an item draggable? (not just classifying an element as draggable)</p>
<p>No, you'll need to use javascript.</p> <p><a href="http://jquery.com/" rel="nofollow">jQuery</a> is very popular javascript framework which does a lot of the heavy lifting for you. Here are the <a href="http://docs.jquery.com/UI/Draggable" rel="nofollow">docs</a> for their draggable component.</p>
What is the most appropriate data type for storing an IP address in SQL server? <p>What should be the most recommended datatype for storing an IPv4 address in SQL server?</p> <p><strong>Or maybe someone has already created a user SQL data-type (.Net assembly) for it?</strong></p> <p>I don't need sorting.</p>
<p>Storing an IPv4 address as a <a href="http://msdn.microsoft.com/en-us/library/ms188362.aspx"><code>binary</code></a>(4) is truest to what it represents, and allows for easy subnet mask-style querying. However, it requires conversion in and out if you are actually after a text representation. In that case, you may pr...
Why are escape characters being added to the value of the hidden input <pre><code>&lt;body&gt; &lt;div&gt; &lt;?= $_POST['msg'] ?&gt; &lt;/div&gt; &lt;form id="frm" method="post"&gt; &lt;input type="hidden" name='msg' value='{"field0": "Im a string", "field1": 84, "field3": "so am I"}' /&gt; &lt;input type=...
<p>Check whether your PHP configuration has <a href="http://www.php.net/manual/en/function.get-magic-quotes-gpc.php" rel="nofollow"><code>magic_quotes_gpc</code></a> activated, in such case the PHP server automatically adds slashes to GET/POST/cookie values...</p>
Objective C problem defining properties <p>When I attempt to define an int as a property in Objective C i get an error (not of type object). I have tried using NSInteger and int but neither work.</p> <p>code: int seat;</p> <p>@property (nonatomic, retain) int seats;</p>
<p>You cannot retain an int or a NSInteger as they are primitive types - not objects. Use the following instead:</p> <pre><code>@property (nonatomic, assign) int seats; </code></pre>
How do I redirect multiple actions to a single action while maintaining DRY? <p>I have an <code>OptionsController</code>, which contains an action <code>account</code>. The corresponding view has three forms, which post to three different actions, <code>update_profile</code>, <code>update_user</code> and <code>change_p...
<p>just put the <code>redirect_to</code> call in each of the actions. There is a fine line between DRY and unintelligible magic. I feel like trying to do something like an <code>after_filter</code> or anything else that nonobviously shatters the expected behavior of an action is probably too much magic.</p>
Entry level computing text books <p>I am looking for some good text books in the public domain, which could be used to teach computing to school kids aged (10-15). I couldn't get any googling for it. Can somebody out there point me to good links. If text books are not available any information on what is taught commonl...
<p>"Computing" is an awfully broad topic. Do you mean teaching them how a computer works (like on the inside), or how to use computer applications (word processing/spreadsheet/internet), or how to program them? I think all three would be good topics for 10-15 year olds.</p> <p>My dad, a computer engineer, taught me mu...
What is the relationship between IIS settings HTTP Keep-Alives Enabled and Connection Timeout? <p>What is the relationship between IIS settings <strong>HTTP Keep-Alives Enabled</strong> and <strong>Connection Timeout</strong> ? Is it the same relationship in different versions of IIS? </p> <p>I am using XP Pro (2002 ...
<p>If you disable the Keep-Alives Visual Studio doesn't automatically attach to the browser process to debug web applications.</p> <p>I've found that reducing the Connection Timeout to 65 seconds seems to stop the "Too many people are accessing your website" problem.</p> <p>There's a method outlined here to <a href="...
Authentication programmable login c# <p>I have a test that requires me to uses Authentication to check to see if a user has logged in and authenticated before performing its task.</p> <p>Is it possible for me to set the Authentication from the unit test so as to fool / mock the Authentication in the main application t...
<p>What I would do in this case is have a method that takes an IIdentity instance. You can then use any mocking framework (such as Rhino Mocks) to mock IIdentity in order to ensure that the "user" is logged in or not logged in.</p> <pre><code>public void DoSomething(IIdentity identity) { if(identity.IsAuthenticat...
Implementing a fully-functional prototype for a web-based application <p>I am building a prototype for a web-based application and was considering building the front-end in HTML, which can then be reused later for the actual application. I had done a Flash-based prototype earlier, which embedded the .swf into a C# exec...
<p>Some of the best programming advice I've seen came from <a href="http://www.cc2e.com/" rel="nofollow">Code Complete</a>, and was along the lines of, "evolutionary prototypes are fine things, and throwaway prototypes are fine things, but you run into trouble when you try to make one from the other." That is, know wh...
How can I decrypt a file encrypted in Perl using Crypt::CBC (Blowfish) in C? <p>I have a small encryption tool in Perl which uses the <a href="http://search.cpan.org/perldoc?Crypt::CBC" rel="nofollow">Crypt::CBC</a> and Blowfish to encrypt files.</p> <p>I want to write the decryption algorithm in C or C++ ... Please s...
<p>Blowfish source code is available <a href="http://www.schneier.com/blowfish-download.html" rel="nofollow">here</a>. Note that since blowfish is a symmetric encryption system, encryption and decryption are the same operation.</p>
How do I browse a Websphere MQ message without removing it? <p>I'm writing a .NET Windows Forms application that will post a message to a Websphere MQ queue and then poll a different queue for a response. If a response is returned, the application will partially process the response in real time. But the response needs...
<p>You need to open the queue with MQOO_BROWSE option. Then on your first read you do a GET using the MQGMO_BROWSE_FIRST option. Finally, your subsequent GET's should use the MQGMO_BROWSE_NEXT option.</p> <p>Note: MQOO is MQ open options and MQGMO is MQ Get Message Options.</p>
how to pass an object from a windowSWF to JSFL? <p>I'm working with an fla, an as file(document class), and a jsfl file. the swf is generated in the WindowSWF folder (e.g. $flash/WindowSWF)</p> <p>I have a simple windowSWF and I'm using MMExecute and fl.runScript to pass variables from as3 to jsfl. I didn't imagine I ...
<p>I'm passing objects from a Data Grid to JSFL. The objects have the following properties: <em>key</em>, <em>replacement</em> and <em>type</em>. Here is the function I've used to construct a string I could pass in JSFL from actionscript:</p> <pre><code>private function dataProviderToString(dataProvider:DataProvider):...
Get random number that does/doesn't match criteria (PHP) <p>Using PHP (other languages, using common built-ins are welcome), how can I get a random (or pseudo-random) number that does NOT match a certain criteria?</p> <p>IE: I want <code>$x = rand(0, 99)</code> but only if <code>($x % 9) != 0</code>. </p> <p>What is ...
<p>Is that your exact usage case, or just an example?</p> <p>If you're trying (in particular) to get numbers from 0 to 99 excluding exact multiples of 9, I can think of a couple of ways to avoid the awkward looping. People don't like to loop while generating random numbers because you could loop forever. (But of cours...
What is the function of the "With" keyword <p>Given the code below, what does the "with" keyword do? I'm not very familiar with it, and I'm not sure of its purpose.</p> <pre><code>Sub NotePage_Load() With Request.Form </code></pre> <p>Thanks Kevin</p>
<p>It's a shorthand... everything within the With..End With block will be treated as if something is appended in front of it.</p> <p>Ex:</p> <pre><code>With Request.Form ["xxx"] = "yyy" ["aaa"] = "bbb" End With </code></pre> <p>is equal to the following:</p> <pre><code>Request.Form["xxx"] = "yyy" Request.Form["...
asp.net: send an object's event from a UserControl to its Parent <p>I have a <strong>User</strong> class with functions to <strong>Login()</strong> and <strong>Logout()</strong> and <strong>GetData()</strong>. There's a <strong><em>UserChanged</em></strong> event, it fires when either of these functions are called.</p>...
<p><strong>Login.ascx.cs</strong></p> <pre><code>public delegate void OnUserChangedHandler(object sender); public OnUserChangedHandler OnUserChanged; private void RaiseUserChangedEvent() //Call this method when the user changes { //UserChanged Event if (OnUserChanged != null) { OnUserChanged(this)...
FBA based SharePoint Application Backup restore <p>Has anyone tried to back up a SharePoint web application using forms based authentication (FBA) to another SharePoint server?</p> <p>We are facing some issues in backup\restore of FBA based sharepoint web applications:</p> <ol> <li>We have a server where we have crea...
<p>I have managed to successfully backup and restore both the database and SharePoint web application for an FBA-enabled SharePoint application.</p> <p>The steps you've listed seem correct to me but are you sure that you've completed them correctly?</p> <p>Particularly step 5: you need to ensure that you've correctly...
What's the best way of creation of thousands of controls in scrollable area using WPF <p>I'm using WPF and C#.</p> <p>I have a problem. I need to create a lot of bindable templated controls in scrollable area (they are all of different types). For example 1000 textboxes, 1000 drop down lists, and 1000 checkboxes. </p>...
<p>The fact that you want ~3000 controls on a single screen is a problem and it is usually a sign that you are approaching you GUI from the wrong angle. I am not very experienced with WPF, but my WinForms knowledge tells me that 1000+ control instances is just asking for trouble. This is what ListBoxes, DataGrids, and ...
What are FTL files <p>I am new to a project and have to learn it inside out. I see a lot of files with the extension <code>.ftl</code> in them. I'n not sure what they are. I know they can be modified and the user sees changes in the front end </p>
<p>Freemarker template files I believe.</p> <p><a href="http://freemarker.org/">http://freemarker.org/</a></p>
Scribd API - is this possible? <p>Scribd API: <a href="http://www.scribd.com/developers" rel="nofollow">http://www.scribd.com/developers</a></p> <p>For those of you that are aware of Scribd, used it or can take a look at the API above.</p> <p>Can anyone tell me if it is possible to upload documents from my site stra...
<p>If I understand correctly, you want users to upload a file, and then upload it directly to scribd without ever storing on your server.</p> <p>If this is the case, it should be possible to handle it similar to a php file upload, except simply pass the file along to scribd rather than storing it.</p> <p>After upload...
How to insert values into C# Dictionary on instantiation? <p>Does anyone know if there is a way I can insert values into a C# Dictionary when I create it? I can, but don't want to, do <code>dict.Add(int, "string")</code> for each item if there is something more efficient like: </p> <pre><code>Dictionary&lt;int, strin...
<p>There's whole page about how to do that here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/bb531208.aspx">http://msdn.microsoft.com/en-us/library/bb531208.aspx</a></p> <p>Example:</p> <blockquote> <p>In the following code example, a <code>Dictionary&lt;TKey, TValue&gt;</code> is initialized with in...
Is it possible to remove some post data with an HttpModule? <p>I'm converting an old classic asp website to asp.net. </p> <p>The application is basically an extension of a tool set for a given set of users but it is hosted at an external vendor. </p> <p>To perform a seamless transfer to this application it POSTS some...
<p>Yes. The following class implements the IHttpModule Interface and registers and event that will fire before the HttpRequestValidationException check occurs. It checks that the request is a POST and that "testinput" is not null and then HTML Encodes it. The Class needs to be registered in your Web.config as an htt...
Why can't I roll a loop in Javascript? <p>I am working on a web page that uses dojo and has a number (6 in my test case, but variable in general) of project widgets on it. I'm invoking dojo.addOnLoad(init), and in my init() function I have these lines:</p> <pre><code>dojo.connect(dijit.byId("project" + 0).InputNode, ...
<p>this is a common problem when dealing with closures. try this:</p> <pre><code>for (var i = 0; i &lt; 6; i++) { (function(i){ dojo.connect(dijit.byId("project" + i).InputNode, "onChange", function() {makeMatch(i);}); }(i)); } </code></pre>