input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Is this a proper MonoState Design? <p>I have a <code>Person</code> Class and based on some help I received in this post. </p>
<p><a href="http://stackoverflow.com/questions/825617/passing-objects-and-the-singleton-pattern/825820">MonoState, Singleton, or Derived Forms: Best approach for CRUD app?</a></p>
<p>I have a ... | <p>Regarding whether the fields should be private, that's just the new (C# 3.0?) way of declaring properties without having a backing variable. A common variation is </p>
<pre><code>public string SomeProperty { get; protected set }
</code></pre>
<p>'Course, as soon as you want to do something like validation in the ... |
MySQL Timestamp - why all zeros? <p>I'm using PHPMyAdmin and I've got a MySQL table column called "timestamp." The type (surprise!) is <code>TIMESTAMP</code>, and in 'attributes' I've set it to <code>ON UPDATE CURRENT_TIMESTAMP</code>.</p>
<p>However, each new record gets a timestamp that looks like this:</p>
<pre><c... | <blockquote>
<p>What am I missing?</p>
</blockquote>
<p>You don't update :)</p>
<p>Use <code>DEFAULT CURRENT_TIMESTAMP</code> along with <code>ON UPDATE CURRENT_TIMESTAMP</code></p>
|
Using Multiple Profile Providers with Overlapping Properties <p>I am working with a site that needs to use two different asp.net profile providers. They are both added in the web.config and the properties of each of them are listed there as well. I run into a problem when I try to enable a property that has the same na... | <p>I've only ever implemented a single profile system with a Web Application project. With the Website template, the functionality is out of the box. Profiles allow you to store some extra information per user when using the ASP.NET membership system. Profiles are stored in the database automatically when we add this e... |
Is there a Log4J Layout/Formatter that prunes Stack Traces for exceptions? <p>I'm looking for a Log4J Layout/Formatter that helps me prune stack-traces in exceptions a little better than the defaults. That the stack-execution is somewhere below main() is quite obvious and unnecessary for me to know, and that the except... | <p>I asked a <a href="http://stackoverflow.com/questions/348582/how-can-i-configure-log4j-to-not-print-the-exception-stacktrace">similar question (about completely suppressing the stack trace</a> a while back.</p>
<p>Unfortunately, there is no setting for that, you need to subclass PatternLayout to do it.</p>
|
CAML Query Help? <p>Is there a way to get all versions of list item(s) using a CAML Query?</p>
| <p>I don't think that's exposed directly in any of the APIs that take CAML queries as parameters. You'll probably need to get the current version of the ListItem using your CAML query and then make another call to get all versions of that item.</p>
|
Browser support <p>I need to make this function <strong>work everywhere, except IE6-7</strong></p>
<pre><code>$(function(){
window.scrollTo(0,300);
})
</code></pre>
<p>Please help.</p>
| <p>You could link in <a href="http://davecardwell.co.uk/javascript/jquery/plugins/jquery-browserdetect/" rel="nofollow">broswer detect</a> and then do something like:</p>
<pre><code>$(function() {
if (!($.browser.msie() && $.browser.version.number() < 8)) {
window.scrollTo(0,300);
}
}
</code></p... |
Adding UiImageView to UiScrollView one at a time... but how? <p>My problem is that my 300 images are being added to UiScrollView and shows up after it's done finishing with addsubview: calls. </p>
<p>How do I set it up so that it adds a subview, who's up on the Screen .. and continue adding ?</p>
| <p>You could add to UIScrollView only first couple of pictures that fit the screen and then add others on request, when user scrolls you have to check bounds and add new image if it would be displayed.</p>
<p>I'm not sure about the code details though.</p>
<p>I know for a sure that UIScrollView with 3 images are show... |
Regular expression syntax In PHP to extract all instances of a format <p>I am attempting to extract all instances of a particular format from a string:</p>
<blockquote>
<p>I am wondering if my new Sony [PT# 123456ABC; Sony] has this feature but my friend says the new Toshiba [PT# AD-3232hjk; Toshiba] has this featur... | <pre><code>$matches = array();
preg_match_all( "/\[PT#([^\];]+);([^\]]+)\]/", $input, $matches, PREG_SET_ORDER);
foreach ($matches as $match) {
echo "id=", trim($match[1]), " brand=", trim($match[2]), "\n";
}
</code></pre>
|
Web service for brand names (electronics, clothing, books, etc.) <p>Does anyone know of a web service that would allow me to search up brand names for a variety of items? Basically, I want a suggest-style dropdown to match brand names as I begin to type. I am writing a household inventory program and I don't want to ... | <p>You will have to deal with miss-typings regardless. </p>
<p>Amazons api will help you with this. Look up 'browse nodes'</p>
<p>Various options I can think of, it will however require some form of trawling the data and stripping brand names you are after.</p>
<p>Although this is for books authors same thing will a... |
To linq To SQL or not... that is the question? <p>Our team is now beginning to look at jumping from 2.0 to 3.5 and have been reviewing all the new stuff....</p>
<p>So, with the whole Linq to SQL not being heavily improved in the future should we ignore it completely?</p>
<p>It seems that it may fit of our needs very ... | <p>Everything I've read seems to suggest that Linq2SQL will still be around for a while. I would, if I were you, just pick the one that best suits the problem you're trying to solve. I might be a little biased toward using the Entity Framework because it's more abstract and might be a good capability for you and your... |
What's the difference between Start Debugging and Start Without Debugging in Silverlight Application? <p>I have a problem wherein I get an AmbiguousMatchException in some of the samples from the Silverlight.FX samples.</p>
<p>The TaskList.aspx sample for example demonstrates this problem when I run Start Debugging the... | <p>I would guess that the exception is being caught some where up the stack and you don't see it without the debugger being attached. Under Debug>Exceptions there are options for changing the way exceptions are handled when running under debug.</p>
|
Refresh dropdown in parent, when user closes popu window <p>I have a three step registration process, all on one page, the last of which requires the user to select a saved payment method or input a new one.</p>
<p>Obviously, I want to collect that new data over SSL. Step 2 of the process involves showing the user a G... | <p>You can access the original window with opener using javascript, including calls to any function defined in that window.</p>
<p>For instance:</p>
<pre><code>window.opener.addValue(newValue);
</code></pre>
<p>Should do what you want.</p>
|
Want to mimic iphone address book search (In terms of interface & interaction) <p>When you do a search in the address book the flow is:</p>
<p>1) Select the search bar</p>
<p>2) The right most transparent a-z index is removed</p>
<p>3) A transparent black window is placed over the current UITableView</p>
<p>4) When... | <p>Use the new iPhone SDK 3.0 where this is provided for free by a new controller.</p>
<p>I can't say more because the iPhone SDK 3.0 is still under NDA.</p>
|
How can I add a horizontal scrollbar to a VBA ListBox <p>I'd like to add a horizontal scrollbar to a VBA ListBox.</p>
<p>It appears that the built in ListBox does not add a horizontal scrollbar automatically. I have a number of fields whose contents exceed the width of the ListBox and are thus unreadable to the user.... | <p>Access will automatically add a horizontal scrollbar if the column width exceed the width of the listbox. HOWEVER, if you are using multiple columns, the first column cannot be set to 0. You must have at least some value in there, even if it's just 0.1" Hope this helps.</p>
|
how to deal with complex winform object databinding? <p>What are the best practices or tips with respect to data binding to objects?</p>
<p>I have a complex data binding scenario where my winform has a BindingSource set to an object. This object is a class of type Customer and the forms are bound the customer's prope... | <p>Binding doesn't have to be one to one. You can listen on a Country or Checkbox change to determine the province for example.</p>
<p>What you have though looks like a state flow, in a given state, do X. Add a 'hidden' property that correctly represents the state you want to use for your bindings: PreDefined, Normal,... |
K&R: array of character pointers <p>On pg. 109 of K&R, we see:</p>
<pre><code>void writelines(char *lineptr[], int nlines)
{
while (nlines -- > 0) printf("%s\n", *lineptr++);
}
</code></pre>
<p>I'm confused about what *lineptr++ does exactly. From my understanding, printf requires a char pointer, so we provi... | <p>Keep reading! At the very bottom of p. 99</p>
<blockquote>
<p>As formal parameters in a function definition,</p>
<pre><code> char s[];
</code></pre>
<p>and</p>
<pre><code> char *s;
</code></pre>
<p>are equivalent; we prefer the latter because it says more explicitly that the parameter is a pointer.</... |
Apache mod rewrite simple redirect <p>I want requests to my site to work as follows:</p>
<p><a href="http://example.com/" rel="nofollow">http://example.com/</a> would pull up the index.php file (the current default behavior) ideally without displaying the index.php</p>
<p><a href="http://example.com/foo.php" rel="nof... | <p>Not exactly what you've asked for I realise, but I often use this in .htaccess:</p>
<pre><code>RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php
</code></pre>
<p>..to send anything that isn't an actual file or directory to index.php, which then contains logic to inter... |
Printing from servlet, why does this not work <p>I want to print from a servlet. I believe I have the correct syntax. But I get the message "delete these tokens" in Eclipse.</p>
<pre><code> PrintWriter out = response.getWriter();
out.println("<html><head><title>Woohoo</title></head><... | <p>You're putting double quotes inside your string like:</p>
<pre><code>"<form id="report_form"...
</code></pre>
<p>You need to escape them:</p>
<pre><code>"<form id=\"report_form\"...
</code></pre>
<p>or use single quotes in the HTML:</p>
<pre><code>"<form id='report_form'...
</code></pre>
|
voice record (winmm.dll) using C#.net <p>My requirement was to build an utility which could record voice (through mic) and save on disk .wav files as desktop and web app. for specific users so i chose activeX technology as i didn't find any other better way (may be you know and can guide me.. would be more than welcome... | <p>I would use DirectShow to capture the audio. Since you added a C# tag to the question, I recommend using the <a href="http://directshownet.sourceforge.net/" rel="nofollow">DirectShow.NET library</a>. Make sure you also download the <a href="http://sourceforge.net/project/showfiles.php?group%5Fid=136334&package... |
Find top sales people <p>I want to find Top and botton 10% sales people.How can I do this using SQL 2005 or 2008?</p>
<pre><code>DECLARE @Sales TABLE
(
SalesPersonID varchar(10), TotalSales int
)
INSERT @Sales
SELECT 1, 200 UNION ALL
SELECT 2, 300 UNION ALL
SELECT 7, 300 UNION ALL
SELECT 4, 100 UNION ALL
SELECT 5, ... | <p>TOP 10 %</p>
<pre><code>select top 10 percent SalesPersonID, sum(TotalSales)
from Sales
order by sum(TotalSales)
group by SalesPersonID
</code></pre>
<p>BOTTOM 10 %</p>
<pre><code>select top 10 percent SalesPersonID, sum(TotalSales)
from Sales
order by sum(TotalSales) desc
group by SalesPersonID
</code></... |
Need to store string as id for objects in some fast data structure <p>I'm implementing a session store for a web-server. Keys are string
and stored objects are pointers. I tried using map but need something
faster. I will look up an object 5-20 times
as frequent than insert. </p>
<p>I tried using hash-map but failed... | <p>I was going to suggest a <code>map</code>, but I see you have already ruled this out.</p>
<blockquote>
<p>I tried using map but need something
faster.</p>
</blockquote>
<p>These are the std::map performance bounds courtesy of the <a href="http://en.wikipedia.org/wiki/Map%5F%28C%2B%2B%5Fcontainer%29" rel="nofol... |
Fortran 90 kind parameter <p>I am having trouble understanding Fortran 90's <code>kind</code> parameter. As far as I can tell it does not determine the precision (i.e., float or double) of a variable, nor does it determine the type of a variable. So what does it determine and what exactly is it for?</p>
| <p>The KIND of a variable is an integer label which tells the compiler which of its supported kinds it should use.</p>
<p>Beware that although it is <em>common</em> for the KIND parameter to be the same as the number of bytes stored in a variable of that KIND, it is <em>not required</em> by the Fortran standard.</p>
... |
How to use "one to many" relations in SubSonic <ul>
<li>What are the ways to tell SubSonic about the relationship (only foreign keys? Or other methods too)?</li>
<li><p>If I have (for example) a team object with related team members</p>
<p>** how do I access and update the team members from the team</p>
<p>** how do ... | <p>Subsonic code generation will read the foreign key relationships in the tables and create the required helper methods in the table classes. The Northwind Product class has a PrimaryKey relationship to the OrderDetail class. Subsonic generates the method</p>
<p>public Northwind.OrderDetailCollection OrderDetails()</... |
Compilation <p>My source code doesn't get compiled when i specify the compiler as Borland C.
It gets compiled when the compiler is selected as Microsoft Visual Express.
Once it gets compiled under Microsoft Visual Express, only then,it gets compiled under Borland C.
Why is this happening?</p>
| <p>I wonder if they use an interchangable object format?</p>
<p>If so, maybe you're using a Microsoft specific extension. You can compile under MS, this generates a bunch of object files. You then compile under Borland, which doesn't actually compile (and so doesn't barf on the MS specific extension) - it just links... |
Cache provider for NHibernate 2.0.1.GA using ASP.NET Cache object <p>I have migrated my application from NHibernate 1.2.1 to NHibernate 2.0.1. Now i am geting the error "Version Conflict error while compiling". It shows that application still using the NHibernate V1 but i have changed the Version by deleteing the old d... | <p>NHibernate.Caches is part of the <a href="http://sourceforge.net/project/showfiles.php?group%5Fid=216446" rel="nofollow">contrib package</a>. You need to download the latest version and update your assembly.</p>
|
Java Exception vs C++ Exceptions <p>Where are exceptions stored ?
Stack, Heap.
How is memory allocated and deallocated for Exceptions?
Now if you have more than one exception which needs to be handled are there objects of all these exceptions created?</p>
| <p>I would assume that memory for exceptions is allocated the same way as for all other objects (on the heap).</p>
<p>This used to be a problem, because then you cannot allocate memory for an OutOfMemoryError,
which is why there was <a href="http://bugs.sun.com/bugdatabase/view%5Fbug.do?bug%5Fid=4753347">no stack trac... |
Bus error vs Segmentation fault <p>Difference between a bus error and a segmentation fault?
Can it happen that a program gives a seg fault and stops for the first time and for the second time it may give a bus error and exit ?</p>
| <p>On most architectures I've used, the distinction is that:</p>
<ul>
<li>a SEGV is caused when you access memory you're not meant to (e.g., outside of your address space).</li>
<li>a SIGBUS is caused due to alignment issues with the CPU (e.g., trying to read a long from an address which isn't a multiple of 4).</li>
<... |
How to read 'List separator' from OS in Java? <p>I am writing a CSV exporter in Java that should respect the user's custom settings, especially the "List separator" to use as a delimiter.</p>
<p>In Windows, one can set this List separator in</p>
<pre><code>Control Panel -> Regional and Language Options -> Regio... | <p>From comments of <a href="http://stackoverflow.com/questions/838590/how-to-read-list-separator-from-os-in-java/838718#838718">this answer</a>:</p>
<blockquote>
<p>Reading the OS-specific setting is a need I <em>have</em> to meet.</p>
</blockquote>
<p>So what if OSs other than Windows <em>don't have</em> such a s... |
What are the steps followed by sql engine to execute the query..?? <p>My question is not how to use inner join in sql. I know about how it matches between table a and table b. </p>
<p>I'd like to ask how is the internal working of inner working. What algorithm it involves? What happens internally when joining multiple... | <p>There are different algorithms, depending on the DB server, indexes and data order (clustered PK), whether calculated values are joined or not etc.</p>
<p>Have a look at a query plan, which most SQL systems can create for a query, it should give you an idea what it does.</p>
|
Excel XML Line Feeds in Fields <p>I' trying to get the following string to output to a cell in Excel using the 2003 XML capabilities "Cheese\nBread" and at the moment it ignores the line break.</p>
<p>If I create a file with the desired effect then I get the following output</p>
<pre><code><Cell ss:StyleID="s62"&g... | <p>I had to add the following to my XML definition (within the "Workbook" element):</p>
<pre><code><Styles>
<Style ss:ID="sMultiLine">
<Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
</Style>
</Styles>
</code></pre>
<p>And then, in the "Cell" element, add the appropriate matchi... |
Is there a way to forbid casting to subclass that is non-const in C++? <p>Here is a complete example.
I want to forbid using A::set from objects casted from B to A by allowing only casting
B to const A.
How to do it?
(I can't use virtual functions)</p>
<pre><code>#include <iostream>
#include <cassert>
u... | <p>You could make the inheritance private and provide a member function in B to use instead of casting.</p>
<pre><code>const A& B::convert_to_A() const { return *this; }
</code></pre>
|
how do you troubleshoot with "works on my machine" scenarios <p>It happens lot of the time that when you report a bug to a developer, he comes back saying "it works on my system" though its a browser app. How do you go about sorting that out ?</p>
| <h2>From a training/process point of view:</h2>
<p>Train your team to know that "works on my machine" is not a get-out-of-jail-free response.</p>
<p>Have an <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome%2Bto%2BCruiseControl.NET">automated build server</a>.</p>
<p>Have an automated test dep... |
Invoke external shell script from PHP and send some input to it <p>my aim is to invoke a shell script from a PHP program and then wait for a few seconds to send some termination key to it (I can't simply kill it because I want to test the correct execution of the termination phase).</p>
<p>Here is an example of what I... | <p>You need to use <a href="http://php.net/manual/en/function.proc-open.php" rel="nofollow">proc_open()</a> to be able to communicate with your process. Your example would work like this:</p>
<pre><code>// How to connect to the process
$descriptorspec = array(
0 => array("pipe", "r"),
1 => array("pipe", "w... |
How to select first row of the first table in an html page using jQuery? <p>Suppose if I have multiple tables in my HTML page (without their 'id' attribute), so how can I select first row of the first table or any specific table using jQuery selectors?</p>
| <pre><code>$("table:first > tr:first")
</code></pre>
<p>or</p>
<pre><code>$("table:first").find("tr:first")
</code></pre>
<p>or</p>
<pre><code>$("table:first").children("tr:first")
</code></pre>
<p>or</p>
<pre><code>$("table").eq(0).children("tr").eq(0)
</code></pre>
<p>So if I understand the followup questio... |
JPA or Hibernate for Java Persistence? <p>I'm researching the development of Enterprise Applications in Java, .NET and Groovy. For each platform, we're going to try how hard it is to realize a simple SOAP web service. We'll use the tools and libraries that are most commonly used, to research the real world as accuratel... | <p>As you're probably already aware, as of 3.2 Hibernate is JPA certified. You can easily use Hibernate as your JPA provider without having to use any of Hibernate's "custom" APIs.</p>
<p>I'd recommend using straight JPA with Hibernate as the provider. And use annotations rather than XML (much nicer). </p>
<p>Then wh... |
How to present a Collection of (View)Models in a ViewModel <p>I have a question regarding the MVVM design for C#/WPF. I've had a look at several demo applications, but they didn't really handle my problem.
My application consists of objects that contain other objects. Much like in a parent - children relationship. </p>... | <p>Actually, the proper way to do this is when you first create a ParentVM, you iterate through the children of the passed-in Parent, creating a ChildVM for each, then add those ChildVM objects to the ParentVM's ChildVMs property. (Some would just call that property 'Children' but I personally like being clear it's a c... |
How to swap MySQL table and change auto_increment atomically? <p>I have two tables:</p>
<pre><code>CREATE TABLE table_a (
id SERIAL
);
CREATE TABLE table_b (
id SERIAL
);
</code></pre>
<p>I want to swap the tables out and set the auto_increment of the new table_a to the MAX(id)+1 of table_b. E.g.</p>
<pre><c... | <p>As long as the server is not on a version of <a href="http://dev.mysql.com/doc/refman/5.0/en/alter-table-problems.html" rel="nofollow">MS Windows</a> and you stick with non-transactional tables, you should be able to use table locks and <code>ALTER TABLE</code> <em><code>table_name</code></em> <code>RENAME TO</code>... |
Database msi installer using Team System Database Edition <p>Has anyone developed a msi setup for database using an embedded resource for the sql scripts. The sql scripts should be the output of the Databse project of Team System Database Edition (Database project)</p>
| <p>You should probably be looking at Wix3 for this. It has an SQL extension that manages creating/updating databases.</p>
|
How to send HTML as GET-Request parameter? <p>I would like to send a html string with a GET request like this with Apaches HttpClient:</p>
<pre><code>http://sample.com/?html=<html><head>...
</code></pre>
<p>This doesnt work at the moment, i think its an encoding problem. Do you have any ideas how to do th... | <p>Try using URL Encoding to format your html string first.</p>
<pre><code>String yourHtmlString = java.net.URLEncoder.encode("<html>....");
method.setQueryString(new NameValuePair[] {new NameValuePair("report", yourHtmlString)});
</code></pre>
|
What rendering engine does cfdocument use for HTML->PDF conversion? <p>Simple question: Does anyone know what CF8 uses to render HTML into PDF?</p>
<p>More specifically, I'd like to know the version and if there's a complete description of what styles it does/doesn't support.</p>
<p>(for example, it doesn't support C... | <p>Yes, it does use iText. CF8 uses version 1.4:</p>
<pre><code><cfset doc = createObject("java", "com.lowagie.text.Document")>
<cfdump var="#doc.getVersion()#">
</code></pre>
|
Access the control of one page from another page <p>In my project, I need to disable some controls in one page from an another page. For example Mainpage.html has a button named "View profile", which needs to be disabled from Profile.html. Any suggestions?</p>
| <p>On the profile page set a cookie that is read on Mainpage.html, depending on whether its set or not the control is disabled.</p>
|
Memory usage of FileChannel#map <p>Does <a href="http://java.sun.com/javase/6/docs/api/java/nio/channels/FileChannel.html#map%28java.nio.channels.FileChannel.MapMode,%20long,%20long%29" rel="nofollow"><code>FileChannel#map</code></a> allocate all the memory needed for the resulting <code>ByteBuffer</code> immediately, ... | <p>Memory usage is never straightforward. The actual buffer used by <code>FileChannel.map</code> is not part of the Java heap. Indeed the memory might be shared with other processes. The file may not even be read from the disc until the pages are touched.</p>
|
'Answer' instance needs to have a primary key value before a many-to-many relationship can be used <p>I have a model called <code>Answer</code> which has a <code>ForeignKey</code> relationship to another model called <code>Question</code>. This means there can be several answers to question, naturally.</p>
<pre><code... | <p>Thanks to everyone who took their time on this question. The classes provided in my question weren't complete, because I thought the inner <code>Meta</code> classes didn't matter. In fact, <code>Answer</code> looked like this:</p>
<pre><code>class Answer(models.Model):
"""
We have two fields here to repre... |
The correct way to encrypt a string using HmacSHA256 in VB.NET <p>I need to create a keyed hash for a string of XML to send to a 3rd party. This is the code I am using but it is producing a different hash than the example that the 3rd party has sent me. I have been through all the tutorials I can find and re-read MSDN ... | <p>(Read my comments)<br />
If My.Settings.PortalHASH is the Base64 encoded key you need to do this:</p>
<pre><code>Dim Key() As Byte = Convert.FromBase64String(My.Settings.PortalHASH)
</code></pre>
|
How to automate development environment setup? <p>Every time a new developer joins the team or the computer a developer is using changes, the developer needs to do lots of work to setup the local development environment to make the current project work. As a SCRUM team we are trying to automate everything including dep... | <p>There are several options, and sometimes a combination of these is useful: </p>
<ul>
<li>automated installation</li>
<li>disk imaging</li>
<li>virtualization</li>
<li>source code control </li>
</ul>
<p>Details on the various options:</p>
<ol>
<li><p><strong>Automated Installation</strong> Tools for automating ... |
How can I get a Future<MyObject> without using ExecutorService? <p>I would really like to do something like this:</p>
<pre><code> Callable<MyObject> myCallable = ....
Future<MyObject> = new Thread( myCallable).start();
</code></pre>
<p>I basically want to start a single long-running task that runs in par... | <p>Try FutureTask. It doesn't have any explicit dependency on the Executor framework and can be instantiated as is, or you can extend it to customize it.</p>
|
Excel: How can I display the data from several sheets in one? <p>I have written a script which creates a complex Excel sheet which contains data from several data sources. The data on each sheet is usually 1-5 rows. It would be great if I could create another sheet which would display the data from the other sheets onl... | <p>if you want a build a Solution by yourself try: <br>
<a href="http://poi.apache.org/" rel="nofollow">http://poi.apache.org/</a> <br>
Apache POI - Java API To Access Microsoft Format Files
Its really easy to use...and you can easily format data etc...</p>
<p>I used POI with Apache Digester (<a href="http://commons.a... |
How to add search functionality to my application <p>I am writing Windows application (with Borland C++ Builder), which stores large number of text files. I want users to be able to search these files very fast, so I need an indexing and search library. I do not use database, but my own file format for storing the docu... | <p><a href="http://clucene.wiki.sourceforge.net/" rel="nofollow">CLucene</a> is a C-Port of the lucene (java) library.
I have only used the original java version, but lucene is able to do what you are asking for.</p>
|
valid html header <p>Is there any way to write a valid header/link/image?
Something like</p>
<pre><code><a href="index.html"><h1 id="logo">Company name</h1></a>
</code></pre>
<p>(with an image set as background and the text moved way to the left so its not visible via css)</p>
| <p>Something like:</p>
<pre><code><h1 id="logo"><a href="index.html">Company Name</a></h1>
#logo a {
display: block;
width: 200px; /* width and height equal to image size */
height: 100px;
background: transparent url(images/logo.png) no-repeat;
text-indent:-9999px;
}
</code... |
Javascript: Check if the user is navigating away with a form submit or a simple link click <p>I need to do remind the users something when they are leaving the page, and that can be handled with the window.onUnload event.
But I also need to check if the user is navigating away by submitting the form on the page, or by ... | <p>You actually want window.onbeforeunload</p>
<pre><code>window.onbeforeunload = function (e) {
var e = e || window.event;
// For IE and Firefox
if (e) {
e.returnValue = 'Are You Sure?';
}
// For Safari
return 'Are You Sure?';
};
</code></pre>
|
The remote server returned an error: (422) <p>I am getting following error when I am trying to get WebResponse using</p>
<pre><code>WebResponse response = request.GetResponse()
</code></pre>
<p><strong>The remote server returned an error: (422).</strong></p>
<pre><code>at System.Net.HttpWebRequest.GetResponse()
a... | <p>That exception means that the web server responded with an error code, namely 422. You will need to check with the administrator of the remote site, why that might be. (Or look at the body of the response if any was returned, it might include some hints).</p>
<p>Here is the explanation of error code 422: <a href="h... |
C++ Function Pointer issue <p>For some reason trying to pass a pointer to this function to a varadic function produces the following error:</p>
<pre><code>1>c:\... : error C2664: 'PyArg_ParseTuple' : cannot convert parameter 3 from 'int (__cdecl *)(PyObject *,void *)' to '...'
1> Context does not allow fo... | <p>This compiles fine in VC++ 2008:</p>
<pre><code>struct PyObject;
template<int ARG> int Arg_MakeSize2U(PyObject *obj, void *out)
{
return 0;
}
int main()
{
int (*sizeConv)(PyObject *,void *) = &Arg_MakeSize2U<1>;
sizeConv(0, 0);
}
</code></pre>
<p>So you must be doing something differe... |
Generic-like behavior in PL/SQL procedure parameters <p>Suppose I have some data types defined in PL/SQL:</p>
<pre><code>TYPE foo_t IS RECORD (...);
TYPE foo_table_t IS TABLE OF foo_t INDEX BY BINARY_INTEGER;
TYPE bar_t IS RECORD (...);
TYPE bar_table_t IS TABLE OF bar_t INDEX BY BINARY_INTEGER;
</code></pre>
<p>Is ... | <p>Not directly. From the PL/SQL programmer's guide:</p>
<p>"The actual parameter and its corresponding formal parameter must have compatible datatypes."</p>
<p>PL/SQL does an implicit conversion of actual parameter datatypes to formal parameter datatypes. So, you could pass a number value to a procedure that wants a... |
What would be a good browser-independent JavaScript programming environment? <p>My team's current project involves re-writing retrieval libraries in JavaScript. We are basically looking for a setup which enables us to apply test-driven development methods.</p>
<p>So far we plan to use Vim to write the code, no fancy I... | <p>You can test your code in Spidermonkey or <a href="http://www.mozilla.org/rhino/" rel="nofollow">Rhino</a> (an older JS interpreter in Java), but you won't really know which browsers it works in until you test your scripts in them!</p>
<p>I agree with the earlier poster, using a browser-independent library like jQu... |
IE8 won`t submit on enter when you have multiple forms <p>if you have 3 forms (shown below) and you set two of forms to not to display (display:none;) and you use javascript to toggle through each form, the forms that were set to hidden, when you set them to visible and you try to submit a form by pressing enter, it wo... | <p>Iâm afraid I donât have IE 8 here to test on, but you might try different CSS properties as a workaround:</p>
<pre><code><style type="text/css">
.hide {
position: absolute;
top: -9999px;
left: -9999px;
}
</style>
<a href="" onclick="$('#form1').removeClass('hide');$('#form2').addClas... |
Date based licensing logic for Java web app? <p>I am trying to come up with a logic for a date based licensing mechanism for a Java web app. The app needs to be deployed in client sites which may not have access to the Internet (deployed on the intranet). In this case how do I build a licensing mechanism based on Start... | <p>Hmm, I think if the rules are: (a) The licensing must be based on start and end dates; and (b) The computer cannot be assumed to be connected to the outside world, then I don't think the problem is even theoretically solvable. Your only source of what the date is will be some date on the computer itself, either the ... |
Where is UdpClient.CancelReceive? <p>I'm implementing a simple local-network discovery protocol, so I call UdpClient.Send and then UdpClient.BeginReceive. In case more than one response is pending, I call UdpClient.BeginReceive at the end of the callback. Something like this:</p>
<pre><code>UdpClient client = new UdpC... | <p>Instead or to overcome this exception create bool and set it before issuing the close command, use that bool to check in callback</p>
<p>like this</p>
<pre><code>bool isClosing=false;
void Callback(IAsyncResult ar)
{
if(isClosing) return;
}
</code></pre>
<p>set the <code>bool</code> <code>isClosing</code> bef... |
Timespan formatting <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/574881/how-can-i-string-format-a-timespan-object-with-a-custom-format-in-net">How can I String.Format a TimeSpan object with a custom format in .NET?</a> </p>
</blockquote>
<p>How do you eleg... | <p>There is no built-in functionality for this, you'll need to use a custom method, something like:</p>
<pre><code>TimeSpan ts = new TimeSpan(0, 70, 0);
String.Format("{0} hour{1} {2} minute{3}",
ts.Hours,
ts.Hours == 1 ? "" : "s",
ts.Minutes,
ts.Minutes == 1 ... |
Linq and the Equality Operator: Expression of type 'System.Int32' cannot be used for parameter of type 'System.Object' <p>I'm trying to override the equality (==) operator in C# to handle comparing any type to a custom type (the custom type is really a wrapper/box around null).</p>
<p>So I have this:</p>
<pre><code>i... | <p>What is wrong with null? Re the missing <code>int</code> vs <code>null</code>, try <code>int?</code>:</p>
<pre><code>exp = Expression.Equal(
Expression.Constant(10, typeof(int?)),
Expression.Constant(null, typeof(int?))
);
</code></pre>
|
How to embed excel in word programmatically? <p>Are there any way to do so? I prefer to use VB.NET or Java and try to avoid to use VBA. Thanks!</p>
| <p><a href="http://www.c-sharpcorner.com/UploadFile/amrish%5Fdeep/WordAutomation05102007223934PM/WordAutomation.aspx" rel="nofollow">This information</a> might help. It walks through automating Word using C#, but the examples should get you going with VB.</p>
|
Changing the current working directory in Java? <p>How can I change the current working directory from within a Java program? Everything I've been able to find about the issue claims that you simply can't do it, but I can't believe that that's really the case.</p>
<p>I have a piece of code that opens a file using a ha... | <p>There is no reliable way to do this in pure Java. Setting the <code>user.dir</code> property via <code>System.setProperty()</code> or <code>java -Duser.dir=...</code> does seem to affect subsequent creations of <code>Files</code>, but not e.g. <code>FileOutputStreams</code>.</p>
<p>The <a href="https://docs.oracle.... |
Guard Clause and Exception handling for the same condition <p>I ran across the following snippet of code. Names have been changed to protect the innocent:</p>
<pre><code> public void RunProgram()
{
System.IO.FileInfo fInfo = new System.IO.FileInfo(Application.StartupPath + "Program.exe");
if (!fInfo.Exists)
... | <p>The file not being there is something that we can reasonably anticipate - and since we are at the UI level (I assume, since <code>MessageBox</code>), it makes reasonable sense to sanity check the request, and just tell the user directly and cancel.</p>
<p>If we were deep in the bowels of the code (a few levels remo... |
Injecting jQuery into a page fails when using Google AJAX Libraries API <p>I'd like to inject jQuery into a page using the Google AJAX Libraries API, I've come up with the following solution:</p>
<p><strong><a href="http://my-domain.com/inject-jquery.js" rel="nofollow">http://my-domain.com/inject-jquery.js</a>:</stron... | <p>If you're injecting, it's probably easier to request the script without using the google loader:</p>
<pre><code>(function() {
var script = document.createElement("script");
script.src = "http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js";
script.onload = script.onreadystatechange = functio... |
Get Id of a row from an image button in a gridview in vb.net <p>I have a gridview and in that gridview i created a list of imagebuttons programmatically with an addhandler as follows:</p>
<pre><code>Dim deletecshr As New ImageButton
deletecshr.ImageUrl = "\images\bttnDeletemini.gif"
deletecshr.ToolTip = "This Will Del... | <p>I'd recommend assigning </p>
<pre><code>imageButton.CommandName = "Delete"
imageButton.CommandArgument = Your_Row_ID_You_Want_To_Get
</code></pre>
<p>and then using the imageButton.OnCommand to do your work.</p>
<p><strong>Edit:</strong>
Here are the steps to follow:</p>
<ol>
<li>Create your image button in Ro... |
How do I limit the number of decimal places shown in a ZedGraph Y Scale? <p>I am using ZedGraph's master pane to display two graphs that have synchronized X axes. I am running into a problem when I zoom in on one of the graphs. As I zoom in, the Y axis will show an increasing number of decimal places, eventually causi... | <p>For a fixed number of decimal places, you can do</p>
<pre><code>GraphPane.YAxis.Scale.Format = "F0"; // 0 decimal places
</code></pre>
<p>Or if you wanted to have a chance to examine the current visible range before deciding on the number of decimal places, you can add an event handler for</p>
<pre><code>GraphPan... |
How to export Excel worksheets into new workbooks <p>I have a bunch of Excel workbooks that contain multiple worksheets. I want to loop through each workbook and export each worksheet into it's own new workbook. I want one worksheet in each new workbook.</p>
<p>Here's what I've got so far:</p>
<pre><code> Sub Expor... | <p>Within Excel this would be accomplished by copying the worksheet to a new workbook, not by creating a new workbook then adding the worksheet to it. This is achieved by using <code>Worksheet.Copy</code> without specifying where in the workbook you want to place the copied worksheet.</p>
<p>More reading: <a href="ht... |
SQL testing best practice <p>What is the best practice for SQL testing (stored procedures, views, queries, triggers...) excluding automated testing?
Most of the time a query works or returns thousands of rows, so it is a bit difficult to check them. I want to know how you usually do the testing of a SQL query.
Can you ... | <p>Try to eliminate extra variables.</p>
<p>Ways to do this:</p>
<ul>
<li>Each test should test only one feature (a view, a stored procedure, etc.)</li>
<li>Use known test data (it should be from a real environment (but not actually the real environment)</li>
<li>Use the smallest amount of test data that adequately t... |
Matrix Library for .NET <p>I'm looking for a good (well-tested, fully-featured, and ideally with a nice interface) matrix library for .NET/C#. My main requirements here are only that it should be free (I don't particularly care whether it's open-source in this case) and preferably support <a href="http://en.wikipedia.o... | <p>Edit:</p>
<p>It wasn't quite there last time I evaluated it, but there has been quite a bit of activity, so you should also consider the (free and open source) <a href="http://numerics.mathdotnet.com/" rel="nofollow">Math.NET Numerics</a>.</p>
<p>In looking now, it seems they've finished their new version, and hav... |
.NET Windows control for editing XML/XSL? <p>Apologies if this has been asked before. Had a quick search and there's nothing that answers my question 100%.</p>
<p>I've got some XSL stored in the database which I want the user to be able to edit within my .NET Windows application. I could just stick it into a multi-lin... | <p>This doesn't directly answer your question, but there is code available on <a href="http://gregsxmleditor.codeplex.com/Wiki/View.aspx" rel="nofollow">CodePlex for an XML editor</a> called Greg's XML Editor. It's not a control, but you could certainly look at the code and see if that helps.</p>
|
Check whether user input is a valid string or not using C <p>I am taking a string input from user. But how d I check whether user has entered a string or a number??</p>
| <p>Call strtol, check that the value stored to endptr is not equal to the input (successful conversion), and is a pointer to a NUL byte (the whole string was used).</p>
<p><a href="http://www.opengroup.org/onlinepubs/000095399/functions/strtol.html" rel="nofollow">http://www.opengroup.org/onlinepubs/000095399/function... |
Why isn't flash updating the display while the mouse is clicked and moving? <p>I have a flash clip that moves a movieclip when the mouse is clicked on the movieclip. Something very basic.</p>
<p>I'm not using drag (since the MC doesn't move with the mouse all the time), but rather using onMouseMove to update the MC lo... | <p>This behavior happens when the movie is specified in the HTML container as 'transparent'. Setting it to 'window' solves this problem.</p>
<p>I still don't know why the "slow effect" didn't happen in firefox, maybe the firefox flash plugin handles transparency better.</p>
|
probability and relative frequency <p>If I use relative frequency to estimate the probability of an event, how good is my estimate based on the number of experiments? Is standard deviation a good measure? A paper/link/online book would be perfect.</p>
<p><a href="http://en.wikipedia.org/wiki/Frequentist" rel="nofollow... | <p>I believe you are looking for the confidence interval for a sample proportion. Here are some resources that might be helpful:</p>
<p><a href="http://davidmlane.com/hyperstat/B9168.html" rel="nofollow">Confidence Interval for Proportion Tutorial</a><br>
<a href="http://www.pitt.edu/~nancyp/stat-0800-f00/handouts/fo... |
How to catch Non-integer values mapped to integer properties in UpdateModel() <p>Let's say you have an object called Person that looks like this:</p>
<pre><code>class Person
{
public int ID { get; set; }
public string Name { get; set; }
public int NumberOfCatsNamedEnder { get; set; }
}
</code></pre>
<p>I have a... | <p>I really like the approach of using a <a href="http://martinfowler.com/eaaDev/PresentationModel.html" rel="nofollow">presentation model</a>. I'd create a class like this:</p>
<pre><code>class PersonPresentation
{
public int ID { get; set; }
public string Name { get; set; }
public string NumberOfCatsNam... |
Ruby on Rails regex <p>I have these statements in a model:</p>
<pre><code>before_save :add_http
protected
def add_http
if (/^http\:\/\/.+$/.match(url)) == nil
str = "http://" + url
url = str
end
end
</code></pre>
<p>I have checked the regex in the console and it appears to be right, but when the 'url' ge... | <p>Not sure if this matters to you or not, but your regex won't work with https URLs. This should work though:</p>
<pre><code>def add_http
self.url += "http://" if self.url.match(/^https?\:\/\/.+$/).nil?
end
</code></pre>
|
Factory Pattern: Enums or Types? <p>When implementing a factory or simple factory, what would go against using a Type instead of an Enum to specify the class to instantiate?</p>
<p>For example</p>
<pre><code>public class SimpleFactory
{
public static ITest Create(Type type)
{
if (type == typeof(ConcreteTest1))
... | <p>Using an enum is more restrictive, which means that it is less likely that the user will try to use your factory with an unsupported type.</p>
<p>I find that it's good to do everything possible when defining an API to discourage usage patterns that will cause exceptions to be thrown. Allowing "Type" in this case o... |
Why do I get a decimal point in my BigInt numbers? <p>Adding 15 digit numbers like <code>999999999999990</code> in Perl produces results with a period
such as <code>1.9999999999999e+.</code> When using <code>substr</code> it still produces <code>1.99999999999</code>, and when using <code>BigInt</code> the result still ... | <p>Use the <a href="http://perldoc.perl.org/bigint.html" rel="nofollow">bigint pragma</a> to get transparent use of <a href="http://perldoc.perl.org/Math/BigInt.html" rel="nofollow">Math::BigInt</a>:</p>
<pre><code>#!/usr/bin/perl
use strict;
use warnings;
print 999999999999990 + 999999999999990, "\n";
use bigint;... |
Simple jQuery Hide/Show does not work in IE <pre><code>$(document).ready(function(){
$('#createGallery').hide();
$("#newGallery").click(function () {
$("#createGallery").show('slow');
});
$("#gallerySelect > option").not("#newGallery").click(function () {
$("#createGallery").hide('slow');
});
});
</code><... | <p>I don't believe that OPTION elements have click events. You'll want to attach the click handler to the SELECT element, and then check the option that was chosen.\</p>
<p>(disclaimer: air-coded)</p>
<pre><code>$(document).ready(function(){
$('#createGallery').hide();
$("#gallerySelect").click(function () {... |
Custom JSF component attribute list <p>I'm writting a custom JSF component that will render image transitions for a set of specified images. The list of images to be used by the component will be specified by the users of the component.</p>
<p>The main component will do the rendering and the resulting markup is not ht... | <pre><code><i:imageComponent width="480" height="320" imageUrls="img1Url1, imgUrl2"
imageCaptions="imageCaption1, imageCaptions2"/>
</code></pre>
<p>This design is error-prone because it requires that two separate lists be kept in sync.</p>
<pre><code><i:imageComponent width="480" height="320">
&l... |
Vim: sourcing based on a string <p>I can't seem to find an answer to this in any of the numerous Vim scripting tutorials online. What I want to do is construct a file name of a script from environment variables and then source it. And I want to do it in Vim.</p>
<p>If I were to do it in a shell I'd do something like... | <p>You can build up a string and then use the execute command:</p>
<pre class="lang-sh prettyprint-override"><code>exec "source " . $HOME . "/.vim/myscript_" . l:foo . ".vim"
</code></pre>
<p>(The <code>l:foo</code> here is an example of using a local variable from within a function.)</p>
<hr>
<p><strong><em>Edit:<... |
Rails i18n Config File Management Best Practices <p>I'm in the process doing an i18n conversion of a RoR website. I'm using Sven Fuchs textmate bundle along with NewDesk's translate plugin. I've started with the yaml files provided by Sven Fuchs here (<a href="http://github.com/svenfuchs/rails-i18n/tree/3e1994d137e1785... | <p>Have you considered generating the files from a database? I'm not sure of other's opinions on this but I needed to provide an interface to a client project to edit the internationalization information. </p>
<p>So I put each into a language profile for the entire site, and let them edit it. They have a button to ... |
What does it mean when "virtual" is in "class Foo : public virtual Bar" as opposed to "virtual void frob()"? <p>What does it mean when "virtual" is in "class Foo : public virtual Bar" as opposed to "virtual void frob()"?</p>
<p>For a given method there are 8 cases stemming from the presence or absence of virtual in th... | <p>That's <a href="http://www.parashift.com/c%2B%2B-faq-lite/multiple-inheritance.html#faq-25.9">virtual inheritance</a>, you do it when you know you'll be doing multiple inheritance. That page goes into way more detail.</p>
|
How long did it take to make your WinXP App Vista-Compatible? <p>"The question you're asking appears subjective and is likely to be closed."<br />
Yes this is a subjective question.<br />
It has no answer. </p>
<p>I was just wondernig if I was the only one.<br />
So... was it painful?<br />
I just want to hear some c... | <p>Very painful, and a cost of several days if not weeks over time...</p>
<p>We had a lot of code revolving around sessions and IPC. So we were effected by the change of <a href="http://www.microsoft.com/whdc/system/vista/services.mspx" rel="nofollow">session 0 isolation</a>.</p>
<p>For Vista x64 and 2008 x64 we als... |
How to preload an ENTIRE web page <p>How can you preload an entire web page using JavaScript so that I can get that page cached in the users browser?</p>
<p><strong>I know how to preload images with JS but what I would like to do is preload the entire page.</strong></p>
<p>Use case: On my website, I have a google map... | <p>Create an invisible or very small <code><iframe src="second_page.html"></code> on the main page.</p>
|
Web Deployment Project with an replacement .config geting "changed" <p>I have cruisecontrol.net building a asp.net web deployment project. This is working great until i created multiple deployment "configurations". Basically we have a dev,test,stage, and prod. </p>
<p>The stage and prod configurations have a web.confi... | <p>If you are using the system described in <a href="http://visualstudiomagazine.com/Articles/2009/06/11/Encrypting-the-Web-Config-File.aspx" rel="nofollow">this MSDN article</a>, then the CipherValue will be different if it is generated on a different machine. But then they would also only be usable on that build serv... |
Setting ColdFusion dynamic application variables from a query <p>I was horsing around and figured it would be nice to move my application variables into a table that can be loaded onApplicationStart. </p>
<p>My intent is to allow ANT to roll out the app, and change a few settings in the database and the proverbial pr... | <p>I do not know if the author was advocating that syntax or merely demonstrating that it works, as a point of interest. </p>
<p>Personally, I prefer array notation. I think it helps promote good scoping habits. </p>
<pre><code><!--- array notation --->
<cfset scope["staticName"& dynamicPortion] = "some... |
What would you name this CRUD class? <p>Trying to avoid the <a href="http://www.codinghorror.com/blog/archives/000553.html">SomethingManager</a> trap here...</p>
<p>Let's say I'm going to write a User editor which will allow administrators to create users in the system. Pretty basic functionality - view a list of exi... | <p>Naming is difficult if is not respected SRP :)
But members naming is often misused.</p>
<p>In your case I'll do something like this:</p>
<ul>
<li>the responsibility of implementation is to cover specified contract of persistence</li>
<li>"who" is under fire</li>
</ul>
<p>Thinks without voice
- persistence is don... |
Can you attach Amazon EBS to multiple instances? <p>We currently use multiple webservers accessing one mysql server and fileserver. Looking at moving to the cloud, can I use this same setup and attach the EBS to multiple machine instances or what's another solution? </p>
| <p><strong>UPDATE (April 2015)</strong>: For this use-case, you should start looking at the new <a href="https://aws.amazon.com/efs/">Amazon Elastic File System (EFS)</a>, which is designed to be multiply attached in exactly the way you are wanting. The key difference between EFS and EBS is that they provide different... |
What is the best method in passing a large number of parameters in SQL Server <p>I'm trying to work out what the best method to passing a large number of parameters into a stored procedure.</p>
<p>Some methods i was thinking about are;</p>
<ol>
<li><p>Create the relevant database objects, including a parameter object... | <p>XML processing is very handy for handling <em>large</em> numbers of parameters. You can easily pass in your parameters in XML and then xml handling to get your values out. Its even better if your data is already .Net. </p>
<p>e.g.</p>
<pre><code>DECLARE @WidgetsIds xml
SET @WidgetsIds ='<Widgets><id>3&... |
Simulate a Detail Disclosure Button press <p>Does anyone know of a way to simulate pressing a detail disclosure button?</p>
| <p>I've used the following to simulate a click on a table row:</p>
<pre><code>[self tableView:self.tableView didSelectRowAtIndexPath:[NSIndexPath indexPathForRow:0 inSection:0]];
</code></pre>
<p>Perhaps something like this would work?</p>
<pre><code>[self tableView:self.tableView accessoryButtonTappedForRowWithInde... |
HTML Parser <p>Anyone know of an HTML parser for VB.NET or C#? I know .NET has a lot of XML support, like XMLReader and XMLWriter. Is there an HTMLWriter or HTMLReader?</p>
<p>Ultimately what I'd like is a library that will parser an HTML file and raise events based on the tags it finds. Anyone know of a library to do... | <p>The <a href="http://www.codeplex.com/htmlagilitypack" rel="nofollow">HTML Agility Pack</a> is the way to go if you want to parse HTML (it even does good job on tag soup). Theoretically, the XML parser included in the BCL should be able to parse valid XHTML, but the HTML Agility Pack is a generic solution that can ha... |
export gridview to excel with correct filename <p>I have a code that will loop through each row and each column and export the data to excel. It is all working fine. When the user clicks on "open" file, the system is opening file with different filename. If I give the filename as "test.xls", it is opening the file as "... | <p>Maybe Windows is adding the [1] when you save it because test.xls already exists or existed previously. Because of that I append the current date to my filenames like so:</p>
<pre><code>Filename = Filename & "_" & String.Format("{0:MM-dd-yyyy}", Now)
</code></pre>
<p>You could even add an incrementing numb... |
Visual studio debugging shortcut <p>What key do I use to step into a method in VS2008 debug mode?</p>
<p>If I have a method call like this:</p>
<pre><code>string s = StepIntoThisMethod(DoNotStepIntoThisOne(i), NotIntoThisEither(j));
</code></pre>
<p>If I use F11, I step into the methods in the argument list. I would... | <p>Well, that's a little tricky I think... </p>
<p>in your example I do: F11, shift-F11 (does first arg in 2 keystrokes), F11, shift-F11 (second arg), then F11</p>
<p>not pretty but works.</p>
|
PHP: exceptions vs errors? <p>Maybe I'm missing it somewhere in the PHP manual, but what exactly is the difference between an error and an exception? The only difference that I can see is that errors and exceptions are handled differently. But what causes an exception and what causes an error?</p>
| <p>Exceptions are <a href="http://us3.php.net/throw">thrown</a> - they are intended to be caught. Errors are generally unrecoverable. Lets say for instance - you have a block of code that will insert a row into a database. It is possible that this call fails (duplicate ID) - you will want to have a "Error" which in ... |
Question concerning markup validation errors <p>I am using [<a href="http://validator.w3.org/" rel="nofollow">http://validator.w3.org/</a>][1] for markup validation and I continue to get errors that don't make any sense to me. For two below, for example, the validator is telling me that there is an error detected withi... | <p>As you can see: <code>ending tag mismatch: div</code> - you're missing a <code></div></code> somewhere.
It can't figure out exactly where it's missing from, but it knows it must be somewhere before <code></body></code></p>
|
Handling null GUIDs in SQL Server and strongly typed datasets <p>I have a table in SQL server:</p>
<pre><code>Categories
--------------
CategoryID (uniqueidentifier)
ParentCategoryID (uniqueidentifier) allow nulls
</code></pre>
<p>ParentCategoryID is meant to hold a value in CategoryID to indicate which category is ... | <p>If you have used the Visual Studio generators and everything is detected properly for your table, then a nullable column will generate the following on your strongly typed DataRow:</p>
<ol>
<li>A public property named for the table Column name ("ParentCategoryID")</li>
<li>A public method that detects a null entry ... |
iPhone: What is Springboard? Do I need to care? <p>When creating iPhone apps in simulator, I sometimes see messages like "Springboard failed to launch application", etc.</p>
<p>What is Springboard? Are there things I should know about it as a developer?</p>
| <p><a href="http://stackoverflow.com/questions/300793/iphone-simulator-springboard-failed-to-launch-application-with-error-7">Springboard</a> is just the iPhone home screen application. </p>
<p>This <a href="http://stackoverflow.com/questions/300793/iphone-simulator-springboard-failed-to-launch-application-with-error-... |
Like to store all command-line arguments to a bash script into a single variable <p>Let's say I have a bash script called <strong>foo.sh</strong>.</p>
<p>I'd like to call it like this</p>
<pre><code>foo.sh Here is a bunch of stuff on the command-line
</code></pre>
<p>and I'd like it to store all of that text into a ... | <pre><code>echo "$*"
</code></pre>
<p>would do what you want, namely printing out the entire command-line arguments, separated by a space (or, technically, whatever the value of <code>$IFS</code> is). If you wanted to store it into a variable, you could do</p>
<pre><code>thevar="$*"
</code></pre>
<p>If that doesn't ... |
Centering Text in HTML <p>I know at first this seems like a very stupid question, but I have a good reason for asking it. Even though I might just be misled.</p>
<p>For EVER I have been using the <code><center>Text</center></code> tag to have text appear centered horizontally.</p>
<p>Apparently this tag i... | <p>The text alignment needs to be declared in CSS. You can do this in a CSS section at the top of the file, in a separate file, or in the element itself. The simplest method would be the latter (note that this method is not generally considered a good practice):</p>
<pre><code><p style="text-align: center">Tex... |
C# ASP.Net MVC View Issue <p>I have an interface that contains a single method called ListAll()</p>
<pre><code>using System.Collections.Generic;
namespace MvcApplication1.Models
{
public interface IMovieRepository
{
IList<Movie> ListAll();
}
}
</code></pre>
<p>I have a class that implements that interface:</p>
... | <p>Right click on your controller, Add View...</p>
<ul>
<li>Keep the name of the view the same as the action.</li>
<li>Check [X] create strongly typed view
<ul>
<li>Put <code>IEnumerable<Movie></code> in the Type box</li>
</ul></li>
</ul>
<p>Your view will be created, and you can access the items by doing this:... |
Sorting gridviews and sortexpression <p>Hi
I am using a gridview and have have to set a sort expression, I am using:</p>
<pre><code><asp:TemplateField HeaderText="Order Name" SortExpression="OrderId">
<ItemTemplate>
<asp:Label ID="Label1" runat="server" Text='<%# O... | <p>You have to use the field name of the data results that you have in your grid. If you have the field in the results, use it.</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.