input
stringlengths
51
42.3k
output
stringlengths
18
55k
How to add data to two tables linked via a foreign key? <p>If I were to have 2 tables, call them TableA and TableB. TableB contains a foreign key which refers to TableA. I now need to add data to both TableA and TableB for a given scenario. To do this I first have to insert data in TableA then find and retrieve TableA'...
<p>That sounds about right. Note that you can use <code>SCOPE_IDENTITY()</code> on a per-row basis, or you can do set-based operations if you use the INSERT/OUTPUT syntax, and then join the the set of output from the first insert - for example, here we only have 1 INSERT (each) into the "real" tables:</p> <pre><code>/...
Can log4net count how many error traces have been logged? <p>For a C# regression test simulation of some hardware we're using log4net to trace the execution of the simulation. Errors are logged every time something goes wrong, and there should be zero errors, of course. We use the error count to determine pass/fail o...
<p>I would log directly to a database or create a routine to import the log files into a database. Once the logs are in a database table they can be easily queried with SQL.</p>
Do you know which library Firefox 3 uses for the "download completed" info? <p>It's the window that shows up when you set showAlertOnComplete = true.</p> <pre><code>about:config browser.download.manager.showAlertOnComplete = true </code></pre> <p>I want to add notification messages in my applications and I need to fi...
<p>There are a few ways of doing notifications. In terms of open source libraries, there are a number of system-wide notification schemes, such as <a href="http://www.fullphat.net/index.php" rel="nofollow">Snarl</a> (Windows), <a href="http://growl.info/" rel="nofollow">Growl</a> (Mac) or <a href="http://www.mumbles-pr...
iPhone 3.0 Compass: how to get a heading? <p>I'm relatively new to Objective-C and really don't know much about it yet, so I apologise for what is probably a really amateurish question.</p> <p>I'm trying to get the magnetic heading from CLHeading and CLLocationDirection. However I'm getting compile errors for this li...
<p>Here are the steps needed to use the compass.</p> <p>1) check the availability: if the <code>headingAvailable</code> property of the location manager is YES, then you can use the compass.</p> <p>2) use the location manager method <code>-(void) startUpdatingHeading</code> to begin receiving the information you are...
How to stop thinking "relationally" <p>At work, we recently started a project using CouchDB (a document-oriented database). I've been having a hard time un-learning all of my relational db knowledge.</p> <p>I was wondering how some of you overcame this obstacle? How did you stop thinking relationally and start think...
<p>I think, after perusing about on a couple of pages on this subject, it all depends upon the types of data you are dealing with.</p> <p>RDBMSes represent a top-down approach, where you, the database designer, assert the structure of all data that will exist in the database. You define that a Person has a First,Last...
Comboxbox Selected Value In XAML <p>How to set the selectedvalue for combobox. For example I have some values from 1-10 and I want to select the 5th value.</p> <p>I tried using <code>SelectedValue</code> and <code>SelectedItem</code>, but its not working for me.</p>
<p>SelectedIndex should work.</p>
.Net browser screen capture utility <p>I am looking for a good .NET based screen capture utility. It would need be able to capture secure pages (https). It would be preferable it would capture Flash/ActiveX.</p>
<p>If are looking to do this from code then you can use the Graphics.CopyFromScreen method as described here: <a href="http://stackoverflow.com/questions/922546/c-screen-capture-virtual-desktop">here</a></p>
Are static functions isolated in JSP/Grails applications under tomcat? <p>I'm using some legacy java code that consists of several static classes from with in a Grails app under tomcat. When I only have one user using the web application everything works fine. When two users use the application things start to go wrong...
<p>No there isn't away to map static methods to http sessions in tomcat or any other application server. Having said that static methods are only a problem if they are holding state statically.</p> <p>If this is the case then you will either need to rewrite those classes such that you can hold instances in the Session...
How to login without leaving RP by showing the OP login window in iframe? <p>How to login without leaving RP by showing the OP login window in iframe ?</p> <p>I am using Openid Provider for the login in my Website.</p> <p>how to implement the login window inside the iframe.</p>
<p>Using an iframe is <em>hugely</em> frowned upon, since the user will be entering their credentials on a page that <em>looks</em> like it is your RP but is supposedly their OP instead. It teaches users to be phished.</p> <p>If you're going to use an iframe anyway, very little special work has to be done. There are...
Javascript -- Unix Time to Specific Time Zone <p>I'm working with a service that gives me broadcast times for Television shows in Unix Time (seconds since midnight, January 1st, 1970, in Greenwich, England). I need to convert this, in javascript, to Eastern Standard time (USA). I need to account for daylight savings ti...
<p>What you'll find is it's not possible to translate to a specific timezone, but as long as your users are in the desired timezone, this will work:</p> <pre><code>var date = new Date(); date.setTime(unixTime * 1000); </code></pre> <p>The resulting date object will display in the timezone of the computer running the ...
What is the simplest way to get all the parents of a record using the id / parent_id model in mysql/php? <p>I'm looking for the simplest way to recursively get all the parent elements from a database using the adjacency list / single table inheritance model (<code>id, parent_id</code>).</p> <p>My select currently look...
<p>It's possible to do it in <code>MySQL</code>, but you'll need to create a function and use in in a query.</p> <p>See this entry in my blog for detailed explanations:</p> <ul> <li><a href="http://explainextended.com/2009/03/17/hierarchical-queries-in-mysql/" rel="nofollow"><strong>Hierarchical queries in <code>MySQ...
How I can use MVVM with CRUD operations? <p>I'm trying to understand the basic MVVM design approach, but I dont' understand where is the best tips for work with CRUD operations.</p> <p>a. Create a ViewModel with abstract of properties and in this ViewModel implement CRUD methods?</p> <p>b. Create ViewModels base and ...
<p>With MVVM, all business logic and interaction with a data source should occur in the model.<br /> Your ViewModel will expose the data and functionality that the View requires. </p> <p>So if for example you had a button on your view that removed an item from the database, the button would bind to an ICommand instan...
In C#, are Lambda Expressions objects? <p>In C#, are lambda expressions objects? If so, what sort of object are they?</p>
<p>Lambda expressions themselves only exist in source code. They don't have a type themselves, which is why the compiler always insists they're convert to a specific type.</p> <p>That's why this code doesn't compile:</p> <pre><code>// No idea what type to convert to! object x = y =&gt; y.Length; </code></pre> <p>But...
ColdFusion: How to check if a certain element exists in a 2-dimensional array? <p>I have an 2 dimensional array. I write 3 values into the array during its initialization and i add a fourth value if an array value is not equal with a value passed through a form. Then i want to check, if the fourth value exists.</p> <p...
<p>I believe you just need to check the array length like so:</p> <pre><code>&lt;cfif ArrayLen(matarray[i]) gte 4&gt; ,status = 'true' &lt;/cfif&gt; </code></pre>
Silverlight - Examples of awesome demo applications NEEDED! <p>At company I'm working, new project will be started soon. I'd like to use Silverlight 2.0 but I need to convince my CEO and Photoshop/AfterEffects guy for using Silverligt for upcoming project. These persons are - let's say - rather Flash / Apple oriented, ...
<p>I find that folks really like <a href="http://quince.infragistics.com/#/Main" rel="nofollow">Quince</a>:</p> <p><img src="http://files.sparklingclient.com/quince.png" alt="Quince Silverlight Application" /></p> <p>One of my favorites is <a href="http://www.microsoft.com/france/entreprises/centre-des-usages/" rel="...
Embeddable messaging component for Java web application <p>In order to satisfy customer requirements, we will need to let users exchange information among each other. The '<strong>messaging system</strong>' does not have sophisticated back-end requirements and could be easily implemented with a few tables to store mess...
<p>If you are looking for opensource java email clients: </p> <p><a href="http://java-source.net/open-source/mail-clients" rel="nofollow">http://java-source.net/open-source/mail-clients</a></p> <p>You may also want to have a look at <strong>Google Wave</strong> . With this you will have next generation communication ...
#import using angle brackets < > and quote marks " " <p>I'm wondering what decides whether you're allowed to use <code>&lt;Header.h&gt;</code> or <code>"Header.h"</code> when you're importing files in Objective-C. So far my observation has been that you use the quote marks <code>""</code> for files in your project that...
<p>Objective-C has this in common with C/C++; the quoted form is for "local" includes of files (you need to specify the relative path from the current file, e.g. <code>#include "headers/my_header.h"</code>), while the angle-bracket form is for "global" includes -- those found somewhere on the include path passed to the...
Display same file successive pages on Emacs split screen <p>I've done this before, years ago, so I know the answer is out there. However the google-space is heavily polluted with namespace collisions, especially new user guides.</p> <p>This is what I'd like to do in Emacs 21:</p> <p>Split the screen on a given file b...
<p>You might be looking for follow-mode</p> <p>It is minor mode that combines windows into one tall virtual window. </p>
'#' character before EL expression used inside a JSTL tag behaves strangely <p>I have the following code to set a userId variable:</p> <p>(userId set in prior code)</p> <pre><code>&lt;c:set var="userId" value="(Cust#${userId})" /&gt; </code></pre> <p>Which produces the following string: (Cust#${userId})</p> <p>The ...
<p>Since JSF would use:</p> <pre><code>#{userId} </code></pre> <p>To return a user Id, I would venture to guess that this is either a bug or expected behavior caused by the # sign making the parser unhappy. Just use either of:</p> <pre><code>&lt;c:set var="userId" value="(Cust&amp;#35;${userId})" /&gt; &lt;c:set va...
Unhandled exceptions in BackgroundWorker <p>I have a small WinForms app that utilizes a BackgroundWorker object to perform a long-running operation.</p> <p>The background operation throws occasional exceptions, typically when somebody has a file open that is being recreated.</p> <p>Regardless of whether the code is r...
<p>What you're describing is not the defined behavior of BackgroundWorker. You're doing something wrong, I suspect.</p> <p>Here's a little sample that proves BackgroundWorker eats exceptions in <strong>DoWork</strong>, and makes them available to you in <strong>RunWorkerCompleted</strong>:</p> <pre><code>var worker =...
Difference between an LL and Recursive Descent parser? <p>I've recently being trying to teach myself how parsers (for languages/context-free grammars) work, and most of it seems to be making sense, except for one thing. I'm focusing my attention in particular on <em>LL(k) grammars</em>, for which the two main algorithm...
<p>LL is usually a more efficient parsing technique than recursive-descent. In fact, a naive recursive-descent parser will actually be <em>O(k^n)</em> (where <em>n</em> is the input size) in the worst case. Some techniques such as memoization (which yields a <a href="http://en.wikipedia.org/wiki/Packrat%5Fparsing#Imp...
A good video to explain version control? <p>Does anyone know where I can find a good video to explain version control to someone (mainly subversion)?</p> <p>One that explains it in the simplest terms (like for someone who has never heard of version control before).</p> <p>(not for me, its for a fellow coder)</p>
<p>only when I saw this 2 tutorials I finally knew what and how version control worked ...</p> <blockquote> <p><a href="http://betterexplained.com/articles/a-visual-guide-to-version-control/">A Visual Guide to Version Control</a></p> </blockquote> <p>and</p> <blockquote> <p><a href="http://betterexplained.com/ar...
Get list of changed fields in Entity from NHibernate Session <p>I want to track changes in my domain model. I know that NHibernate ISession is an inmplementation of UnitOfWork pattern, so it tracks this changes. Is there any way to pull out them, for example, before Commit() or Flush()?</p>
<p>Take a look at NHibernate's IInterceptor.</p> <p>OnFlushDirty - will show you persisted properties on an updated object.</p> <p>OnSave - will shows you persisted properties on a saved object.</p> <p>You just need to create an interceptor class that implements this interface, and when you configure your NHibernate...
Is there a file-based equivalent to .htaccess in IIS6? (not config/plugin) <p>There are lots of <em>similar</em> questions to this, but they all seem to involve either configuring permissions or installing a plugin.</p> <p>I'm looking for a solution that is "dumb" - i.e. to allow the code to be deployed from source co...
<p>You could create a script that would do this when you cycle through your deployment, like say a scheduled task where you use a PowerShell script or batch script that sets up the enviroment. </p> <p>With IIS6 this is going to require mucking with the Metabase, which could solve your problem, but it will require scri...
jQuery not updating div <p>I have an element like this:</p> <pre><code>&lt;div id="foo_&lt;?php echo $id;?&gt;" class="hidden"&gt;&lt;/div&gt; </code></pre> <p>I'm trying</p> <pre><code>if ($("#foo_ " + id).is(':hidden')) { //stuff $("#foo_ " + id).html(html).slideDown('fast'); } </code></pre> <p>I've check...
<p>The space in your selector:</p> <pre><code>if ($("#foo_ " + id).is(':hidden')) { //stuff $("#foo_ " + id).html(html).slideDown('fast'); } </code></pre> <p>Get rid of it:</p> <pre><code>if ($("#foo_" + id).is(':hidden')) { //stuff $("#foo_" + id).html(html).slideDown('fast'); } </code></pre> <p>Pr...
Open/close a winform application from ASP.NET <p>Is there a way to open/close (i.e. start-up/shut-down) a winform application via ASP.NET? I'm sure this reeks of a security violation, but the application of this technique (if it's even possible) would be in a controlled environment. </p> <p>I assume extra permission...
<p>You're asking about how to do this on the client? I don't think there's any way to start a program using JavaScript.</p> <p>The best (worst?) you could do would be to use an ActiveX control. Otherwise, you should look into SilverLight.</p>
Getting the width/height of the entire browser in IE? <p>Does anybody here know what the Javascript call is to get the width/height of the entire browser window (including nav, menu, etc?)</p> <p>I know there is <code>outerWidth</code>, <code>outerHeight</code> in FF, Safari and other browsers.</p>
<p>This also could be helpful, depending on what exactly you're trying to accomplish:</p> <p>window.moveTo(0,0); window.resizeTo(screen.width,screen.height); var navButtonsEtcHeight = screen.height - window.innerHeight; var navButtonsEtcWidth = screen.width - window.innerWidth;</p> <p>Note: For browser-independent so...
BanBuilder Banned-Word List Generator - Would You Use It? <p>From <a href="http://banbuilder.com/" rel="nofollow">http://banbuilder.com/</a>:</p> <blockquote> <p>Why BanBuilder?</p> <p>BanBuilder is designed to allow you to customize your banned-words list, and is constantly evolving. As people find new w...
<p>I don't think it's very useful.</p> <p>Perhaps for a kiddie site where people feel this is super important.</p> <p>Still, plenty of offensive things can be said without using foul language which means that ultimately this is an exercise in futility if you ask me.</p> <p>I much prefer the trend that's evolving for...
multiple dynamically generated checkboxes in PHP/MySQL <p>I have a series of check boxes that are coming out of one MySQL table:</p> <pre><code>&lt;?php $result = mysql_query("SELECT * FROM strategies"); if (!$result) { die("Database query failed: " . mysql_error()); } while($row = mysql_fetch_array($r...
<p>Try this:</p> <pre><code> $query ="INSERT INTO sslink (study_id, strategyname) VALUES ('".$_GET['id']. "', '" .$strategy. "')"; </code></pre>
CruiseControl Failed Build Recovery <p>Cruiscontrol sometimes can't connect to the repository and build fails. Is there a way that I can have cruisecontrol try to build again automatically when something like this happens????? In other words, I want cruisecontrol to keep building when it fails until build is successful...
<p>The Java version or .NET?</p> <p>If the Java version use <a href="http://cruisecontrol.sourceforge.net/main/configxml.html#project" rel="nofollow">buildafterfailed=true</a>.</p>
Stacking and delaying multiple UI change notifications <p>Did anyone handle such scenario in the code?</p> <p>User is typing something in the input area (say, rich text box). This causes multiple TextChanged events to fire. We want to capture only last changed event when user stops typing (i.e.: no changed events for ...
<p>Make a <code>Timer</code> with an interval of five (or whatever) seconds, and, in your <code>TextChanged</code> event, stop the timer and start it again. Then, move your handler code to the timer's <code>Tick</code> event.</p>
NSInvalidArgumentException/copyWithZone exception with NSMutableDictionary <p>I have a class that I'm encapsulating ABRecordID with and when it's used as a key to add to an NSMutableDictionary, I get the run-time exception:</p> <blockquote> <p>"NSInvalidArgumentException: *** -[MyRecordId copyWithZone:]: unrecogni...
<p>Use NSNumber to store the ABRecordID in an Obj-C class:</p> <pre><code>[dict setObject:@"hello" forKey:[NSNumber numberWithInt:recordId]]; </code></pre> <p>to obtain the recordId again, do:</p> <pre><code>recordId = [[dict objectForKey:@"hello"] intValue]; </code></pre>
Process on linux ignoring resource limits <p>I had asked some questions about developing an online judge sometime ago on stackoverflow and I found quite a few good answers to that. I've started working on developing one and I seem to have run into a major flaw in my code.</p> <p>The user submitted source will be compi...
<p>On linux, specifically, a user could do what you say. But linux will send sigkill to the process if the hard limit is reached(as opposed to the soft limit you've set), and that will terminate the process.</p> <p>(Remember though, you really really need to run your stuff in a chrooted environment)</p>
Upgrade an existing application to include ClickOnce <p>Is it possible to introduce ClickOnce functionality to an existing application?</p> <p>The scenario is: Version 1.0 is already installed on client premises. I would like to send them a new setup package which will upgrade to 1.1, which has ClickOnce functionality...
<p>No, it is not possible with a standard ClickOnce deployment scenario.</p> <p>ClickOnce is a sandboxed installation on the client side. It will not know about version 1.0 that's already installed. It is simply going to check to see whether its <a href="http://en.wikipedia.org/wiki/Globally_unique_identifier" rel="no...
Strange Blackberry Issue - New Build Suddenly Requesting Permission Access <p>During development testing of my app I'm running into a strange issue where new builds (Build 2.0) of the exact same code base suddenly default permissions (carrier internet, gps) to be Prompt rather than Allow on install.</p> <p><strong>Det...
<p>Is it possible you did something on your device between 1.0 and 2.0 that would cause this, such as turning on your firewall?</p> <p>As far as I know, there isn't anything you can do at build, download, or install time to set or query the permissions for an app. You need to wait until it actually runs before you ha...
Contents Folder Convention in MVC <p>I am wondering what the history behind the convention for a /contents folder in ASP.NET MVC project is; where it originates; and the reasoning behind it.</p> <p>Our team is considering to move our /images and /styles out of /contents to decrease the folder levels in the project. It...
<p>it is an effort from the Frameworks side to organize your files and it is the "Convention over Configuration" way which most of the MVC frameworks follow so if you follow this convention it will be easy to develop libraries and plugins which can make use of this convention</p> <p>for.ex. you can build an HtmlHelper...
How to split flv file by size using FFmpeg or mencoder or smth else? <p>I need to split an flv file into chunks of the known size on linux server. For example my original file is 9Mb and the chunk size is 4Mb. So I should get 3 parts - 4Mb, 4Mb and 1 Mb.</p> <p>Seems that FFmpeg can split only by time.</p> <p>Mencode...
<p>There is a commandline utility which does just that: <a href="http://mpgtx.sourceforge.net/" rel="nofollow">http://mpgtx.sourceforge.net/</a> </p> <pre><code>mpgtx -3 movie.mpg -b mysplit </code></pre> <p>will split the movie into 3 chunks with the names mysplit-1.mpg, mysplit-2.mpg, mysplit-3.mpg</p> <p>That sai...
How to use HTML anchors as a table of contents in email when rendered in clients like Groupwise or Gmail? <p>I would like to put a table of contents at the top of an internal <strong>email</strong> newsletter that will allow readers to 'jump' down to the part of the newsletter that interests them. Something like:</p> ...
<p>Try adding the 'name' attribute to the anchor as well as the 'id'.</p> <pre><code>&lt;a id="FUNDING" name="FUNDING"&gt; </code></pre>
Google App Engine -- How fast is it <p>I have been visiting some sites hosted on GAE and I found them to be very slow. Pretty much all of them take longer than usual to load.</p> <p>Time: (in seconds) [ YSlow ]</p> <pre><code>9.9 giftag.com 3.1 hotskills.net 1.9 jeeyo.net 1.5 appspot.com </code></pre> <p>Is it tha...
<p>You're using the YSlow plugin to measure this, and YSlow tells you why the site is slow (the cunning name is the clue). For example, in the case of gifttag.com, YSlow reports that:</p> <blockquote> <p>This page has 9 external Javascript scripts. Try combining them into one. This page has 3 external stylesheet...
How to set TCP_NODELAY on BSD socket on Solaris? <p>I am trying to turn off Nagle's algorithm for a BSD socket using:</p> <pre><code>setsockopt(newSock, IPPROTO_TCP, TCP_NODELAY, (char*)&amp;flag, sizeof flag); </code></pre> <p>but the compiler claims <code>TCP_NODELAY</code> hasn't been seen before:</p> <pre><code>...
<p>Looks like you are missing <code>#include &lt;netinet/tcp.h&gt;</code> - that's where <code>TCP_...</code> defines live.</p>
.NET Session not working <p>This is a weird one, but hopefully someone can give me an idea here. I'm putting a few values into session in the <code>Session_Start</code> of the <code>Global.asax</code> in my app. Immediately after the <code>Session_Start</code> my base page's <code>OnInit</code> gets called and tries to...
<p>BREAKPOINTS!</p> <p>I had breakpoints set in the constructor methods of the base page, and the main page, as well as the Session_Start and the OnInit. A coworker deleted all breakpoints in the debugger and the problem dissappeared!</p> <p>Ugh!</p>
How does browser search tool work on web page? <p>I am trying to figure out how the search tool in a web browser is being able to parse through the entire web page(assuming huge content on a page) and highlight the result as we type. Does it pre-cache the page while loading in a map or use regex to get a quick result o...
<p>The document is already parsed, by the browser. Searching that document could walk the DOM tree, decide what nodes that could be searched, and inject document nodes to alter the display(such as making the text bold etc).</p> <p>A standard string matching algorithms can parse through a really huge chunk of text in a...
Why are the arguments to atan2 Y,X rather than X,Y? <p>In C the atan2 function has the following signature:</p> <pre><code>double atan2( double y, double x ); </code></pre> <p>Other languages do this as well. This is the only function I know of that takes its arguments in Y,X order rather than X,Y order, and it scre...
<p>Because I believe it is related to arctan(y/x), so y appears on top.</p> <p>Here's a nice link talking about it a bit: <a href="http://wiki.tcl.tk/10814" rel="nofollow">Angles and Directions</a></p>
Providing serialization services in a base class that can be used in derived classes <p>I've implemented a data access library that allows devs to mark up their derived classes with attributes to have them mapped directly to stored procedures. So far, so good. Now I'd like to provide a Serialize() method or override To...
<h3>XML Serialization using XmlSerializer</h3> <p>In the first instance, I would look at the <a href="http://msdn.microsoft.com/en-us/library/system.xml.serialization.aspx" rel="nofollow">XML Serialization</a> in the .NET Framework that supports serialization of objects to and from XML using an <a href="http://msdn.mi...
Control Hardware (TFT Display, Monitor) with .NET / C# <p>I know, I am propably way out of line here :-)</p> <p>I want to control my Display from within a .NET application. Background is simple: There is a really nice Tablet which should become my little helper. For this reason, it will be always on. But the display c...
<p>See <a href="http://fci-h.blogspot.com/2007/03/turn-off-your-monitor-via-code-c.html" rel="nofollow">Turn off your monitor via code (C#)</a>. That's pretty thorough, but turning it on from a WinForms app boils down to:</p> <pre><code>SendMessage(this.Handle.ToInt32(), WM_SYSCOMMAND, SC_MONITORPOWER, –1); </code>...
Dimensional Modeling: should a fact table have a foreign key? <p>Can a <a href="http://en.wikipedia.org/wiki/Fact%5Ftable" rel="nofollow">fact table</a> have no keys at all? or if it can, is it a good design? If a fact table do not have any dimensions, on what basis is it analyzed?</p> <p>What if a fact table has pr...
<p>Speaking inexactly, the foreign keys link you to the tables that break your fact table into categories and sub-categories.</p> <p>So if the fact table was </p> <pre><code>create table stores (id, kindOfStore, sales) </code></pre> <p>Then the kindOfStore would be your dimension- if that was it, then you could arg...
Dealing with Firefox and Internet Explorer's Differences <p>This question is because I just found out that my site is looking ok in IE7 and in IE8 with compatibility-mode, but in FF it is all screwed up.</p> <p>What would be the best way to go about it.</p> <p>Separate CSS files?</p> <p>Thanks, Richard</p>
<p>If your layouts are radically different, the best solution would be to go back and re-think your Layout/CSS. In all honesty, I have never needed two styles sheets - one for FF, and another for IE. </p> <p>One very helpful tool is a "reset stylesheet", like <a href="http://meyerweb.com/eric/tools/css/">the one Eric ...
How to use jqGrid with C#/ASP.NET and JSON.NET (and no AJAX.NET stuff)? <p>OK, I've been looking into this a few days and am not particularly sure what I am doing wrong. If anyone has working examples of using jqGrid with C#/ASP.NET and open source tools, please, please let me know where to find them. Any tips on fin...
<p>Before doing anything else, download and install this:</p> <p><a href="http://www.fiddler2.com/fiddler2/" rel="nofollow">http://www.fiddler2.com/fiddler2/</a></p> <p>It will let you see exactly what is being requested and sent back by the jqGrid requests to get the JSON data.</p> <p>I have some code for a working...
Using a cursor with dynamic SQL in a stored procedure <p>I have a dynamic SQL statement I've created in a stored procedure. I need to iterate over the results using a cursor. I'm having a hard time figuring out the right syntax. Here's what I'm doing.</p> <pre><code>SELECT @SQLStatement = 'SELECT userId FROM users' D...
<p>A cursor will only accept a select statement, so if the SQL really needs to be dynamic make the declare cursor part of the statement you are executing. For the below to work your server will have to be using global cursors.</p> <pre><code>Declare @UserID varchar(100) declare @sqlstatement nvarchar(4000) --move decl...
How can I import load a .sql or .csv file into sqlite? <p>I need to dump a <strong>.sql</strong> or <strong>.csv</strong> file into sqlite (I'm using sqlite3 API). I've only found documentation for importing/loading tables, not entire databases. Right now, when I type:</p> <p><code>sqlite3prompt&gt; .import FILENAME T...
<p>To import from an SQL file use the following:</p> <pre><code>sqlite&gt; .read &lt;filename&gt; </code></pre> <p>To import from a CSV file you will need to specify the file type and destination table:</p> <pre><code>sqlite&gt; .mode csv &lt;table&gt; sqlite&gt; .import &lt;filename&gt; &lt;table&gt; </code></pre>
Is there a better way to wait for queued threads? <p>Is there a better way to wait for queued threads before execute another process?</p> <p>Currently I'm doing:</p> <pre><code>this.workerLocker = new object(); // Global variable this.RunningWorkers = arrayStrings.Length; // Global variable // Initiate process fore...
<p>You likely want to take a look at AutoResetEvent and ManualResetEvent.</p> <p>These are meant for exactly this situation (waiting for a ThreadPool thread to finish, prior to doing "something").</p> <p>You'd do something like this:</p> <pre><code>static void Main(string[] args) { List&lt;ManualResetEvent&gt; r...
referencing CSS <p>I would like to construct an HTML link element referencing a CSS file and I would like to use the same reference from multiple documents.</p> <p>For example, my CSS file is in: {root}/style/style.css</p> <p>For files in {root}, I use: <code>&lt;link type="text/css" rel="stylesheet" href="style/styl...
<p>A simple / usually means "start from root"</p>
Repeater with paging through ObjectDataSource <p>Is it possible to implement custom paging for repeater using ObjectDataSource's:</p> <pre><code>EnablePaging="true" MaximumRowsParameterName="maximumRows" StartRowIndexParameterName="startRowIndex" SelectCountMethod="TotalNumberOfProducts"&gt; </code></pre> <p>Or I ...
<p>As repeater does not support paging and you can't achevie this using Objectdatasource... <br/> but if you want to do paging, you have to handle at code level... <br/> I did paging for datalist at code level as datalist also not support paging... <br/> If you need code I can provide you.... Call bindRpt method when y...
How to properly return T from a generic method while implimenting an interface? <p>I am working through a bug. In recreating the bug for the following sample I was able to determine why the problem is happening. But I am stuck for a better solution. So given the following program:</p> <pre><code>public interface IFoo&...
<p>Uh, I'm not too familiar with this stuff but shouldn't it be:</p> <pre><code>static void CallOutputType&lt;T&gt;(T t) where T : IFoo&lt;T&gt; { t.OutputType(t); } </code></pre> <p>It worked when I compiled it.</p>
python classes that refer to each other <p>I have two classes that refer to each other, but obviously the compiler complains. Is there any way around this?</p> <p><strong>EDIT</strong></p> <p>Actually my code is slightly different than what Hank Gay uses. So python can definitely deal with some kinds of circular re...
<p>In python, the code in a class is run when the class is loaded.</p> <p>Now, what the hell does that mean? ;-)</p> <p>Consider the following code:</p> <pre><code>class x: print "hello" def __init__(self): print "hello again" </code></pre> <p>When you load the module that contains the code, python will pri...
python observer pattern <p>I'm new to python but I've run into a hitch when trying to implement a variation of the observer pattern.</p> <pre><code>class X(models.Model): a = models.ForeignKey(Voter) b = models.CharField(max_length=200) # Register Y.register(X) </code></pre> <p>This doesn't seem to ...
<p>In python, code defined in a class block is executed and only <strong>then</strong>, depending on various things---like what has been defined in this block---a class is created. So if you want to relate one class with another, you'd write:</p> <pre><code>class X(models.Model): a = models.ForeignKey(Voter) b...
Streaming large file uploads to ASP.NET MVC <p>For an application I'm working on, I need to allow the user to upload very large files--i.e., potentially many gigabytes--via our website. Unfortunately, ASP.NET MVC appears to load the entire request into RAM before beginning to service it--not exactly ideal for such an ...
<p>It turns out that my initial code was basically correct; the only change required was to change</p> <pre><code>request.ContentLength = clientRequest.InputStream.Length; </code></pre> <p>to</p> <pre><code>request.ContentLength = clientRequest.ContentLength; </code></pre> <p>The former streams in the entire reques...
Client Profile Application prerequisites <p>One last question about Client Profile installation. I downloaded the Microsoft .NET Framework Client Profile Online Installer because we want to put it in the installation CD because our end user might not have either .net framework 3.5 or internet. So we want to be able to ...
<p>Ok, here's the thing. I tried with the Client Profile but it didn't work, I think it's because the Client Profile Installer does not have the features of .net framework 3.5 <strong>SP1</strong>. So in the installation process it ask for .net framework 3.5 SP1 too, so I had to make that available offline too. Here's ...
How to relate ga:campaign and ga:pagePath (content) on Google Analytics Export API? <p>Using custom reports you are able to drill down on a specific campaign and then choose the Landing Page or content page that the individual visitor choose. When I try to retrieve the same information through the Google Analytics Exp...
<p>I just tried it with some GA data. It seems to be picky about what metric you join it to but ga:pageviews works. Both ga:campaign and ga:pagePath are dimensions and you need to join them to a metric. You can reference GA documentation <a href="http://code.google.com/apis/analytics/docs/gdata/gdataReferenceDimensions...
How to detect if a type is a Func<T> and get the type of the T <p>I am wondering whether I can upgrade a basic IoC container I am using to support lazy load. So if I have registered IFoo, I would like the IoC container to know how to fulfil both of the following dependencies (the first being the standard way IoC contai...
<p>take a look at this question from this morning - might give you a good start - <a href="http://stackoverflow.com/questions/1043755/c-generic-list-t-how-to-get-the-type-of-t">http://stackoverflow.com/questions/1043755/c-generic-list-t-how-to-get-the-type-of-t</a></p>
How to configure SMTP in IIS 7? <p>How to to configure SMTP mail in IIS 7?</p> <p>I am new to IIS 7 and want to know how to configure that, or its better to keep using the IIS 6 SMTP?</p> <p>Any one know where to find some videos to learn SMTP in IIS 7?</p>
<p>The IIS7 SMTP server is managed using IIS6 management console.</p>
How to build a Visual Studio 9.0 solution from Cygwin and get build output? <p>I am trying to set up an automated build system on Windows using Cygwin. Among other things, it needs to be able to build several Visual C++ solutions. I have a script which sets up the environment variables needed for devenv, and if I type...
<p>Will cygwin find and run .com files? </p> <p>There are 2 <code>devenv</code> executables, one is <code>devenv.com</code> which is a console mode application that handles stdin, stdout and stderr proxying for the other executable, <code>devenv.exe</code>, which is a GUI mode application. If <code>devenv.exe</code>...
How can I validate a string to only allow alphanumeric characters in it? <p>How can I validate a string using Regular Expressions to only allow alphanumeric characters in it?</p> <p>(I don't want to allow for any spaces either).</p>
<p>Use the expression:</p> <pre><code>^[a-zA-Z0-9]*$ </code></pre> <p>ie: using System.Text.RegularExpressions;</p> <pre><code>Regex r = new Regex("^[a-zA-Z0-9]*$"); if (r.IsMatch(SomeString)) { ... } </code></pre>
Setting a default value to a param in s:include <p>I am writing a small widget in struts which I want to include. The height of the widget should be auto unless I pass in a param of height. For example:</p> <pre><code># Example 1: &lt;s:include value="myWidget.jsp"&gt; &lt;s:param name="height"&gt;300 px&lt;/s:par...
<p>You could use <a href="http://java.sun.com/products/jsp/jstl/" rel="nofollow">c:out</a> in the <a href="http://java.sun.com/products/jsp/jstl/1.1/docs/tlddocs/index.html" rel="nofollow">JSTL</a> core tags.</p> <pre><code>&lt;c:out value="${param.height}" default="auto"/&gt; </code></pre>
Maven Exec Plugin not reading configuration <p>I'm trying to execute my project using the Maven exec:exec goal and I've tried to configure it with this snippet:</p> <pre><code>&lt;plugin&gt; &lt;groupId&gt;org.codehaus.mojo&lt;/groupId&gt; &lt;artifactId&gt;exec-maven-plugin&lt;/artifactId&gt; &lt;version&...
<p>I see one issue with your code. You need to put -jar into its own <code>argument</code> element. You will get an error if you don't. The rest of your code is dead on acurate. Here is a working example from one of my projects. This executes a jar that is packaged in the target directory after executing <code>mvn pac...
Using JSLint in Notepad++ <p>I have seen other text editors use extensions to allow syntax checkers such as <a href="http://www.jslint.com">JSLint</a>, is this possible with Notepad++?</p>
<p>I have managed to get two lint programs to run using the <a href="http://notepad-plus.sourceforge.net/">notepad++</a>'s <a href="http://sourceforge.net/project/showfiles.php?group_id=189927&amp;package_id=224034">NppExec</a> Plugin.</p> <p>The NppExec plugin is usually installed by default and can be found under pl...
from a CSV of filenames, find and open multiple files in a folder (or sub-folders) <p>Each camera folder has many thousands of photos, I need to open 20-or so specific files which could be located in any one or more folders, all within one 'root' folder:</p> <blockquote> <p>Photos</p> <p>|-- CameraA</p> <p...
<p>Do you really need it to be an AppleScript specifically? It's easier with shell scripting if you ask me:</p> <pre><code>for f in 6504 6505 8902 4501; do find . -name "$f" -exec open -a "Photoshop" {} \;; done </code></pre> <p>Where the numbers are replaced with your desired filenames and "Photoshop" is replaced wi...
I cannot compile using template in C++ <p>I compiled the following cords with g++</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; template&lt;class T&gt; class Node&lt;const char*&gt;{ private: string x_; Node* next_; public: Node (const char* k, Node* next):next_(next),x_(k...
<p>You're mixing up declarations and instantiations. When you declare a template, you don't specify a type immediately after its name. Instead, declare it like this:</p> <pre><code>template&lt;class T&gt; class Node { private: const T x_; Node *next_; public: Node (const T&amp; k, Node *next) : x_(k), next_(ne...
How do I get this mysql query to include null values? <p>Im writing a pruning script, to delete content from my site that was uploaded over a week ago, and been accessed 0 or 1 times, also in the last week.</p> <p>there are 2 tables: </p> <ul> <li>daily_hits - which stores the item id, date, and number of hits that ...
<p>total_hits &lt; 2</p> <p>This guarantees "null hits" won't show up. </p> <p>Make a second query that finds the nulls (it will show records from videos that have no corresponding key in daily_hits).</p> <p>Make a UNION query to present the two datasets as one. </p>
What to do after starting simple_server? <p>For some quick background, I'm an XHTML/CSS guy with some basic PHP knowledge. I'm trying to dip my feet into the Python pool, and so far understand how to start simple_server and access a simple Hello World return in the same .py file. This is the extent of what I understand...
<p>I would recommend <a href="http://www.djangoproject.com/" rel="nofollow">Django</a>.</p>
Twice postback in ASP.NET <p>My page is fully postback twice. I am using master page with AJAX. The structure of master page is as follows.</p> <pre><code>+---------------------------------------------+ | Web User Control with AJAX Tab Control | +---------------------------------------------+ | | ...
<p>When Page directive autoeventwireup is true and you attach an event OnInit to things like Page_Load, those events will be raised twice, making it look like double postback. It could be semething else, too.</p>
cron jobs to upload a file via FTP <p>Is it possible to use CRON to upload a file via FTP? If yes how can I call FTP to run an upload?</p>
<p>Assuming a UNIX-like operating system you could setup a cron job that pointed to a shell script like the following:</p> <pre><code>#!/bin/sh cd [source directory] ftp -n [destination host]&lt;&lt;END user [user] [password] put [source file] quit END </code></pre> <p>Depending on your ftp client defaults and the so...
Dynamic nested master pages, shared properties <p>I have a base master page that specifies the main layout template of a website. It also handles some logic that changes tabs depending on the section, and also sets page meta information. </p> <p>I'm dynamically loading nested master pages by looking at the querystring...
<p>You could always pass the record in the HttpContext.Items collection. Once it is in the Items collection it is available to every thing that can reach the HttpContext for the duration of the request.</p>
Extract RGB values from a AVFrame (FFMPEG) in C++ <p>I am currently trying to read in video frames by using FFMPEG. The format is PIX_FMT_RGB24; For each frame, the RGB values are all combined together in frame->data[0] (Where frame is of the type AVFrame). </p> <p>How do I extract the individual R, G and B values for...
<p>My guess:</p> <pre><code>int p=x*3+y*frame-&gt;linesize[0]; r=frame-&gt;data[0][p]; g=frame-&gt;data[0][p+1]; b=frame-&gt;data[0][p+2]; </code></pre> <p>I might have r, g, and b backwards. And there's a lot of room for speedup.</p>
How do I wait until the user has finished writing down in a text input to call a function? <p>I'm designing a web site and I would like to be able to call a function 1 second after the last user input. I tried using onKeyUp, but it waited 1 second after the first keystroke.</p> <p>Does anyone know how would this be po...
<p>Another similar approach, without globals:</p> <pre><code>var typewatch = function(){ var timer = 0; return function(callback, ms){ clearTimeout (timer); timer = setTimeout(callback, ms); } }(); </code></pre> <p>...</p> <pre><code>&lt;input type="text" onKeyUp="typewatch(function(){a...
Asp.NET Development Server DirectoryNotFoundException <p>The TempImage is located under the root directory of the current web app. When I try to set the ImageUrl of an image I get the error below. For some reason asp.net web server trying to locate the directory under its own current root</p> <p>This is what I am tryi...
<p>If the image is in the root of the current application just specify:</p> <pre><code>&lt;asp:image ImageUrl="~/imagename.jpg" runat="server" /&gt; </code></pre>
How to create heroku based Sinatra apps <p>I am trying to create Sinatra based heroku app without any luck?</p>
<p>To answer your question: Yes!</p> <p>For reference: <a href="http://docs.heroku.com/rack#sinatra" rel="nofollow">http://docs.heroku.com/rack#sinatra</a></p>
How do I Invoke 3 REST endpoints in parallel? <p>I have to invoke REST endpoints A, B &amp; C in parallel and combine the resulting JSON from each into one JSON. All REST endpoints reside on different servers.</p> <p>My initial design calls for 3 Callables executed via FutureTasks. I will then do a Future.get(1000ms) ...
<p>That's how I would do it. I really like the <a href="http://java.sun.com/javase/6/docs/api/java/util/concurrent/Future.html" rel="nofollow">Future interface</a>.</p>
How to make Vim continue bullet points? <p>When I use Mediawiki-syntax first-level bullet points, pressing enter key shows a bullet point for the next line as well:</p> <pre><code>* &lt;CR&gt; * </code></pre> <p>But when I have the second-level bullet points, it just starts a new blank line</p> <pre><code>** &lt;CR&...
<p>Try </p> <pre><code>setlocal formatoptions=ctnqro setlocal comments+=n:*,n:# </code></pre> <p>It works that way in <a href="http://www.vim.org/scripts/script.php?script%5Fid=2226" rel="nofollow">vimwiki</a>.</p>
Passing output of named_scope to another method <p>I am retrieving data on individual lines within a report with the following <code>named_scope</code> in my survey_response.rb model:</p> <pre><code>named_scope :job_responses, lambda{|job_code, survey_code| {:conditions =&gt; ["survey_job_id = ? AND survey_id = ?", jo...
<p>This sort of behavior would probably be better placed in your controller. Anyway, it sounds like all you need to do is collect the values of the field. You could define the data like this:</p> <pre><code>@job_responses = SurveyResponse.job_responses(survey_response.id, survey_response.survey_id) @base_pay = @job_re...
Install Shield 2009 Premier : Install Windows Installer 3.1 or 2.0 (best fit for system) with any sysem restart <p>Basic MSI project, from release wizard I chose Install Windows Installer 3.1 or 2.0 (best fit for system), extract from setup.exe. When in installation, after installing Windows installer system restarts. ...
<p>I am in Installshield 2008, and in the release wizard there is an option "Delay engine reboot until after your installation completes". Have you enabled this option?</p>
ASP.NET tab control with custom tab shapes <p>I need to create ASP.NET tabs with each tab looking like a triangle (similar to OneNote tabs). are there any available tab controls that support this out of the box?</p> <p>if it's not in ASP.NET world, but in js (like extJS or jQuery) I'll take that and just adopt it. I k...
<p>check out Matt Berseth AjaxControlToolkit TabContainer Theme Gallery [<a href="http://mattberseth.com/blog/2008/04/ajaxcontroltoolkit_tabcontaine.html" rel="nofollow">http://mattberseth.com/blog/2008/04/ajaxcontroltoolkit_tabcontaine.html</a>][1] </p> <p>[1]: <a href="http://AjaxControlToolkit" rel="nofollow">http:...
Create executable application in linux <p>I wanna know how to create executable application in linux just like .exe file in windows. most of you have used/seen "Pidgin IM" in linux on click of that it will open the window where you can see your buddies and more similar to gnome-caculator. i want to ...
<p>The most common way to create executables is to use a compiler. (Just like on windows.) The GNU Compiler Collection (GCC) may already be installed on your Linux system, see if you can find it with:</p> <pre><code>$ which gcc </code></pre> <p>or</p> <pre><code>$ gcc --help </code></pre> <p>If not, you'll have to ...
MS Access library for python <p>Is there a library for using MS Access database in python? The win32 module is not as easy as the MySQL library. Is there a simpler way to use MS Access with Python?</p>
<p>Depending on what you want to do, <a href="https://github.com/mkleehammer/pyodbc" rel="nofollow">pyodbc</a> might be what you are looking for. </p> <pre><code>import pyodbc db_file = r'''C:\x.mdb''' user = 'admin' password = '' odbc_conn_str = 'DRIVER={Microsoft Access Driver (*.mdb)};DBQ=%s;UID=%s;PWD=%s' %\ ...
How to import excel files into SqlDatabase .mdf file <p>I have one long excel sheet with books details of a library..can i import this data into a .mdf file.</p>
<p>Yes. Depends on SQL Server version you have installed (for exact instructions) but you use DTS (Data Transformation Services). </p> <p>Right click on your database and you should see <strong>Import data</strong>. Wizard will do most of the work, basically it's a next next next operation. </p>
google chart tutorial <p>What is good place to learn about google charts except ofcourse official google page on same and various things you can do with charting libraries on the web beside google? Any good place you been to on same topic? need to integrate in GAE app.</p>
<p>how about "<a href="http://www.ajaxonomy.com/2008/web-20/google-chart-api-a-real-world-example" rel="nofollow">Google Chart API - A Real World Example</a>"?</p>
How to list available callbacks exposed by a flash element <p>Is there a way to query an embedded flash element to determine the available methods that can be executed on it via JavaScript?</p> <p>Edit: It appears that in IE it's as simple as </p> <pre><code>for ( i in flashNode ) { alert(i); } </code></pre> <p>...
<p>While it is possible to get the callbacks by enumerating the <code>&lt;object&gt;</code> DOM node in IE, they are mixed in with all the other properties of the DOM node and they are unable to be progamatically distinguished without keeping a list of known properties to compare them against and then taking the differ...
Webbrowser unable to perform search and authentication <p>Greeting everyone. Thank you for your time to read my question. I am hoping that the descrption of the issue I put below actually make sense. I have tried to google around many sites but can't seem to find issues that match mine.</p> <p>Problem happens mainly o...
<p>Try installing Firefox, and install the HttpFox plugin. Open it up and click "Start". Then you will see every HTTP request you make, and how long it takes to respond. You may at least get a clue as to which request(s) is/are causing the problem?</p>
Average Logins per day SQL Query <p>I have a users table in MSSQL and i want to find out the average number of logins for all users per day?</p> <p>I am thinking something with division but not entirely sure the USER table looks like this</p> <pre><code> [ID] ,[APPLICATION_ID] ,[LOGIN_NAME] ,[EMAIL] ,[MOBILE...
<p>From the table you provide, there is no way of calculating an average. To do this, you would need an historical record of user logins.</p>
Books to refer for learning OOP through C++ <p>I am looking for a book which can teach OOP concepts using c++ . Could you guys please suggest me some books.</p>
<p>C++ is probably not the ideal language for doing this, because very large chunks of the language do not require or use object oriented techniques. You might be better off looking at something like Java or Python instead.</p>
can a web parser differentiate between static and dynamic text? <p>Can a web parser differentiate between static and dynamic text on a webpage? For example there is a string on a webpage</p> <blockquote> <p>Hello "Fantastic Four"</p> </blockquote> <p>In this "Hello" is a static data and "Fantastic Four" is a dynami...
<p>I think that it's not possible. The client can't know anything about the executing code in the server, so there is no way that know if the text has been generated by PHP, ASP or any other language... or even is static.</p>
Substituting text in a file within a Perl script <p>I am using webmin and I am trying to change some settings in a file. I am having problems if the person uses any weird characters that might trip up sed or Perl using the following code:</p> <pre><code>&amp;execute_command("sed -i 's/^$Pref.*\$/$Pref \"$in{$Pref}\"/g...
<p>Perl's regex support includes the \Q and \E operators, which will cause it to avoid interpreting regex symbols within their scope, yet they allow variable interpolation.</p> <p>This works:</p> <pre><code>$i = '(*&amp;%)*$£(*'; if ($i =~ /\Q$i\E/){ print "matches!\n"; } </code></pre> <p>Without the \Q and \E...
jQuery Traversing <p>My page has this design.</p> <pre><code>&lt;tr id="master"&gt; &lt;td id="row1"&gt; &lt;textbot&gt; &lt;/td&gt; &lt;td id="row2"&gt; &lt;linkbutton&gt; &lt;/td&gt; &lt;/tr&gt; </code></pre> <p>I am cloning the same TR onclick of the linkbutton and the current link button will be hidden. so a new ...
<p>You can't/shouldn't clone elements that have IDs, because IDs are supposed to be unique in a document. Although a browser will happily let you have the same ID twice, Javascript and jQuery do not forgive you for this and things will not work as expected. The proper way to group elements is by classes.</p> <p>So if ...
How do I handle an apostrophe (') in MS SQL 2008 FTS? <p>I have a website that utilizes MS SQL 2008's FTS (Full-Text Search). The search works fine if the user searches for a string with an apostrophe like <b>that's</b> - it returns any results that contain <b>that's</b>. However, it will not return a result if the use...
<p>use a parameter </p> <pre><code>myCommand.Parameters.AddWithValue("@searchterm", txtSearch.Text.Trim()); </code></pre> <p>it will be handle by you, without any hassle.</p> <p>regarding that, that's and thats you should look up <a href="http://msdn.microsoft.com/en-us/library/aa259235%28SQL.80%29.aspx" rel="nofoll...
Taking a screenshot of the window in the background <p>Will it be any problems to take a screenshot of the window content, if that window is overlapped by some other application.</p>
<p>Unless you've got a method in the application to render it to an off-screen bitmap you'll only get the visible portions of the window.</p>
SSIS get reference to package <p>I'm trying to programmatically add an Execute SQL task from within a script task of my SSIS package. I know that the Microsoft.SqlServer.Dts.Runtime.Package class has an Executables collection which I can add my new task to but how to I get a reference to the package Im inside of?</p>
<p>It is not possible, SSIS does not support self-modifying packages.</p> <p>To prevent any attempts of doing what you are trying to do, the task code does not have access to the package API, so you can't obtain reference to Package object from a task. But even if you find a way to curcumvent this - the results are no...
HttpWebRequest and Transfer-Encoding <p><code>HttpWebRequest</code> is used to download files from ASP.NET site with basic authentication. Everything works fine in many cases, but some proxies make answer chunked and <code>HttpWebRequest.GetResponse()</code> throws an exception if answer with <code>401</code> status co...
<p>I actually think the error isn't that Chunked Transfer Encoding (CTE) isn't allowed, I think it's that the server is doing the CTE incorrectly. If you look at the response body, it's looking like this: </p> <pre><code>Language: en \r\n \r\n 0 \r\n \r\n 0 \r\n \r\n </code></pre> <p>If you notice, there are two 0 le...
How to call a .NET web service from android? <p>I need to call a web service with a URL something like: <code>"http://192.168.1.19/TestWeb/WebService.asmx"</code> from android.</p> <p>Please anyone help me with a full example?</p>
<p>Finally, i got the solution for my own question.</p> <p>Here is the code:</p> <pre><code>package projects.ksoap2sample; import org.ksoap2.SoapEnvelope; import org.ksoap2.serialization.SoapObject; import org.ksoap2.serialization.SoapSerializationEnvelope; import org.ksoap2.transport.HttpTransportSE; import andro...
Pause/Resume Upload in C# <p>I'm looking for a way to pause or resume an upload process via C#'s WebClient.</p> <p>pseudocode:</p> <pre>WebClient Client = new WebClient(); Client.UploadFileAsync(new Uri("http://mysite.com/receiver.php"), "POST", "C:\MyFile.jpg");</pre> <p>Maybe something like..</p> <pre>Client.Paus...
<p><code>WebClient</code> doesn't have this kind of functionality - even the slightly-lower-level <code>HttpWebRequest</code> doesn't, as far as I'm aware. You'll need to use an HTTP library which gives you more control over <em>exactly</em> when things happen (which will no doubt involve more code as well, of course)....
Unable to understand a statement about compilers' optimization <p>I am interested in optimization at runtime by a VM and at compile-time. I have had the idea that optimizations are most efficient and easiest at compile-time.</p> <p>However, my thought seems to be false in certain circumstances. This is evident in <a h...
<p><strong>Short answer:</strong> Because it is easier to identify and analyze at runtime the hotspots - the parts of your program that are using the most time.</p> <p><strong>Long answer:</strong></p> <p>If you start running the code in interpreted mode a virtual machine can count how often and how long different pa...