instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>What are the ways to retrieve data submitted to the web server from a form in the client HTML in ASP.NET?</p>
| <p>You can also search through both the Form and QueryString collections at the same time so that the data will be found regardless of the the request method.</p>
<pre><code>value = Request("formElementID")
</code></pre>
| <p>In VB.NET</p>
<p>For POST requests:</p>
<pre><code>value = Request.Form("formElementID")
</code></pre>
<p>For GET requests:</p>
<pre><code>value = Request.QueryString("formElementID")
</code></pre>
| 5,064 |
<p>I teach the third required intro course in a CS department. One of my homework assignments asks students to speed up code they have written for a previous assignment. Factor-of-ten speedups are routine; factors of 100 or 1000 are not unheard of. (For a factor of 1000 speedup you have to have made rookie mistakes ... | <p>I would say something like Git might fit the bill:</p>
<ul>
<li>As it's a distributed system, you don't need to have a central repository, the repos exist with the source directory</li>
<li>It is easy to create patch files that can be mailed and applied.</li>
<li>Although it might seem that git is difficult to use,... | <p>I would say your best bet will be to try to work with your IT department to set up a system/method for your students to easily create new SVN/CVS repositories.</p>
<p>Probably you could get the IT department to give you the privileges necessary to create repositories for your students even if they won't give the pr... | 42,299 |
<p>Do you know what's the format of the DepartureWindow parameter for sabre web-services' OTA_AirLowFareSearch call? Whatever I pass, it shows me an error.</p>
<p>This is the entire documentation for those parameters (I kid you not):</p>
<pre><code><!--"DepartureDateTime" represents the date and time of departure.... | <p>You must specify time within window in DepartureDateTime</p>
<pre><code> <ns1:DepartureDateTime>2009-01-03T15:00:00</ns1:DepartureDateTime>
<ns1:DepartureWindow>11001559</ns1:DepartureWindow>
</code></pre>
<p>works fine for me</p>
| <p>also, you can use OriginDestinationInformation.TPA_Extensions.AlternateTime instead</p>
| 37,080 |
<p>When I launch perfmon and try to add a counter, the displayed performance objects are all numbers. How can I reset these Performance objects?</p>
| <p>I found a way to solve the problem:</p>
<ul>
<li>copy C:\WINDOWS\system32\PerfStringBackup.INI from a PC where perfmon works correctly</li>
<li>cd C:\WINDOWS\system32</li>
<li>lodctr /R:PerfStringBackup.INI</li>
</ul>
| <p>What do you mean my "reset"? What's the behavior you're expecting? </p>
<p>The perfmon "System Monitor" view shows the (near) real time value of the counter. Since these measurements are always being taken there will (almost) always be a number there.</p>
<p>If you want to be able to control the collection of thes... | 30,040 |
<p>I'm writing a query to summarize some data. I have a flag in the table that is basically boolean, so I need some sums and counts based on one value of it, and then the same thing for the other value, like so:</p>
<pre><code>select
location
,count(*)
,sum(duration)
from my.table
where type = 'X'
and locati... | <pre>
<code>
select
location
,Sum(case when type = 'X' then 1 else 0 end) as xCount
,Sum(case when type = 'Y' then 1 else 0 end) as YCount
,Sum(case when type = 'X' then duration else 0 end) as xCountDuration
,Sum(case when type = 'Y' then duration else 0 end) as YCountDuration
from my.table
where
location ... | <p>To make the counts work, instead of count(a.*) just do count(a.location), or any other not-null column (the PK would be ideal).</p>
<p>As to the main question, either of the answers given by shahkalpesh or George Eadon above would work. There is no reason in this example to join the table twice.</p>
| 28,146 |
<p>Almost every Java book I read talks about using the interface as a way to share state and behaviour between objects that when first "constructed" did not seem to share a relationship. </p>
<p>However, whenever I see architects design an application, the first thing they do is start programming to an interface. How ... | <p>Programming to an interface means respecting the "contract" created by using that interface. And so if your <code>IPoweredByMotor</code> interface has a <code>start()</code> method, future classes that implement the interface, be they <code>MotorizedWheelChair</code>, <code>Automobile</code>, or <code>SmoothieMaker<... | <p>In one sense, I think your question boils down to simply, "why use interfaces and not abstract classes?" Technically, you can achieve loose coupling with both -- the underlying implementation is still not exposed to the calling code, and you can use Abstract Factory pattern to return an underlying implementation (in... | 7,108 |
<p>Ok, so there has to be a way to do this... no? If not I'd love some ideas. </p>
<p>I have two repeaters and an image inside an update panel along with some AJAX dropdowns with link buttons to the left. I want to update the data inside the update panel as fast as possible as values are selected from the dropdowns. <... | <p>As far as I know, it is not easy to get just Data and data-bind the repeater on the client side. But, you might want to <a href="http://dotnetslackers.com/articles/ajax/ASPNETRepeater.aspx" rel="nofollow noreferrer">check this out</a>.</p>
| <p>Wrap only the repeater you want to rebind with an update panel of its own. The only viewstate transferred when doing this is the portion inside the update panel. You may have to play around with the triggers and update mode of the panels to get everything to play nicely. </p>
<p>Another option is instead of usin... | 8,715 |
<p>How do I format a string to <a href="http://www.grammar-monster.com/lessons/capital_letters_title_case.htm" rel="noreferrer">title case</a>?</p>
| <p>Here is a simple static method to do this in C#:</p>
<pre><code>public static string ToTitleCaseInvariant(string targetString)
{
return System.Threading.Thread.CurrentThread.CurrentCulture.TextInfo.ToTitleCase(targetString);
}
</code></pre>
| <p>Without using a ready-made function, a super-simple low-level algorithm to convert a string to title case:</p>
<p><pre><code>
convert first character to uppercase.
for each character in string,
if the previous character is whitespace,
convert character to uppercase.
</pre></code></p>
<p>This asssumes t... | 2,316 |
<p>is there a way to change an oracle user's default schema?</p>
<p>I found it in the FAQ that I can alter it in the session, but it's not what I want. E.G. the user at log on always sees another schema as default.</p>
<p>Thanks in advance.</p>
| <p>I believe a logon trigger should work:</p>
<pre><code>CREATE OR REPLACE TRIGGER db_logon
AFTER logon ON DATABASE WHEN (USER = 'A')
BEGIN
execute immediate 'ALTER SESSION SET CURRENT_SCHEMA = B';
END;
</code></pre>
| <pre><code>create or replace trigger AFTER_LOGON_TSFREL
AFTER LOGON ON "TSFRELEASEAPP".SCHEMA
BEGIN
EXECUTE IMMEDIATE 'ALTER SESSION SET current_schema=TSF_RELEASE';
END;
</code></pre>
| 35,960 |
<p>In Ruby, is there the equivalent of the <code>__str__()</code> method that you can define on Python classes? </p>
| <p>You could use to_s.</p>
<p><a href="http://briancarper.net/2006/09/26/ruby-to_s-vs-to_str/" rel="nofollow noreferrer">http://briancarper.net/2006/09/26/ruby-to_s-vs-to_str/</a></p>
| <p>On the core classes it is typically 'inspect'.</p>
<p>Eg:</p>
<pre><code>irb(main):001:0> puts "array is: #{[1,2,3].inspect}"
array is: [1, 2, 3]
=> nil
irb(main):002:0> puts "array is: #{[1,2,3]}"
array is: 123
=> nil
irb(main):003:0>
</code></pre>
| 16,349 |
<p>In the past and with most my current projects I tend to use a for loop like this:</p>
<pre><code>var elements = document.getElementsByTagName('div');
for (var i=0; i<elements.length; i++) {
doSomething(elements[i]);
}
</code></pre>
<p>I've heard that using a "reverse while" loop is quicker but I have no rea... | <p>Here's a nice form of a loop I often use. You create the iterated variable from the for statement and you don't need to check the length property, which can be expensive specially when iterating through a NodeList. However, <strong>you must be careful</strong>, you <strong>can't use it if any of the values in array ... | <p>I like to use a <a href="https://developer.mozilla.org/en-US/docs/Web/API/TreeWalker" rel="nofollow">TreeWalker</a> if the set of elements are children of a root node.</p>
| 19,028 |
<p>I have the following html code: </p>
<pre><code><h3 id="headerid"><span onclick="expandCollapse('headerid')">&uArr;</span>Header title</h3>
</code></pre>
<p>I would like to toggle between up arrow and down arrow each time the user clicks the span tag. </p>
<pre><code>function expandCol... | <p>When the HTML is parsed, what JQuery sees in the DOM is a <code>UPWARDS DOUBLE ARROW</code> ("⇑"), not the entity reference. Thus, in your Javascript code you should test for <code>"⇑"</code> or <code>"\u21d1"</code>. Also, you need to change what you're switching to:</p>
<pre><code>function expandCollapse(id) {
... | <p>Maybe you're not getting an exact match because the browser is lower-casing the entity or something. Try using a carat (^) and lower-case "v" just for testing.</p>
<p>Edited - My first theory was plain wrong.</p>
| 4,983 |
<p>I'm using an <em>Edit in Place</em> jquery plugin which needs to post the data to a script that will do the actual database update.</p>
<p>The URL to this update script is easily viewable in the html source as well as with Firebug, so I need to add some sort of authentication check before the update is processed. T... | <p>I think you'd be best off switching the script to a POST method as most edit-in-place uses will be too big to use GET practically. You should never use the SessionId or the password as a URL parameter and I wouldn't use the username for anything but viewing a public profile. If your AJAX URL is a PHP file, I'm fairl... | <p>To pass the information you should use the session id in the actual GET string. This way the php script can connect to the session, validate the user, and see if the user has the rights to edit what they've posted. Then if they have the rights, proceed, or else return an error message.</p>
<p>I believe you can, i... | 29,950 |
<p>Let's say I have the three following lists</p>
<p>A1<br>
A2<br>
A3 </p>
<p>B1<br>
B2</p>
<p>C1<br>
C2<br>
C3<br>
C4<br>
C5 </p>
<p>I'd like to combine them into a single list, with the items from each list as evenly distributed as possible sorta like this:</p>
<p>C1<br>
A1<br>
C2<br>
B1<br>
C3<br>
A2<br>
C4<b... | <ol>
<li><p>Take a copy of the list with the most members. This will be the destination list.</p>
</li>
<li><p>Then take the list with the next largest number of members.</p>
</li>
<li><p>divide the destination list length by the smaller length to give a fractional value of greater than one.</p>
</li>
<li><p>For each i... | <p>A quick suggestion, in python-ish pseudocode:</p>
<pre><code>merge = list()
lists = list(list_a, list_b, list_c)
lists.sort_by(length, descending)
while lists is not empty:
l = lists.remove_first()
merge.append(l.remove_first())
if l is not empty:
next = lists.remove_first()
lists.appen... | 44,866 |
<p>I need to get the actual local network IP address of the computer (e.g. 192.168.0.220) from my program using C# and .NET 3.5. I can't just use 127.0.0.1 in this case.</p>
<p>How can I accomplish this?</p>
| <p>In <a href="http://www.devcity.net/Articles/62/1/gethostbyname.aspx" rel="nofollow noreferrer" title="Article by John Spano, Published 1 Dec 2002"><em>How to get IP addresses in .NET with a host name</em></a> by John Spano, it says to add the <code>System.Net</code> namespace, and use the following code:</p>
<blockq... | <p>If you know there are one or more IPv4 addresses for your computer, this will provide one of them:</p>
<pre><code>Dns.GetHostAddresses(Dns.GetHostName())
.First(a => a.AddressFamily == AddressFamily.InterNetwork).ToString()
</code></pre>
<p><code>GetHostAddresses</code> normally blocks the calling thread wh... | 18,229 |
<p>We are currently working on an application that will use a WCF service. The host (the client) is using the excellent <a href="http://bloggingabout.net/blogs/erwyn/archive/2006/12/09/WCF-Service-Proxy-Helper.aspx" rel="nofollow noreferrer">WCF Service Proxy Helper from Erwyn van der Meer</a>.</p>
<p>What I would lik... | <p>You should try to minimize the number of proxy objects you create. Proxies in WCF are quite expensive to set up, so creating one and calling functions on it multiple times is definitely more efficient than creating a new one for each method invocation.</p>
<p>The relationship between proxy objects and connections ... | <p>It doesn't do pooling like SqlConnection, if that is what you mean.</p>
<p>[caveat: I use "connection" here loosely to mean a logical connection, not necessarily a physical connection]</p>
<p>Between using a connection on-demand, and keeping one around, there are advantages and disadvantages to both approaches. Th... | 34,738 |
<p>I have very little experience building software for Windows, and zero experience using the Windows API, but I'm reasonably familiar with Python. How should I go about learning to use the Windows API with Python?</p>
| <p>Honestly, no. The Windows API is an 800 pound monster covered with hair. <a href="http://www.charlespetzold.com/faq.html" rel="noreferrer">Charlie Petzold's 15 pound book</a> was the canonical reference once upon a time.</p>
<p>That said, the <a href="http://python.net/crew/mhammond/win32/" rel="noreferrer">Pytho... | <p>Once upon a time I read over some Win32 API tutorials at <a href="http://www.relisoft.com" rel="nofollow noreferrer">www.relisoft.com</a></p>
<p>They are an anti-MFC and pro-Win32 API shop and have a manifesto of sorts explaining practical reasons for why.</p>
<p>They also have a general C++ tutorial. 99% of the ... | 44,562 |
<p>I am trying to pass some Subsonic collections to a client via a web service. When I reference the web service the IDE complains with:</p>
<p>Cannot serialize member 'EndDate' of type System.Nullable`1[System.DateTime]. XmlAttribute/XmlText cannot be used to encode complex types.</p>
<p>Is there any way of seriali... | <p>The way you handle optional properties is to include a boolean XXXSpecified member where XXX is the name of the property. Nullable types are not handled properly by the xml serializer used by ASMX. Note that this is not a limitation of WCF.</p>
| <p>This is a .NET Limitation</p>
<p>If you want you can try generating your classes with this property in the SubSonicService section in the the web.config file.</p>
<p>generateNullableProperties="false"</p>
<p><a href="http://forums.subsonicproject.com/forums/t/3285.aspx" rel="nofollow noreferrer">http://forums.sub... | 25,361 |
<p>I have a windows service written in dotNet. There is a worker service that spawns worker threads using various Delegate.BeginInvokes. When the service crashes are those threads going to be cleaned up automatically? And if so, when?</p>
| <p>All threads created by your process are inside that process. When your application crashes your process dies, and all threads in that process are terminated abruptly. They are not terminated friendly-like (they're not given an abort signal or anything), they are just killed. They may or may not be given enough proce... | <p>only when the service is terminated and unloaded from memory</p>
| 49,189 |
<p>I'd like to see a series of diffs for a file. I'd settle for simply the log listing restricted to only those entries that modified the file.</p>
| <p><code>svn log filename</code></p>
<p>or </p>
<pre><code>svn log URL
</code></pre>
<p>I also recommend adding <code>--limit N</code> to show only recent entries:</p>
<pre><code>svn log main.cpp --limit 4
</code></pre>
<p>These can be applied to a file or project, BTW.</p>
| <p>SVN Log for a single file</p>
<blockquote>
<p>svn log filename.php</p>
</blockquote>
<p>SVN diff for changes on a file between revision 1033 and 1191</p>
<blockquote>
<p>svn -r 1033:1191 diff filename.php</p>
</blockquote>
| 45,658 |
<p>I have a site where users can post stuff (as in forums, comments, etc) using a customised implementation of TinyMCE. A lot of them like to copy & paste from Word, which means their input often comes with a plethora of associated MS inline formatting.</p>
<p>I can't just get rid of <code><span whatever></c... | <p><a href="http://htmlpurifier.org/" rel="noreferrer">HTML Purifier</a> will create standards compliant markup and filter out many possible attacks (such as XSS).</p>
<p>For faster cleanups that don't require XSS filtering, I use the PECL extension <a href="http://www.php.net/tidy" rel="noreferrer">Tidy</a> which is ... | <p>The website <a href="http://word2cleanhtml.com/" rel="nofollow">http://word2cleanhtml.com/</a> does a good job on converting from Word. I'm using it in PHP by scrapping, to process some legacy HTML, and until now it's working pretty fine (the result is very clean <code><p>, <b></code> code). Of course, b... | 49,696 |
<p>When should you NOT use a singleton class although it might be very tempting to do so? It would be very nice if we had a list of most common instances of 'singletonitis' that we should take care to avoid.</p>
| <p>Do not use a singleton for something that might evolve into a multipliable resource.</p>
<p>This probably sounds silly, but if you declare something a singleton you're making a very strong statement that it is absolutely unique. You're building code around it, more and more. And when you then find out after thousan... | <p>One of the things that tend to make it a nightmare is if it contains <strong>modifiable</strong> global state. I worked on a project where there were Singletons used all over the place for things that should have been solved in a completely different way (pass in strategies etc.) The "de-singletonification" was in s... | 16,394 |
<p>is it possible to throw a custom error message to a ThrowActivity, in windows workflow foundation?</p>
<p>eg. Imagine i want to throw this exception, in my WF :-</p>
<pre><code>CutomException("This is my custom error message", myNumber, myObect);
</code></pre>
<p>cheers :)</p>
| <p>Maybe I do not understand your question well, but you can set the specific exception with the <code>Fault</code> property of <code>ThrowActivity</code> in any place before the activity execution, e.g.:</p>
<pre><code>throwActivity1.Fault = new CustomException("This is my custom error message", myNumber, myObect);
<... | <p>You can throw any custom exception like this way.</p>
<p>public DiscontinuedProductException discontinuedProductException1 = new DiscontinuedProductException();</p>
<p>[SerializableAttribute()]
public class DiscontinuedProductException : Exception
{
public DiscontinuedProductException()
... | 36,370 |
<p>I've been asked to display the 'correct' time on our website which I frankly feel is rather pointless as 'correct' can be interpretted in such a variety of ways.</p>
<p>Our current method definately results in an inaccurate time as it uses a server control rendering JavaScript that runs onload using the datetime fr... | <p>I needed to show the accurate time to clients in an auction web app. You can send the current server time with the page and have the javascript initialize right away without waiting for the rest of the page to load. So the, you only are dealing with network latency which in the worst case is not likely to be more th... | <p>you can use <a href="http://en.wikipedia.org/wiki/Geo_targeting" rel="nofollow noreferrer">geo targeting</a> to know the physical location of a website visitor and in your database stored the (GMT - XX:XX) of the zone and then calculate the time based on the location of the request. that is going to save the long tr... | 30,263 |
<p>We are getting very slow compile times, which can take upwards of 20+ minutes on dual core 2GHz, 2G Ram machines.</p>
<p>A lot of this is due to the size of our solution which has grown to 70+ projects, as well as VSS which is a bottle neck in itself when you have a lot of files. (swapping out VSS is not an optio... | <p>The Chromium.org team listed several options for <a href="http://dev.chromium.org/developers/how-tos/build-instructions-windows" rel="noreferrer">accelerating the build</a> (at this point about half-way down the page):</p>
<blockquote>
<p>In decreasing order of speedup:</p>
<ul>
<li>Install Microsoft hotfi... | <p>Slow Visual Studio Performance … Solved!
September 24th, 2014 by Uzma Abidi</p>
<p>I had an odd performance-related issue today. My Microsoft Visual Studio seemed to be taking far too long to perform even the simplest of operations. I Googled around and tried a few ideas that people had such as disabling add-ins or... | 7,932 |
<p>I'm writing a few little bash scripts under Ubuntu linux. I want to be able to run them from the GUI without needing a terminal window to enter any input or view any output.</p>
<p>So far the only input required is a password for sudo - and gksudo handles that fine.
But I haven't found an easy way to show a message... | <p>I believe <a href="http://live.gnome.org/Zenity" rel="noreferrer">Zenity</a> will do what you want. It's specifically designed for displaying GTK dialogs from the command line, and it's available as an <a href="http://packages.ubuntu.com/hardy/zenity" rel="noreferrer">Ubuntu package</a>.</p>
| <p>Kdialog and dialog are both good, but I'd recommend Zenity. Quick, easy, and much better looking the xmessage or dialog. </p>
| 2,870 |
<p>In Nant, I would like to be able to extract the last name of the directory in a path.<br>
For example, we have the path 'c:\my_proj\source\test.my_dll\'</p>
<p>I would like to pass in that path and extract 'test.my_dll'</p>
<p>Is there a way to easily do this?</p>
| <p>You can actually do it with existing NAnt string functions. Just a bit ugly...</p>
<pre><code>${string::substring(path, string::last-index-of(path, '\') + 1, string::get-length(path) - string::last-index-of(path, '\') - 1)}
</code></pre>
| <p>No. You'll need to write a custom task for something like that.</p>
| 17,612 |
<p>I have several blocks of the following code that each use there own matrix. Is there a way to run each block in it's own thread rather then run all of them sequentially?</p>
<pre>
for i=1:length(DJI)
DJI2(:,1) = reshape(datenum(strvcat(DJI(:,2)(:)), length(DJI(:,2)),'yyyy-mm-dd'));
DJI2(:,2:6) = reshape(str2num(str... | <p>If you want to go with the preconfigured distribution, but still want to let your developers choose, which plugins from a restricted set of plugins to install additionally, then its worth to create a company internal update site, which <strong>mirrors selected features</strong> and plugins, so your developers can in... | <p>We do not have <em>exactly</em> a common eclipse configuration but rather a common eclipse <strong>distribution</strong>.</p>
<p>A new developer copy that distribution, and launches it through a custom "eclipse.exe" which:</p>
<ul>
<li>calls a script checking if there is any in-house updates I have set up since th... | 45,802 |
<p>If I have a form-backing object that has a complicated object tree -- say a Person that has a Contact Info object that has an Address object that has a bunch of Strings -- it seems that the object needs to be fully populated with component objects before I can bind to it. So if I'm creating a new Person, I need to ... | <p>Call it overkill if you like, but what we actually ended up doing was to create a generic factory that will take any object and use reflection to (recursively) find all the null properties and instantiate an object of the correct type. I did this using Apache Commons BeanUtils. </p>
<p>This way you can take an ob... | <p>I guess you are talking about something like <code> < form:input path="person.contactInfo.homeAddress.street"/></code> ?
Not clear for me but assuming i'm right :) :</p>
<p>1) Yes, When you write <code>person.contactInfo.homeAddress.street </code>, read <code>person.getContactInfo().getHomeAddress().getStreet()... | 49,511 |
<p>What is the simplest way to install memcached on CentOS for someone new to the world of Linux? What is the best way to enable it for Apache and PHP</p>
| <p>Unless Apache and PHP have some option to utilize memcached for internal workings (of which I am unaware of), you typically don't "enable" it for such apps. Instead, you would get a <a href="http://www.danga.com/memcached/apis.bml" rel="nofollow noreferrer">client library</a> to use memcached from within your appli... | <p>The easiest way is to find a reilable source of the RPM's needed to install memcached and memcached for PHP. There is a blog post which addresses this concern:</p>
<p><a href="http://blog.gahooa.com/2009/02/08/update-on-fedora-vs-redhat-enterprise-linux/" rel="nofollow noreferrer">http://blog.gahooa.com/2009/02/08... | 4,358 |
<p>I'm building a site using ajax and am trying to decide where to put the files that supply the data for the ajax requests.</p>
<p>For example, I am going to have a .js file that can be included in a page that will create country/state select boxes. I will have the .js file under /inc/js.</p>
<p>However, I am not s... | <p>If you're planning on using a Model-View-Controller architecture, then you would place your ajax handler scripts where you maintain the remainder of the your controller scripts for the site.</p>
<p>For example:</p>
<pre>
/application
/default
/controllers
index.php
index.ajax.ph... | <p>Create a separate site (same server or on another) that will serve only as a REST service generating output for your requests.
When you work with AJAX you are in essence consuming published web services.</p>
| 30,913 |
<p>Is there a tool for Windows XP and Vista (built-in or otherwise ideally freeware/<a href="http://en.wikipedia.org/wiki/Open_source_software" rel="nofollow noreferrer">OSS</a>) that can notify the user when the CPU is above a (configurable) threshold for some (configurable) duration?</p>
<p>I am particularly interes... | <p>Maybe <a href="http://www.donationcoder.com/Software/Mouser/proctamer/index.html" rel="nofollow noreferrer">ProcessTamer</a> could be helpfull. It does not exactly what you are look for. But it might be a quick and dirty solution.</p>
<blockquote>
<p>Process Tamer is a tiny (140k) and super efficient utility for ... | <p>You could write your own utility.</p>
<p>Here a sample as starter:
<a href="http://gist.github.com/11658" rel="nofollow noreferrer">http://gist.github.com/11658</a></p>
<ol>
<li>Create a CpuMeter instance</li>
<li>ResetCounter</li>
<li>Wait for an intervall</li>
<li>Check Cpu utilisation</li>
<li>Start again</li>
... | 12,634 |
<p>Please consider the following <code>fork()</code>/<code>SIGCHLD</code> pseudo-code.</p>
<pre><code> // main program excerpt
for (;;) {
if ( is_time_to_make_babies ) {
pid = fork();
if (pid == -1) {
/* fail */
} else if (pid == 0) {
/* child stuff */
... | <p>Simplest solution would be to block SIGCHLD signal before <code>fork()</code> with <code>sigprocmask()</code> and unblock it in parent code after you have processed the pid.</p>
<p>If child died, signal handler for SIGCHLD will be called after you unblock the signal. It is a critical section concept - in your case ... | <p>In addition to the existing "children" add a new data structure "early deaths". This will keep the contents of children clean.</p>
<pre><code> // main program excerpt
for (;;) {
if ( is_time_to_make_babies ) {
pid = fork();
if (pid == -1) {
/* fail */
} else if (pid ==... | 44,210 |
<p>What is the difference between ArrayList and List in VB.NET</p>
| <p>ArrayLists are essentially deprecated as they're untyped - you need to use casts with them - and they're slower and less space efficient for value types because they require the items to be boxed.</p>
<p>Generic lists were introduced with .Net 2.0 and are the way to go. Often a List is better than an array, with fe... | <p>List can make use of generics so that only objects of specific types can be placed into it, so that you can have extra type checking and so that you can cut down on processing time due to boxing and unboxing. Arraylist cannot use this. In almost all cases, you'll want to use a List rather than an Arraylist.</p>
| 47,717 |
<p>I am trying to write a grammar in EBNF (barring a really good reason, it has to be EBNF) and am looking for a couple of utilities for it - if there's a GUI interface that can make one, that would be great, but the thing I'm looking for most is something that can check the grammar, for instance to see if it is LALR(<... | <p>Taking Steven Dee's suggestion one step further, you might want to check out <a href="http://www.antlr.org/works/index.html" rel="nofollow noreferrer">ANTLRWorks</a>, which is an interactive GUI development tool for ANTLR grammars.</p>
| <p><a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a> is a GUI parser generator in Java that has extensive capabilities for grammar analysis and factoring. Check the FAQ; it might support what you're looking for.</p>
| 33,094 |
<p>I have a pretty good knowledge of programming languages like C/C++, Java, Python. But they were all mostly learnt in a college / high school class room setting where the best user interface was a numbered menu. You know, the standard data structures, implementation of various algorithms, file handling and the like. ... | <p>I'l try the book <a href="https://rads.stackoverflow.com/amzn/click/com/1568843224" rel="noreferrer" rel="nofollow noreferrer">About face: Essential of User Interface Design</a>, its centered on design practices for UI as well as designing taking into account the user goals, that is, what the user wants to acomplish... | <p>I would look into C# .NET development and its <a href="http://en.wikipedia.org/wiki/Windows_Forms" rel="nofollow noreferrer">WinForms</a> API. It's much easier to program GUI desktop apps for Windows with that than with the Win32 API. You can always ease into Win32 API stuff later, if it's still relevant.</p>
<p>... | 11,399 |
<p>From the man page on git-merge, there are a number of merge strategies you can use. </p>
<ul>
<li><p><em>resolve</em> -
This can only resolve two heads (i.e. the current branch and another branch you pulled from) using 3-way merge algorithm. It tries to carefully detect criss-cross merge ambiguities and is consid... | <p>I'm not familiar with resolve, but I've used the others:</p>
<h2>Recursive</h2>
<p>Recursive is the default for non-fast-forward merges. We're all familiar with that one.</p>
<h2>Octopus</h2>
<p>I've used octopus when I've had several trees that needed to be merged. You see this in larger projects where many br... | <p>With Git 2.30 (Q1 2021), there will be a <em>new</em> merge strategy: <strong>ORT</strong> ("<strong>Ostensibly Recursive's Twin</strong>").</p>
<pre><code>git merge -s ort
</code></pre>
<p>This comes from <a href="https://public-inbox.org/git/CABPp-BFRftNf8hoj8nTDiw+akci=w2qVAgamVDyRw1NUk-QCNA@mail.gmail.... | 47,882 |
<p>I have just converted a project from Visual Studio 2003 to 2005 and although most of it 'converted' fine, I have a series of STL errors from the following line:</p>
<pre><code>void SomeFn( std::vector<CSomeObject*>::iterator it,
std::vector<CSomeObject*>::iterator itBegin = NULL,
std::vector<CSomeObj... | <p>Your program is incorrect as NULL cannot be converted as an iterator. I don't really know what you want these iterators to be initialized as. If you need an iterator guarantied not to be in a container but to be still "valid", you can use a default-constructor:</p>
<pre><code>typedef std::vector<CSomeObject*>... | <p>In 2003, <code>std::vector<T>::iterator</code> is just <code>T *</code>. In 2005, at least in debug mode, it is a class, and hence you can't use <code>NULL</code> for its value (<code>NULL</code> resolves to <code>0</code>).</p>
<p>You can use a default-constructed iterator instead:</p>
<pre><code>std::vecto... | 35,969 |
<p>I'm trying to get the start element and the end element of a selection and the offset of the selection in each, i do this in firefox as follows:</p>
<pre><code>var delselection = window.getSelection();
var startOffset = delselection.anchorOffset;
var endOffset = delselection.focusOffset;
var startNode = delselec... | <p>document.selection.</p>
<p>However the TextRange object returned by IE does not match Firefox/WebKit/W3's, and determining the exact positions of the start and end points is very frustrating. Depending on what exactly you are doing with the range you may be able to get somewhere with range.parentElement(), range.in... | <p>You should look at the <a href="http://msdn.microsoft.com/en-us/library/ms537447(VS.85).aspx#" rel="nofollow noreferrer">ControlRange</a> and <a href="http://msdn.microsoft.com/en-us/library/ms535872(VS.85).aspx" rel="nofollow noreferrer">TextRange</a> objects of the IE BOM.</p>
<p>AnchorOffset,focusOffset and wind... | 26,817 |
<p>I just read a post mentioning "full text search" in SQL. </p>
<p>I was just wondering what the difference between FTS and LIKE are. I did read a couple of articles but couldn't find anything that explained it well.</p>
| <p>In general, there is a tradeoff between "precision" and "recall". High precision means that fewer irrelevant results are presented (no false positives), while high recall means that fewer relevant results are missing (no false negatives). Using the LIKE operator gives you 100% precision with no concessions for recal... | <p>FTS is more efficient, powerful (especially for Word Breakers and stemming functionalities)
... but check your requirements because sometimes DBs don't support all languages for example MSSQL doesn't support Greek (check on this page <a href="http://msdn.microsoft.com/en-us/library/ms176076%28v=sql.110%29.aspx" rel... | 27,773 |
<p>is it possible to extend vim functionality via custom extension (preferably, written in Python)?</p>
<p>What I need ideally is custom command when in command mode. E.g.</p>
<p>ESC</p>
<p>:do_this</p>
<p>:do_that</p>
| <p>vim supports scripting in python (and in perl as well, I think).</p>
<p>You just have to make sure that the vim distribution you are using has been compiled with python support.</p>
<p>If you are using a Linux system, you can download the source and then compile it with</p>
<pre><code>./configure --enable-pythoni... | <p>Had a problems to compile Vim with Python. </p>
<blockquote>
<p>...checking if compile and link flags for Python are sane... no: PYTHON DISABLED" in the ./configure output.</p>
</blockquote>
<p>On Ubuntu 10.04 you have to install <code>python2.6-dev</code>. The flags for <code>./configure</code> are:</p>
<pre><... | 16,797 |
<p>I'm looking for an easiest way how to implement the "suggest" feature for a text entry field in a Rails application. The idea is to complete names stored in a database column, giving the user a drop-down menu of possible matches as he types.</p>
<p>Thanks for any suggestions!</p>
| <p>Ruby on Rails has the <a href="http://www.prototypejs.org" rel="noreferrer">Prototype framework</a> available. This framework is used by <a href="http://script.aculo.us/" rel="noreferrer">Script.aculo.us</a> and it provides an <a href="http://demo.script.aculo.us/ajax/autocompleter" rel="noreferrer">autocompleter co... | <p>EDIT: I'll leave this answer here as a sort of theoretical reference point, but it sounds like the <a href="https://stackoverflow.com/questions/194450/suggest-feature-for-textboxes-in-a-rails-app#194453">autocompleter answer</a> is likely to be more useful to you :)</p>
<p>Disclaimer: Although I work for Google (wh... | 23,627 |
<p>I have the following code:</p>
<pre><code>using System;
using System.Linq;
using System.Linq.Expressions;
public class Program
{
public static void Main()
{
Descendant d = new Descendant();
d.TestMethod();
}
}
public class Base
{
protected void FigureItOut<TClass, TMember>(Ex... | <p>How about an extension method that calls the actual (<code>protected internal</code>) implementation? The only downside is you have to add <code>this.</code>.</p>
<p>This works because the <code>source</code> parameter (via <code>this</code>) infers a type for <code>TClass</code>.</p>
<pre><code>public class Base
... | <p>Unless it takes a parameter, it cant be inferred.
Unless it assigns a return value, it cant be inferred.</p>
| 32,734 |
<p>I have a small diagnostic VB.Net application ( 2 forms, 20 subs & functions) written using VB.Net 2008 that targets Framework 2.0 and higher, but now I realize I need to support Framework 1.1. I'm looking for the most efficient way to accomplish this given these constraints:</p>
<ul>
<li>I don't know which pa... | <p>Your app sounds small enough that I would create a fresh project/solution in a separate folder for the 1.1 framework, copy over the necessary files, use the "Add Existing Item" option, and then build. All the problems will bubble up to the surface that way.</p>
<p>A rather "ugly" approach, but it'll show you everyt... | <p>Probably not. If you don't understand which bits are 2.0-specific, you're probably going to have to go the trial-and-error route. However, you can probably save yourself quite a bit of work if you go looking for generics beforehand. In my experience, those are the most numerous 1.1-incompatible bits that tend to mak... | 8,956 |
<p>Take this non-compiling code for instance:</p>
<pre><code>public string GetPath(string basefolder, string[] extraFolders)
{
string version = Versioner.GetBuildAndDotNetVersions();
string callingModule = StackCrawler.GetCallingModuleName();
return AppendFolders(basefolder, version, callingModule, extraFo... | <p>Just pass it. The folders parameter is an array first. the "params" functionality is a little bit of compiler magic, but it's not required.</p>
<pre><code>AppendFolders(extraFolders);
</code></pre>
<p>Now, it this particulat instance, you'll have to add some things to that array, first.</p>
<pre><code>List<s... | <p>A quick and dirty solution would be to build a List<string> from the items and then pass that (with ToArray()).</p>
<p>Note that you don't need to test for the backslash. Path.Combine handles <a href="https://stackoverflow.com/questions/144439/building-a-directory-string-from-component-parts-in-c">the dirty t... | 23,417 |
<p>I have hit a classic problem of needing to do a string replace on a text field in an sql 2000 database. This could either be an update over a whole column or a single field I'm not fussy.</p>
<p>I have found a few examples of how to use updatetext to achieve it but they tend to be in stored procedures, does anyone ... | <p>Here is the sample query to update table with text column using REPLACE function. Hope this is useful for you.</p>
<pre><code>UPDATE <Table> set textcolumn=
REPLACE(SUBSTRING(textcolumn,1,DATALENGTH(textcolumn)),'findtext','replacetext')
WHERE <Condition>
</code></pre>
| <p>You would have to cast the text field to a varchar(8000) or nvarchar(4000) if you are replacing over an ntext field.</p>
<p>MyField = REPLACE(CAST(MyField as VARCHAR(4000)), "string1", "string2")</p>
<p>This ofcourse will only work if you can guarantee the content in the field is <= 4000/8000 characters in leng... | 36,899 |
<p>I've got this code in a pair of button click event handlers on a C# form:</p>
<pre><code>class frmLogin
{
private const int SHORT_HEIGHT = 120;
private const int LONG_HEIGHT = 220;
private EventHandler ExpandHandler;
private EventHandler ShrinkHandler;
public frmLogin()
{
Initializ... | <p>My guess: The DPI or system font size is different on that machine and your form's AutoScaleMode is either "Font" or "Dpi", making your form's MinimumSize or MaximumSize prevent the change.</p>
| <p>Make sure you do not have one of those AutoScale/Size/Whatever properties set to to true.</p>
| 47,170 |
<p>I recently learnt that oracle has a feature which was pretty useful to me - as the designer/implementator didn't care much about data history - I can query the historical state of a record if it's available yet in the oracle cache, like this:</p>
<pre><code>select *
from ( select *
from sometable whe... | <p>Yes, like this:</p>
<pre><code>SQL> select sal from emp where empno=7369;
SAL
----------
5800
SQL> update emp set sal = sal+100 where empno=7369;
1 row updated.
SQL> commit;
Commit complete.
SQL> update emp set sal = sal-100 where empno=7369;
1 row updated.
SQL> commit;
Co... | <pre><code>SELECT *
FROM sometable
VERSIONS BETWEEN TIMESTAMP systimestamp - 1 AND systimestamp
</code></pre>
<p>will give you all versions of all rows in the last day.</p>
<p>There's lots more you can do with this. Check out the <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/statements_... | 46,931 |
<p>There seems to be three common approaches for mapping an application end user to a database user. </p>
<ol>
<li><strong>One to One Mapping:</strong> Each Application user (bob, nancy and fred) also get a corresponding database user account (bob nancy and fred).</li>
<li><strong>N to M mapping:</strong> Each appl... | <p>In addition to the simpler administration, there are performance advantages of option 3 on web-servers; this allows pooling of connections - i.e. a low number of physical database connections can be re-used continuously to service a large number of app users. This is known as the "<a href="http://msdn.microsoft.com/... | <p>Because the database roles (by object, CRUD, etc.) don't generally apply to usernames unless they are database developers. Both AD and the database have roles, but there is the same mismatch between the two. The only halfway defensible mappings would be for administrator roles, but even that is sloppy.</p>
<p>This ... | 45,179 |
<p>I'm trying to get into java again (it's been a few years). I never really did any GUI coding in java. I've been using Netbeans to get started with this.</p>
<p>When using winforms in C# at work I use a usercontrols to build parts of my UI and add them to forms dynamically. </p>
<p>I've been trying to use <code>JPa... | <p>I figured it out. The comments under the accepted answer here explain it:
<a href="https://stackoverflow.com/questions/121715/dynamically-added-jtable-not-displaying">Dynamically added JTable not displaying</a></p>
<p>Basically I just added the following before the mainPanel.add()</p>
<pre><code>mainPanel.setLayou... | <p>Try <code>mainPanel.invalidate()</code> and then if necessary, <code>mainPanel.validate()</code>. It also might be worth checking that you're doing this all in the event dispatch thread, otherwise your results will be spotty and (generally) non-deterministic.</p>
| 20,490 |
<p>What is a free tool to compare two Sql Server tables (data and schema). </p>
<p>It would be great if the tool can script the differences found.</p>
<p>I also went through some older <a href="https://stackoverflow.com/questions/176316/compare-tools-to-generate-update-script-for-sql-server">posts</a>. The closest I... | <p>TableDiff.exe should have everything you need. It is one of the <a href="http://www.microsoft.com/technet/prodtechnol/sql/bestpractice/gems-top-10.mspx" rel="noreferrer">hidden gems in SQL Server 2005</a>. So you don't have to download anything.</p>
<p>• Table Difference tool allows you to discover and reconcile di... | <p>A SQL Server specific database table diff tool is <a href="http://www.volpet.com/" rel="nofollow noreferrer">Volpet's Table Diff</a></p>
| 23,510 |
<p>Is there any way to verify in Java code that an e-mail address is valid. By valid, I don't just mean that it's in the correct format (someone@domain.subdomain), but that's it's a real active e-mail address.</p>
<p>I'm almost certain that there's no 100% reliable way to do this, because such a technique would be the... | <p>Here is what I have around. To check that the address is a valid format, here is a regex that verifies that it's nearly rfc2822 (it doesn't catch some weird corner cases). I found it on the 'net last year.</p>
<pre><code>private static final Pattern rfc2822 = Pattern.compile(
"^[a-z0-9!#$%&'*+/=?^_`{|}~... | <p>If you're using GWT, you can't use InternetAddress, and the pattern supplied by MBCook is pretty scary.</p>
<p>Here is a less scary regex (might not be as accurate):</p>
<pre><code>public static boolean isValidEmail(String emailAddress) {
return emailAddress.contains(" ") == false && emailAddress.match... | 18,561 |
<p>What is the best way to track changes in a database table?</p>
<p>Imagine you got an application in which users (in the context of the application not DB users ) are able to change data which are store in some database table. What's the best way to track a history of all changes, so that you can show which user at ... | <p>In general, if your application is structured into layers, have the data access tier call a stored procedure on your database server to write a log of the database changes.</p>
<p>In languages that support such a thing <a href="http://en.wikipedia.org/wiki/Aspect-oriented_programming" rel="noreferrer">aspect-orient... | <p>If all changes from php. You may use <a href="https://github.com/moledet/database-change-log" rel="nofollow noreferrer">class</a> to log evry INSERT/UPDATE/DELETE before query. It will be save <strong><em>action</em></strong>, <strong><em>table</em></strong>, <strong><em>column</em></strong>, <strong><em>newValue</e... | 5,936 |
<p>I would like to apply some logic to a page containing a CheckBoxList control when the user checks or unchecks individual checkbox items. Say, for instance to dynamically show or hide a related control.</p>
<p>I came up with a way using ASP.Net 2.0 callback mechanism (AJAX) with a combination of client-side Javascri... | <p>I'd do a couple of things. One, I'd figure out a way to pass the value that needs to be passed back to the client-side onclick handler. Depending on how you are populating your CheckBoxList, this might be as simple as adding an "onclick" attribute to the ListItem for that checkbox that calls your function with the... | <p>you can add an event to the checkbox control on the onclick() event. and send the id of the control as a parameter and then update the attributes of the desired control</p>
<pre><code><input type='checkbox' id='ctl00_....' value='1' onclick="OnCheckBoxClicked('ctrl_toUpdateID');" />
<script type="text/j... | 28,184 |
<p>I have the need to build lots of sites that are very similar, but not exactly the same, using ASP.NET 2.0.</p>
<p>I'm trying to find the best way to make generating these sites quick and easy.</p>
<p>The sites will be used to collect information about a user, and there will be multiple steps for each site.</p>
<p... | <p>you can create base classes which handle all of the common functionality and then have your site specific controls inherit from their respective base classes and then implement their specific implementations.</p>
| <p>Have you looked into Monorail (www.castleproject.org) this is an implementation of themvc pattern, similar to Ruby on rails with a few nice view engines, I prefer Nvelocity.
from castle project as well you can use n implementation of ActiveRecord that makes life real nice. if you are on that trail also have a look a... | 15,714 |
<p>Basically I'm going to go a bit broad here and ask a few questions to get a bit of a picture of how people are handling UI these days.</p>
<p>Lately I've found it pretty easy to do some fancy things with UI design and with WPF specifically we're finding new ways to do layouts that are better looking and more functi... | <p>I recommend that you read <a href="https://rads.stackoverflow.com/amzn/click/com/0789723107" rel="nofollow noreferrer" rel="nofollow noreferrer">Steve Krug's Don't Make Me Think</a> first. The book has a great checklist of things that you have to take into consideration when designing your UIs. While it's focused on... | <p>@David H Aust That's part of the reason for asking the question - with these newer tools like WPF that lend themselves to providing newer, more intricate, and at the same time simpler for the user, interfaces that we might need to adapt to new ways of doing things.</p>
<p>And trying to find out who else is adaptin... | 6,214 |
<p>Service Oriented Architecture seems to be more and more of a hot quote these days, but after asking around the office I have found that I seem to get many different definitions for it. How would you guys define SOA? What would you consider the official definition?</p>
| <p>As Martin Fowler says, it means different things to different people. His article on the topic is pretty good although it isn't quite a definition.</p>
<p><a href="http://martinfowler.com/bliki/ServiceOrientedAmbiguity.html" rel="noreferrer">http://martinfowler.com/bliki/ServiceOrientedAmbiguity.html</a></p>
<p>It... | <p>I attempted to define SOA in <a href="http://vincentfazio.blogspot.com/2008/07/something-old-something-new.html" rel="nofollow noreferrer">one of my blog posts</a>. Here's an excerpt...</p>
<blockquote>
<p>For years it's been standard practice to separate functionality into functions, classes, and modules. The idea... | 8,416 |
<p>I was trying to compile a program using an external compiled object coreset.o. I wrote the public01.c test file and my functions are in computation.c, both of which compiles. However its failing on linking it together. What might be the problem?</p>
<pre><code>gcc -o public01.x public01.o computation.o coreset.o... | <p>I think that coreset.o was compiled for 64-bit, and you are linking it with a 32-bit computation.o.</p>
<p>You can try to recompile computation.c with the '-m64' flag of <a href="http://www.manpagez.com/man/1/gcc-3.3/" rel="noreferrer">gcc(1)</a></p>
| <p>It turns out the compiler version I was using did not match the compiled version done with the coreset.o. </p>
<p>One was 32bit the other was 64bit. I'll leave this up in case anyone else runs into a similar problem.</p>
| 26,551 |
<p>I know that <a href="http://opencv.willowgarage.com/wiki/Mac_OS_X_OpenCV_Port" rel="noreferrer">OpenCV was ported to Mac OS X</a>, however I did not find any info about a port to the iPhone.</p>
<p>I am not a Mac developer, so that I do not know whether a Mac OS X port is enough for the iPhone.</p>
<p>Does anyone ... | <p>OpenCV does indeed work on the iphone. Use the configure script here to compile the library: <a href="http://lambdajive.wordpress.com/2008/12/20/cross-compiling-for-iphone/" rel="nofollow noreferrer">cross compiling for iphone</a></p>
<p>You just have to cross-compile just as you do your apps.</p>
| <p>Here's modified script (based on the one from LambdaJive) that builds universal OpenCV framework for iPhone/iPhone Simulator - <a href="http://zaaghad.blogspot.com/2009/02/universal-i386arm-opencv-framework-for.html" rel="nofollow noreferrer">universal-i386arm opencv framework</a> </p>
| 45,289 |
<p>I am a newbie to 3D printing and ran into a weird infill line on my second 3D printing object on a new Qidi X-Pro machine (which works great). I've included a screenshot of the infill line, which is deliberately printed the full height of the object. I'm thinking this line has been deliberately inserted by the Qidi ... | <p>I do not know the Qidi slicer, but if you look closely, you will see this line is thinner than the normal support infill lines. You could try to visualize the G-code in a viewer, usually this can be done in the slicer itself, but <a href="http://gcode.ws/" rel="nofollow noreferrer">online viewers</a> are available. ... | <p>Here have a posible solution -> <a href="https://3dprinting.stackexchange.com/questions/6990/how-to-remove-unwanted-filament-trails-from-sharp-corners">How to remove unwanted filament trails from sharp corners</a></p>
<p>I think, that can be a combination of z-hopping and combing-mode in the slicer that you use.</p... | 1,042 |
<p>How can I get <strong>hierarchy recordset</strong> in ms access through <strong>select</strong> statement?</p>
| <p>You actually want <code>/proc/self/status</code>, which will give you information about the currently executed process.</p>
<p>Here is an example:</p>
<pre><code>$ cat /proc/self/status
Name: cat
State: R (running)
Tgid: 17618
Pid: 17618
PPid: 3083
TracerPid: 0
Uid: 500 500 500 500
Gid: 500 50... | <p>The things you are looking for may be in environment variables. You need to be careful about what shell you are using when you check environment variables. bash uses "UID" while tcsh uses "uid" and in <code>*nix</code> case matters. I've also found that tcsh sets "gid" but I wasn't able to find a matching variabl... | 11,522 |
<p>I just played with Java file system API, and came down with the following function, used to copy binary files. The original source came from the Web, but I added try/catch/finally clauses to be sure that, should something wrong happen, the Buffer Streams would be closed (and thus, my OS ressources freed) before quit... | <p>The try/finally pattern is the correct way to handle streams in most cases for Java 6 and lower.</p>
<p><em>Some are advocating silently closing streams. Be careful doing this for these reasons: <a href="http://illegalargumentexception.blogspot.com/2008/10/java-how-not-to-make-mess-of-stream.html" rel="noreferrer">... | <p>Unfortunately, this type of code tends to get a bit bloated in Java.</p>
<p>By the way, if one of the calls to oSBuffer.read or oDBuffer.write throws an exception, then you probably want to let that exception permeate up the call hierarchy.</p>
<p>Having an unguarded call to close() inside a finally-clause will ca... | 23,602 |
<p>I made a simple game for the iPhone using OpenGL ES. Everything works fine except for this problem:</p>
<p>I turn the phone completely off, then back on, then launch my app and I get this wierd flickering! Every other frame is correct... the incorrect frames are just the same frame over and over again. If I quit... | <p>Apple published additional information about this issue: </p>
<blockquote>
<p>Q: My OpenGL ES application flickers.
Especially when running on iPhone 3GS,
the flickering seems to happen every
frame. How do I fix this problem?</p>
<p>A: By default, the contents of a
renderbuffer are invalidated after ... | <p>Hmm. I haven't done much with OpenGL on the iPhone, but I have to say I haven't noticed this behavior with other applications. I'd suspect it's something to do with how you're switching active framebuffers. </p>
<p>Maybe take a look at some of the sample code, and see what you're doing differently?</p>
| 25,800 |
<p>Do you know a good source to learn how to design SQL solutions?</p>
<p>Beyond the basic language syntax, I'm looking for something to help me understand:</p>
<ol>
<li>What tables to build and how to link them</li>
<li>How to design for different scales (small client APP to a huge distributed website)</li>
<li>How ... | <p>I started with this book: <a href="http://www.amazon.co.uk/Relational-Database-Explained-Kaufmann-Management/dp/1558608206/ref=sr_1_3?ie=UTF8&s=books&qid=1229597641&sr=8-3" rel="noreferrer">Relational Database Design Clearly Explained (The Morgan Kaufmann Series in Data Management Systems) (Paperback)</a... | <p>These are questions which, in my opionion, requires different knowledge from different domains.</p>
<ol>
<li>You just can't know in advance "which" tables to build, you have to know the problem you have to solve and design the schema accordingly;</li>
<li>This is a mix of database design decision and your database ... | 49,415 |
<p>When writing C/C++ code, in order to debug the binary executable the debug option must be enabled on the compiler/linker. In the case of GCC, the option is -g. When the debug option is enabled, how does the affect the binary executable? What additional data is stored in the file that allows the debugger function ... | <p>-g tells the compiler to store symbol table information in the executable. Among other things, this includes:</p>
<ul>
<li>symbol names</li>
<li>type info for symbols</li>
<li>files and line numbers where the symbols came from</li>
</ul>
<p>Debuggers use this information to output meaningful names for symbols and... | <p>There is some overlap with this <a href="https://stackoverflow.com/questions/69250/why-does-a-cc-program-often-have-optimization-turned-off-in-debug-mode#69313">question</a> which covers the issue from the other side.</p>
| 11,509 |
<p>When I ssh into a remote production server I would like the colour scheme of my terminal window to change to something brigh and scary, preferably red, to warn me that I am touching a live scary server. </p>
<p>How can I make it automatically detect that I have ssh'ed somewhere, and if that somewhere is on a specif... | <p>Put following script in <code>~/bin/ssh</code> (ensure <code>~/bin/</code> is checked before <code>/usr/bin/</code> in your PATH):</p>
<pre><code>#!/bin/sh
HOSTNAME=`echo $@ | sed s/.*@//`
set_bg () {
osascript -e "tell application \"Terminal\" to set background color of window 1 to $1"
}
on... | <p>You should change the color of username and host machine name.</p>
<p>add the following line to your <code>~/.bash_profile</code> file:</p>
<pre><code>export PS1=" \[\033[34m\]\u@\h \[\033[33m\]\w\[\033[31m\]\[\033[00m\] $ "
</code></pre>
<p>The <strong>first part</strong> (purple colored) is what you're looking ... | 19,102 |
<p>Suppose I have a vector that is nested in a dataframe one or two levels. Is there a quick and dirty way to access the last value, without using the <code>length()</code> function? Something ala PERL's <code>$#</code> special var?</p>
<p>So I would like something like:</p>
<pre><code>dat$vec1$vec2[$#]
</code></pr... | <p>I use the <code>tail</code> function:</p>
<pre><code>tail(vector, n=1)
</code></pre>
<p>The nice thing with <code>tail</code> is that it works on dataframes too, unlike the <code>x[length(x)]</code> idiom.</p>
| <p>The xts package provides a <code>last</code> function:</p>
<pre><code>library(xts)
a <- 1:100
last(a)
[1] 100
</code></pre>
| 10,294 |
<p>I have a piece of code in ANSI C which uses the time.h library and time_h structures to (amongst other date-related calculations) work out the interval between two given dates. This works fine but this limits my code to input between 1970 and 2038. I would now like to make my code more general.</p>
<p>Is there a co... | <p>Yes, the <a href="http://code.google.com/p/y2038/" rel="nofollow noreferrer">y2038 project</a> is reimplementing time.h to be 2038 safe. So far <code>gmtime()</code>, <code>localtime()</code>, <code>mktime()</code> and <code>gmtime()</code> are done and well tested. Those were the hard bits. It spans about 300 bi... | <p>There's a public domain implementation used in SQLite: <a href="http://www.sqlite.org/lang_datefunc.html" rel="nofollow noreferrer">documentation</a>, <a href="http://www.sqlite.org/cvstrac/fileview?f=sqlite/src/date.c&v=1.94" rel="nofollow noreferrer">source</a></p>
<p>I've also found the <a href="http://www.t... | 42,910 |
<p>Can a <code>JApplet</code> use a <code>JFileChooser</code> so that the user can select a file on his hard-drive? Or would this violate Java applet security? (I'm assuming that the default security settings are being used. I don't want to ask my users to grant me extra permissions.)</p>
| <p><a href="http://forums.sun.com/thread.jspa?threadID=5322793&tstart=91" rel="nofollow noreferrer">This thread</a> indicates that you need to digitally sign your applet before a <code>JFileChooser</code> is permitted.</p>
| <p>In that case (of using default settings), you're correct, the default security manager does not allow access to local files.</p>
| 29,119 |
<p>I have a program that can have a lot of parameters (we have over +30 differents options).</p>
<p>Example:
<code>myProgram.exe -t alpha 1 -prod 1 2 -sleep 200</code></p>
<p>This is 3 Commands (from command pattern object at the end) that each contain some parameters. Inside the code we parse all command (start with... | <p>Create a hash table which stores function pointers (in C# that'd be delegates) for handling each of the parameters, keyed using the parameter text. Then you just go through the command line in a loop and make calls to delegates based on what comes out of hash table lookups.</p>
| <p>I dont think this is too cludging.. </p>
<pre><code>private void Main()
{
string c = "-t alpha 1 -prod 1 2 -sleep 200";
foreach (string incommand in Strings.Split(c, "-")) {
HandleCommand(Strings.Split(incommand.Trim, " "));
}
}
public void HandleCommand(string[] c)
{
switch (c(0).ToLower) {
ca... | 41,931 |
<p>Is there a function, that clears last line in command prompt? I dont mean "cls" - it clears the whole sreen, I want to delete just the last line.</p>
<p>e.g. I am searching for a file in a folder and its subfolders and I want to print to cmd current folder - but I want to rewrite it, when the folder changes, not ju... | <p>Which one is that last line?<br>
The one just above the prompt?<br>
If that's what you mean then no, there is no way to clear just that using the prompt.
If you're talking about doing it programatically, try using <code>"\r"</code> like so:</p>
<pre><code>print("\rNew text in the line");
</code></pre>
| <p>You Could use brackets to record the previous, then not record the line you want to delete using the TYPE command: (This is just an example)</p>
<pre><code>(
echo (Previous Outputs)
(This may happen as many times as needed)
) >> C:\file.txt
set /P thing=
cls
type C:\file.txt
pause
</code></pre>
| 48,033 |
<p>I am making a quiz system, and when quizmakers insert questions into the Question Bank, I am to check the DB for duplicate / very highly similar questions.</p>
<p>Testing MySQL's <a href="http://dev.mysql.com/doc/refman/5.0/en/fulltext-search.html#function_match" rel="noreferrer">MATCH() ... AGAINST()</a>, the high... | <p>andygeers is on the right track: Those numbers have no empirical meaning other than their relations to each other and cannot be used on their own to determine what is or is not an "exact match". You need to determine that yourself. Even aside from the limitations of fulltext search ranking, there's also the open ... | <p>I don't know the specifics of the MySQL function you're using, but I imagine it could be that there is no absolute meaning for those numbers - they're just designed to be compared with other values produced by the same function. To check for an absolute match you could select out the text itself and compare manually... | 29,436 |
<p>How do I save a jpg image to database and then load it in Delphi using FIBplus and TImage?</p>
| <pre><code>var
S : TMemoryStream;
begin
S := TMemoryStream.Create;
try
TBlobField(AdoQuery1.FieldByName('ImageField')).SaveToStream(S);
S.Position := 0;
Image1.Picture.Graphic.LoadFromStream(S);
finally
S.Free;
end;
end;
</code></pre>
<p>if you are using JPEG images, add JPG unit to <strong>u... | <p><a href="http://delphi.about.com/od/database/l/aa030601a.htm" rel="nofollow noreferrer">Take a look here.</a>
I think you have to convert it to a stream, store it and vice versa.</p>
| 8,759 |
<p>I've tried using source control for a couple projects but still don't really understand it. For these projects, we've used TortoiseSVN and have only had one line of revisions. (No trunk, branch, or any of that.) If there is a recommended way to set up source control systems, what are they? What are the reasons a... | <p>I recommend checking out the following from Eric Sink:</p>
<p><a href="http://www.ericsink.com/scm/source_control.html" rel="noreferrer">http://www.ericsink.com/scm/source_control.html</a></p>
<p>Having some sort of revision control system in place is probably the most important tool a programmer has for reviewing... | <p>Even if you don't branch, you may find it useful to use tags to mark releases.</p>
<p>Imagine that you rolled out a new version of your software yesterday and have started making major changes for the next version. A user calls you to report a serious bug in yesterday's release. You can't just fix it and copy over ... | 3,438 |
<p>I need to generate a tone that I can manipulate frequency and wave. The overall goal is to create a basic piano. Does anyone know how I can achieve this?</p>
<p>My development platform is the iPhone 2.x</p>
| <p>You could always start with <code>sin</code> waves. :-)</p>
<pre><code>#include <cmath>
typedef double Sample;
typedef double Time;
class MonoNote {
protected:
Time start, duration;
virtual void internalRender(double now, Sample *mono) = 0;
public:
MonoNote(Time s, Time d) : start(s), duration(d... | <p>Check out <a href="http://mda.smartelectronix.com/" rel="nofollow noreferrer">http://mda.smartelectronix.com/</a>. They are a series of open source VST plugins. Look at the source for Piano, ePiano or DX10. It's about as simple as you are going to find.</p>
| 45,182 |
<p>So we've discussed logging in passing at my place of work and I was wondering if some of you guys here could give me some ideas of your approaches?</p>
<p>Typically our scenario is, no logging really at all, and mostly .NET apps, winforms/WPF clients talking through web services or direct to a db.</p>
<p>So, the r... | <p>The key thing for logging is good planning. I would suggest that you look into the enterprise library exception and logging application block (<a href="http://msdn.microsoft.com/en-us/library/cc467894.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc467894.aspx</a>). There is a wee bit of a ... | <p>Thanks guys, lot of good info, but Martin has given me a bit more detail on how to proceed. I'll give him the answer, as it seems like now we're off the front few pages answers will drop off.</p>
| 5,644 |
<p>I currently have some code that pulls down a list of users in a group and then iterates through that group to determine if a given account exists, but it seems like there ought to be a more concise (and perhaps faster) way to accomplish this.</p>
<p>This code (VB.NET) attempts to use the member property of the grou... | <p>If you are on .NET 3.5 stack, <a href="http://msdn.microsoft.com/en-us/library/system.directoryservices.accountmanagement.aspx" rel="noreferrer">System.DirectoryServices.AccountManagement.dll assembly</a> has a nice API on top of AD. The following method can be implemented to solve your issue:</p>
<pre><code>static... | <p>I found an answer that seems to work in NET 2.0, is relatively quick and overcomes the possible issue of groups containing more than 100 items (which require range searching)</p>
<p>Here is the code that I wound up with:</p>
<pre><code>Dim DSearcher As New DirectorySearcher(group, "(&(objectClass=user)(cn=" + ... | 48,157 |
<p>I am creating a GUI for a machine that runs remote (WinXP) or on the machine itself (Windows CE 6.0).</p>
<p>Right now I've created a fast visualisation (read: very simple) of the machine itself. The goal is to make a bit more complex visualisation of the machine and for that I would need a lightweight 3d engine.</... | <p>Did you try <a href="http://irrlicht.sourceforge.net/" rel="nofollow noreferrer">Irrlicht</a>. </p>
<blockquote>
<p>Recently Irrlicht has acquired official .NET bindings, allowing users to develop in .Net languages such as VB.NET, C# and Boo.</p>
</blockquote>
<p>There is also <a href="http://en.wikipedia.org/wi... | <p>It is a good question. I have looked as well, and not seen anything. It would be great to see some easy to access great visual effects for mobile, to somewhat compete with other platforms that are getting better looking.</p>
<p>Sometimes with Windows Mobile I feel like I am in the Windows 3.1 days!</p>
| 6,726 |
<p>Is there a javascript function to swap a still image(jpg) to a movie(swf)? If there is is there a disjointed swap image path?</p>
| <p>You could do something like this:</p>
<pre><code><div id="still_image" style="display:block">
<!-- img code here -->
</div>
<div id="ani_swf" style="display:none">
<!-- embedded swf here -->
</div>
<input type="button" value="Swap" onclick="imgToSWF();" />
<s... | <p>You can use <a href="http://code.google.com/p/swfobject/" rel="nofollow noreferrer">swfobject</a>. Ofcourse, you didn't said too much about what do you really want to do: on mouseover, on page load (and the image will be only a replacement), and so on...</p>
| 49,570 |
<p>I’ve got an issue with loading a particular X509 certificate within an ASP.NET application (i.e. not through IIS for https). I’ve loaded it into my ‘Personal’ and ‘Trusted Root’ stores on my local machine (through the MMC snap in) but can’t load it from either store.</p>
<p>It seems the NETWORK SERVICE account does... | <p>It's been a while, but I seem to recall having had permission-related certificate issues that I solved by importing the cert into a <em>physical</em> store (click the "Show physical stores" check box when installing your certificate).</p>
<p>Alternatively, you could take a look with <a href="http://technet.microsof... | <p>Couple different thoughts. I'm a little confused by how you are using the term "cert with a private key" and what you mean by "use the cert" after you have tried to access it with admin rights. I'm guessing that you are trying to do one of the following:</p>
<ul>
<li><p>get a copy of the certificate and do someth... | 43,929 |
<p>There have been plenty of questions on MVC validation but so far the answer has been pretty much inconclusive.</p>
<p>For my needs in particular, I would like something that generates client validation and server validation from the same description and should allow both model based attributes as well as code based... | <p>Different search engines have different algorithms to get the description out of the page if/when they are lacking the description meta tag. Some ignore the tag even it it's there.</p>
<p>If you want the description Google has, the most accurate way to get it would be to scrape it. Otherwise, you could write your... | <p>You may want to check AboutUs.org (i.e. <a href="http://www.aboutus.org/StackOverflow.com" rel="nofollow noreferrer">http://www.aboutus.org/StackOverflow.com</a>).
But, there's little chance that the site will have an aboutus page and not have a meta description.</p>
| 38,609 |
<p>Is there a way to include all the jar files within a directory in the classpath?</p>
<p>I'm trying <code>java -classpath lib/*.jar:. my.package.Program</code> and it is not able to find class files that are certainly in those jars. Do I need to add each jar file to the classpath separately? </p>
| <p>Using Java 6 or later, the classpath option supports wildcards. Note the following:</p>
<ul>
<li>Use straight quotes (<code>"</code>)</li>
<li>Use <code>*</code>, not <code>*.jar</code></li>
</ul>
<p><strong>Windows</strong></p>
<blockquote>
<p><code>java -cp "Test.jar;lib/*" my.package.MainClass</cod... | <p>Order of arguments to <code>java</code> command is also important:</p>
<pre><code>c:\projects\CloudMirror>java Javaside -cp "jna-5.6.0.jar;.\"
Error: Unable to initialize main class Javaside
Caused by: java.lang.NoClassDefFoundError: com/sun/jna/Callback
</code></pre>
<p>versus</p>
<pre><code>c:\project... | 27,034 |
<p>ASP.NET MVC routes have names when mapped:</p>
<pre><code>routes.MapRoute(
"Debug", // Route name -- how can I use this later????
"debug/{controller}/{action}/{id}",
new { controller = "Home", action = "Index", id = string.Empty } );
</code></pre>
<p>Is there a way to get the route name, e.g. "Debug" i... | <p>The route name is not stored in the route unfortunately. It is just used internally in MVC as a key in a collection. I think this is something you can still use when creating links with HtmlHelper.RouteLink for example (maybe somewhere else too, no idea).</p>
<p>Anyway, I needed that too and here is what I did:</p>... | <p>another option - use MapRoute with string[] namespaces argument, then you can see your namespaces as <code>RouteData.DataTokens["Namespaces"]</code></p>
| 47,419 |
<pre><code> [SoapRpcMethod(Action = "http://cyberindigo/TempWebService/InsertXML",
RequestNamespace = "http://cyberindigo/TempWebService/Request",
RequestElementName = "InsertXMLRequest",
ResponseNamespace = "http://cyberindigo/TempWebService/Response",
ResponseElementName = "InsertXMLResponse",
U... | <p>The source of the next part of this post is: </p>
<blockquote>
<p><a href="http://bluebones.net/2003/07/server-did-not-recognize-http-header-soapaction/" rel="noreferrer">http://bluebones.net/2003/07/server-did-not-recognize-http-header-soapaction/</a> </p>
</blockquote>
<p>(since the OP didn't want to give attr... | <p>I had to sort out capitalisation of my service reference, delete the references and re add them to fix this. I am not sure if any of these steps are superstitious, but the problem went away.</p>
| 45,857 |
<p>I am working on a small parser that should accept input in a number of languages. I am going to have maybe 50 strings that will serve as keywords/anchors in parsing the input. In PHP, what would be the best way to organize these translated keywords? </p>
<p>One possible solution that comes to my mind is to use an a... | <p>For a complete translation solution, you can look on a solution like <a href="http://www.php.net/manual/en/intro.gettext.php" rel="nofollow noreferrer">gettext</a>.</p>
<p>you solution is good enough (fast, cheap on resources) for small dictionaries.
I didn't understand what you tried to do using the strpos() funct... | <p>Generally people use l10n (or something similar) in their application because it allows for additional languages by adding a localization file which means the programmers do not have to change code. But if it is a simple script, then <a href="http://codeutopia.net/blog/2007/11/22/localize-your-site-in-3-easy-steps/"... | 33,864 |
<p>We have a large ASP.NET project consisting of several hundred reports. We are in the process of moving all the SQL Queries (running against an Oracle Database) into three web services. The web services are categorized by command, selections and report queries. We have to deploy a sub-set of our project using a SQ... | <p>This problem would seem to be quite independent of the purpose of the software. The issue here is that you have a small, finite number of files that multiple developers will be working with on a daily basis. I do not have experience with Serena ChangeMan software nor TFS other than playing around with it. I do ha... | <p>We use SOA, but we also use SVN which is more merging oriented. Maybe consider a different source control system?</p>
| 46,078 |
<p>Is there a c++ equivalent of Java's</p>
<pre><code>try {
...
}
catch (Throwable t) {
...
}
</code></pre>
<p>I am trying to debug Java/jni code that calls native windows functions and the virtual machine keeps crashing. The native code appears fine in unit testing and only seems to crash when called throug... | <pre><code>try{
// ...
} catch (...) {
// ...
}
</code></pre>
<p>will catch all C++ exceptions, but it should be considered bad design. You can use c++11's new current_exception mechanism, but if you don't have the ability to use c++11 (legacy code systems requiring a rewrite), then you have no named exceptio... | <p>Well this really depends on the compiler environment.
gcc does not catch these.
Visual Studio and the last Borland that I used did.</p>
<p>So the conclusion about crashes is that it depends on the quality of your development environment.</p>
<p>The C++
specification says that catch(...) must catch any exceptions, ... | 40,794 |
<p>I am trying to use an XML-RPC server on my Drupal (PHP) backend to make it easier for my Perl backend to talk to it. However, I've run into an issue and I'm not sure which parts, if any, are bugs. Essentially, some of the variables I need to pass to Drupal are strings that sometimes are strings full of numbers and... | <p>The number <code>9876352345</code> is too big to fit in a 32bit integer. That might cause the problem.</p>
| <p>The number <code>9876352345</code> is too big to fit in a 32bit integer. That might cause the problem.</p>
| 32,510 |
<p>I can't seem to find a nice clean example of using AES 128 bit encryption.</p>
<p>Does anyone have some sample code?</p>
| <p>If you just want to use the built-in crypto provider RijndaelManaged, check out the following help article (it also has a simple code sample):</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.rijndaelmanaged.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/li... | <p>Try this code, maybe useful.<br>
1.Create New C# Project and add follows code to Form1:</p>
<pre><code>using System;
using System.Windows.Forms;
using System.Security.Cryptography;
namespace ExampleCrypto
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent... | 34,449 |
<p>I'm trying to create a unit test to test the case for when the timezone changes on a machine because it has been incorrectly set and then corrected.</p>
<p>In the test I need to be able to create DateTime objects in a none local time zone to ensure that people running the test can do so successfully irrespective of... | <p><a href="https://stackoverflow.com/questions/246498/creating-a-datetime-in-a-specific-time-zone-in-c-fx-35#246512">Jon's answer</a> talks about <a href="http://msdn.microsoft.com/en-us/library/system.timezone.aspx" rel="noreferrer">TimeZone</a>, but I'd suggest using <a href="http://msdn.microsoft.com/en-us/library/... | <p>You'll have to create a custom object for that. Your custom object will contain two values:</p>
<ul>
<li>a DateTime value</li>
<li>a <a href="http://msdn.microsoft.com/en-us/library/system.timezone.aspx" rel="nofollow noreferrer">TimeZone</a> object</li>
</ul>
<p>Not sure if there already is a CLR-provided data ty... | 30,597 |
<p>I am trying to construct a way to keep certain hard drive partitions/usb drives from being accessed for security reasons (protecting intellectual property). I was thinking that when windows attempts to access the "locked down drive/usb" the attempted is halted and returns something like "drive inaccessible" or somet... | <p>You will need to write a <a href="http://en.wikipedia.org/wiki/Filter_driver" rel="nofollow noreferrer">filter driver</a> to achieve your goal. You will need to put your driver somewhere in disk driver stack and fail the IRP_MN_START_DEVICE for the drive/partition you want to block. </p>
<p>You will need <a href="h... | <p>You need to encrypt the drives, anything else would allow attackers to just attach the drive to another machine and extract the contents.</p>
<p>You shouldn't implement encryption yourself - it's much better to rely on someone else's reviewed code. I suggest <a href="http://www.truecrypt.org/" rel="nofollow norefer... | 25,953 |
<p>I have a C project where all code is organized in <code>*.c</code>/<code>*.h</code> file pairs, and I need to define a constant value in one file, which will be however also be used in other files. How should I declare and define this value?</p>
<p>Should it be as <code>static const ...</code> in the <code>*.h</cod... | <p>The rule I follow is to only declare things in H files and define them in C files. You can declare and define in a single C file, assuming it will only be used in that file.</p>
<p>By declaration, I mean notify the compiler of its existence but don't allocate space for it. This includes <code>#define</code>, <code>... | <p>I can give you an indirect answer. In C++ (as opposed to C) <code>const</code> implies <code>static</code>. Thatis to say in C++ <code>static const</code> is the same thing as <code>const</code>. So that tells you how that C++ standards body feels about the issue i.e. all <code>const</code>s should be static.</p>
| 46,298 |
<p><strong>Is there a tool out there for visualizing dynamic call graphs?</strong> I saw a reference to one for Visual Basic 6 but I'd like one for .NET.</p>
<p><strong>If I had to build a visualizer myself should I bother with the <em>.NET profiling API</em> or should I do something with <em>Mono.Cecil</em>?</strong>... | <p>Maybe this open source project on CodePlex could help as starting point:</p>
<p><strong>SequenceViz</strong></p>
<p><a href="http://www.codeplex.com/sequenceviz" rel="nofollow noreferrer">http://www.codeplex.com/sequenceviz</a></p>
<p><em>"SequenceViz is a tool to generate sequence diagrams by reverse engineering... | <p>You coud use <a href="http://nprof.sourceforge.net/Site/Description.html" rel="nofollow noreferrer"><strong>NProf</strong></a>, an open source project on Sourceforge. It allows you to <strong>extend the default GUI with new visualization tools</strong>.</p>
<p><em>"nprof is designed to be not only a fully-fledged p... | 45,394 |
<p>I'm just starting to wean myself from ASP.NET UpdatePanels. I'm using jQuery and jTemplates to bind the results of a web service to a grid, and everything works fine. </p>
<p>Here's the thing: I'm trying to show a spinner GIF while the table is being refreshed (à la UpdateProgress in ASP.NET) I've got it all workin... | <p>It's not the Ajax call that's freezing the browser. It's the success handler (applyTemplate). Inserting HTML into a document like that can freeze IE, depending on how much HTML there is. It's because the IE UI is single threaded; if you notice, the actual IE menus are frozen too while this is happening.</p>
<p>As a... | <p>Browsers are single-threaded and multi-threaded.</p>
<p>For any browser :
When you a called a function that contains a nested ajax function</p>
<p>java/servlet/jsp/Controller >
keep Thread.sleep(5000); in servlet to understand the async in ajax when
true or false.</p>
<pre><code> function ajaxFn(){
$('#sta... | 23,248 |
<p>Recent conversations with colleagues have produced varying points of view on this matter. What say you, SO members?</p>
<p>I know, even the concept of scalability can be taken in so many different ways and contexts, but that was part of the discussion when this came up. Everyone seemed to have a different take on w... | <p>I would guess that the best way to check is by writing benchmarks, but in my opinion LINQ has the possibility for optimizations that hand-writing similar code does not. I don't know how well it takes advantage of those yet.</p>
<p>LINQ lets you express what you want, not how to generate it. One obvious advantage is... | <p>Linq is scalabile in many ways.</p>
<p>One aspect is Specification implementation behind linq, which allows Expression to be interpreted to run out of process, in a different language (Linq2Sql, Linq2Hibernate), or in a distributed computing invironment such as a map-reduce cluster for that matter (<a href="http://... | 26,338 |
<p>I realize this would violate convention, but I'm curious to know if you can do this through configuration.</p>
<p><strong>Edit: I understand why I wouldn't want to do this. BUT, I do want to understand the internals of this time of project.</strong></p>
| <p>No you cannot rename this folder and have it actually contain executable code. The web project system is hard coded to look for code in this folder and will not consider any other folder for raw code. </p>
| <p>I dont think this is posible, but why do you need to change it?</p>
| 31,218 |
<p>I have a bunch of tasks in a MySQL database, and one of the fields is "deadline date". Not every task has to have to a deadline date.</p>
<p>I'd like to use SQL to sort the tasks by deadline date, but put the ones without a deadline date in the back of the result set. As it is now, the null dates show up first, the... | <p>Here's a solution using only standard SQL, not ISNULL(). That function is not standard SQL, and may not work on other brands of RDBMS.</p>
<pre><code>SELECT * FROM myTable
WHERE ...
ORDER BY CASE WHEN myDate IS NULL THEN 1 ELSE 0 END, myDate;
</code></pre>
| <pre><code>SELECT foo, bar, due_date FROM tablename
ORDER BY CASE ISNULL(due_date, 0)
WHEN 0 THEN 1 ELSE 0 END, due_date
</code></pre>
<p>So you have 2 order by clauses. The first puts all non-nulls in front, then sorts by due date after that</p>
| 18,224 |
<p>I know that lots of web hosting providers are offering FreeBSD, but how good is FreeBSD as a development platform?</p>
<p>Specifically, is Java 1.6 available in it?
Is there somthing specific that it offers with regard to tools that is not available under Linux?</p>
| <p>I've always found FreeBSD a wonderful secure hosting environment, but perhaps not the easiest development platform. You will have to dig a bit to get Java 1.6 up and running, though I think it will be doable. I hope you are familiar with emacs or vi. The ports system will afford you access to many pieces of software... | <p><a href="https://www.truenas.com/trueos-discontinuation/" rel="nofollow noreferrer">TrueOS</a> has been discontinued. I'm kinda surprised... would have been interesting to have some synergy between TrueNAS and TrueOS.</p>
| 35,630 |
<p>I am making a new concept in searching, I am calling lt as WikiRank,
In this , a extension will be installed on firefox browser. This extension will see watch the user activity, and he will send visiting url and its visit time also user can give ranking to the material also. So in nutshell,. there will not be any c... | <p>It seems that you're re-inventing a wheel... again. Did you check any <a href="http://en.wikipedia.org/wiki/Alexa_Internet" rel="nofollow noreferrer">prior art</a> (there are more obviously) on what you're planning to do? From your description it does not sound like a 'new' concept to me at all.</p>
| <p>Mainly I want to collect page visit time per url of user. Also user can send optional rank (1-10) about the content of the page.</p>
| 16,865 |
<p>When C# 4.0 comes out and we have the dynamic keyword as described in this <a href="http://channel9.msdn.com/pdc2008/TL16/" rel="noreferrer">excellent presentation by Anders Hejlsberg</a>, (C# is evolving faster than I can keep up.. I didn't have much time to acquaint myself with the var keyword)</p>
<p>Would I sti... | <p>No, they're very different.</p>
<p><code>var</code> means "infer the type of the variable at compile-time" - but it's still entirely statically bound.</p>
<p><code>dynamic</code> means "assume I can do anything I want with this variable" - i.e. the compiler doesn't know what operations are available, and the DLR w... | <p>Yes you will still need var:</p>
<p><strong>Var</strong> is a <em>variable</em> whose type will be inferred by the compiler.
<br>
<strong>dynamic</strong> will have its type assigned at runtime</p>
<p>So:</p>
<pre><code>Var i = "Hello World"
</code></pre>
<p>will have its type inferred as a string type in doing ... | 38,174 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.