input
stringlengths
51
42.3k
output
stringlengths
18
55k
C#: Argument validation: null/empty strings <p>I don't know how many countless times I've had to write code to validate string arguments:</p> <pre><code>public RoomName(string name) { if (string.IsNullOrEmpty(name)) { throw new ArgumentException("Cannot be empty", "name"); } } </code></pre> <p>Is the...
<p>You can do that via code injection with attributes.</p> <p>Another option to save some coding time, but still give you a lot of control, would be to use something like <a href="http://www.codeplex.com/conditions">CuttingEdge.Conditions</a>. This provides a fluent interface for argument checking, so you can write:<...
Dojo, how to do onclick event on a DIV <p>There was a fade out sample in the internet.. <a href="http://docs.dojocampus.org/dojo/fadeOut?t=tundra">http://docs.dojocampus.org/dojo/fadeOut?t=tundra</a></p> <p>but i want to do something different.. i want people directly click on the text then the text will fade out.</p>...
<p>If I understand what you are trying to do, I think you can accomplish it with this:</p> <p><strong>HTML</strong></p> <pre><code> &lt;div id='parentNode'&gt; &lt;div id='textDiv'&gt; &lt;div id='iconDiv'&gt;this is icon div&lt;/div&gt; &lt;div id='messageDiv'&gt;this is message div&lt;/div&gt; ...
Python Lambda Problems <p>What's going on here? I'm trying to create a list of functions:</p> <pre><code>def f(a,b): return a*b funcs = [] for i in range(0,10): funcs.append(lambda x:f(i,x)) </code></pre> <p>This isn't doing what I expect. I would expect the list to act like this:</p> <pre><code>funcs[3]...
<p>lambdas in python are closures.... the arguments you give it aren't going to be evaluated until the lambda is evaluated. At that time, i=9 regardless, because your iteration is finished.</p> <p>The behavior you're looking for can be achieved with functools.partial</p> <pre><code>import functools def f(a,b): ...
How can I select an element by name with jQuery? <p>Have a table column I'm trying to expand and hide: </p> <p>jQuery seems to hide the td elements when I select it by <a href="http://docs.jquery.com/Selectors/class#class">class</a> but not by element <a href="http://docs.jquery.com/Selectors/element#element">name</a>...
<p>you can use the attribute selector</p> <pre><code>$('td[name=tcol1]') // matches exactly 'tcol1' $('td[name^=tcol]') // matches those that begin with 'tcol' $('td[name*=tcol]') // matches those that contain 'tcol' </code></pre>
What is the best way to post to Twitter from a django app? <p>What I want to do is pretty straightforward. I have a site powered by django. I want to have the site automatically post to twitter any time a new object is created and saved in the database. What is the absolute best way to do this?</p>
<p>One way is the following:</p> <p>First, handle the <code>post_save</code> signal from Django. Note that <code>post_save</code> passes your handler a boolean parameter <code>created</code> to let you know whether it's a new object that was saved.</p> <ul> <li><a href="http://docs.djangoproject.com/en/dev/ref/signa...
Handling 'If' statements in .aspx files in asp.net <p>One of my code behind file is sending some boolean value (read from the data base) to the corresponding.aspx file. I want to change the css style class of the container division based on this boolean value. I tried to do it the following way, </p> <p>code behind fi...
<p>Your Result Div is wired up in the codebehind so you don't need to put the if statement in the ASPX at all.</p> <pre><code>protected void Page_Load(object sender, EventArgs e) { Result.InnerText = "false"; //In real scenario, this is retrieved from a db if (Result.InnerText == "true") { Result.Sty...
Will a Mac Mini suffice for an iPhone Development machine? <p>So the past two clients I've been at, all the talk has been about creating an iPhone app, and I won't lie, I want to make one. Or at least learn how to make them.</p> <p>I've never owned a Mac, so I have no idea how their OS functions/works/performs, whate...
<p>As long as it has an Intel processor its fine. Good Luck!</p> <p>Also here is some stuff to get you started:</p> <ul> <li><a href="http://www.cocoadevcentral.com/d/learn_objectivec/" rel="nofollow">CocoaDev Central</a></li> <li><a href="https://itunes.apple.com/us/podcast/iphone-how-to-tutorial-videos/id407737445"...
Using code written for the serial port on an usb port <p>I've got an <em>USB</em> card reader that I need to access from Lazarus / Delphi.</p> <p>The SDK is written in VB6 and talks to the <em>serial</em> port, so in Windows it installs a driver to map the USB port to a serial port.</p> <p>I'd like to skip that step ...
<p>The USB protocol is completely different from a serial port. It sounds like the easiest approach for you might be to install a suitable USB-serial driver on Linux, and use the same serial protocol. Chances are there already exists such a driver that works with your device.</p>
Will the save method in a Cakephp model class choose between creating and updating a record? <p>Basically, I want to achieve the same thing as <a href="http://dev.mysql.com/doc/refman/5.0/en/insert-on-duplicate.html" rel="nofollow">ON DUPLICATE KEY</a> in MySQL.</p> <p>Here's a contrived example:</p> <pre> $rec = arr...
<p>If you call <code>save()</code>, supplying a record with an existing <code>id</code> (or whatever is the primary key), it will update, otherwise it will create a new record.</p> <p>So in your case, yes, it would update the record that was first created at the top.</p> <p><strong>Update</strong></p> <p>Here's <a h...
101 connections to self error <p>my site keeps going down on my shared hosting account and this is what my host said:</p> <blockquote> <p>It appears that the IP address of your site is being blocked on the firewall due to your site causing excessive connections to itself.</p> <p>"101 connections to self"<...
<p>Is it possible you're opening several connections to MySQL without closing them? Perhaps using persistent connections for some reason?</p>
How to get WPF xaml content by code on form C# <p>I design a form in WPF project. The xaml content is automatically generated based on the GUI I design (drag/drop,set position on GUI). How can I read/retreive the xaml content data by code in C# on form? </p>
<p>In WPF you have to decide what controls/UI elements are accessible in codebehind/C# by adding the Name="<em>someMeaningfullName</em>" or x:Name="<em>someMeaningfullName</em>" to the element in XAML. Then you can access it in the codebehind like this: <code>someMeaningfullName.Text = "blablabla";</code>or similar.</...
PHP - Script Execution Speed Command Line vs In Browser <p>I have a PHP script that makes a few calculations and SQLite3 queries/transactions using PDO. Its both hosted and tested on my laptop running a windows/nginx/fastcgi php5.2 server.</p> <p>I ran it both in the console and in the browser, and to my surprise, the...
<p>PHP doesn't run in browsers. PHP is server-side technology which feeds it's output to the browser. A more proper question would be phrased as comparing the Command line interface to the server embedded interface (mod_php, or cgi). My guess is the the CLI has to load the PHP code on start-up, so will be slower for sh...
Keyboard doesn't disappear <p>While using UITextField in objective c, keyboard appears, after typing some figure I wanna move to another Textfield or button but neither the cursor removes from text field nor the key board disappears. Wat should i do?</p> <pre><code>tempTextField.borderStyle = UITextBorderStyleBezel; t...
<p>You should use the <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/UIResponder_Class/Reference/Reference.html" rel="nofollow"><code>resignFirstResponder</code></a> method of <code>UIResponder</code>, which <a href="http://developer.apple.com/library/ios/#documentation/uikit/reference/U...
How to change where Subversion repositories are stored? <p>Newbie question: I just installed VisualSVN Server and created a repository. I noticed that it created it at C:\Repositories. I need it stored on my D drive instead as there is more space there. I Googled around but can't figure out how to do it.</p> <p>This i...
<ol> <li>Open <strong>VisualSVN Server Manager</strong></li> <li>Right-click on <strong>root node</strong> and select <strong>Properties</strong></li> <li>Change repositories location on <strong>Storage</strong> page</li> <li>Click <strong>OK</strong></li> </ol>
Why do my icons line up top-to-bottom instead of flowing left-to-right in a DIV layout? <p>I have these 3 icons enclosed in separate DIVs all of which are enclosed within a single DIV:</p> <pre><code>&lt;div id="icons"&gt; &lt;div id="divtxt" class="divicon"&gt; &lt;img src="/icons/text.png" id="icontxt" class=...
<p>And now for something a bit more comprehensive:</p> <p>You look like you just want a row of icons. Using your HTML, you would need to <code>float</code> the divs containing the icons in order for them to be next to each other. The reason why you need to float is because a div is a block level element (as opposed to...
MVC C# - Simplest Possible Implementation <p>My first try of MVC. Am trying to implement a <em>simple</em> example. Inspiration from <a href="http://stackoverflow.com/questions/1015813/what-goes-into-the-controller-in-mvc">here</a>. Have I got this pattern (yet!)?</p> <ol> <li><p>View: "Hey, controller, the user jus...
<p>Hmm... I am not sure if I'd call this MVC... As with ASP.NET WebForm, this form is more like an MVP pattern.</p> <p>As per my understanding, in MVC, controller is the one responsible for managing all resources and flow of the code. In your example, you basically creating a Windows Form first (the view) and then a...
can't send email to addresses at my own domain <p>I have a simple php script on my domain that sends me an email:</p> <pre><code>... $toMail = "me@gmail.com"; //this works - I get the email at my gmail $toMail = "me@mydomain.com"; //this doesn't - I get nothing mail($toMail, $subject, $message, $header); </code></pre...
<p>For the people using Google Apps for email, but having your host in other provider this are more detailed instructions for the people that is not very familiar with cPanel.</p> <p>I could fix the problem of sending email from my domain using a PHP form, when sending the email to an account inside my domain.</p> <p...
creating a DLL in Visual Studio 2005 <p>I am developing a C++ library that I want to pass on to my team. The library has just one class with a bunch of methods. </p> <p>So, I have developed the class definition file (X.cpp) and a corresponding class declaration file (X.h). </p> <p>Here are my questions --</p> <ol> <...
<p>The easiest way to build a DLL, is New->Project->Win32 Console Application. Then on the dialog select DLL and select "Exports Symbols". This will synthesize a dll with a .h, and .cpp file which demonstrate how to export your classes. You can get rid of this .h/.cpp but first import your class add the appropriate #if...
Which is better for left-to-right layout: float or display:inline? <p>I have some icons inside divs and needed to lay them out with a left-to-right structure instead of the default top-to-bottom layout that seems to come with divs. It's probably not news to most people who know CSS but I figured out (with <a href="http...
<p>You cannot set an explicit width/height on inline elements, so if they must be a specific size then you're stuck with floating them. Floating elements can cause various layout quirks, so inline is definitely preferred if you don't <em>have</em> to float things.</p> <p>Here, you should be able to set the size on the...
Is GIJ (GNU Interpreter for Java) stable enough for commercial use? <p>I have been asked to write a java program on linux platform. According to system admin, the JRE on the linux system is GIJ, which is supposed to be compatible to JRE 1.4.2.</p> <pre><code>java version "1.4.2" gij (GNU libgcj) version 4.1.2 20080704...
<p>gij is very ancient, and while I don't have references I doubt it's reliable enough to support commercial applications. That, and Java 1.4 is a chore to program in.</p> <p>If your systems administrator is willing to install and support a newer version of Java, it'd probably be best to have them do it.</p> <p>If t...
size_t can not be found by g++-4.1 or others on Ubuntu 8.1 <p>This has happened before to me, but I can't remember how I fixed it.</p> <p>I can't compile some programs here on a new Ubuntu install... Something is awry with my headers.</p> <p>I have tried g++-4.1 and 4.3 to no avail.</p> <pre><code>g++ -g -frepo -DI...
<p>Start by removing -I/usr/include/linux and -I/usr/include. Adding system directories to include paths manually either has no effect, or breaks things. Also, remove -frepo for extra safety.</p>
system.web.extentions.dll not getting published! <p>I use the publish option of asp.net 2.0 to create a deployable copy of my web application. Lately I've noticed that the System.Web.Extensions.Design.dll and the System.Web.Extensions.dll does not get copied when using the publish option. Has anyone any idea why this ...
<p>They're part of the framework, so they are not published.</p>
JRuby with Ruby 1.9 <p>I know there is ongoing work for in this regards but what is the exact status of JRUby 1.3 compatibility with Ruby 1.9.1 ? I am slightly confused if I can dwnload jruby 1.3 and start working with my ruby 1.9 installation.</p> <p>The JRuby homepage says : * Ruby 1.8.6 compatible now * ...
<p>A detailed overview of what is done and what is missing can be found <a href="http://kenai.com/projects/jruby/pages/Ruby1%5F9Support" rel="nofollow">on their wiki</a>. From that page:</p> <blockquote> <p>These are entire areas that need to be worked on.</p> <ul> <li>Encoding::Converter</li> <li>Yielder/G...
Design patterns for Java EE application <p>We are starting a new Java EE project and am looking for suggestions regarding design patterns to expose the backend interfaces. </p> <p>It would be preferable if the backend logic can run seamlessly on Tomcat, other Java EE 5 containers. We are currently veering towards Java...
<p>Core J2EE Patterns book has started to be a bit dated. It seems like you are focus on standards. If so - I would consider looking at <a href="http://seamframework.org/" rel="nofollow">Seam</a> as an architecture foundation and use the patterns that Seam describes. This is a framework which is focused on standards, b...
Scope, arrays, and the heap <p>So, I have this array. It needs to be accessed outside the scope of this function. I have been slapping a pointer to it into a pair which gets put into a deque. But once I'm outside the scope, the local stack is gone, the array is invalid, and I've just got a useless pointer, right?</p> ...
<p>There are two problems. First, indeed, you are confused about pointers/arrays:</p> <pre><code>int a[4]; // this is an array of 4 integers, a is the name of the array int *a[4]; // This is an array of 4 *pointers* to int </code></pre> <p>So your declaration:</p> <pre><code>int **blah[4]; </code></pre> <p>Define a...
VCDIFF for Java or alternative binary diff formats <p>Is there an open-source Java implementation of the VCDIFF binary diff format (decoder and encoder)?</p> <p>There are <a href="http://xdelta.org/" rel="nofollow">xdelta</a> and <a href="http://code.google.com/p/open-vcdiff/" rel="nofollow">open-vcdiff</a>, but those...
<p>You can generate binary diffs using badiff; the website is</p> <p><a href="http://badiff.org/" rel="nofollow">http://badiff.org/</a></p> <p>and it is available on maven central. It's BSD licensed, so friendly for both OSS and commercial. The algorithm used is a chunked version of the O(ND) diff described in this...
Does the .NET JIT optimize nested try/catch statements? <p>I've been thinking about nested try/catch statements and started to think about under which conditions, if any, the JIT can perform an optimization or simplification of the compiled IL.</p> <p>To illustrate, consider the following functionally-equivalent repre...
<p>It's worth noting that in the first case they're <em>only</em> functionally equivalent when you're doing nothing within the catch block. Otherwise, consider this:</p> <pre><code>try { foo(); } catch (IOException) { throw new ArgumentException(); // Bubbles up to caller } catch (ArgumentException) { Cons...
Wrapper library - Builder vs Factory with POCO <p>I'm stuck between a rock and a hard place at the moment trying to decided on a good API layout for a .NET COM wrapper project I am working on. This is mainly a design problem and what would work better.</p> <p>So I have this COM point object:</p> <pre><code>public cla...
<p>I believe that you can combine Builder and Factory patterns, and then you can apply the "Unify interfaces with Adapter" in <a href="http://www.industriallogic.com/xp/refactoring/index.html" rel="nofollow">Refactoring Pattern</a> book. Please, correct me if I goes wrong direction. As you mentioned, you are going to ...
Should View Models in ASP.Net MVC be all strings? <p>I've got to the point (unintentionally) that I feel in some parts I'm doing too much within the view (.aspx) itself, too much formatting, concatenation, in one place a little regex replace.</p> <p>I was starting to work on a new part and trying to improve my approac...
<p>Your model should produce the correct data, then it is up to the view to produce the data in the format that it requires. If you built another view on top of the model, you might want to do different manipulations of the data, so i suggest <strong>NOT</strong> returning them as strings from the model.</p>
Database Relationship <p>I have two database one with relationship(no data) and another with out Relationship (with data) and i want to insert data from one database to another database i am not able import data i got the error for forgien key.</p> <p>Is there any way for this ?</p>
<p>You need to copy the data over in the correct order, starting with data at the bottom of the "tree".</p> <p>e.g. TableA, TableB, TableC If TableA references a record in TableB which in turn references a record in TableC then you should import the data in this order: 1) TableC 2) TableB 3) TableA</p>
Android: Retrieving data from the database issue <p>I created the following method for retrieving stored settings from the database:</p> <pre><code>public String getEntry(long rowIndex){ String value = ""; Cursor c = db.query(DATABASE_TABLE, new String[] {KEY_NAME, VALUE}, KEY_NAME + "=" + rowIndex, null, null, ...
<p>I don't know your DB-Wrapper you use, but I want to make two guesses, since I know Sqlite a little.</p> <p>It could either be:</p> <ol> <li><p>In my wrapper and in the C-API it is necessary to make a step (or next) every time you want to retrieve data. Your exception indicates, that you are not positionated at the...
How to write endpoint information in app.config at runtime WCF? <p>Is there a way to write in a app.config file the information about endpoints? Actually I want to read the <code>&lt;service&gt;</code> tag from one app.config file and want to write it in other app.config file's <code>&lt;Services&gt;</code> tag.</p> ...
<p>Your calling "OpenExeConfiguration" - this will open the config for the currently executing app.</p> <p>You need to read up on the .NET 2.0 configuration system: there's an excellent 3-part series on the .NET configuration system on CodeProject:</p> <p>There's a series of really good articles on you to demystify t...
HTTP headers "q" factor in firefox? <p>Does anyone know what the "q" factor HTTP headers emitted by Firefox 3 mean?</p> <p>It only appears in the Accept and Accept-Charset headers.</p> <p>For example:</p> <p><strong>Accept</strong>: text/html,application/xhtml+xml,application/xml;<strong>q=0.9</strong>,<strong>**/**...
<p><a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html">This page</a> should clarify the "q" parameter, which comes from "quality factor".</p> <blockquote> <p>Quality factors allow the user or user agent to indicate the relative degree of preference for that media-range, using the qvalue scale from...
How to be agile when most people have special jobs? <p>our team worked with SCRUM since a bunch of month (nearly 2 years). When in the first time it was a miracle how good it works, we now run against walls with this strategy.</p> <p>Our problem is, that we have now (from a team of 10-12 people) a lot of special jobs,...
<p>The most obvious solution to your problem would be to try to make the team more cross-functional. Why is this not an option? If more than one person can perform a task, you would decrease these problems.</p>
MySQL Session Table Approach <p>I am developing a multi-tenant web application using LAMP. All my user session data is currently stored in mysql with table type InnoDB.</p> <p>Is there any way that I can use MEMORY (used to be HEAP) table type to store the current sessions and use the garbage collector function of the...
<p>Writing a <a href="http://us2.php.net/manual/en/function.session-set-save-handler.php">custom session handler</a> is surprisingly easy, but I think there are probably better ways to store session data than <code>MEMORY</code> tables.</p> <p>A schema something like (lifted with changes from <a href="http://stackover...
MySql User Defined Variable <p>How to use the user defined variable in a way that the value of the variable is reused in the subsequent query in mysql?</p>
<p>Just use it:</p> <pre><code>SELECT @r := 1 --- 1 SELECT @r := @r + 1 --- 2 </code></pre>
delete a NULL pointer does not call overloaded delete when destructor is written <pre><code>class Widget { public: Widget() { cout&lt;&lt;"~Widget()"&lt;&lt;endl; } ~Widget() { cout&lt;&lt;"~Widget()"&lt;&lt;endl; } void* operator new(size_t sz) throw(bad...
<p>I remember something similar on operator delete a while ago in comp.lang.c++.moderated. I cannot find it now, but the answer stated something like this ..</p> <blockquote> <p>Unfortunately, the language specification is not sufficiently clear on whether the control should go into the overloaded 'operator de...
Can UILabel's drawTextInRect method be overridden to change the size of UILabel's text? <p>Apple's documentation for drawTextInRect seems to indicate this is possible:</p> <blockquote> "By the time this method is called, the current graphics context is already configured with the default environment and text color for...
<pre><code>/* use CGContextSetLineWidth() and CGContextSetStrokeColorWithColor() to adjust your outline settings: directly preceding StrokeRect() */ - (void)drawTextInRect:(CGRect)rect{ [super drawTextInRect:rect]; // let super do the work CGContextStrokeRect(UIGraphicsGetCurrentContext(),rect); } </code>...
SVG draggable using JQuery and Jquery-svg <p>I have an HTML 5 page where I load an svg circle. When I click on the circle I create another small circle where I click. I want to be able to drag the second circle but cant seem to do it with jquery-ui .draggable();</p> <p>I am able to move the circle by accessing its cx ...
<p>jQuery UI draggable behavior does work, but you need to update the position manually in the drag handler, as relative CSS positioning doesn't work inside SVG.</p> <pre><code>svg.rect(20,10,100,50, 10, 10, {fill:'#666'}); svg.rect(40,20,100,50, 10, 10, {fill:'#999'}); svg.rect(60,30,100,50, 10, 10, {fill:'#ccc'}); ...
How to implement a Cocoa-based Adobe Photoshop plugin <p>Cocoa used to work on CS3 with the <a href="http://furbo.org/2008/07/08/plug-ins-the-cocoa-way/" rel="nofollow">trick of putting a Cocoa bundle inside the main Carbon plugin bundle</a>, loading it from Carbon and issuing a NSApplicationLoad(). That's because Phot...
<p>You have to create a new <em>Loadable Bundle</em> target that contains your nibs and your Cocoa code. Add the bundle product to the <em>Copy Bundle Resources</em> phase of your plugin. Then the code for a filter plugin that loads a Cocoa window with some controls would be:</p> <pre><code>Boolean DoUI (void) { ...
How can I submit jQuery form object (not ajax)? <p>How can I submit jQuery form object (not ajax)?</p> <p>I try form.submit() and it doesn't work.</p> <p>I create the form by </p> <pre><code>tempform = $("&lt;form method='post'&gt;&lt;/form&gt;"); tempform.attr("action", "abc.aspx"); </code></pre> <p>and then appen...
<p>Maybe try this:</p> <pre><code>tempform = $("&lt;form method='post'&gt;&lt;/form&gt;").attr('id','myForm'); tempform.attr("action", "abc.aspx"); $('body').append(tempform); $('#myForm').submit(); </code></pre> <p>Also worth pointing out that it has no elements. What makes you say it doesn't work?</p>
Using an array for GET variables <p>I am currently using the following code for Get variables, and would like to know the best way to convert to an array. Is the main advantage of doing this just aesthetic, or is there a performance/efficiency aspect as well?</p> <pre><code>if (isset($_GET["cmd"])) $cmd = $_GET["cmd...
<p>Basically, if you are doing repetition like the above then there is usually a better way of doing things. If you have a collection data, as it looks like you do, it is always generally best to keep it in an array.</p> <p>If you are getting it from a form you can actually put it in an array in the form itself, usin...
C#, C++/cli: How do you unit test a component that can only be loaded once per process <p>I'm currently implementing a .NET wrapper for a Java library by using JNI to start the JavaVM and interacting with Java classes. To be on the save side, I'd like to have unit tests for my code. </p> <p>The Problem I'm facing now ...
<p>You could create an ad-hoc .Net test application, that would run on its own process. </p> <p>Your NUnit tests would thus launch this process (even in command line), let it actually run the tests, and the return the value as std output. IOW, keep it simple and launch many processes.</p>
How to set binary data using setBlob() in C++ connector <p>I know this has been asked before, and I tried to implement the solution, but I just get exception errors when I call ps->executeUpdate(). Has anyone got an explicit example?</p>
<p>Sorry Matthew - I assumed the previous answer to this question (by elrohin). Maybe I should have replied to that. Anyway heres the code he suggested:</p> <pre><code>class DataBuf : public streambuf { public: DataBuf(char * d, size_t s) { setg(d, d, d + s); } }; // prepare sql update statement etc. and...
Why do I always get the same sequence of random numbers with rand()? <p>This is the first time I'm trying random numbers with C (I miss C#). Here is my code:</p> <pre><code>int i, j = 0; for(i = 0; i &lt;= 10; i++) { j = rand(); printf("j = %d\n", j); } </code></pre> <p>with this code, I get the same sequence...
<p>You have to seed it. Seeding it with the time is a good idea:</p> <p><a href="http://en.cppreference.com/w/cpp/numeric/random/srand"><code>srand()</code></a></p> <pre><code>#include &lt;stdio.h&gt; #include &lt;stdlib.h&gt; #include &lt;time.h&gt; int main () { srand ( time(NULL) ); printf ("Random Number: %d...
SQL Server Group By Query using multiple values <p>I am new to Microsoft SQL Server and have been frustrated by a GROUP BY query that won't do what I want it to. The table is the following:</p> <pre><code>make model distancefrom distanceto driverid toyota yaris 358.2 368.2 401 toyota yaris 368.2 3...
<p>You clearly want to keep journeys separate - the results you say you want for e.g. driver 401 involve the first row, then min/max run over the second set of rows for that driver. So it looks as if you are missing a "JourneyID" column or similar. The first row would have one value for JourneyID, the second set of row...
Assigning string to class redirects it to property <p>I have a class named Car with property Name. Now every time I like to change Name of my Car I must write Car1.Name = "Porka Turbo". Now what I would like to acomplish is 5 characters less to write like this:</p> <pre><code>Car1 = "Porka Turbo" </code></pre> <p>It ...
<p>Assuming <code>Car1</code> is a variable of type <code>Car</code>, you can't do it. Nor should you - it's a readability nightmare.</p> <p>Assignment to a variable should mean a change in the value of the variable to the (possibly converted) value on the RHS of the assignment operator. You're trying to change the me...
Android emulator Output <p>I am running on helloword application as getting started with android application developement. but i cant able to see output in android emulator. it will show only android in the emulator screen. and i am just print "Hello from Brijesh". but it will not display in the emulator of the android...
<p>If i understand correctly, you would like to output some debugging messages to the screen ? In standard java you can use the System.out.println method, but with android i suggest you use the Dalvik debugger. </p> <p>Use:</p> <pre><code>Log.i("mytag","My simple message"); </code></pre> <p>And se the output by usin...
Include folder in setup project <p>I want to include a folder in a setup project so that when I deploy that setup the complete folder is also deployed to the install location.</p>
<p>Right click the setup project, and select "View" > "File System", and from there you can access a lot of special folders like install folder, appdata, desktop etc, and add files to there, that will be created when you install the application. Make sure to set the "alwayscreate" property to true.</p>
Linq where in between IENumerable and List<> <p>I have filled <code>List&lt;Object1&gt;</code> Object 1 contain 2 fields (int id &amp; string name)</p> <p>Also i Have <code>IEnumerable&lt;Object2&gt;</code> Generated by linq2sql. With fields (id, name)</p> <p>i need to get items from <code>List&lt;Object1&gt;</code> ...
<p>How about:</p> <pre><code>HashSet&lt;string&gt; knownIds = new HashSet&lt;string&gt;(list2.Select(x =&gt; x.Id)); var exceptions = list1.Where(x =&gt; !knownIds.Contains(x.Id)); </code></pre> <p>As Earwicker rightly says, this will just give an <code>IEnumerable&lt;Object1&gt;</code> - if you need a list, change t...
Can NVL Function be Cascaded? <p>can nvl() function be cascaded,...it was asked me in IBM interview .....and why????</p>
<p>Better yet, use <code>COALESCE</code></p>
What's the difference between the HttpRuntime Cache and the HttpContext Cache? <p>I know there is a very similar question <a href="http://stackoverflow.com/questions/863654/difference-b-w-httpruntime-cache-vs-httpcontext-current-cache">here</a> but I was hoping to get a better explination. Why would I ever use HttpCont...
<p>It really is the same cache at the end, only <code>HttpContext.Current</code> can sometimes be null (when not in a web context, or in a web context but not yet constructed). You'd be safe to always use <code>HttpRuntime.Cache</code>.</p>
What does a while after a print mean in Perl? <p>I am new to Perl. Know a little bit of C though. I came across this snippet in one of our classroom notes :</p> <pre><code>$STUFF="c:/scripts/stuff.txt"; open STUFF or die "Cannot open $STUFF for read :$!"; print "Line $. is : $_" while (&lt;STUFF&gt;); </code></pre> ...
<p>It's the same as</p> <pre><code>while (&lt;STUFF&gt;) { print "Line $. is : $_"; } </code></pre> <p>It's written the way it is because it's simpler and more compact. This is, in general, Perl's <sub>(in)</sub>famous "statement modifier" form for conditionals and loops.</p>
Why can't I call super method from an in-place event handling function? <p>I have a overriden function in my class, that adds an event handler like so:</p> <pre><code>override public function hide():void { ... tween.addEventListener(TweenEvent.MOTION_FINISH, function(evt:Event):void { ... super.hide(); }...
<p>it is, because <code>this</code> in an anonymous function points to <code>[object global]</code> ... have a go, and trace it ...</p> <p>now an AS3 feature is, that you can access instance members from inside there, but that's a really strange feature ... <code>this.myProp</code> will not work, whereas <code>myProp<...
How do I make this template class compiling in both VC6 and VC9 <p>I have a template class compiling fine in VC6. But it is not compiling in VC9. For that I have added "typename" keyword in front of one type. After this it is compiling in vc9 but not in VC6. How do I make it compiling with both the compilers.</p> <pre...
<p>VC6 is not very standards-compliant. You may just have to #IFDEF your way around this one.</p>
Is there some Gui component I can use to allow users to create connection strings? <p>I have an client app which will use a connection string to get access to some data. I need the administrators to be able to define the connection string that the clients will use. I would like to give them a wizard similar to the on...
<p>Look at this one <a href="http://geekswithblogs.net/thibbard/archive/2005/06/29/45087.aspx" rel="nofollow">http://geekswithblogs.net/thibbard/archive/2005/06/29/45087.aspx</a> also in discuss I could implement it for you)))</p>
AS3: TextField Focus <p>I'm trying to handle a focus event on a TextField so I can select all the text when focusing (tab or click). Seems like I'm doing something wrong here ?</p> <pre><code>txtTextField.addEventListener(FocusEvent.FOCUS_IN, handleFocusIn); function handleFocusIn() { //select all text here } </code>...
<p>I needed the same thing, to select the contents of a textfield when it receives focus. </p> <p>I tried:</p> <p>A) Simply selecting after a FocusEvent. This doesn't seem to work (my guess is that FocusEvents are fired before the mouse click is being processed, which in turn will undo the selection).</p> <p>B) Sele...
What is the fastest way to find out if a string ends with another string? <p>What is the best rewrite of this method to speed it up?</p> <pre><code>public static bool EndsWith(string line, string term) { bool rb = false; int lengthOfTerm = term.Length; string endOfString = StringHelpers.RightString(line...
<p>Maybe I am missing the point completely, but I would spontaneously go for the <a href="http://msdn.microsoft.com/en-us/library/system.string.endswith.aspx" rel="nofollow"><code>String.EndsWith</code></a> method.</p>
Unable to open Qt form (*.ui) files from Visual Studio <p>I am unable to open QT form file (*.ui) from a Visual Studio 2008 Qt project. I'm using Qt 4.5.0. I get the the following error:</p> <pre><code>The file test.ui cannot be opened with Qt 4 form editor. Try converting the file using uic.exe </code></pre>
<p>Are you sure that your *.ui file are in the qt4 format and not in the qt3 format ? If there have been created with qt3, ui.exe can convert them to qt4 !</p> <p>Another reason could be the version of the qt-integration tool for visual studio 2008, Do you have the last version ? Can you open the *-ui file with Qt Des...
How to assign multiple values to an Open or Fixed-size array? <p>I want to do the following,but I get errors:</p> <pre><code>procedure JumpToCodeCave(CurrentLocation:DWORD;Destination:Pointer;out_JmpBack:Pointer); var calc:DWORD; jmppatch:Array[0..3] of byte absolute calc; Buffer:Array[0..9] of byte; begin calc := (...
<p>Delphi doesn't support array literals like that, especially not ones that would accept a four-byte value and turn it into four one-byte values.</p> <p>You can have array constants, <a href="http://stackoverflow.com/questions/1109330/how-to-assign-multiple-values-to-an-open-or-fixed-size-array/1109430#1109430">as Kc...
Removing an inherited Attribute in .net <p>I got a ASP.NET MVC controller like this</p> <pre><code>[Authorize] public class ObjectController : Controller { public ObjectController(IDataService dataService) { DataService = dataService; } public IDataService DataService { get;set;} } </code>...
<p>Since it is marked as inherited, there isn't much you can do in this case (since you don't control the code that is checking for the attribute via reflection). Implementing your own attribute seems the most practical option.</p> <p>With MVC you can also often achieve the same functionality with overrides (the <code...
Latex Problem: Undefined control sequence when using /multirow <p>I simple want to combine some cells in a row of a table in Latex. For instance, I tried to compile the following table:</p> <pre><code>\begin{tabular}{|l|l|l|} \hline \multicolumn{3}{|c|}{Team sheet} \\ \hline Goalkeeper &amp; GK &amp; Paul Robi...
<p>How about trying</p> <pre><code>\usepackage{multirow} </code></pre> <p>?</p>
Do ADO.Net DataTables have indexes? <p>I am using VSTS 2008 + C# + .Net 3.5 + SQL Server 2008 + ADO.Net. If I load a table from a database by using a DataTable of ADO.Net, and in the database table, I defined a couple of indexes on the table. My question is, whether on the ADO.Net DataTable, there is related index (the...
<p>Actually George's question is not so "bad" as some people insist it is. (I am more and more convinced that there's no such think as "a bad question".)</p> <p>I have a rather big table which I load into the memory, in a DataTable object. A lot of processing is done on lines from this table, a lot of times, on variou...
How do I remove "duplicate" rows from a view? <p>I have a view which was working fine when I was joining my main table: </p> <pre><code>LEFT OUTER JOIN OFFICE ON CLIENT.CASE_OFFICE = OFFICE.TABLE_CODE. </code></pre> <p>However I needed to add the following join:</p> <pre><code>LEFT OUTER JOIN OFFICE_MIS ON CLIENT.R...
<p>DISTINCT won't help you if the rows have any columns that are different. Obviously, one of the tables you are joining to has multiple rows for a single row in another table. To get one row back, you have to eliminate the other multiple rows in the table you are joining to.</p> <p>The easiest way to do this is to ...
The correct pattern for passing data to child controls in a server control <p>I'm working with a 3rd party system to implement some forms in a website.</p> <p>The 3rd party system provides me with XML definitions for these forms. e.g.</p> <pre><code>&lt;form&gt; &lt;segment&gt; &lt;label&gt;The header&lt;...
<p>As well as looking at different ways of passing information between controls, as the other answers here have put forward, I think that a different approach may be of value, depending on the specifics of your case. An analogous problem to the one you describe - associating some specific text with some controls on a f...
How to group this query so it behaves correctly? <p>I have a table called Stock and another called Listed, within the Stock Table is a Status Code that indicates when something is at the front of the queue of items of stock - I want to be able to find the most recently added item and set this to be the "front of queue"...
<p>This is a variation of <code>pick-a-winner</code>... it's <code>pick-all-losers</code>.</p> <p>Here's the gist. There are several records with a common value, but one record is special - it is the winner. The rest of the records with that common value are losers.</p> <p>For example, this query picks a winner (per...
Can I use generics to populate List(of t) with custom classes? <p>I have several different lists I want to call. They all have the same format for the class: id, value, description, order. Instead of creating a bunch a classes to return the all of the many lists, I wanted to use generics and just TELL it what kind of l...
<p>You could add two generic constraints; I don't know how to express them in VB, but here's the C# version:</p> <ul> <li><code>T : new()</code> - there has to be a parameterless constructor</li> <li><code>T : ICommonInterface</code> - <code>T</code> has to implement an interface</li> </ul> <p>You then put the common...
How can I access the last Perl hash key without using a temporary array? <p>How can I access the last element of keys in a hash without having to create a temporary array?</p> <p>I know that hashes are unordered. However, there are applications (like mine), in which my keys can be ordered using a simple <code>sort</co...
<pre><code>print( (keys %hash)[-1]); </code></pre> <p>Note that the extra parens are necessary to prevent syntax confusion with <code>print</code>'s param list.</p> <p>You can also use this evil trick to force it into scalar context and do away with the extra parens:</p> <pre><code>print ~~(keys %hash)[-1]; </code><...
Firefox, Jquery and missing dom elements <p>I've come across a problem when trying to loop through all divs on a page.</p> <p>I can grab all the divs using $('div') in IE but not in firefox.</p> <p>I did the following as a test :-</p> <pre><code> $(function() { var divs = document.getElementsByTagName('div'...
<p>Check your markup. With 29 divs, I bet you have a missing <code>&lt;/div&gt;</code> or something somewhere. IE might just count the opening tag; perhaps FF is more strict.</p>
What are some ways to map & normalize related data? <p>Let's say you need to funnel random, related data given to you into more succinct categories.</p> <p>Example - You're given the following data. <strong><em>NOTE</em></strong> - There could be any number of other related, columnar data:</p> <pre><code> Customer ...
<p>This seems like a data cleansing exercise, perfection is pretty impossible. Issues:</p> <p>1). Can you specify up front the categories, or must you deduce from the data?</p> <p>2). What rules can we use to accept equivalence?</p> <p>"Cat 1" is the same as "Category 1" ? and "Category one" ? </p> <p>is </p> <p>"...
InternetAttemptConnect causing crash C++ <p>I have an app that uses the wininet libraries to do some server posting/requesting. 99.9% of the time it works perfectly, but once in a blue moon the app will crash on an invalid memory reference while attempting to do ::InternetAttemptConnect(NULL). Sorry that the descriptio...
<p>Are you obeying WinInet's multhithreading guarantees? WinInet is only somewhat thread safe; see <a href="http://groups.google.com/group/microsoft.public.inetsdk.programming.wininet/browse%5Fthread/thread/8cf882060ad412a1/bde28a4732cf368b?q=wininet+thread-safe&amp;%5Fdone=%2Fgroups%3Fq%3Dwininet+thread-safe%26hl%3De...
python singleton into multiprocessing <p>How can I code to share the same instance of a "singletonic" class among processes?</p>
<p>Best is to designate one specific process as owning that instance and dedicated to it; any other process requiring access to that instance obtains it by sending messages to the owning process via a Queue (as supplied by the multiprocessing module) or other IPC mechanisms for message passing, and gets answers back vi...
"Call Stack" for C++ errors in Visual Studio 2005 <p>Is there a "call stack" for compiler errors in Visual Studio 2005 (C++)?</p> <p>For example, I am using a boost::scoped_ptr as the value in a QHash. This is however causing the following compile error:</p> <pre><code>1&gt;c:\qt\include\qtcore\../../src/corelib/tool...
<p>Sometimes with strange errors it helps to preprocess the file and look at that output. With VS look for "Generate Preprocessed File" under preprocessor settings (or set the /P switch). This will generate XXX.i from XXX.cpp which may help you figure out the problem.</p> <p>Make sure you turn off the switch after, wi...
Hide a base class method from derived class, but still visible outside of assembly <p>This is a question about tidyness. The project is already working, I'm satisfied with the design but I have a couple of loose ends that I'd like to tie up.</p> <p>My project has a plugin architecture. The main body of the program di...
<p>If the plugins are only really meant to override one method, I suggest you make them implement an interface with just the one method in. Then your current <code>BasePlugin</code> can use composition instead of inheritance to deal with "real" plugin based just on the interface. It may need to pass something into <cod...
Persistent hashtable for Ruby programs? <p>I need a small unstructured database for my Ruby scripts. Not Sqlite, something more like a persistent hashtables would work perfectly, as long as it can store basic Ruby structures (arrays, strings, hashes etc. - all serializable) and won't get corrupted when Ruby scripts cra...
<p>There is <a href="http://ruby-doc.org/stdlib/libdoc/pstore/rdoc/index.html">PStore</a> in the Ruby Standard Library, no need to install anything.</p> <pre><code>require 'pstore' store = PStore.new('store.pstore') store.transaction do store['key'] = 'value' end </code></pre>
Editing markup of an ASP.NET control then saving on PostBack <p>I am using jquery to append or remove a &lt;ListItem&gt; (rendered as &lt;option&gt;) from the &lt;ListBox&gt; (rendered as &lt;select multiple="multiple"&gt;). </p> <p>The problem arises when I try to save on PostBack. The correct information is saved to...
<p>If you don't want to redirect to the same page after the postback (following the <a href="http://en.wikipedia.org/wiki/Post/Redirect/Get" rel="nofollow">Post-Redirect-Get pattern</a>, which can actually clean ASP.NET pages up tremendously!), your best options are to:</p> <p>1) After you save the item to the databas...
Why doesn't my LINQ to Objects query return any results? <p>I have the following query I'm using (which mostly came from the help I received <a href="http://stackoverflow.com/questions/1075992/how-can-i-organize-this-data-into-the-objects-i-want-with-linq">here</a>):</p> <pre><code> public IEnumerable&lt;Entities.A...
<p>I can offer you a bit of meta-help. You should go grab <a href="http://www.linqpad.net/" rel="nofollow">LINQPad</a> and start using .Dump() to see where you're going wrong (you can also look at the direct SQL translations as well).</p>
Increase a struct pointer with half the struct size <p>I just got an interesting problem to take care of, and I see no neat way to solve it. </p> <p>I have two base data structures that represents a complex graph, declared something like this:</p> <pre><code>typedef struct _node_t node_t; typedef struct _graph_t grap...
<p>On ptrdiff_t : "This is the type returned by the subtraction operation between two pointers. This is a signed integral type, and as such can be casted to compatible fundamental data types. A subtraction of two pointers is only granted to have a valid defined value for pointers to elements of the same array (or for t...
How to get the values of an enum into a SelectList <p>Imagine I have an enumeration such as this (just as an example):</p> <pre><code>public enum Direction{ Horizontal = 0, Vertical = 1, Diagonal = 2 } </code></pre> <p>How can I write a routine to get these values into a System.Web.Mvc.SelectList, given t...
<p>It's been awhile since I've had to do this, but I think this should work.</p> <pre><code>var directions = from Direction d in Enum.GetValues(typeof(Direction)) select new { ID = (int)d, Name = d.ToString() }; return new SelectList(directions , "ID", "Name", someSelectedValue); </code></pre>
How to make php script run another php script <p>I'm trying to do exactly the same thing as in my previous Python question, but in PHP. <a href="http://stackoverflow.com/questions/1104064/run-php-script-from-python">See my previous (answered) question</a></p> <p>PHP script from previous question does something and the...
<p>This is a bit of unix/linux-only hack that might not work on shared web servers:</p> <p><strong>file1.php</strong></p> <pre><code>&lt;?php $somearg = escapeshellarg('blah'); exec("php file2.php $somearg &gt; /dev/null &amp;"); </code></pre> <p><strong>file2.php</strong></p> <pre><code>&lt;?php //do some stuff th...
How to programmatically tell if the terminal server service is running <p>How can I programmatically tell if the terminal services service is running and is healthy? I'm creating a .net console application that will check if terminal services are running on a list of computers.</p> <p>I can check the remote registry e...
<p>If you (or, specifically, the user the application runs as) has permission to do so, you could remotely query the SCM of the target machine to determine if the TS service is running.</p> <p>You should be able to use System.ServiceProcess.ServiceController.GetServices(string machineName) to get a list of all the ser...
jQuery UI regenerate (zombie) draggable elements <p>Dear all, I'd like to know how to create draggable elements using jQuery UI that once they are dragged and dropped into another container, regenerate the same item. For example, I can drop a button from container A to container B, and once I do that, the same button (...
<p>The right way to go about this would be to go with an append or prepending a new element to an existing anchor.</p> <pre><code>var newElement = $("&lt;div id='home'&gt;&lt;/div&gt;").draggable( { snap: '.droppable', revert: 'invalid' } ); $("#homearea").append(newElement); </code></pre>
LINQ, custom objects, serialization and object references <p>I'm currently using LINQ to SQL for data retrieval and then populating my custom objects with LINQ queries. My custom objects inherit from a base class that uses the IsReference = true attribute in the datacontract. I'm then taking my object hierarchy and ser...
<p>Thought I'd update this as I've found a workable solution.</p> <p>Since my custom objects are separate from my DataContext and not tracked by it I went ahead and created a lookup table for my objects and I check that table before instantiating a new object.</p> <p>This has provided me with the references in the XM...
Adding Screentips to a label <p>I know it is possible to add a tooltip to just about every element in Visual Studio, but I was wondering if anyone knew if it was possible to add screentips to a label? I have 5 images I'd like to trigger when the user hovers their mouse above the element (a label).</p> <p>I have 5 labe...
<p>You can create a form in html with an image in it and refer to it on the tool tip by using its id in javascript. <a href="http://www.walterzorn.com/tooltip/tooltip%5Fe.htm#docu" rel="nofollow">Check out this site.</a></p>
WIndow Authentication in Java <p>Can anyone roughly explain how can i do window authentication in JSF application? From google search quite lot of example is about asp.net.</p>
<p>This doesn't really have anything to do with JSF, but rather if your app server has an authentication provider for windows (kerberos/NTLM) authentication.</p>
Subsonic 3 - What is the difference between these approaches? <p>This method works fine:</p> <pre><code>Person p = new Person(3); p.Name = "Bob"; p.Update(); </code></pre> <p>However if I have an IQueryable foreign key collection the below fails</p> <pre><code>var foreignItems = Person.Find(x =&gt; x.ID == 3) foreac...
<p>This looks like a bug, you should report it to <a href="http://github.com/subsonic" rel="nofollow">github</a> (the new host for SubSonic source). In the meantime does calling p.Save() may work around the issue.</p>
Apache: Redirect dynamic subdomains to different ip's <p>I have a application with dynamic subdomains that should be redirected to different servers depending on a part of the subdomain.</p> <p>Example (anything means whateveryouwant, a dynamic name):</p> <pre><code>example.com --&gt; server1 anything.example.com --&...
<p>Sure you can do it in DNS. Just create A records for <code>example.com.</code>, <code>anything.example.com.</code>, <code>b.example.com.</code>, etc. that all have the IP of server 1, and similarly for the domains you want on server 2. Of course, you'll still have to configure virtual hosts for the various domains o...
What do the various Tk cursors mean? <p>My Google-fu is failing me. Please, consider the following: <a href="http://tcl.activestate.com:8000/man/tcl8.4/TkCmd/cursors.htm" rel="nofollow">http://tcl.activestate.com:8000/man/tcl8.4/TkCmd/cursors.htm</a></p> <p>Some of the cursors I understand easily enough, "watch" tells...
<p>See <a href="http://wiki.tcl.tk/13165" rel="nofollow">http://wiki.tcl.tk/13165</a>, a Tk cursor demo written by Richard Suchenwirth </p>
How do I replace the formula in a cell with the output of the formula? <p>How do I replace the formula in a cell with the output of the formula? </p> <p>I simply need "=RIGHT(E86,LEN(E86)+1-FIND("(",E86,1))" to become "(e)"</p> <p>Is there a way to do this to the whole sheet? Replace all the cells with formulas with ...
<p>Select the cells you want to replace and copy them. Then go to "Edit->Paste Special" and select values instead of all.</p> <p>Since this doesn't change non-formula cells, you could select the entire sheet and copy->paste special to remove all formulas.</p> <p>To do it programatically, look at Steve's answer. He...
Server Connection dies out with ICEFaces with long request <p>I have long HTTP request ( generating large Excel file - about 60K records or so) which takes like 5 minutes to complete. The wheel with icefaces shows connection is dead and although the file is ready on the server, ICEFaces page is dead and I have to refre...
<p>Seems to be a client timeout! Try async creation with ajax response.</p>
How do I search for an array of values in a many to many relation? <p>I have a problem with my LINQ to Entity model many to mant relation. I am new to both C# and LINQ, so bear with me.</p> <p>I have a model containing pictures and tags, where each picture can have many tags, and each tag can be on many pictures. In t...
<p>There are a lot of ways to do this. Here is one way. I'm not going to claim it's "the best," but it will work.</p> <pre><code>IQueryable&lt;Picture&gt; FindByTags(IEnumerable&lt;string&gt; tags) { var q = Context.Pictures; foreach (var tag in tags) { q = q.Where(p =&gt; p.Tags.Any(t =&gt; t.Nam...
WebDAV behind a reverse proxy <p>I have 2 servers. One Reverse proxy on the web and one on a private link serving WebDAV.</p> <p>Booth servers are apache httpd v2.</p> <p>On the proxy I have:</p> <pre> ProxyRequests Off &lt;Proxy *&gt; Order deny,allow Allow from all &lt;/Proxy&gt; ...
<p>Hmm, found the answer. Always the same :)</p> <p>I added:</p> <pre> LoadModule headers_module /usr/lib/apache2/modules/mod_headers.so RequestHeader edit Destination ^https http early </pre> <p>and it worked. I don't know if this has drawbacks. I'll see.</p>
Magento Inheriting and Re-Using Template Variables <p>Is it possible to pass a variable from a parent template to a child template. For example, if i wanted to put some repeated HTML in a separate template that was included within a foreach loop in its parent template</p> <pre><code>&lt;?php foreach ($items as $item...
<p>I've split my product list template to a separate file so I can use it in several places.</p> <p>In the parent template, I do something like:</p> <pre><code>&lt;?PHP $this-&gt;getChild('product_list_list')-&gt;setData('products', $_productCollection); echo $this-&gt;getChildHtml('product_list_list'); ?&gt; </code...
Does Flash10 + p2p really work? <p>I've been googling around and I still can't get it. Some people say: here you go, just use it. Others claim it has certain restrictions that does not allow you to use p2p the way you want it in Flash.</p> <p>So, here's a simple question: <strong>is it possible to implement a Flash10 ...
<p>The answer is pretty much no ... well, it's just no, to be honest.<br> @drudru pointed out the right technology for flash p2p, i.e. stratus.</p> <p>Flash p2p is based on RTMFP, which is built upon UDP. Actually, flash does bind a port, but this comes from the internals. There is no API to do that manually.</p> <p>...
Non greedy searches with Hpricot? <p>I'm using Hpricot for traversing an XML packet. For each node I'm on, I want to get a list of the <strong>immediate</strong> children . However when using </p> <pre><code>(current_node/:section) </code></pre> <p>I'm getting ALL descendant sections, not just the immediate childre...
<p>You can just use <code>current_node.children</code>.</p>
AMR Encoder for iPhone <p>I was trying to find an <code>AMR Encoder</code> for iPhone,that I can integrate with my Voice recording application.</p>
<p>This is addressed in this topic, basically you can't out of the box but there is open source you could try to incorporate.</p> <p><a href="http://stackoverflow.com/questions/276644/how-can-i-record-amr-audio-format-on-the-iphone/614686">http://stackoverflow.com/questions/276644/how-can-i-record-amr-audio-format-on-...
Problem with manually editing a textbox bound to a property that's continuously updated <p>I have a textbox bound to a property. The property continously gets updated from a timer. What I'm trying to do is to make it so that when I'm in the middle of typing something in the textbox, the textbox should stop updating its...
<p>I'm not a WPF or databinding expert, so there may be a better way, but I'd say you'll have to handle the GotFocus and LostFocus events and add/remove the databinding in those event handlers.</p>
Can't autoscroll a VBox unless height is explicity set(in pixels) in Flex 3 <p>I have a VBox who dynamically adds and removes children programatically. The height is set to 100% and verticalScrollPolicy=auto.</p> <p>When a user wants to add another child to that Vbox, I want it to autoscroll to the bottom of the VBox ...
<p>You might not be scrolling the VBox, actually; there's a good chance that if your VBox is contained by another container, like a Canvas or the like, and you're adding items to the VBox as you say you are, it's the Canvas that's doing the scrolling, not the VBox -- in which case the VBox would indeed return 0 for its...
Flash Actionscript NTLM authentication example? <p>Does anyone have an example of calling a webservice from actionscript 3.0 with NTLM authentication in place. The adobe livedocs list NTLM authentication as supported but I can't figure out where to pass user credentials.</p> <p>Thanks, Peter</p>
<p>I'm fairly sure that this is not directly possible except when using Adobe AIR. The authentication info in the LiveDocs is applicable only to AIR (the little symbol next to the method name signifies this).</p> <p>From some quick reading about <a href="http://www.innovation.ch/personal/ronald/ntlm.html" rel="nofollo...
Basic File upload in GWT <p>I'm trying to figure out how to upload one file using GWTs FileUpload widget. I'm using GWT and Google AppEngine with Java but I would like to upload file to my own Linux server. I have the following code already but now I can't figure out how to submit my file to the Google AppServer serve...
<p>Here's the code from my app:</p> <p>1) I created a class to accept http request:</p> <pre><code>import java.io.ByteArrayOutputStream; import java.io.IOException; import java.io.InputStream; import javax.servlet.ServletException; import javax.servlet.http.HttpServlet; import javax.servlet.http.HttpServletRequest;...