input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Does Perl's $| setting affect system commands? <p>I am looking at some old code in Perl, where the author has writtern
<code>$| = 1</code> in the first line.</p>
<p>But the code does not have any print statements, it calls a C++ binary using the <code>system</code> command. Now I read that <code>$|</code> will force ... | <p>I do not believe so. The $| will affect the way that Perl is running, not any external executable.</p>
<p>You should be safe to remove it.</p>
<p><a href="http://perldoc.perl.org/perlvar.html">perldoc - perlvar</a> : States "<em>If set to nonzero, forces a flush right away and after every write or print on the cu... |
wxpython compilation <p>I'm trying wxpython for the first time,so i need a sample program with the details of how to run it</p>
| <p>There are several tutorials available. You might want to start here: <a href="http://wiki.wxpython.org/Getting%20Started" rel="nofollow">http://wiki.wxpython.org/Getting%20Started</a></p>
<p>Among other things, this page includes some sample applications, from a simple "Hello World" to event-handling and other exam... |
How can I build XmlDocument with many xml namespaces in a single node? <p>I'm trying to build XmlDocument so that after serialization I could achieve something like this xml:</p>
<pre><code><?xml version="1.0" encoding="UTF-8"?>
<wnio:element xmlns:wnio="somuri" xmlns:xf="abcd">
<xf:nestedelement>... | <p>The attributes "xmlns:wnio" and "xmlns:xf" are attributes like any other. Simply add them to the XmlElement that you would like these XML Namespaces to scope to.</p>
<p>The following snippet produces almost exactly what you want:</p>
<pre><code>XmlDocument document = new XmlDocument();
document.AppendChild(documen... |
Getting a list of all classloaders in a JVM <p>Is it possible to get a list of all class loaders in a JVM or at least all class loaders associated with web apps in a Java EE Server (WebLogic in my case). </p>
| <p>There are good overviews on the class loader hierarchy at:</p>
<p><a href="https://web.archive.org/web/20090619193125/http://e-docs.bea.com/wls/docs81/programming/classloading.html" rel="nofollow">Archived version of http://e-docs.bea.com/wls/docs81/programming/classloading.html</a></p>
<p><a href="http://weblogic... |
Does my basic PHP Socket Server need optimization? <p>Like many people, I can do a lot of things with PHP. One problem I do face constantly is that other people can do it much cleaner, much more organized and much more structured. This also results in much faster execution times and much less bugs.</p>
<p>I just finis... | <p>One small thing, personally i'd create a function for outputting instead of just using echo, that way its easy to turn it off, change the format etc.. eg</p>
<pre><code>function log($message = '')
{
echo '['.date('Y-m-d H:i:s').']'.$message;
}
</code></pre>
<p>and then you can use :</p>
<pre><code>log("SERVER... |
Can I write a C application without using the heap? <p>I'm experiencing what appears to be a stack/heap collision in an embedded environment (see <a href="http://stackoverflow.com/questions/960389/how-can-i-visualise-the-memory-sram-usage-of-an-avr-program">this question</a> for some background).</p>
<p>I'd like to tr... | <p>I did it once in an embedded environment where we were writing "super safe" code for biomedical machines.
Malloc()s were explicitly forbidden, partly for the resources limits and for the unexpected behavior you can get from dynamic memory (look for malloc(), VxWorks/Tornado and fragmentation and you'll have a good e... |
Good Gui editors for win C programming <p>I am trying to get back to C programming in windows. </p>
<p>I normally use codeblocks for the code and for the gui I used Resource Editor from radasm, but it seems it's no longer available.</p>
<p>Anyone know of a simple program that will let me create dialogs, edit existing... | <p><a href="http://www.qtsoftware.com/products/developer-tools" rel="nofollow">Qt Creator</a> is capable of doing all those things, if you choose to use Qt for your project.</p>
|
NSURLConnection doesn't call didRecieveData method <p>I want my application to download some data from the internet, in iPhone SDK documentation
i found NSURLConnection class, which is used for downloading, Am i right?
I wrote the same code as it is in the documentation and ran it. Connection was created successfully, ... | <p>You've misspelt "receive":</p>
<pre><code>// Your signature
- (void)connection:(NSURLConnection *)connection didRecieveData:(NSData *)data;
// Correct signature
- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data;
</code></pre>
|
iphone distributing <p>if i am an individual or enterprise,can i see how many times my applications has been downloaded from app store? through portal?</p>
| <p>Yes, there are download statistics available in <a href="http://itunesconnect.apple.com/" rel="nofollow">iTunes Connect</a></p>
|
Should I add a new SVN repository or a new folder? <p>Have one application in SVN (on unfuddle.com).
Want to add a new application (related to, but independent of the existing one).</p>
<p>Today I have:
repo1/root/app1</p>
<p>Should I add the new application in a new repository or in a new folder ?</p>
<p>i.e. s... | <p>Do like you want and what makes less hassle. Both decisions can be reverted: The directory in the repository can be extracted and imported to a new repository, or the separate repository can be imported into the first one. I don't think any of the approaches is significant better. So choose freely. I think your deci... |
MySQL Search Refinement (replace long regex with subquery) <p>I have a MySQL query</p>
<pre><code>select query from HR_Health_Logs where query REGEXP 'CPU|MAC|PC|abacus|calculator|laptop|mainframe|microcomputer|minicomputer|machine';
</code></pre>
<p>Except that the regex is much longer, and contains many synonyms an... | <p>How about the <a href="http://dev.mysql.com/doc/refman/5.0/en/any-in-some-subqueries.html" rel="nofollow"><code>ANY</code> function</a> ?</p>
<pre><code>select query from HR_Health_Logs where query REGEXP ANY (SELECT spell FROM misspelled WHERE correct = 'masturbate' ) ;
</code></pre>
|
How to pass two parameters when using std::mem_fun? <p>Lets say I have hierarchy like this (This is just a test program. Please do not point anything related to memory leaks, destructor is not virtual etc):</p>
<pre><code>class I
{
public:
virtual void fun(int n, int n1) = 0;
};
class A : public I
{
public:
v... | <p>You could create your own functor like this:</p>
<pre><code>class Apply
{
private:
int arg1, arg2;
public:
Apply(int n, int n1)
: arg1(n), arg2(n1)
{}
void operator() (I* pI) const
{
pI->fun(arg1, arg2);
}
};
int main ()
{
// ...
std::for_each(a.begin(), a.end(), Apply(n, n1))... |
Is there a performance difference between these two pieces of code? <p>Is there a performance difference between these two pieces of code? My gut feeling is that the second option is slower, as the Cell object has to be constructed each time, but I like the idea of returning a Cell.</p>
<p>Option One:</p>
<pre><code... | <p>Write a test program and see for yourself.</p>
|
How to make a part of log4net message uppercase <p>I'm using AdoNetAppender to log messages. I've added %property{log4net:HostName} conversion pattern to the message parameter.</p>
<pre><code><parameter>
<parameterName value="@message"/>
<dbType value="String"/>
<size value="4000... | <p>The solution suggested by Ron Grabowski is extending PatternConverter.</p>
<pre><code>public class HostNameToUpperConverter : PatternConverter
{
protected override void Convert(TextWriter writer, object state)
{
string hostName = (string)GlobalContext.Properties[LoggingEvent.HostNameProperty];
... |
Is it possible to create new widget instances from within a Dashboard widget? <p>This is a followup to this <a href="http://stackoverflow.com/questions/1023397/multiple-dashboard-widget-instances-dont-survive-widget-update-any-way-to-preve">question</a>.<br />
It seems to be impossible to to simply keep already configu... | <p>It is possible, but I don't know how. The Delivery Status widget allows you to open a new copy of itself. You can see the + sign in the screenshot in the <a href="http://junecloud.com/support/delivery-status-help.html?site=junecloud&offset=-1" rel="nofollow">help image</a>.</p>
|
Read file into array <p>I have a file of words/phrases separated by newlines. I need to get the file and read each word/phrase into the array. I have this so far:</p>
<pre><code> NSFileHandle *wordsFile = [NSFileHandle fileHandleForReadingAtPath:[[NSBundle mainBundle] pathForResource:@"WordList"
... | <p>Just for completeness (and because I am bored) here's a complete example bassed on teabot's post:</p>
<pre><code> NSString *string = [NSString stringWithContentsOfFile:[[NSBundle mainBundle]
pathForResource:@"file" ofType:@"txt"]];
NSArray *array = [string componentsSeparatedByCharacter... |
What Http code should i return for "Thing not found"? <p>i'm constructing a web-service that is used, in this particular case, to ask for information about a patron. </p>
<p>Let's say, for the sake of argument, that the lookup web hit is:</p>
<pre><code>GET /patrons/619 HTTP/1.1
</code></pre>
<p>If the patron is fou... | <p>404 Not Found is the correct thing to return, if it's a service, it's not really being used by humans but by machines, and therefore, typos, shouldn't be your first concern.</p>
<p>Also, there's very little you're going to be able to do to counter human behavior anyway (thinking one thing when it's really another).... |
Apache log lines appearing out of sequence - why? <p>I've got an apache web server, and when a certain user accesses a certain page I get a log line who's timestamp is out of sync.</p>
<p>Sample output:</p>
<pre><code>IP1 - - [22/Jun/2009:12:20:40 +0000] "GET URL1" 200 3490 "REFERRING_URL1" "Mozilla/4.0 (compatible; ... | <p>The logs are written when the request is completed, so early long requests may be written after late short ones. Add the %D to tour LogFormat definition to see the time taken to serve the request, in microseconds.</p>
<p>See more <a href="http://httpd.apache.org/docs/2.0/mod/mod%5Flog%5Fconfig.html#formats">here</a... |
Visualize B-Spline in .NET <p>I might need to visualize a B-Spline ( <a href="http://en.wikipedia.org/wiki/B-spline" rel="nofollow">http://en.wikipedia.org/wiki/B-spline</a> ) in .NET. I do not where to start. Is there any easy way or library to do it? I would prefer to do it in Silverlight but WPF and Win Forms is als... | <p>A B-Spline is a solution to a problem, maybe you should describe your problem and ask what the best solution is. GDI+ contains DrawBezier and DrawCurve for drawing splines, that might be a good point to start. Something like this:</p>
<pre><code>Point p1 = new Point(10, 10);
Point p2 = new Point(50, 10);
Point p3 =... |
DataGridView capturing user row selection <p>I am having trouble handling the selections in <code>DataGridView</code>.
My grid view contains an amount column. There is a textbox on the form which should display the total amount of the selected grid view rows. Hence I need to capture events when the user selects/ desele... | <p>Found the solution. I can use <code>RowStateChanged</code> and run my code only if <code>StateChanged</code> for the row is <code>Selected</code>...</p>
<pre><code>private void dgridv_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e)
{
// For any other operation except, StateChanged, do not... |
Can I use Lotus Notes to send mail? <p>I have to code an app that at some point in time will have to send some reports using Lotus Notes.</p>
<p>My questions are :</p>
<ol>
<li><p>Can I send mail through the Lotus Notes client, or something related to Lotus Notes ( a command line tool maybe? )? If so, where could I f... | <p>Yes you can send email through a Lotus Notes client. I've had to do this before in a .NET application because a number of our clients were using Lotus Notes.</p>
<p>Lotus Notes publishes an SDK to do this.</p>
<p>Here's a <a href="http://www.ibm.com/developerworks/lotus/downloads/toolkits.html" rel="nofollow">lin... |
Subclass a table and a big trouble in Delphi <p><img src="http://img29.imageshack.us/img29/825/simplemodel.jpg" alt="alt text" /></p>
<p>How you can see above, it's a kind of subclass a table in a RDBMS (in this case, my favorite: MySQL) so I handle it with Visual Subclassing a base form for tb_order_base with validat... | <p>One thing I have done in such a condition was to break away from doing DBMS direct calls, and to instead use a memory dataset (or client dataset) for the form. When the user presses the save button, I would validate my edits and return any errors. If no errors then I would begin a database transaction, commit the ... |
C++ pointer-to-char question <pre><code>char *ps;
ps = &anotherChar;
cout << ps;
</code></pre>
<p>Why this displays the value of anotherChar not just the address?. </p>
| <p>There is an <code>operator<<</code> overload for <code>char *</code> which interprets it as a string to be output. If you want an address, you could to cast to <code>void*</code>.</p>
|
Using STL algorithms, is it better to pass a function pointer or a functor? <p>Which of these 2 methods is better and why?</p>
<p>Method 1:</p>
<pre><code>void fun(int i) {
//do stuff
}
...
for_each(a.begin(), a.end(), fun);
</code></pre>
<p>Method 2:</p>
<pre><code>class functor {
public:
void operator()(int ... | <p>Functors may (and <strong>will</strong>) be trivially inlined â this isn't done for regular function pointers.</p>
<p>Thus, functors have a real performance benefit which may be huge in tight loops. Furthermore, functors are generally more easily composable and in particuler play nicer with the STL: <code>std::bi... |
Generate Google Analytics events (__utm.gif requests) serverside <p>I am willing to use Google Analytics to track stats about usage of my Client/Server application (no Browser on the user computer!).</p>
<p>So I guess if anyone ever tried to craft requests to __utm.gif from serverside code.</p>
<p>I have found some i... | <p>I asked a similar question recently and somebody gave me a link, and I found another from the same site:</p>
<p><a href="http://www.vdgraaf.info/wp-content/uploads/image-url-explained.txt">http://www.vdgraaf.info/wp-content/uploads/image-url-explained.txt</a><br>
<a href="http://www.vdgraaf.info/wp-content/uploads/... |
Constantly Querying Server via Javascript - Good Idea? <p>I've got a small website that has about 5-10 administrators. I've set it up to monitor what each administrator is doing (adding items, removing items, etc). I had a list within our admin-panel that shows the previous 10 activities performed by the collective adm... | <p>3-4 users every 30 seconds isn't very much at all. Even 300 users at that rate wouldn't be much at all.</p>
<p>You may want to check into these questions: </p>
<ul>
<li><a href="http://stackoverflow.com/questions/219868/client-notification-should-i-use-an-ajax-push-or-poll">Should I use Ajax Push or Pull</a></li>
... |
How do I get started on my first web application? <p>I have this idea for a small-medium web application that I would like to build, probably with a combination of Velocity and Spring MVC. My problem is that I have never dealt with issues such as user registration, or with design issues such as CSS, layout, etc.</p>
<... | <p>You sound like you are suffering from <em>project-planning-paralysis</em>. I would suggest that you just start working on the parts you <em>are</em> certain of (like the application and data layers) and leave the parts you are unsure of alone. </p>
<p>Depending on the size of the project it may be worthwhile to g... |
Need help in sorting the programming buzz-words <p>How do you sort out the good buzz from the bad buzz? - I really need your help here :)</p>
<p>I see a lot of buzz-words nowadays, both here on SO and in school. For example, we had a teacher who everyone respected, who said "be careful about gold-plating and death-by-... | <p>If/when someone says one of those blanket statements to you always ask them "Why?".</p>
<p>If the answer makes sense and applies to what you were doing then it's probably worth heeding.</p>
<p>If the answer is "Ummm" or "Because Joel said so" feel free to ignore it. :-)</p>
|
Adding a User Control to a Webpage <p>I have a compiled class library containing a user control and I'd like to add it to a webpage. I'm adding an object tag to the html page that looks like:</p>
<pre><code> <OBJECT id="Main" classid="http://localhost/HelloWorld/Hello.World.dll#Hello.World.UserControl"></OBJE... | <p>Inside that file is a stack trace -- if you post it, I might be able to help.</p>
<p>Also, you need to have full-trust with the site set up in your .NET x.x Configuration control panel (or use CASPOL to set it).</p>
<p>Here's how to debug</p>
<ol>
<li>Use fiddler (google, download, and run).</li>
<li>Refresh the ... |
is it possible to put the template of a component in an other folder then the template folder in Symfony <p>I have a component that calls a template from the template folder as it should be done. But as there are a lot of files in the template folder i would rather have them split up in different sub folders.
Is it pos... | <p>This is something I've been thinking of and wanting to do since I started using Symfony over a year ago. As far as I know, there is no simple way of doing this. I usually end up creating new modules or using some kind of naming scheme that makes the partials easier to find.</p>
|
Winforms: Screen Location of Caret Position <p>How can I find the screen position of the caret for a standard Winforms TextBox?</p>
| <p>You can do it only with native interop: <a href="http://msdn.microsoft.com/en-us/library/ms648402%28VS.85%29.aspx" rel="nofollow">GetCaretPos</a></p>
<pre><code>[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
static extern bool GetCaretPos(out Point lpPoint);
</code></pre>
|
XAConnection performance in Oracle (10g) <p>In our project, we use the Oracle XA Connection pool.
Only a small subset of the queries(transactions) are distributed.
Rest are quite straightforward single database modification.</p>
<p>I would like to know if there is a performance difference in using
XAConnections Vs t... | <p>I have no benchmarks to substantiate the following, this is just "we all know that" conventional wisdom. As with all performance discussions Your Milage Will Vary, if this is absolutely critical to your application then you need to perform your own benchmarks.</p>
<p>I believe that there is no signifincant performa... |
Improving performance reflection , what alternatives should I consider <p>I need to dynamically set values on a bunch or properties on an object , call it a transmission object. There will be a fair number of these transmission objects that will be created and have its properties set in a short space of time.I want to ... | <p>Use <a href="http://msdn.microsoft.com/en-us/library/system.delegate.createdelegate.aspx" rel="nofollow"><code>Delegate.CreateDelegate</code></a> to turn a <code>MethodInfo</code> into a strongly-typed delegate. This can improve performance <em>massively</em>. I have a <a href="http://blogs.msmvps.com/jonskeet/2008/... |
Is python a stable platform for facebook development? <p>I'm trying to build my first facebook app, and it seems that the python facebook (<a href="http://code.google.com/p/pyfacebook/" rel="nofollow">pyfacebook</a>) wrapper is really out of date, and the most relevant functions, like stream functions, are not implemen... | <p>The updated location of pyfacebook is <a href="http://github.com/sciyoshi/pyfacebook/tree/master" rel="nofollow">on github</a>. Plus, as <a href="http://arstechnica.com/open-source/news/2009/04/how-to-using-the-new-facebook-stream-api-in-a-desktop-app.ars" rel="nofollow">arstechnica</a> well explains:</p>
<blockquo... |
How do I convince Linq to Sql to generate Sql to compare strings with greater than or less than? <p>Let's say I have a MS-SQL 2005 table named "People" with the following rows:</p>
<pre><code>|FirstName|LastName|
|JD |Conley |
|Joe |Schmo |
|Mary |Jane |
</code></pre>
<p>I want to execute a SQL s... | <p>You want <a href="http://msdn.microsoft.com/en-us/library/35f0x18w.aspx" rel="nofollow"><code>String.CompareTo</code></a> here</p>
<pre><code>var query = from p in db.People
where p.FirstName.CompareTo("JD") > 0
select p;
</code></pre>
|
"The test form is only available for requests from the local machine." <p>I created a Web Service in .Net and so the address of the service file has a nifty auto generated explanation about how it works. When I run the page from the machine it's hosted on it even has a form that I can use to submit test values to the s... | <p>You can work around this issue by modifying your <code>web.config</code> to include these nodes:</p>
<pre><code><configuration>
<system.web>
<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
... |
Override ringer volume in iPhone apps <p>I have built an app that plays lots of sounds the easy way:</p>
<pre><code>AudioServicesPlaySystemSound(someSoundID);
</code></pre>
<p>When I use the device volume buttons to increase or decrease the volume, the volume I actually change is the phone's ringer volume. So if you ... | <p>I have found the solution to what I thought would be a common problem. So here is how your app can have its own volume, and not mess with the user's ringer volume, even if you are only playing sounds as System Sounds.</p>
<p>You have to import the AVFoundation framework and in an object that stays loaded the whole ... |
Dropdownlist with datasource set and empty value? <p>Is there a quick way to add a blank value to a drop down list for a winforms application? Some of my dropdowns are bound to lists of objects and some are bound to datarows from a datatable. Since I am setting the datasource property, I can't just add one through co... | <p>You could add a DataRow with empty values to your datatable programatically, </p>
|
What is the difference between String.Empty and ââ and null? <blockquote>
<p><strong>Possible Duplicate:</strong><br />
<a href="http://stackoverflow.com/questions/151472/what-is-the-difference-between-string-empty-and">What is the difference between String.Empty and “”</a> </p>
</blockquote>
<p>I... | <pre><code>public sealed class String {
//...
public static readonly String Empty = "";
//...
}
</code></pre>
<p>Use <code>null</code> when you want to represent that there is no value;</p>
<p>Use <code>String.Empty</code> when you want to represent that there is a value, but the value is a blank string.<... |
What is (functional) reactive programming? <p>I've read the Wikipedia article on <a href="http://en.wikipedia.org/wiki/Reactive_programming">reactive programming</a>. I've also read the small article on <a href="http://en.wikipedia.org/wiki/Functional_reactive_programming">functional reactive programming</a>. The descr... | <p>If you want to get a feel for FRP, you could start with the old <a href="http://conal.net/fran/tutorial.htm">Fran tutorial</a> from 1998, which has animated illustrations. For papers, start with <a href="http://conal.net/papers/icfp97/"><em>Functional Reactive Animation</em></a> and then follow up on links on the p... |
Enterprise language, compiled or for JVM <p>We are currently developing carrier grade telecom applications in C++, Rational Rose and Java to run on an embedded platform based on Enea OSE which provides interfaces for the above three languages (actually C, Rose and java). </p>
<p>I'm interested in increasing the produc... | <p>Depends on your goals.</p>
<p>For long term support and maintainability, you're probably not going to beat Java.</p>
<p>For productivity--that's a bit of a question.</p>
<p>Since the telcom industry is fairly heavy into testing and process, reducing your number of lines of code isn't really the thing that will sp... |
Randomizing -and remembering that randomisation- multiple choice questions in php <p>Problem:</p>
<p>I'm trying to code a multiple choice quiz for my fellow students -and primarily to aid my own learning- and so I'm creating a multiple choice web-based quiz using PHP (5.2.08) and MySQL (5.0.32)</p>
<p>The questions t... | <p>Your data tables are awful. You need one table for questions and another table for answers. Each entry in the answers table refers back to a question in the questions table and has a flag indicating whether it is the correct answer.</p>
<p>So, the <code>QUESTIONS</code> table has the following fields:</p>
<ul>
<li... |
Set CommandTimeout used in Strongly Typed DataSet TableAdapter? <p>Preamble:</p>
<p>So, over the past 5 years or so various applications and tools have been written here at my company. Unfortunately many of the people who developed these applications used strongly typed datasets, I'm considering outlawing them in our... | <p>You don't say what language you're using. The following is in VB.NET since I happened to find such an example first:</p>
<pre><code>Namespace AdventureWorksPurchasingDSTableAdapters
Partial Public Class SalesOrderHeaderTableAdapter
Public Property SelectCommandTimeout() As Integer
Get
Return Adapter.Sel... |
Use cases for boxing a value type in C#? <blockquote>
<p><strong>There are cases when an instance of a
value type needs to be treated as an
instance of a reference type.</strong> For
situations like this, a value type
instance can be converted into a
reference type instance through a
process called boxing... | <p>There is almost never a good reason to deliberately box a value type. Almost always, the reason to box a value type is to store it in some collection that is not type aware. The old <a href="http://msdn.microsoft.com/en-us/library/system.collections.arraylist.aspx" rel="nofollow">ArrayList</a>, for example, is a col... |
CLR SQL Stored Procedures Testing with Unit Test Project <p>I'm just getting into using VS2008 to write clr stored procedures for SQL 2008. When writing c# code I am used to having a separate 'Test Project' where I would place all my unit testing code, however it appears at first blush that I can't have the same setup... | <p>You have to enabled SQL/CLR debugging on the connection before being able to debug your code.
in order to do that, follow the instructions here
<a href="http://msdn.microsoft.com/en-us/library/ms165039" rel="nofollow">http://msdn.microsoft.com/en-us/library/ms165039</a>(VS.80).aspx</p>
<p>Note that when you debug y... |
Flash player IE7 BitmapData send to server with amfphp <p>Does anybody experienced this kind of fault.</p>
<p>So i have some kind of imageuploader.</p>
<p>It fetches an image, grabs the bitmap data from it. convert that with a jpgencoder to a bytearray, send that bytearray to a server with amfphp and in php save that... | <p>So i figured it out. IE7 caching problem.</p>
<p>?Math.random();</p>
<p>does a lot :)</p>
|
get urls of firefox tabs from firefox extension <p>In a firefox extension, how do you enumerate the current window's tabs and retrieve their URLs?</p>
| <p>There's a code snippet at <a href="https://developer.mozilla.org/En/Code_snippets/Tabbed_browser#Enumerating_browsers">MDC</a> that does exactly that.</p>
|
Core Data: Strange bindings error on re-opening a document. Help? <p>I have been building a core data application to administrate some data and I've been stumped by a bug that indicates my objects aren't KVO compliant. However, I haven't modified the default KVO compliance of the NSManagedObject, and now I'm left scrat... | <p>This turned out to be a bug. Here's the report, with the reason and workaround.</p>
<p> NSArrayController 'Auto rearrange content' raises KVO exception for NSManagedObjects</p>
<p>Summary:
When 'Auto Rearrange Content' is checked on an NSArrayController that is managing the data of a core data entity, an exception... |
Convert .Net ManagementBaseObject to ManagementObject <p>I am trying to use the following code to write out all processes started on a computer. My problem is that the EventArrived method is passed a EventArrivedEventArgs which has a NewEvent property of type ManagementBaseObject. This does not have a InvokeMethod me... | <p><em>IS</em> the object a <code>ManagementObject</code> instance? The indexer may pass the return value as a <code>Base</code> because it's a general-purpose property. Try this:</p>
<pre><code>Private Shared Sub EventArrived(ByVal sender As Object, ByVal e As EventArrivedEventArgs)
Dim targetInstance As Manageme... |
Displaying associated objects <p>I am a Ruby on Rails newbie and had a question about the view logic in case of associated objects:</p>
<p>My models look similar to</p>
<pre><code>class Post < ActiveRecord::Base
has_many :comments
end
class Comment < ActiveRecord::Base
belongs_to :post
end
</code></pre>
<... | <p>You should avoid writing complex business login in the view. In this case, your execution is simple enough that you can write all the code in your view. It should look like this</p>
<pre><code><% @posts.each do |post| %>
<% @post.comments.all(:limit => 3, :order => "created_at DESC").each do |comme... |
Are inner classes commonly used in Java? Are they "bad"? <p>Are inner classes commonly used in Java? Are these the same as nested classes? Or have these been replaced in Java by something better? I have a book on version 5 and it has an example using an inner class, but I thought I read somewere that inner classes w... | <p>Inner classes are frequently used, and something very similar - anonymous classes - are practically indispensable, as they are the closest thing Java has to closures. So if you can't remember where you heard that inner classes are bad, try to forget about it!</p>
|
What is the Rolls-Royce way to deploy a Java applet? <p>I know how to deploy an applet using <code>applet</code>, <code>object</code>, <code>embed</code> tags and <code>JavaScript</code>, but I'm after the best approach (in terms of end user experience).</p>
<p>Sun suggests using <a href="http://java.sun.com/javase/6/... | <p>After much struggling with old and outdated information all over the web it seems like there's actually a really easy way to deploy applets - just let Sun write the correct tags for you!</p>
<pre><code><script src="http://java.com/js/deployJava.js"></script>
<script>
var attributes = {
code:... |
Invalid Cast Exception, Stored Procedure, LINQ TO SQL <p>9 months later, the same problem shows up again. I've tried everything I can think of:</p>
<ul>
<li>I cast as varchar(max) on the stored procedure;</li>
<li>I changed the mapping;</li>
<li>tried to find the collection linq works with, but couldn't find anywhere;... | <p>My guess is that you have a value in your table that is triggering SQL Server's conversion through the "numeric" data type. i.e. your value is being converted into an imprecise data type (float or real) and causing LINQ to SQL to attempt a double. See the caution in <a href="http://msdn.microsoft.com/en-us/library/m... |
Getting the ip-address <p>In C#:</p>
<pre><code>IPHostEntry IPHost = Dns.GetHostEntry(Dns.GetHostName());
for (int i = 0; i < IPHost.AddressList.Length; i++)
{
textBox1.AppendText("My IP address is: "
+ IPHost.AddressList[i].ToString() + "\r\n");
}
</code></pre>
<p>In this code, the <code>IPHostEntry... | <p>Assuming you only want the IPv4 address, I'm currently using this code (modified a bit for posting) which is robust enough for my use. Just invoke ToString on the result to get the address:</p>
<pre><code>// return the first IPv4, non-dynamic/link-local, non-loopback address
public static IPAddress GetIPAddress()
{... |
SEO blacklisting for cloaking <p>I am using postbacks to perform paging on a large amount of data. Since I did not have a sitemap for google to read, there will be products that google will never know about due to the fact that google does not push any buttons.</p>
<p>I am doing cloaking to spit out all the products w... | <p>Here is a <a href="http://www.google.com/support/webmasters/bin/answer.py?hl=en&answer=66355" rel="nofollow">FAQ</a> by google on that topic. I suggest to use CSS to hide some content. For example just give links to your products as an alternative to your buttons and use display:none; on them. The layout stays i... |
Extract OLE Object (pdf) from Access DB <p>We are upgrading/converting several old Access databases to MS-SQL. Many of these databases have OLE Object fields that store PDF files. I'm looking for a way to extract these files and store them in our SQL database. I've seen similar questions that answer how you might do t... | <p>I finally got some code working for what I want it to do. The trick is determining what part is the OLE Header and removing it. Here is what is working for me (based on code found <a href="http://blogs.msdn.com/pranab/archive/2008/07/15/removing-ole-header-from-images-stored-in-ms-access-db-as-ole-object.aspx" rel="... |
changing context to parent with jQuery <p>I've got a function I am running on a jQuery object using .each(). Except, if a certain test passes, I actually want to run the function on the parent of the node in the current iteration. However, when I try to switch contexts, I get an assignment error or endless loop.</p>
... | <p>Sorry mate but you'll have to make a variable out of it.</p>
<pre><code>$(this).each(function() {
var mycontext;
if($(this).attr("title")) {
content = $(this).attr("title");
mycontext = $(this).parent();
} else {
mycontext = $(this);
content = $(this).html();
}
//other stuff using myconte... |
Protect yourself against Dos attacks <p>This might be something more suited for Serverfault, but many webdevelopers who come only here will probably benefit from possible answers to this question.</p>
<p>The question is: How do you effectively protect yourself against Denial Of Service attacks against your webserver?<... | <p>There's no panacea, but you can make DoS attacks more difficult by doing some of the following:</p>
<ul>
<li>Don't (or limit your willingness to) do expensive operations on behalf of unauthenticated clients</li>
<li>Throttle authentication attempts</li>
<li>Throttle operations performed on behalf of each authentica... |
how can i do this with jquery? (its something created with flash) <p><a href="http://pal-auto.ebizautos.com/" rel="nofollow">http://pal-auto.ebizautos.com/</a></p>
<p>if you look at that page above, there is something that looks like a carasel which operates when the mouse is over each item and slides to the left. doe... | <p>Go on the jQuery site and search for accordion plug ins.</p>
|
Creating a Primary Key on a temp table - When? <p>I have a stored procedure that is working with a large amount of data. I have that data being inserted in to a temp table. The overall flow of events is something like</p>
<pre><code>CREATE #TempTable (
Col1 NUMERIC(18,0) NOT NULL, --This will not be an ident... | <p>This <strong>depends</strong> a lot.</p>
<p>If you make the primary key index clustered after the load, the entire table will be re-written as the clustered index isn't really an index, it is the logical order of the data. Your execution plan on the inserts is going to depend on the indexes in place when the plan ... |
Delphi: Mimicking MS OneNote's Data Structure <p>MS's OneNote uses a data hierarchy that is essentially a simple tree, even though the info is displayed via a tabbed interface rather than a treeview. You begin with "notebooks," which can have "sections," which have "pages." I'm trying to model this. In my case, a page ... | <p>Whether you go with a database or XML, try putting your data access routines in a datamodule. Let your GUI unit(s) make calls to public methods of the datamodule, and ensure that those calls do not depend on how your data are stored. That way, you can start with one approach, and switch to the other just by editin... |
Is there a way to remove the history for a single file in Mercurial? <p>I think I already know the answer to this but thought I would ask anyway:</p>
<p>We have a file that got added to a Mercurial repository with sensitive information in it. Is there any way to remove that file along with its change history without r... | <p>It is correct that you cannot easily remove a particular file from Mercurial in the sense that doing so will disrupt all the changeset IDs in your repository. When you change the changeset IDs, everybody has to re-clone the repository. See the <a href="http://www.selenic.com/mercurial/wiki/EditingHistory">Wiki page ... |
Formatting cells in Excel with Python <p>How do I format cells in Excel with python?</p>
<p>In particular I need to change the font of several subsequent rows
to be regular instead of bold.</p>
<p>Thnak you,</p>
<p>Alex</p>
| <p>Using <a href="http://pypi.python.org/pypi/xlwt" rel="nofollow">xlwt</a>:</p>
<pre><code>from xlwt import *
font0 = Font()
font0.bold = False
style0 = XFStyle()
style0.font = font0
wb = Workbook()
ws0 = wb.add_sheet('0')
ws0.write(0, 0, 'myNormalText', style0)
font1 = Font()
font1.bold = True
style1 = XFStyle... |
convert an xs:float value to a hex-string representation of its binary value <p>Using xsl 2.0, how would you convert an xs:float value to a hex-string representation of its binary value? i have no problem doing this for an integer (divide by 16 recursively and concatenate chars 0-9A-F), but float/double is stumping me... | <p>I would go out on a limb and say that this is impossible in vanilla XSLT. With access to user-definable extension functions it is easy to offshore it to some language better suited, as you already indicated yourself by <code>magic-here($in)</code>.</p>
<p>I don't think XSLT has a way to cast a number into a byte ar... |
How can I enable multiple segments of a UISegmentedControl to be selected? <p>Lets say my UISegmentedControl has 8 numbered segments. I would like for the user to be able to turn on 2, 3, or more of them at once. Toggling them. Essentially like a bits in a byte. Is this possible? I believe it is on regular Mac OS X but... | <p>This isn't possible using UIKit. I would recommend creating a custom control, or an array of <code>UISwitch</code> controls, representing each of the options in your UISegmentedControl.</p>
|
What is a good automated data import method for SQL Server? <p>I'm in the process of porting some SQL Server 2005 databases to SQL Server 2008. One of these databases has an associated import application (Windows task) which uses <a href="http://en.wikipedia.org/wiki/SQL_Server_Integration_Services" rel="nofollow">SSIS... | <p>I received a suggestion that I use ADO.NET to convert the .mdb file to a bunch of flat files, then use tsql's bulk insert statement to import the flat files. If it works, I'll mark this as the answer.</p>
<p><strong>EDIT:</strong></p>
<p>This worked really well. Far speedier than the old DTS. One down side is that... |
access: conditional formatting on report <p>I have a report example two fields [Name1], [Name2]</p>
<p>what is the expression for conditional formatting on name1 to highlight when not = to name2?</p>
<p>Is it:</p>
<p><>[Name2]</p>
<p>it is not working :(</p>
| <p>You can do it two ways:</p>
<p>Select "Field Value", "Not Equal" and then type in "[Name2]"</p>
<p>or</p>
<p>Select "Expression" and type in "[Name1]<>[Name2]"</p>
|
BackgroundWorker and Timer, handling one item at a time <p>My app monitors a directory where users can upload a file. When a new file is detected it is added to a queue. I have a timer that runs through the queue and determines if the file has finished uploading. If there are any files that are complete it will take th... | <p>You could store ready-to-process files in another queue (like a Queue< string> ) and have the BgWorker continuously poll that Queue. You might get better performance too, less idle time. You will have to protect the Queue (with Monitor) and have the BgWorker use Monitor.Wait when the Queue is empty.</p>
<p>To ge... |
How are ER modeled subtypes implemented in the database? <p>Sorry if this is too simple, but I've found a lot of documentation on ER-modeling recently, but all of it seems to skip over the actual implementation and I just want to clarify.</p>
<p>Is a subtype just a second table with a foreign key to the supertype alon... | <p>Yes, that's one of the three ways of doing it.</p>
<p>The second way, and perhaps the most simiple, is to just have the values in the subtype be fields in the supertype that can be null. It takes requires more space, but increases performance as it requires fewer queries to get the subtype-specific data.</p>
<p>T... |
Get MIME type from filename extension <p>How can I get the MIME type from a file extension?</p>
| <p>I've found many mime types my application uses are not in the default Windows registry and others are in the registry but not in the list included with IIS. I've compiled a list from these locations and added a few others that we use.</p>
<p>EDIT: See most up-do-date version with contributions <a href="https://git... |
Restoring multiple database backups in a transaction <p>I wrote a stored procedure that restores as set of the database backups. It takes two parameters - a source directory and a restore directory. The procedure looks for all .bak files in the source directory (recursively) and restores all the databases. </p>
<p>Th... | <p>Essentially, what was happening was that one of the files that needed to be restored had a problem, and the restore process was throwing an error, but the error is not severe enough to abort the proc. That is the reason there is no problem without the try-catch. However, adding the try-catch traps any error with se... |
Picking top 5 scores from a range <p>I run a small golf eclectic with excel. One of the things we have is a points system. I would like to get the 5 highest points scored over the season and have them ranked from 1 (being the highest points scored) to 5.</p>
<p>My knowledge of excel "sums" goes only a wee bit further ... | <p>If you don't want to change the order that they are presently in you can use the LARGE function. It returns the kth largest value. </p>
<p>Below is a great formula, if you drag it down it will automatically get the second, third and nth largest value from a table of data (in this example the data is between A1 to A... |
Visual Basic How do I read a CSV file and display the values in a datagrid? <p>I'm using VB 2005, how do I open a CSV file and read the columns/rows and display the values in a datagrid?</p>
<p>CSV file example:
jsmith,jsmith@hotmail.com</p>
<p>I then want to perform an action on each row i.e. each user, how would I ... | <p>Use the <a href="http://msdn.microsoft.com/en-us/library/microsoft.visualbasic.fileio.textfieldparser.aspx">TextFieldParser</a> that's <a href="http://msdn.microsoft.com/en-us/library/cakac7e6.aspx">built into</a> VB.NET. Google found me <a href="http://liveandonthewire.blogspot.com/2007/05/vbnet-data-grid-view-read... |
Modifying fields for a Workflow Task in Sharepoint <p>Does anyone know how you can modify the fields in an out-of-the-box (OOTB) Workflow Task (specifically Priority and Due Date)? The OOTB Approval workflow doesn't allow you to set these fields (it allows setting a due date, but not a due time). </p>
<p>I had a cunni... | <p>I've just realised you can edit field such as priority and due date (time) from the task list by selecting Actions > Edit in Datasheet. This works for normal task list items and those created by workflow. </p>
<p>I'd still like to know why a custom workflow that is set to trigger on new items in a task list doesn't... |
PHP alternative to trac? <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/349241/is-there-an-equivalent-to-trac-written-in-php">Is there an equivalent to Trac written in PHP?</a> </p>
</blockquote>
<p>Are there any PHP alternatives to Edgewall's Trac solution ... | <p>I'd try <a href="http://www.thebuggenie.com/">The Bug Genie</a></p>
|
GCC on HP-UX, lots of poll(), pipe(), and file issues <p>I'm having a lot of trouble building a 'middleman' logger - the intention is to place it on the path above an item in /usr/bin and capture everything going to and from the application. (Black box 3rd-party app is failing FTP for some reason.) Once run, the midd... | <p>The real problems:</p>
<h3>1st (but minor) Problem</h3>
<pre><code>struct pollfd pollArray[2] = {{0, POLLIN, 0}, {childOutPipe[0], POLLIN, 0}};
</code></pre>
<p>You are making possibly unwarranted assumptions about the order and contents of 'struct pollfd'. All the standard says is that it contains (at least) th... |
Java A4 printable document <p>I currently use an ActiveX control to print out an html document from a popup window without prompting the user. I've never liked this method and have finally got around to reconsidering the problem. </p>
<p>I've decided to use a Java applet, and have already managed to get the promptless... | <p>The standard way to print HTML from a browser (which is what it sounds like you want to do) is to use CSS and define a print specific style sheet.</p>
<p>There a good article on how to do that here <a href="http://www.alistapart.com/articles/goingtoprint/" rel="nofollow">http://www.alistapart.com/articles/goingtopr... |
How to Deal With Codeigniter Templates? <p>I'm fairly new to MVC, and I've found CodeIgniter recently. I'm still learning everyday, but one problem is its template engine. What is the best way to create templates in CodeIgniter?</p>
<p>CakePHP comes with its own template library, is there a similar feature in CodeIgni... | <p>Unlike other frameworks CodeIgniter does not have a global template system. Each Controller controls it's own output independent of the system and views are FIFO unless otherwise specified.</p>
<p>For instance if we have a global header:</p>
<pre><code><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://... |
.net GridView Control for online catalogue, will it work? <p>Trying to build an online catalog for a web shop. Is the GridView control configurable enough for this, i.e. each item, for example product picture, title, price, qty field, 'add' button, and then move right to the next one, basically a typical online shop la... | <p>The GridView will work but I would strongly suggest the use of a Repeater control as it is considerably more efficient!</p>
<p>If you are used to doing everything manually you will love the Repeater! Also...is there a chance for you to move to ASP.NET MVC in this application? You will love this framework over web... |
Does python have a "causes_exception()" function? <p>I have the following code:</p>
<pre><code>def causes_exception(lamb):
try:
lamb()
return False
except:
return True
</code></pre>
<p>I was wondering if it came already in any built-in library?</p>
<p>/YGA</p>
<p>Edit: Thx for all the c... | <p>No, as far as I know there is no such function in the standard library. How would it be useful? I mean, presumably you would use it like this:</p>
<pre><code>if causes_exception(func):
# do something
else:
# do something else
</code></pre>
<p>But instead, you could just do </p>
<pre><code>try:
func()
... |
How do you pass multiple enum values in C#? <p>Sometimes when reading others' C# code I see a method that will accept multiple enum values in a single parameter. I always thought it was kind of neat, but never looked into it.</p>
<p>Well, now I think I may have a need for it, but don't know how to</p>
<ol>
<li>set up... | <p>When you define the enum, just attribute it with [Flags], set values to powers of two, and it will work this way.</p>
<p>Nothing else changes, other than passing multiple values into a function.</p>
<p>For example:</p>
<pre><code>[Flags]
enum DaysOfWeek
{
Sunday = 1,
Monday = 2,
Tuesday = 4,
Wednesday... |
How can I make rdoc properly read method arguments from my c extension? <p>all, I'm using rdoc to generate documentation for my Ruby code which contains C-extensions, but I'm having problems with my method arguments. Rdoc doesn't parse their names correctly and instead uses p1, p2 etc.</p>
<p>So, first off, my extens... | <p>RDoc is completely clueless about argument names in C extensions*. This is how RDoc compiles the string of arguments:</p>
<pre><code>meth_obj.params = "(" + (1..p_count).map{|i| "p#{i}"}.join(", ") + ")"
</code></pre>
<p>Changing your source formatting won't help.</p>
<p>To improve your documentation, you could u... |
How fast can you get a fixed bug into production? <p>I'm working with 2 very different applications. </p>
<p>App #1 is a web app where I have direct access to the FTP, so fixing bugs is pretty easy. Cat A bugs are usually fixed within the next day. No problems here.</p>
<p>App #2 is an oil business document control a... | <p>The faster I fix bugs the more bugs I find I need to fix.</p>
|
XML Representation of C++ Objects <p>I'm trying to create a message validation program and would like to create easily modifiable rules that apply to certain message types. Due to the risk of the rules changing I've decided to define these validation rules external to the object code.</p>
<p>I've created a basic inte... | <p>Personally, for small, easily modifiable XML, I find <a href="http://www.grinninglizard.com/tinyxmldocs/tutorial0.html" rel="nofollow">TinyXML</a> to be an excellent library. You can make each class understand it's own format, so your object hierarchy is represented directly in the XML.</p>
<p>However, if you don't... |
launch X windows on client machine <p>I have a shell script on a Unix box which when executed sets the DISPLAY variable dynamicaly to the clients ip address and if the client has some sort of x windows up and running then it launches say a program ike xcalc.</p>
<p>I would want the shell script to launch the x windows... | <p>The general answer to that is "no, not unless you explicitly enable it."</p>
<p>Think about this in a general sense. Your questions is "Is my PC security so weak that external computers can connect in start programs on it, without a password or certificate?"</p>
<p>Clearly this effectively would mean that your PC... |
jQuery.. pulling a string before current element <p>HTML..</p>
<pre><code><div class="row">
<div>
<b>Title A</b> <a href="#">Link 1</a> <a href="#">Link 2</a>
</div>
Content A
</div>
<div class="row">
<div>
<b>Title B... | <p>You can get the previous sibling by using the <a href="http://docs.jquery.com/Traversing/prev#expr" rel="nofollow">.prev() method</a>. You can do that, or you can get the links <a href="http://docs.jquery.com/Traversing/parent#expr" rel="nofollow">.parent()</a>, and then <a href="http://docs.jquery.com/Traversing/fi... |
Flash Characters on Screen in Linux <p>I have a XFCE 4.6 on kernel 2.6. Is there a quick and easy way to flash a message on the screen for a few seconds? </p>
<p>My Thinkpad T60 has 3 volume buttons (up, down, mute). When I pressed the buttons, I would like to flash the volume on the screen for a second on screen. Can... | <p><a href="http://goodies.xfce.org/projects/applications/notification-daemon-xfce" rel="nofollow">notification-daemon-xfce</a> allows <a href="http://www.galago-project.org/" rel="nofollow">libnotify</a> clients to show brief messages in XFCE. libnotify has <a href="http://www.galago-project.org/files/releases/source... |
Race conditions in django <p>Here is a simple example of a django view with a potential race condition:</p>
<pre><code># myapp/views.py
from django.contrib.auth.models import User
from my_libs import calculate_points
def add_points(request):
user = request.user
user.points += calculate_points(user)
user.s... | <p>Django 1.4+ supports <a href="https://docs.djangoproject.com/en/dev/ref/models/querysets/#django.db.models.query.QuerySet.select_for_update">select_for_update</a>, in earlier versions you may execute raw SQL queries e.g. <code>select ... for update</code> which depending on underlying DB will lock the row from any u... |
How can I stop Flash from changing indent when user Clicks on hyperlink in TextField? <p>I have a TextField which I initialize by setting htmlText.
The text has anchor tags (hyperlinks).
When a user clicks on the hyperlink, the indentation of the second and subsequent lines in the paragraph changes. Why? How do I stop... | <p>I found a workaround, along the lines of my IDEA above.</p>
<p>1) Prefix all hyper-links with "event:".
2) Add an event listener on the control to process the request.
3) The listener launches the browser AND sets the text to empty string then its original value.</p>
<p>1) Prefixing with event:.</p>
<pre><code>pu... |
Conceptual Problems with Iterator <p>I'm trying to write my first iterator class / container type. Basically, I want to be able to iterate though a file, have the file converted to HEX on the fly, and pass the result into the boost::xpressive library. I don't want to do a one shot conversion to a string in RAM, because... | <p><code>operator++(int)</code> should be defined in terms of <code>operator++()</code>, not the other way around. Try switching them. Same for <code>operator--</code>.</p>
|
Effective way to make a system tray application <p>This is my first post on Stack Overflow and I'm just wondering on the options of making a system tray application. The application would run primary from the system tray while still operating, and could be brought up into a window when clicked on. It is also needed to ... | <p>Java 6 has new functionality which allows for the creation of applications which use the system tray.</p>
<p>The <a href="http://java.sun.com/developer/technicalArticles/J2SE/Desktop/javase6/systemtray/" rel="nofollow">New System Tray Functionality in Java SE 6</a> article goes into the details, and provides some s... |
How to use NHibernate ICriteria API to query by properties on a subclass of an associated object <p><strong>Example:</strong></p>
<p>Client object has a collection of Action objects which records a history of actions performed against the client. Action is abstract and has several subclasses e.g. SystemAction, Corre... | <p>Yes. Create DetachedCriteria for each search criteria that the user can specify and then add them to your CreateCriteria call.</p>
|
Is there a WmpBitmapDecoder equivelant in Silverlight? <p>Does anyone know how to use Windows Media Photo (.wdp) in silverlight? There is the WmpBitmapDecoder class for regular wpf applications, but I don't see anything like that when I create a silverlight application.</p>
<p>Are there any alternative image formats t... | <p>AFAIK, .wmp is not supported in Silverlight. </p>
|
Jquery: run a method on certain elements but not others <p>I'm having a hard time figuring out how to run a method on certain elements/nodetypes but not others.</p>
<p>For instance here's some HTML:</p>
<pre><code><div id="parent">
<div class="subparent">Changing Text
<div class="no-change"... | <p>I'm not really sure why you're writing a plugin to do this. This would find all the <code><div></code> elements inside #parent, filter out those that don't have the class of <code>.no-change</code>, and edit the text contents of them:</p>
<pre><code>$('#parent').find('div').not('.no-change').text('Edited!');
... |
Does MBTI assessment help development teams? <p>How much (if at all) does <a href="http://en.wikipedia.org/wiki/Myers-Briggs_Type_Indicator" rel="nofollow">MBTI type testing</a> help development teams?</p>
| <p>The MBTI has one surprising benefit: It's often the first time some developers are confronted with the notion that not everyone thinks the same way that they do. That realization can reduce "flipping the bozo bit" behavior based on developers having trouble communicating with one another.</p>
|
Form submission in cakephp using JQuery <p>I have created the Form as like</p>
<pre><code><?php echo $form->create('Result',array('action'=>'submit'));?>
//some input text fields,texarea fields
<?php echo $form->end('submit');?>
</code></pre>
<p>In my JQuery code, i have written like,</p>... | <p>Few issues:</p>
<ul>
<li>You are sending a Ajax Request,when the Submit button is clicked, but not stopping the click event with something like, so it will in any case redirect to the /submit page</li>
</ul>
<pre>
$(".submit").click(function (){
// do something .. in your case Ajax request
... |
How I can Update the row ionto database using ADo.net Data Entity Model? <p>How I can Update the row into database using ADo.net Data Entity Model?</p>
| <p>each data row is represented by an object.</p>
<p>you just need to fetch the required row, update the relevant property and save the changes using the object context.</p>
<p>for example:</p>
<pre><code>using(MyContext db = new MyContext())
{
var customer = db.Customers.First();
customer.Name = "New Value";
db... |
PHP - Pagination Picks Correct Number of Pages, But Doesn't Divide Up Rows <p>The code below is an attempt at pagination. It doesn't quite work. I am playing around with a result that has 49 rows. If I use <code>$rowsperpage = 10;</code>, the code below will correctly have hyperlinks to 4 pages at the bottom. Howev... | <p>You have to use limit to get specific items from your table.</p>
<pre><code>select * form table limit 5, 10
</code></pre>
<p>That will start at element 5 in the query and return the next 10 items.</p>
<p>Usually for pagination you want to do something like</p>
<pre><code>select * from table limit (PAGE-1)*ITEMS_... |
Scheduling priority considerations <p>Schedulers in contemporary operating systems implicitly give higher priority to I/O bound process over CPU bound processes. Do you think that while scheduling the processes, CPU bound processes should be given higher priority as compared to I/O bound processes so that the throughpu... | <p>If serving IO is given lower priority it is likely that some input is missed while the processor is executing non-IO processes which is almost certainly bad. That's why higher priority for IO processes is a necessary evil. If this is a problem you need an operating system that schedules otherwise.</p>
|
Calculator keypress <p>i made a basic calculator. but i don't know how to assign keypress. how it assigned?</p>
| <p>I <strong>strongly</strong> suggest you pick up a copy of a C# book (covering Windows Forms, etc) or try to follow an on-line tutorial.</p>
<p>For example, take a look at <a href="http://kamhungsoh.com/001e.php" rel="nofollow">this tutorial</a> or <a href="http://csharpcomputing.com/Tutorials/calculator.htm" rel="n... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.