qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
137,314 | <p>I've got a CAkePHP 1.2 site. I've got three related Models/tables:
A Comment has exactly one Touch, a Touch has exactly one Touchtype.</p>
<p>In each model, I have a belongs to, so I have
Comments belongs to Touch, Touch belongs to Touchtype.</p>
<p>I'm trying to get a list of comments that includes information about the touch stored in the touchtype table. </p>
<pre><code>$this->Comment->find(...)
</code></pre>
<p>I pass in a fields list to the find(). I can grab fields from Touch and Comment, but not TouchType. Does the model connection only go 1 level? I tried tweaking recursive, but that didn't help.</p>
| [
{
"answer_id": 137323,
"author": "nobody",
"author_id": 19405,
"author_profile": "https://Stackoverflow.com/users/19405",
"pm_score": 5,
"selected": true,
"text": "cut -b 1-LIMIT\n"
},
{
"answer_id": 137642,
"author": "Yanick",
"author_id": 10356,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/43/"
] |
137,326 | <p>How do you embed a SWF file in an HTML page?</p>
| [
{
"answer_id": 137332,
"author": "Ólafur Waage",
"author_id": 22459,
"author_profile": "https://Stackoverflow.com/users/22459",
"pm_score": 7,
"selected": false,
"text": "<object width=\"100\" height=\"100\">\n <param name=\"movie\" value=\"file.swf\">\n <embed src=\"file.swf\" wid... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137326",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18309/"
] |
137,336 | <p>PHP, as we all know is very loosely typed. The language does not require you to specify any kind of type for function parameters or class variables. This can be a powerful feature.</p>
<p>Sometimes though, it can make debugging your script a painful experience. For example, passing one kind of object into a method that expects a different kind of object can produce error messages complaining that a certain variable/method doesn't exist for the passed object. These situations are mostly annoyances. More onerous problems are when you initialize one object with an object of the wrong class, and that "wrong object" won't be used until later on in the script's execution. In this case you end up getting an error much later than when you passed the original argument.</p>
<p>Instead of complaining that what I passed doesn't have a specific method or variable, or waiting until much later in script execution for my passed in object to be used, <strong><em>I would much rather have an error message, at exactly where I specify an object of the wrong type, complaining about the object's type being incorrect or incompatible.</em></strong> </p>
<p>How do you handle these situations in your code? How do you detect incompatible types? How can I introduce some type-checking into my scripts so that I can get more easily understood error messages? </p>
<p>Also, how can you do all this while accounting for inheritance in Php? Consider:</p>
<pre><code><?php
class InterfaceClass
{
#...
}
class UsesInterfaceClass
{
function SetObject(&$obj)
{
// What do I put here to make sure that $obj either
// is of type InterfaceObject or inherits from it
}
}
?>
</code></pre>
<p>Then a user of this code implements the interface with their own concrete class:</p>
<pre><code><?php
class ConcreteClass extends InterfaceClass
{
}
?>
</code></pre>
<p>I want ConcreteClass instances, and all future, unknown user-defined objects, to also be acceptable to SetObject. How would you make this allowable in checking for the correct type?</p>
| [
{
"answer_id": 137342,
"author": "Eran Galperin",
"author_id": 10585,
"author_profile": "https://Stackoverflow.com/users/10585",
"pm_score": 5,
"selected": true,
"text": " <?php\n class UsesBaseClass\n {\n function SetObject(InterfaceObject $obj) \n {\n }\n }\n ?>\n"
},
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137336",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8123/"
] |
137,340 | <p>The question posed came about during a 2nd Year Comp Science lecture while discussing the impossibility of generating numbers in a deterministic computational device.</p>
<p>This was the only suggestion which didn't depend on non-commodity-class hardware.</p>
<p>Subsequently nobody would put their reputation on the line to argue definitively for or against it. </p>
<p>Anyone care to make a stand for or against. If so, how about a mention as to a possible implementation?</p>
| [
{
"answer_id": 137401,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "@ips : list = getIpAddresses();\n@rnd = PseudorandomNumberGenerator(0 to (ips.count - 1));\n\n@getTrueRandomNum... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137340",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4857/"
] |
137,359 | <p>I produce a report as an CSV file.
When I try to open the file in Excel, it makes an assumption about the data type based on the contents of the cell, and reformats it accordingly.</p>
<p>For example, if the CSV file contains</p>
<pre><code>...,005,...
</code></pre>
<p>Then Excel shows it as 5.
Is there a way to override this and display 005?</p>
<p>I would prefer to do something to the file itself, so that the user could just double-click on the CSV file to open it.</p>
<p>I use Excel 2003.</p>
| [
{
"answer_id": 3259242,
"author": "JW.",
"author_id": 4321,
"author_profile": "https://Stackoverflow.com/users/4321",
"pm_score": 0,
"selected": false,
"text": "...,`005,...\n"
},
{
"answer_id": 4597545,
"author": "personaelit",
"author_id": 42574,
"author_profile": "... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137359",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10557/"
] |
137,375 | <p>I'm teaching/helping a student to program.</p>
<p>I remember the following process always helped me when I started; It looks pretty intuitive and I wonder if someone else have had a similar approach.</p>
<ol>
<li>Read the problem and understand it ( of course ) .</li>
<li>Identify possible "functions" and variables.</li>
<li>Write how would I do it step by step ( algorithm ) </li>
<li>Translate it into code, if there is something you cannot do, create a function that does it for you and keep moving.</li>
</ol>
<p>With the time and practice I seem to have forgotten how hard it was to pass from problem description to a coding solution, but, by applying this method I managed to learn how to program.</p>
<p>So for a project description like: </p>
<blockquote>
<p><em>A system has to calculate the price of an Item based on the following rules ( a description of the rules... client, discounts, availability etc.. etc.etc. )</em></p>
</blockquote>
<p>I first step is to understand what the problem is.</p>
<p>Then identify the item, the rules the variables etc.</p>
<p>pseudo code something like:</p>
<pre><code>function getPrice( itemPrice, quantity , clientAge, hourOfDay ) : int
if( hourOfDay > 18 ) then
discount = 5%
if( quantity > 10 ) then
discount = 5%
if( clientAge > 60 or < 18 ) then
discount = 5%
return item_price - discounts...
end
</code></pre>
<p>And then pass it to the programming language..</p>
<pre><code>public class Problem1{
public int getPrice( int itemPrice, int quantity,hourOdDay ) {
int discount = 0;
if( hourOfDay > 10 ) {
// uh uh.. U don't know how to calculate percentage...
// create a function and move on.
discount += percentOf( 5, itemPriece );
.
.
.
you get the idea..
}
}
public int percentOf( int percent, int i ) {
// ....
}
}
</code></pre>
<p>Did you went on a similar approach?.. Did some one teach you a similar approach or did you discovered your self ( as I did :( ) </p>
| [
{
"answer_id": 137485,
"author": "jop",
"author_id": 11830,
"author_profile": "https://Stackoverflow.com/users/11830",
"pm_score": 4,
"selected": false,
"text": "- simple calculations (no discounts and concessions) with:\n - single item\n - two items\n - maximum number of items ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137375",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] |
137,380 | <p>Does anyone have a suggestion for where to find archives or collections of everyday English text for use in a small corpus? I have been using Gutenberg Project books for a working prototype, and would like to incorporate more contemporary language. A <a href="https://stackoverflow.com/questions/122595/nlp-qualitatively-positive-vs-negative-sentence#126378">recent answer</a> here pointed indirectly to a great <a href="http://us.imdb.com/Reviews/" rel="nofollow noreferrer">archive of usenet movie reviews</a>, which hadn't occurred to me, and is very good. For this particular program technical usenet archives or programming mailing lists would tilt the results and be hard to analyze, but any kind of general blog text, or chat transcripts, or anything that may have been useful to others, would be very helpful. Also, a partial or downloadable research corpus that isn't too marked-up, or some heuristic for finding an appropriate subset of wikipedia articles, or any other idea, is very appreciated.</p>
<p>(BTW, I am being a good citizen w/r/t downloading, using a deliberately slow script that is not demanding on servers hosting such material, in case you perceive a moral hazard in pointing me to something enormous.)</p>
<p><strong>UPDATE</strong>: User S0rin points out that wikipedia requests no crawling and provides <a href="http://en.wikipedia.org/wiki/Special:Export" rel="nofollow noreferrer">this export tool</a> instead. Project Gutenberg has a policy specified <a href="http://www.gutenberg.org/wiki/Gutenberg:Information_About_Robot_Access_to_our_Pages" rel="nofollow noreferrer">here</a>, bottom line, try not to crawl, but if you need to: "Configure your robot to wait at least 2 seconds between requests."</p>
<p><strong>UPDATE 2</strong> The wikpedia dumps are the way to go, thanks to the answerers who pointed them out. I ended up using the English version from here: <a href="http://download.wikimedia.org/enwiki/20090306/" rel="nofollow noreferrer">http://download.wikimedia.org/enwiki/20090306/</a> , and a Spanish dump about half the size. They are some work to clean up, but well worth it, and they contain a lot of useful data in the links.</p>
<hr>
| [
{
"answer_id": 138242,
"author": "Aleksandar Dimitrov",
"author_id": 11797,
"author_profile": "https://Stackoverflow.com/users/11797",
"pm_score": 2,
"selected": false,
"text": "wget"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/137380",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11596/"
] |
137,387 | <p>I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library:</p>
<pre><code>Set fso = CreateObject("Scripting.FileSystemObject")
Set folderObject = fso.GetFolder(folder)
size = folderObject.Size
</code></pre>
<p>There isn't an equivalent mechanism on the System.IO.Directory and System.IO.DirectoryInfo classes.</p>
<p>To achieve the same result in .NET do I actually have to recursively walk the whole folder structure keeping a running total of file sizes?</p>
<p>Update: @Jonathon/Ed - thanks....as I thought. I think I'll just reference the Scripting.FileSystemObject COM library. Works just as well even if breaking the .NET purity of my app. It's for an internal reporting app so it's not such a big deal.</p>
| [
{
"answer_id": 137393,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 2,
"selected": false,
"text": "public static long DirSize(DirectoryInfo d) \n{ \n long Size = 0; \n // Add file sizes.\n FileInfo[] fis = d.... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137387",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/419/"
] |
137,392 | <p>I'm sick of remembering all the passwords for different logins. Lately I found the interesting tool <a href="http://www.xs4all.nl/~jlpoutre/BoT/Javascript/PasswordComposer/" rel="nofollow noreferrer">password composer</a> which lets you generate passwords base on the <strong>hostname</strong> and a secret <strong>master password</strong>. But I don't want to use a website or installing software to generate my passwords.</p>
<p>So I'm looking for a simple one way hashing alogorithm which I can execute without computer aid to generate my passwords. Something in the spirit of the <a href="http://en.wikipedia.org/wiki/Solitaire_(cipher)" rel="nofollow noreferrer">solitare cipher</a> without the need for cards.</p>
<p>Using a PW store is not an option.</p>
| [
{
"answer_id": 137421,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 2,
"selected": false,
"text": "Master Password: kaboom\nMachine Name: hal9000\nShuffle: khaablo9o0m00\nTransposition table: shift 5 left\nabcdefghi... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137392",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/720/"
] |
137,398 | <p>I have a SQL query (MS Access) and I need to add two columns, either of which may be null. For instance:</p>
<pre><code>SELECT Column1, Column2, Column3+Column4 AS [Added Values]
FROM Table
</code></pre>
<p>where Column3 or Column4 may be null. In this case, I want null to be considered zero (so <code>4 + null = 4, null + null = 0</code>).</p>
<p>Any suggestions as to how to accomplish this?</p>
| [
{
"answer_id": 137410,
"author": "Michael Haren",
"author_id": 29,
"author_profile": "https://Stackoverflow.com/users/29",
"pm_score": 5,
"selected": true,
"text": "SELECT Column1, Column2, IIF(ISNULL(Column3),0,Column3) + IIF(ISNULL(Column4),0,Column4) AS [Added Values]\nFROM Table\n"
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137398",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14902/"
] |
137,399 | <p>Occasionally I come accross a unit test that doesn't Assert anything. The particular example I came across this morning was testing that a log file got written to when a condition was met. The assumption was that if no error was thrown the test passed.</p>
<p>I personally don't have a problem with this, however it seems to be a bit of a "code smell" to write a unit test that doesn't have any assertions associated with it.</p>
<p>Just wondering what people's views on this are?</p>
| [
{
"answer_id": 137438,
"author": "Brad Wilson",
"author_id": 1554,
"author_profile": "https://Stackoverflow.com/users/1554",
"pm_score": 5,
"selected": true,
"text": "// Act\nException ex = Record.Exception(() => someCode());\n\n// Assert\nAssert.Null(ex);\n"
},
{
"answer_id": 13... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137399",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/493/"
] |
137,448 | <p>Take the following snippet:</p>
<pre><code>List<int> distances = new List<int>();
</code></pre>
<p>Was the redundancy intended by the language designers? If so, why?</p>
| [
{
"answer_id": 137455,
"author": "Nescio",
"author_id": 14484,
"author_profile": "https://Stackoverflow.com/users/14484",
"pm_score": 4,
"selected": false,
"text": " var distances = new List<int>();\n"
},
{
"answer_id": 137459,
"author": "Ana Betts",
"author_id": 5728,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137448",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] |
137,449 | <p>I have a draggable div element with a hover style. This works fine, but the div contains some form elements (label, input). The problem is that when the mouse is over these child elements the hover is disabled.</p>
<pre><code><div class="app_setting">
<label">Name</label>
<input type="text" name="name"/>
</div>
.app_setting:hover {
cursor:move;
}
</code></pre>
<p>Any ideas how to get the hover to apply also to the child elements?</p>
| [
{
"answer_id": 137466,
"author": "garrow",
"author_id": 21095,
"author_profile": "https://Stackoverflow.com/users/21095",
"pm_score": 6,
"selected": true,
"text": ".app_setting *:hover { cursor:move }\n"
},
{
"answer_id": 137496,
"author": "seanb",
"author_id": 3354,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137449",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14971/"
] |
137,452 | <p>I hate case sensitivity in databases, but I'm developing for a client who uses it. How can I turn on this option on my SQL Server, so I can be sure I've gotten the case right in all my queries?</p>
| [
{
"answer_id": 137505,
"author": "Matt",
"author_id": 4154,
"author_profile": "https://Stackoverflow.com/users/4154",
"pm_score": 4,
"selected": true,
"text": "ALTER DATABASE database_name COLLATE collation_name\n"
},
{
"answer_id": 289842,
"author": "nickd",
"author_id":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137452",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/672/"
] |
137,454 | <p>Considering "private" is the default access modifier for class Members, why is the keyword even needed?</p>
| [
{
"answer_id": 137686,
"author": "Mark Cidade",
"author_id": 1659,
"author_profile": "https://Stackoverflow.com/users/1659",
"pm_score": 1,
"selected": false,
"text": "private int x;\npublic string y;\nprotected float z;\n"
},
{
"answer_id": 137962,
"author": "Jeffre... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137454",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/781/"
] |
137,487 | <p>I am told that good developers can spot/utilize the difference between <code>Null</code> and <code>False</code> and <code>0</code> and all the other good "nothing" entities.<br>
What <em>is</em> the difference, specifically in PHP? Does it have something to do with <code>===</code>?</p>
| [
{
"answer_id": 137539,
"author": "Orion Adrian",
"author_id": 7756,
"author_profile": "https://Stackoverflow.com/users/7756",
"pm_score": 3,
"selected": false,
"text": "NULL"
},
{
"answer_id": 137553,
"author": "Gavin M. Roy",
"author_id": 13203,
"author_profile": "ht... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137487",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] |
137,497 | <p>In Oracle, is there an easy way to fully unwrap a view? eg: If I have a view which is made up of selects on more views, is there some way to unwrap it to just select directly on real tables?</p>
| [
{
"answer_id": 137750,
"author": "Mark Stock",
"author_id": 19737,
"author_profile": "https://Stackoverflow.com/users/19737",
"pm_score": 2,
"selected": false,
"text": "SELECT text FROM dba_views\nWHERE owner = 'the-owner' AND view_name = 'the-view-name';\n"
},
{
"answer_id": 138... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137497",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3839/"
] |
137,521 | <p>My Invoice model has an address_id attribute, and I don't want this address_id to change FOREVER. So I don't want this to happen outside the class:</p>
<pre><code>invoice.address_id = 1
invoice.address = some_address
</code></pre>
<p>Rails automatically adds this address_id attribute to the model from the invoice table, so how can I declare this attribute private/protected? Calling</p>
<pre><code>attr_protected :address_id
</code></pre>
<p>is most likely not the solution since based on the documentation it only prevents mass assignments.</p>
<p>Thanks!</p>
| [
{
"answer_id": 137538,
"author": "ryw",
"author_id": 2477,
"author_profile": "https://Stackoverflow.com/users/2477",
"pm_score": 2,
"selected": false,
"text": "def address_id=(id)\n if new_record?\n write_attribute(:address_id, id)\n else\n raise 'address is immutable!'\n end\ne... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11082/"
] |
137,523 | <p>I'd like to learn assembler. However, there are very few resources for doing assembler with OS X.</p>
<p>Is there anyone out there who has programmed in assembly on a Mac? Where did you learn?</p>
<p>And, is there any reason I shouldn't be doing assembly? Do I risk (significantly) crashing my computer irreparably?</p>
| [
{
"answer_id": 137680,
"author": "Martin Cote",
"author_id": 9936,
"author_profile": "https://Stackoverflow.com/users/9936",
"pm_score": 3,
"selected": false,
"text": "gcc -S hello.c -o hello.asm\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/137523",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1615/"
] |
137,526 | <p>On some systems it is UTF-8, on others latin-1. How do you set this? Is it something in php.ini?</p>
<p>(I know you can set the encoding/charset for a given page by setting HTTP headers, but this is not what I am looking for.)</p>
<p>Alex</p>
| [
{
"answer_id": 137680,
"author": "Martin Cote",
"author_id": 9936,
"author_profile": "https://Stackoverflow.com/users/9936",
"pm_score": 3,
"selected": false,
"text": "gcc -S hello.c -o hello.asm\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/137526",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5295/"
] |
137,530 | <p>Ok, this is a curly one. I'm working on some Delphi code that I didn't write, and I'm encountering a very strange problem. One of my stored procedures' parameters is coming through as <code>null</code>, even though it's definitely being sent <code>1</code>.</p>
<p>The Delphi code uses a TADOQuery to execute the stored procedure (anonymized):</p>
<pre><code> ADOQuery1.SQL.Text := "exec MyStoredProcedure :Foo,:Bar,:Baz,:Qux,:Smang,:Jimmy";
ADOQuery1.Parameters.ParamByName("Foo").Value := Integer(someFunction());
// other parameters all set similarly
ADOQuery1.ExecSQL;
</code></pre>
<p><code>Integer(SomeFunction())</code> currently always returns 1 - I checked with the debugger.</p>
<p>However, in my stored proc ( altered for debug purposes ):</p>
<pre><code>create procedure MyStoredProcedure (
@Foo int, @Bar int, @Baz int,
@Qux int, @Smang int, @Jimmy varchar(20)
) as begin
-- temp debug
if ( @Foo is null ) begin
insert into TempLog values ( "oh crap" )
end
-- do the rest of the stuff here..
end
</code></pre>
<p><code>TempLog</code> does indeed end up with "oh crap" in it (side question: there must be a better way of debugging stored procs: what is it?).</p>
<p>Here's an example trace from profiler:</p>
<pre><code>exec [MYDB]..sp_procedure_params_rowset N'MyStoredProcedure',1,NULL,NULL
declare @p3 int
set @p3=NULL
exec sp_executesql
N'exec MyStoredProcedure @P1,@P2,@P3,@P4,@P5,@P6',
N'@P1 int OUTPUT,@P2 int,@P3 int,@P4 int,@P5 int,@P6 int',
@p3 output,1,1,1,0,200
select @p3
</code></pre>
<p>This looks a little strange to me. Notice that it's using @p3 <em>and</em> @P3 - could this be causing my issue? </p>
<p>The other strange thing is that it seems to depend on which TADOConnection I use. </p>
<p>The project is a dll which is passed a TADOConnection from another application. It calls all the stored procedures using this connection.</p>
<p>If instead of using this connection, I first do this:</p>
<pre><code>ConnectionNew := TADOQuery.Create(ConnectionOld.Owner);
ConnectionNew.ConnectionString := ConnectionOld.ConnectionString;
TADOQuery1.Connection := ConnectionNew;
</code></pre>
<p>Then the issue does not occur! The trace from this situation is this:</p>
<pre><code>exec [MYDB]..sp_procedure_params_rowset N'MyStoredProcedure',1,NULL,NULL
declare @p1 int
set @p1=64
exec sp_prepare @p1 output,
N'@P1 int,@P2 int,@P3 int,@P4 int,@P5 int,@P6 varchar(20)',
N'exec MyStoredProcedure @P1,@P2,@P3,@P4,@P5,@P6',
1
select @p1
SET FMTONLY ON exec sp_execute 64,0,0,0,0,0,' ' SET FMTONLY OFF
exec sp_unprepare 64
SET NO_BROWSETABLE OFF
exec sp_executesql
N'exec MyStoredProcedure @P1,@P2,@P3,@P4,@P5,@P6',
N'@P1 int,@P2 int,@P3 int,@P4 int,@P5 int,@P6 varchar(20)',
1,1,1,3,0,'400.00'
</code></pre>
<p>Which is a bit much for lil ol' me to follow, unfortunately. What sort of TADOConnection options could be influencing this?</p>
<p>Does anyone have any ideas?</p>
<p><strong>Edit:</strong> <a href="https://stackoverflow.com/questions/137530/why-is-my-stored-procedure-receiving-a-null-parameter#177214">Update below</a> (didn't want to make this question any longer :P)</p>
| [
{
"answer_id": 152251,
"author": "Francesca",
"author_id": 9842,
"author_profile": "https://Stackoverflow.com/users/9842",
"pm_score": 0,
"selected": false,
"text": " ADOQuery1.Parameters.Refresh;\n"
},
{
"answer_id": 152265,
"author": "Constantin",
"author_id": 20310,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137530",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/369/"
] |
137,534 | <p>I was reading about output buffering in JavaScript <strong><a href="http://www.webreference.com/programming/javascript/jkm3/4.html" rel="nofollow noreferrer">here</a>,</strong> and was trying to get my head around the script the author says was the fastest at printing 1 to 1,000,000 to a web page. (Scroll down to the header "The winning one million number script".) After studying it a bit, I have a few questions: </p>
<ul>
<li>What makes this script so efficient compared to other approaches? </li>
<li>Why does buffering speed things up? </li>
<li>How do you determine the proper buffer size to use?</li>
<li>Does anyone here have any tricks up her/his sleeve that could optimize this script further?</li>
</ul>
<p>(I realize this is probably CS101, but I'm one of those blasted, self-taught hackers and I was hoping to benefit from the wisdom of the collective on this one. Thanks!)</p>
| [
{
"answer_id": 137898,
"author": "Josh",
"author_id": 11702,
"author_profile": "https://Stackoverflow.com/users/11702",
"pm_score": 1,
"selected": false,
"text": "<html>\n<head>\n<script type=\"text/javascript\">\n function printAllNumberBuffered(n, bufferSize)\n {\n var sta... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137534",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11577/"
] |
137,580 | <p>I know how to do a HEAD request with httplib, but I have to use mechanize for this site. </p>
<p>Essentially, what I need to do is grab a value from the header (filename) without actually downloading the file.</p>
<p>Any suggestions how I could accomplish this?</p>
| [
{
"answer_id": 137624,
"author": "Michał Kwiatkowski",
"author_id": 21998,
"author_profile": "https://Stackoverflow.com/users/21998",
"pm_score": 4,
"selected": true,
"text": "import mechanize\n\nclass HeadRequest(mechanize.Request):\n def get_method(self):\n return \"HEAD\"\n\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137580",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18866/"
] |
137,605 | <p>I have been looking at XML and HTML libraries on rubyforge for a simple way to pull data out of a web page. For example if I want to parse a user page on stackoverflow how can I get the data into a usable format?</p>
<p>Say I want to parse my own user page for my current reputation score and badge listing. I tried to convert the source retrieved from my user page into xml but the conversion failed due to a missing div. I know I could do a string compare and find the text I'm looking for, but there has to be a much better way of doing this.</p>
<p>I want to incorporate this into a simple script that spits out my user data at the command line, and possibly expand it into a GUI application.</p>
| [
{
"answer_id": 137639,
"author": "Armin Ronacher",
"author_id": 19990,
"author_profile": "https://Stackoverflow.com/users/19990",
"pm_score": 4,
"selected": false,
"text": "require 'hpricot'\nrequire 'open-uri'\n\ndoc = Hpricot(open(\"http://stackoverflow.com/users/19990/armin-ronacher\"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137605",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22423/"
] |
137,621 | <p>I can't find a reference to it but I remember reading that it wasn't a good idea to call virtual (polymorphic) methods within a destructor or the Dispose() method of IDisposable.</p>
<p>Is this true and if so can someone explain why?</p>
| [
{
"answer_id": 137947,
"author": "Alex Lyman",
"author_id": 5897,
"author_profile": "https://Stackoverflow.com/users/5897",
"pm_score": 4,
"selected": true,
"text": "Dispose"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/137621",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21429/"
] |
137,623 | <p>Expanding this question on how I learnt to pass from <a href="https://stackoverflow.com/questions/137375/"> problem description to code </a> Two people mentioned TDD.</p>
<p>Would it be good for a starter to get into TDD ( and avoid bad habits in the future ? ) Or would it be too complex for a stage when understand what a programming language is?</p>
| [
{
"answer_id": 137662,
"author": "ryw",
"author_id": 2477,
"author_profile": "https://Stackoverflow.com/users/2477",
"pm_score": 2,
"selected": false,
"text": "def self.learn_tdd_and_programming_together?\n if you_have_tdd_mentor_sitting_next_to_you?\n \"go for it\"\n else\n if l... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137623",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20654/"
] |
137,629 | <p>How do you render primitives as wireframes in OpenGL?</p>
| [
{
"answer_id": 137644,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 6,
"selected": false,
"text": "// Turn on wireframe mode\nglPolygonMode(GL_FRONT, GL_LINE);\nglPolygonMode(GL_BACK, GL_LINE);\n\n// Draw the box\nDra... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137629",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
137,630 | <p>I was wondering if there was a way to use "find_by_sql" within a named_scope. I'd like to treat custom sql as named_scope so I can chain it to my existing named_scopes. It would also be good for optimizing a sql snippet I use frequently.</p>
| [
{
"answer_id": 180440,
"author": "Orion Edwards",
"author_id": 234,
"author_profile": "https://Stackoverflow.com/users/234",
"pm_score": 4,
"selected": true,
"text": "find_by_sql"
},
{
"answer_id": 927136,
"author": "jdwyah",
"author_id": 53387,
"author_profile": "htt... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137630",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1227001/"
] |
137,659 | <p>Do you know any easy or simple way to make a map object (from the STL library) persistent (i.e. write it to a file) so that you can recover its state later when the program in run later ??</p>
<p>Thanks for your help</p>
| [
{
"answer_id": 137696,
"author": "Eclipse",
"author_id": 8701,
"author_profile": "https://Stackoverflow.com/users/8701",
"pm_score": 3,
"selected": false,
"text": "outputFile.Write(thisMap.size());\nfor (map<...>::const_iterator i = thisMap.begin(); i != thisMap.end(); ++iMap)\n{\n ou... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137659",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1876/"
] |
137,660 | <p>In a J2EE application (like one running in WebSphere), when I use <code>System.out.println()</code>, my text goes to standard out, which is mapped to a file by the WebSphere admin console.</p>
<p>In an ASP.NET application (like one running in IIS), where does the output of <code>Console.WriteLine()</code> go? The IIS process must have a stdin, stdout and stderr; but is stdout mapped to the Windows version of /dev/null or am I missing a key concept here?</p>
<p>I'm <strong>not asking</strong> if I should log there (I use log4net), but where does the output go? My best info came from this <a href="http://www.velocityreviews.com/forums/t91075-where-does-consolewriteline-goto.html" rel="noreferrer">discussion</a> where they say <code>Console.SetOut()</code> can change the <code>TextWriter</code>, but it still didn't answer the question on what the initial value of the Console is, or how to set it in config/outside of runtime code.</p>
| [
{
"answer_id": 879928,
"author": "Greg Bernhardt",
"author_id": 24387,
"author_profile": "https://Stackoverflow.com/users/24387",
"pm_score": 10,
"selected": false,
"text": "System.Diagnostics.Debug.WriteLine(...)"
},
{
"answer_id": 1432088,
"author": "Ruben",
"author_id"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137660",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22514/"
] |
137,661 | <p>In C#, I can do this:</p>
<pre><code>class Program
{
static void Main(string[] args)
{
List<Animal> animals = new List<Animal>();
animals.Add(new Dog());
animals.Add(new Cat());
foreach (Animal a in animals)
{
Console.WriteLine(a.MakeNoise());
a.Sleep();
}
}
}
public class Animal
{
public virtual string MakeNoise() { return String.Empty; }
public void Sleep()
{
Console.Writeline(this.GetType().ToString() + " is sleeping.");
}
}
public class Dog : Animal
{
public override string MakeNoise()
{
return "Woof!";
}
}
public class Cat : Animal
{
public override string MakeNoise()
{
return "Meow!";
}
}
</code></pre>
<p>Obviously, the output is (Slightly paraphrased):</p>
<ul>
<li>Woof</li>
<li>Dog is Sleeping</li>
<li>Meow</li>
<li>Cat is Sleeping</li>
</ul>
<p>Since C# is often mocked for its verbose type syntax, how do you handle polymorphism/virtual methods in a duck typed language such as Ruby?</p>
| [
{
"answer_id": 137675,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 5,
"selected": true,
"text": "class Animal\n def MakeNoise\n return \"\"\n end\n def Sleep\n print self.class.name + \" is sle... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137661",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1965/"
] |
137,679 | <p>I setup phpMyID on one of my machines, and I'm trying to get apache to redirect to HTTPS only when a password is being submitted. I am doing this as my original setup of redirecting all openid traffic didn't work stackoverflow doesn't like my self signed certificate. This is the new rule I've written, but its not working:</p>
<pre><code>RewriteRule http://%{SERVER_NAME}/openid/index.php(\?.+)$ https://%{SERVER_NAME}/openid/index.php$1
</code></pre>
| [
{
"answer_id": 137692,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 3,
"selected": true,
"text": "RewriteCond %{SERVER_PORT} 80\nRewriteCond %{QUERY_STRING} (.+)\nRewriteRule /openid/index.php https://%{SERVER_NAME}... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137679",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9940/"
] |
137,721 | <p>As title but would like the flexibility to specify how the output xml file will look like. Any free tool available on windows platform that I can use to achieve that? Thanks</p>
| [
{
"answer_id": 164065,
"author": "neu242",
"author_id": 13365,
"author_profile": "https://Stackoverflow.com/users/13365",
"pm_score": 1,
"selected": false,
"text": "import java.io.ByteArrayOutputStream;\nimport java.io.FileInputStream;\nimport java.io.IOException;\nimport java.io.OutputS... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137721",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14790/"
] |
137,730 | <p>How to post a username, password and multiple binary files from a single html form and process it using php? I'm not allowed to use ajax.</p>
| [
{
"answer_id": 137751,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 1,
"selected": false,
"text": "$_FILES"
},
{
"answer_id": 137907,
"author": "phatduckk",
"author_id": 3896,
"author_profile": "... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137730",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3740/"
] |
137,753 | <p>I'm looking for the most ideal data structure (for performance and ease of use) from which values can be retrieved by string key or index. Dictionary doesn't work because you can't really retrieve by index. Any ideas?</p>
| [
{
"answer_id": 137762,
"author": "FlySwat",
"author_id": 1965,
"author_profile": "https://Stackoverflow.com/users/1965",
"pm_score": 0,
"selected": false,
"text": "List<KeyValuePair<K,V>>\n"
},
{
"answer_id": 137772,
"author": "Mark Cidade",
"author_id": 1659,
"author... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137753",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4541/"
] |
137,773 | <p>In our product we ship some linux binaries that dynamically link to system libraries like "libpam". On some customer systems we get the following error on stderr when the program runs:</p>
<pre><code>./authpam: /lib/libpam.so.0: no version information available (required by authpam)
</code></pre>
<p>The application runs fine and executes code from the dynamic library. So this is not a fatal error, it's really just a warning.</p>
<p>I figure that this is error comes from the dynamic linker when the system installed library is missing something our executable expects. I don't know much about the internals of the dynamic linking process ... and googling the topic doesn't help much. :(</p>
<p>Anyone know what causes this error? ... how I can diagnose the cause? ... and how we could change our executables to avoid this problem?</p>
<p>Update: The customer upgraded to the latest version of debian "testing" and the same error occurred. So it's not an out of date libpam library. I guess I'd like to understand what the linker is complaining about? How can I investigate the underlying cause, etc?</p>
| [
{
"answer_id": 3387789,
"author": "Dieter_be",
"author_id": 408644,
"author_profile": "https://Stackoverflow.com/users/408644",
"pm_score": 2,
"selected": false,
"text": "root@monitoring:$ echo $LD_LIBRARY_PATH\n\nsu - zenoss\nzenoss@monitoring:/root$ echo $LD_LIBRARY_PATH\n/usr/local/ze... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137773",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
137,775 | <p>I've wanted this for fluent interfaces. See, for example <a href="http://channel9.msdn.com/forums/Coffeehouse/257556-C-Extension-Properties/" rel="nofollow noreferrer">this</a> Channel9 discussion. Would probably <a href="http://ayende.com/Blog/archive/2007/12/02/Why-C-doesnt-have-extension-properties.aspx" rel="nofollow noreferrer">require</a> also adding indexed properties.</p>
<p>What are your thoughts? Would the advantages outweigh the "language clutter"?</p>
| [
{
"answer_id": 137891,
"author": "Aaron Powell",
"author_id": 11388,
"author_profile": "https://Stackoverflow.com/users/11388",
"pm_score": -1,
"selected": false,
"text": "public string MyProperty { get; set; }\n"
},
{
"answer_id": 1884696,
"author": "Chris Marisic",
"aut... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137775",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22528/"
] |
137,783 | <p>Given a function which produces a random integer in the range 1 to 5, write a function which produces a random integer in the range 1 to 7.</p>
| [
{
"answer_id": 137807,
"author": "Will Hartung",
"author_id": 13663,
"author_profile": "https://Stackoverflow.com/users/13663",
"pm_score": 4,
"selected": false,
"text": "function rnd7() {\n do {\n r1 = rnd5() - 1;\n do {\n r2=rnd5() - 1;\n } while (r2 ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137783",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22535/"
] |
137,784 | <p>I have a report in SSRS 2005 that's based on a query that's similar to this one: </p>
<pre><code>SELECT * FROM MyTable (NOLOCK)
WHERE col1 = 'ABC'
AND col2 LIKE '%XYZ%'
</code></pre>
<p>I need to be able to dynamically include the AND part of the WHERE clause in the query based on whether the user has checked a checkbox. Basically, this is a dynamic SQL statement and that's the problem. I tried several approaches to no avail. Is this possible? Does SSRS 2005 supports dynamic SQL? Thanks!</p>
| [
{
"answer_id": 137856,
"author": "Jason Stevenson",
"author_id": 13368,
"author_profile": "https://Stackoverflow.com/users/13368",
"pm_score": 1,
"selected": false,
"text": "if @checked = 1\n select * from mytable (nolock) where col = 'ABC'\nelse\n select * from mytable (nolock) wh... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137784",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11507/"
] |
137,803 | <p>Does anyone happen to remember the function name used to generate sequential row number built-in SQL Server 2000.</p>
| [
{
"answer_id": 137818,
"author": "FryHard",
"author_id": 231,
"author_profile": "https://Stackoverflow.com/users/231",
"pm_score": 5,
"selected": true,
"text": "SELECT newId() AS ColId, Col1, Col2, Col3 FROM table1\n"
},
{
"answer_id": 138524,
"author": "Andy Jones",
"aut... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137803",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15396/"
] |
137,812 | <p>As many of us know (and many, many more don't), C++ is currently undergoing final drafting for the next revision of the International Standard, expected to be published in about 2 years. Drafts and papers are currently available from the <a href="http://open-std.org/JTC1/SC22/WG21/" rel="noreferrer">committee website</a>. All sorts of new features are being added, the biggest being concepts and lambdas. There is a very comprehensive <a href="http://en.wikipedia.org/wiki/C++0x" rel="noreferrer">Wikipedia article</a> with many of the new features. GCC 4.3 and later implement <a href="http://gcc.gnu.org/projects/cxx0x.html" rel="noreferrer">some C++0x features</a>.</p>
<p>As far as new features go, I really like type traits (and the appropriate concepts), but my definite leader is variadic templates. Until 0x, long template lists have involved Boost Preprocessor usually, and are very unpleasant to write. This makes things a lot easier and allows C++0x templates to be treated like a perfectly functional language using variadic templates. I've already written some very cool code with them already, and I can't wait to use them more often!</p>
<p>So what features are you most eagerly anticipating?</p>
| [
{
"answer_id": 237819,
"author": "Motti",
"author_id": 3848,
"author_profile": "https://Stackoverflow.com/users/3848",
"pm_score": 2,
"selected": false,
"text": "constexpr"
},
{
"answer_id": 3117365,
"author": "lornova",
"author_id": 297373,
"author_profile": "https:/... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137812",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16855/"
] |
137,817 | <p>I'm interested in building a PC for a car that will boot off of a USB flash drive. I'm planning on using <a href="http://en.wikipedia.org/wiki/Windows_Preinstallation_Environment" rel="nofollow noreferrer">Windows PE</a> 2.0 for it with the GUI being written in C# or VB.NET.</p>
<p>Obviously, for this to work, I'd need to have <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="nofollow noreferrer">.NET</a> 2.0 or later installed. Understanding that .NET is not included by default, is there a way to package .NET 2.0 with Windows PE 2.0 in such a way as to allow my <a href="http://en.wikipedia.org/wiki/Graphical_user_interface" rel="nofollow noreferrer">GUI</a> application to work?</p>
| [
{
"answer_id": 237819,
"author": "Motti",
"author_id": 3848,
"author_profile": "https://Stackoverflow.com/users/3848",
"pm_score": 2,
"selected": false,
"text": "constexpr"
},
{
"answer_id": 3117365,
"author": "lornova",
"author_id": 297373,
"author_profile": "https:/... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
137,837 | <p>Does your software handle newline characters from other systems?</p>
<pre><code>Linux/BSD linefeed ^J 10 x0A
Windows/IBM return linefeed ^M^J 13 10 x0D x0A
old Macs return ^M 13 x0D
others?
</code></pre>
<p>For reasons of insanity, I am going with using the Linux version of the newline character in my text files. But, when I bring my text files over to say Windows, some programs do not play nicely with newline characters in my text. How would you deal with this?</p>
| [
{
"answer_id": 137841,
"author": "Greg Hewgill",
"author_id": 893,
"author_profile": "https://Stackoverflow.com/users/893",
"pm_score": 0,
"selected": false,
"text": "fopen(..., \"r\")"
},
{
"answer_id": 137842,
"author": "SCdF",
"author_id": 1666,
"author_profile": "... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19737/"
] |
137,845 | <p>How do I determine whether an object is a member of a collection in VBA?</p>
<p>Specifically, I need to find out whether a table definition is a member of the <code>TableDefs</code> collection.</p>
| [
{
"answer_id": 218727,
"author": "Mark Nold",
"author_id": 4134,
"author_profile": "https://Stackoverflow.com/users/4134",
"pm_score": 5,
"selected": false,
"text": "Public Function InCollection(col As Collection, key As String) As Boolean\n Dim var As Variant\n Dim errNumber As Long\n... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137845",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10439/"
] |
137,868 | <p>In Java, there is a practice of declaring every variable (local or class), parameter final if they really are.</p>
<p>Though this makes the code a lot more verbose, this helps in easy reading/grasping of the code and also prevents mistakes as the intention is clearly marked.</p>
<p>What are your thoughts on this and what do you follow?</p>
| [
{
"answer_id": 137875,
"author": "SCdF",
"author_id": 1666,
"author_profile": "https://Stackoverflow.com/users/1666",
"pm_score": 4,
"selected": false,
"text": "public String doSomething() {\n final String first = someReallyComplicatedExpressionToGetTheString();\n final String second =... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137868",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15321/"
] |
137,870 | <p>I'd like to change the security attribute of a directory that InstallShield creates under the <code>CSIDL_COMMON_APPDATA</code> - can someone please advise on how to do that during the installation process?</p>
<p>It's a script-defined folder.</p>
<p>Thank you.</p>
| [
{
"answer_id": 147122,
"author": "saschabeaumont",
"author_id": 592,
"author_profile": "https://Stackoverflow.com/users/592",
"pm_score": 2,
"selected": false,
"text": "Installation Designer > Components > [somecomponent] > Destination Permissions\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/137870",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20208/"
] |
137,872 | <p>I am using the JQuery form plugin (<a href="http://malsup.com/jquery/form/" rel="noreferrer">http://malsup.com/jquery/form/</a>) to handle the ajax submission of a form. I also have JQuery.Validate (<a href="http://docs.jquery.com/Plugins/Validation" rel="noreferrer">http://docs.jquery.com/Plugins/Validation</a>) plugged in for my client side validation.</p>
<p>What I am seeing is that the validation fails when I expect it to however it does not stop the form from submitting. When I was using a traditional form (i.e. non-ajax) the validation failing prevented the form for submitting at all.... which is my desired behaviour.</p>
<p>I know that the validation is hooked up correctly as the validation messages still appear after the ajax submit has happened.</p>
<p>So what I am I missing that is preventing my desired behaviour? Sample code below....</p>
<pre><code><form id="searchForm" method="post" action="/User/GetDetails">
<input id="username" name="username" type="text" value="user.name" />
<input id="submit" name="submit" type="submit" value="Search" />
</form>
<div id="detailsView">
</div>
<script type="text/javascript">
var options = {
target: '#detailsView'
};
$('#searchForm').ajaxForm(options);
$('#searchForm').validate({
rules: {
username: {required:true}},
messages: {
username: {required:"Username is a required field."}}
});
</script>
</code></pre>
| [
{
"answer_id": 137881,
"author": "billjamesdev",
"author_id": 13824,
"author_profile": "https://Stackoverflow.com/users/13824",
"pm_score": 1,
"selected": false,
"text": "$(\"form\").validate({\n"
},
{
"answer_id": 139336,
"author": "Community",
"author_id": -1,
"auth... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137872",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4884/"
] |
137,880 | <p>Start with the simplest task of capturing the URL in Firefox from a C# application. It appears using user32.dll Windows API functions will not work as is the approach for capturing the URL within IE. </p>
| [
{
"answer_id": 21419194,
"author": "Victor D. Castillo",
"author_id": 1996777,
"author_profile": "https://Stackoverflow.com/users/1996777",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing OpenQA.Se... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137880",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/391678/"
] |
137,893 | <p>I'm using code that I found on the <a href="http://www.codeproject.com/KB/cs/CSLLKeyboardHook.aspx" rel="nofollow noreferrer">CodeProject.com for a low-level keyboard hook</a>. The only problem is it uses external DLL calls that don't work in mono. I was wondering if anyone knew of a way to accomplish the same thing as that code, but will run in both Windows using .net, and Linux using mono?</p>
<p>Edit: Clarifying what I'm trying to do:
I'm making a <a href="http://joel-llamaduck.blogspot.com/" rel="nofollow noreferrer">Dashboard like application</a>. The program sits in the system tray and when the user presses the hot-key, it will pop up all the gadgets. So the program doesn't have focus, so typically it won't catch any keystrokes, so I'm using the low-level keyboard hook and I hook the two keys that the user defines as the hot-keys. But I'm using a Windows DLL call for that, which doesn't work in Linux using mono. So I'm wondering if there's a way to do the same thing, but will run in Linux using mono?</p>
| [
{
"answer_id": 21419194,
"author": "Victor D. Castillo",
"author_id": 1996777,
"author_profile": "https://Stackoverflow.com/users/1996777",
"pm_score": 2,
"selected": false,
"text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing OpenQA.Se... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137893",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13713/"
] |
137,911 | <p>I want to add the link tags to redirect my web-site to my OpenID provider. These tags should go in the head element. What's the best way to add them in Plone?</p>
<p>I understand that filling the head_slot is a way to do it, but that can only happen when you are adding a template to the page and that template is being rendered. In my case I'm not adding any template. Which template should I modify (that is not main_template.pt, which is my current solution, with it's huge drawbacks).</p>
| [
{
"answer_id": 147805,
"author": "michaeljoseph",
"author_id": 5549,
"author_profile": "https://Stackoverflow.com/users/5549",
"pm_score": 3,
"selected": false,
"text": "head_slot"
},
{
"answer_id": 197777,
"author": "Reinout van Rees",
"author_id": 27401,
"author_pro... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137911",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6068/"
] |
137,933 | <p>We are writing a complex rich desktop application and need to offer flexibility in reporting formats so we thought we would just expose our object model to a scripting langauge. Time was when that meant VBA (which is still an option), but the managed code derivative VSTA (I think) seems to have withered on the vine.</p>
<p>What is now the best choice for an embedded scripting language on Windows .NET?</p>
| [
{
"answer_id": 596097,
"author": "Grant Peters",
"author_id": 68241,
"author_profile": "https://Stackoverflow.com/users/68241",
"pm_score": 7,
"selected": false,
"text": "\nusing System;\nusing System.Windows.Forms;\nusing System.Reflection;\nusing System.CodeDom.Compiler;\n\nnamespace S... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137933",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9731/"
] |
137,935 | <p>In Vim editor I opted <code>]I</code> on a function (in C++ code).
This presented a list, which says <em>'Press ENTER or type command to continue'</em>.</p>
<p>Now to jump to an occurrence say 6, I type <code>6</code> - but this is not working.</p>
<p>What commands can I type in such a case, and how do I jump to Nth occurrence from this list?</p>
<p><strong>Update:</strong></p>
<p>Actually I tried <a href="https://stackoverflow.com/questions/137935/how-to-jump-to-an-occurrence-from-vim-search-list#137942">:N</a> (eg :6) - but the moment I type <code>:</code> Vim enters Insert mode, and the colon gets inserted in the code instead.</p>
<p><strong>Update</strong></p>
<p>Assuming <a href="https://stackoverflow.com/questions/137935/how-to-jump-to-an-occurrence-from-vim-search-list#137942">:N</a> approach is correct, still complete uninstall and install of Vim, without any configuration, too did not help - though now typing <code>:</code> does not switch Vim to insert mode.</p>
| [
{
"answer_id": 137942,
"author": "John Millikin",
"author_id": 3560,
"author_profile": "https://Stackoverflow.com/users/3560",
"pm_score": 3,
"selected": true,
"text": "1: 345 my_func (int var)\n2: 4523 my_func (int var)\n3: 10032 my_func (3);\n"
},
{
"answer_id": 137956,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137935",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14803/"
] |
137,951 | <p>I have an ASP.NET Datagrid with several text boxes and drop down boxes inside it. I want to read all the values in the grid using a JavaScript function. How do i go about it?</p>
| [
{
"answer_id": 137993,
"author": "Rodrick Chapman",
"author_id": 3927,
"author_profile": "https://Stackoverflow.com/users/3927",
"pm_score": 2,
"selected": false,
"text": " $('#client_id_of_datagrid input, #client_id_of_datagrid select')\n.each(function() {val = this.value; /* Do Stuf... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137951",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
137,952 | <p>I decide to learn more about vim and its syntax highlighting.
Using examples for others, I am creating my own syntax file for Markdown. I have seen <a href="http://www.vim.org/scripts/script.php?script_id=1242" rel="noreferrer">mkd.vim</a> and it has this problem too.
My issue is between list items and code block highlighting.</p>
<p>Code Block <a href="http://daringfireball.net/projects/markdown/syntax#precode" rel="noreferrer">definition</a>:</p>
<ul>
<li>first line is blank</li>
<li>second line begins with at least 4 spaces or 1 tab</li>
<li>block is finished with a blank line</li>
</ul>
<p>Example:</p>
<pre><code>Regular text
this is code, monospaced and left untouched by markdown
another line of code
Regular Text
</code></pre>
<p>My Vim syntax for code block:</p>
<pre><code>syn match mkdCodeBlock /\(\s\{4,}\|\t\{1,}\).*\n/ contained nextgroup=mkdCodeBlock
hi link mkdCodeBlock comment
</code></pre>
<p>Unorder List item <a href="http://daringfireball.net/projects/markdown/syntax#list" rel="noreferrer">definition</a>:</p>
<ul>
<li>first line is blank</li>
<li>second line begins with a [-+*] followed by a space</li>
<li>the list is finished with a blank line then a normal (non-list) line</li>
<li>in between line items any number of blank lines can be added</li>
<li>a sub list is specified by indenting (4 space or 1 tab)</li>
<li>a line of normal text after a list item is include as a continuation of that list item</li>
</ul>
<p>Example:</p>
<pre><code>Regular text
- item 1
- sub item 1
- sub item 2
- item 2
this is part of item 2
so is this
- item 3, still in the same list
- sub item 1
- sub item 2
Regular text, list ends above
</code></pre>
<p>My Vim syntax for unorder list item definition (I only highlight <code>[-+*]</code>):</p>
<pre><code>syn region mkdListItem start=/\s*[-*+]\s\+/ matchgroup=pdcListText end=".*" contained nextgroup=mkdListItem,mkdListSkipNL contains=@Spell skipnl
syn match mkdListSkipNL /\s*\n/ contained nextgroup=mkdListItem,mkdListSkipNL skipnl
hi link mkdListItem operator
</code></pre>
<p>I cannot get the highlighting to work with the last two rule for list and with a code block.</p>
<p>This is an example that breaks my syntax highlighting:</p>
<pre><code>Regular text
- Item 1
- Item 2
part of item 2
- these 2 line should be highlighted as a list item
- but they are highlighted as a code block
</code></pre>
<p>I currently cannot figure out how to get the highlighting to work the way I want it too</p>
<hr>
<p>Forgot to add a "global" syntax rule used in both rules listed below. It is to ensure a that they start with a blank line.</p>
<pre><code>syn match mkdBlankLine /^\s*\n/ nextgroup=mkdCodeBlock,mkdListItem transparent
</code></pre>
<hr>
<p>Another Note: I should have been more clear. In my syntax file, the List rules appear before the Blockquote Rules</p>
<hr>
| [
{
"answer_id": 138186,
"author": "hcs42",
"author_id": 17916,
"author_profile": "https://Stackoverflow.com/users/17916",
"pm_score": 4,
"selected": true,
"text": "syn match mkdCodeBlock /\\(\\s\\{4,}\\|\\t\\{1,}\\).*\\n/ contained nextgroup=mkdCodeBlock \nhi link mkdCodeBlock comment... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137952",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/873/"
] |
137,975 | <p>The <a href="https://en.wikipedia.org/wiki/Singleton_pattern" rel="noreferrer">singleton pattern</a> is a fully paid up member of the <a href="https://en.wikipedia.org/wiki/Design_Patterns" rel="noreferrer">GoF</a>'s <a href="https://rads.stackoverflow.com/amzn/click/com/0201633612" rel="noreferrer" rel="nofollow noreferrer">patterns book</a>, but it lately seems rather orphaned by the developer world. I still use quite a lot of singletons, especially for <a href="https://en.wikipedia.org/wiki/Factory_method_pattern" rel="noreferrer">factory classes</a>, and while you have to be a bit careful about multithreading issues (like any class actually), I fail to see why they are so awful.</p>
<p>Stack Overflow especially seems to assume that everyone agrees that Singletons are evil. Why?</p>
<p>Please support your answers with "<em>facts, references, or specific expertise</em>"</p>
| [
{
"answer_id": 138017,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 6,
"selected": false,
"text": "public MyConstructor(Singleton singleton) {\n this.singleton = singleton;\n}\n"
},
{
"answer_id": 138021,
"a... | 2008/09/26 | [
"https://Stackoverflow.com/questions/137975",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9731/"
] |
138,000 | <p>When I try to send an HTTP GET request through XMLHttpRequest it works on non-secure HTTP.</p>
<p>But when sent over HTTPS, different browsers gave different results:</p>
<p>On Firefox 3.0.2:
- The GET request doesn't reach the web server.</p>
<p>On IE 7:
- The GET request reached the web server.</p>
<p>Does this have something to do with Firefox 3 getting stricter with untrusted certificates?
Is there a way around this?</p>
<p>I've already added the URL as an exception in Firefox's Certificate Manager.
The error console doesn't report any error.
I've added a try-catch around XMLHttpRequest's open() and send. No exception is thrown.</p>
<p>Using both absolute and relative URL path doesn't work.</p>
<p>Here's the code snippet:</p>
<pre><code> var xmlHttp;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
return false;
}
}
}
// we won't be handling any HTTP response
xmlHttp.onreadystatechange=function()
{
// do nothing..
}
// send HTTP GET request
try
{
xmlHttp.open("GET", "/[relative path to request]", true);
xmlHttp.send(null);
}
catch (e)
{
alert('Error sending HTTP GET request!');
return false;
}
</code></pre>
<p>Thanks,
Kenneth</p>
| [
{
"answer_id": 161889,
"author": "Chris",
"author_id": 15578,
"author_profile": "https://Stackoverflow.com/users/15578",
"pm_score": 1,
"selected": false,
"text": "// send HTTP GET request\ntry\n{\n xmlHttp.open(\"GET\", \"/[relative path to request]\", true);\n}\ncatch (e)\n{\n al... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138000",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16139/"
] |
138,028 | <p>Is it possible to call a COM API from Java (specifically the HP/Mercury Quality Center OTA API)? If so, what's the best way?</p>
<p>Is something like JACOB appropriate?</p>
<p>Code fragments would be helpful for the basics :-)</p>
| [
{
"answer_id": 43658568,
"author": "user2228895",
"author_id": 2228895,
"author_profile": "https://Stackoverflow.com/users/2228895",
"pm_score": 2,
"selected": false,
"text": "MsWordApp comObj = this.factory.createObject(MsWordApp.class);\n\nDocuments documents = comObj.getDocuments();\n... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138028",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1119/"
] |
138,029 | <p>After a bind a method to an event of a Tkinter element is there a way to get the method back?</p>
<pre><code>>>> root = Tkinter.Tk()
>>> frame = Tkinter.Frame(root, width=100, height=100)
>>> frame.bind('<Button-1>', lambda e: pprint('Click')) # function needed
>>> frame.pack()
>>> bound_event_method = frame.???
</code></pre>
| [
{
"answer_id": 138039,
"author": "Dan Lenski",
"author_id": 20789,
"author_profile": "https://Stackoverflow.com/users/20789",
"pm_score": 0,
"selected": false,
"text": "lambda"
},
{
"answer_id": 226141,
"author": "Bryan Oakley",
"author_id": 7432,
"author_profile": "h... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138029",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/680/"
] |
138,040 | <p>I have to create a dialog based application, instead of old CFormView type of design. But CDialog produces fixed-size dialogs. How can I create dialog based applications with resizable dialogs?</p>
| [
{
"answer_id": 138062,
"author": "jussij",
"author_id": 14738,
"author_profile": "https://Stackoverflow.com/users/14738",
"pm_score": 6,
"selected": true,
"text": "IDD_DIALOG_DIALOG DIALOGEX 0, 0, 320, 201\nSTYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU\n"
},
{
"answer_... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138040",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
138,043 | <p>I want to create a new net.tcp://localhost:x/Service endpoint for a WCF service call, with a dynamically assigned new open TCP port.</p>
<p>I know that TcpClient will assign a new client side port when I open a connection to a given server.</p>
<p>Is there a simple way to find the next open TCP port in .NET?</p>
<p>I need the actual number, so that I can build the string above. 0 does not work, since I need to pass that string to another process, so that I can call back on that new channel.</p>
| [
{
"answer_id": 150974,
"author": "TheSeeker",
"author_id": 4829,
"author_profile": "https://Stackoverflow.com/users/4829",
"pm_score": 8,
"selected": true,
"text": "static int FreeTcpPort()\n{\n TcpListener l = new TcpListener(IPAddress.Loopback, 0);\n l.Start();\n int port = ((IPEndP... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4829/"
] |
138,045 | <p>Is there something like <a href="http://effbot.org/zone/python-getattr.htm" rel="noreferrer">Python's getattr()</a> in C#? I would like to create a window by reading a list which contains the names of controls to put on the window.</p>
| [
{
"answer_id": 138053,
"author": "Eric Schoonover",
"author_id": 3957,
"author_profile": "https://Stackoverflow.com/users/3957",
"pm_score": 3,
"selected": false,
"text": "Type.GetProperty()"
},
{
"answer_id": 138054,
"author": "mattlant",
"author_id": 14642,
"author_... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22562/"
] |
138,071 | <p>The questions says everything, take this example code: </p>
<pre><code><ul id="css-id">
<li>
<something:CustomControl ID="SomeThingElse" runat="server" />
<something:OtherCustomControl runat="server" />
</li>
</ul>
</code></pre>
<p>Now if an error gets thrown somewhere inside these controlls (that are located in a master page) they will take down the entire site, how would one catch these exceptions?</p>
| [
{
"answer_id": 138082,
"author": "Drejc",
"author_id": 6482,
"author_profile": "https://Stackoverflow.com/users/6482",
"pm_score": 4,
"selected": true,
"text": "protected void Application_Error(Object sender, EventArgs e)\n"
},
{
"answer_id": 138092,
"author": "Brannon",
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138071",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/452521/"
] |
138,073 | <p><strong>Scenario:</strong> C# apps uses SQL2000. It excecute 3 stored procs within a try catch in the app. In the catch the error is suppressed. Due to some legalities, the c# code cannot be changed and implemented. </p>
<p><strong>Q:</strong> How do I trap the actual SQL error in the stored proc into a log file or other table? @@Error returns an error message to the app but when evaluated in query analyzer it is always 0 although the 'If @@Error <> 0' does fire. I try to store the @@Error number, but it is always 0.</p>
<p>Please help.</p>
| [
{
"answer_id": 138111,
"author": "Matt Lacey",
"author_id": 1755,
"author_profile": "https://Stackoverflow.com/users/1755",
"pm_score": 2,
"selected": false,
"text": "RAISERROR ... WITH LOG\n"
},
{
"answer_id": 138114,
"author": "Brannon",
"author_id": 5745,
"author_p... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138073",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
138,096 | <p>I have a Window where I have put a Frame. I would like to add a Page to the Frame when I click a button that is also on the Window but not in the Frame. There are several buttons in the Window and each click on a button should load a different Page in the Frame.</p>
<p>Since I'm a total newbie on this WPF stuff it's quite possible that this approach is not the best and I have thought about replacing the Frame with a Canvas and then make UserControls instead of Pages that will be added to the Canvas. I welcome any ideas and suggestions on how to best solve this. </p>
<p>I aiming for a functionality that is similar to the application Billy Hollis demonstrated in dnrtv episode 115. (<a href="http://dnrtv.com/default.aspx?showID=115" rel="noreferrer">http://dnrtv.com/default.aspx?showID=115</a>). </p>
| [
{
"answer_id": 138315,
"author": "Joachim Kerschbaumer",
"author_id": 20227,
"author_profile": "https://Stackoverflow.com/users/20227",
"pm_score": 5,
"selected": true,
"text": "myFrame.Navigate(myPageObject);\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/138096",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/143/"
] |
138,097 | <p>I need to find the PID of the current running process on a Linux platform (it can be a system dependent solution). Java does not support getting the process ID, and JRuby currently has a bug with the Ruby method, Process.pid.</p>
<p>Is there another way to obtain the PID?</p>
| [
{
"answer_id": 138098,
"author": "Mike Stone",
"author_id": 122,
"author_profile": "https://Stackoverflow.com/users/122",
"pm_score": 6,
"selected": true,
"text": "String pid = new File(\"/proc/self\").getCanonicalFile().getName();\n"
},
{
"answer_id": 138332,
"author": "jass... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138097",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/122/"
] |
138,099 | <p>GWT's serializer has limited <code>java.io.Serializable</code> support, but for security reasons there is a whitelist of types it supports. The documentation I've found, for example <a href="http://www.gwtproject.org/doc/latest/FAQ_Server.html#Does_the_GWT_RPC_system_support_the_use_of_java.io.Serializable" rel="noreferrer">this FAQ entry</a> says that any types you want to serialize "must be included in the serialization policy whitelist", and that the list is generated at compile time, but doesn't explain how the compiler decides what goes on the whitelist.</p>
<p>The generated list contains a number of types that are part of the standard library, such as <code>java.lang.String</code> and <code>java.util.HashMap</code>. I get an error when trying to serialize <code>java.sql.Date</code>, which implements the <code>Serializable</code> interface, but is not on the whitelist. How can I add this type to the list?</p>
| [
{
"answer_id": 144894,
"author": "rustyshelf",
"author_id": 6044,
"author_profile": "https://Stackoverflow.com/users/6044",
"pm_score": 5,
"selected": true,
"text": "public String getStringForDates(ArrayList<java.util.Date> dates);\n"
},
{
"answer_id": 992745,
"author": "Comm... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3562/"
] |
138,105 | <p>Is there a way in Delphi 7 to find out if a pop-up menu is visible (shown on the screen) or not, since it lacks a Visible property.</p>
| [
{
"answer_id": 139161,
"author": "Ondrej Kelle",
"author_id": 11480,
"author_profile": "https://Stackoverflow.com/users/11480",
"pm_score": 2,
"selected": false,
"text": "procedure TForm1.WMContextMenu(var Message: TWMContextMenu);\nbegin\n FPopupActive := True;\n try\n OutputDebugS... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6482/"
] |
138,117 | <p>how to send rich text message in system.net.mail need code for send a mail as html</p>
| [
{
"answer_id": 138128,
"author": "Vincent McNabb",
"author_id": 16299,
"author_profile": "https://Stackoverflow.com/users/16299",
"pm_score": 2,
"selected": false,
"text": "System.Net.Mail.MailMessage mm = new System.Net.Mail.MailMessage();\nmm.Body = \"<html>...</html>\";\nmm.IsBodyHtml... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138117",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
138,122 | <p>I'd like to be able to create a large (say 20,000 x 20,000) pixel bitmap in a C++ MFC application, using a CDC derived class to write to the bitmap. I've tried using memory DCs as described in the MSDN docs, but these appear to be restricted to sizes compatible with the current display driver.</p>
<p>I'm currently using a bitmap print driver to do the job, but it is extremely slow and uses very large amounts of intermediate storage due to spooling GDI information.</p>
<p>The solution I'm looking for should not involve metafiles or spooling, as the model that I am drawing takes many millions of GDI calls to render.</p>
<p>I could use a divide and conquer approach via multiple memory DCs, but it seems like a pretty cumborsome and inelegant technique.</p>
<p>any thoughts?</p>
| [
{
"answer_id": 138143,
"author": "Simon Buchan",
"author_id": 20135,
"author_profile": "https://Stackoverflow.com/users/20135",
"pm_score": 3,
"selected": true,
"text": "BITMAPINFOHEADER bmi = { sizeof(bmi) };\nbmi.biWidth = 20000;\nbmi.biHeight = 20000;\nbmi.biPlanes = 1;\nbmi.biBitCoun... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138122",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22564/"
] |
138,132 | <p><strong>Here's the situation</strong>: I'm trying my hand at some MySpace page customisations. If you've <a href="https://stackoverflow.com/questions/116610/myspace-dom">ever tried</a> [stackoverflow], I'm sure you understand how frustrating it can be.<br>
Basically it can be all customised via CSS, within a certain set of rules (e.g. the '#' character is not allowed...how useful!).<br>
Have a look at this <a href="http://www.mikeindustries.com/blog/archive/2006/04/hacking-myspace-layouts" rel="nofollow noreferrer">blog</a> if you want more info, I used it as the basis for my customisations</p>
<p>So the only problem is with the comments section, where 'friends' post whatever they feel like.
It already has...</p>
<pre><code>max-width:423px;
</code></pre>
<p>...set on the table, but I've discovered if long URLs are posted in the comment section, it blows out the table width, regardless of the max setting!</p>
<p><strong>Question</strong>: Is there a way to manage text that is going to push the width of the table?<br>
Perhaps splitting/chopping the string? Or is there more I should be doing..?<br>
The URLs are posted as text, not hrefs.</p>
<p>Using Firefox and Firebug btw.</p>
<p><strong>Edit</strong>: Also javascript is not allowed ;)</p>
<p><strong>Another edit</strong> Just checked with IE7, and it seems to work.. so firefox is being the hassle in this case..</p>
| [
{
"answer_id": 138151,
"author": "Antti Rasinen",
"author_id": 8570,
"author_profile": "https://Stackoverflow.com/users/8570",
"pm_score": 0,
"selected": false,
"text": " overflow: hidden\n"
},
{
"answer_id": 138154,
"author": "Owen",
"author_id": 4853,
"author_profil... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6340/"
] |
138,133 | <p>Is there a standard framework (maybe part of Enterprise Library... or .NET itself) that allows you to do common parameter validation in method attributes?</p>
| [
{
"answer_id": 1438327,
"author": "Christian",
"author_id": 54193,
"author_profile": "https://Stackoverflow.com/users/54193",
"pm_score": 3,
"selected": true,
"text": "public Rational(int numerator, int denominator)\n{\n Contract.Requires(denominator ! = 0);\n \n this.numerator ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138133",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3957/"
] |
138,144 | <p>What essential things (functions, aliases, start up scripts) do you have in your profile?</p>
| [
{
"answer_id": 138224,
"author": "Ed Guiness",
"author_id": 4200,
"author_profile": "https://Stackoverflow.com/users/4200",
"pm_score": 2,
"selected": false,
"text": "############################################################################## \n# Get an XPath Navigator object based on... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138144",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20911/"
] |
138,153 | <p>Are there any ncurses libraries in C/C++ for Windows that emulate ncurses in native resizable Win32 windows (<em>not</em> in console mode)?</p>
| [
{
"answer_id": 1517788,
"author": "Adam Batkin",
"author_id": 120808,
"author_profile": "https://Stackoverflow.com/users/120808",
"pm_score": 4,
"selected": false,
"text": "CMD.EXE"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/138153",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6619/"
] |
138,157 | <p>Hey, I've been developing an application in the windows console with Java, and want to put it online in all of its console-graphics-glory.</p>
<p>Is there a simple web applet API I can use to port my app over?</p>
<p>I'm just using basic System.out and System.in functionality, but I'm happy to rebuild my I/O wrappers.</p>
<p>I think something along these lines would be a great asset to any beginning Java developers who want to put their work online.</p>
| [
{
"answer_id": 144467,
"author": "Aleksandar Dimitrov",
"author_id": 11797,
"author_profile": "https://Stackoverflow.com/users/11797",
"pm_score": 2,
"selected": false,
"text": "prompt()"
},
{
"answer_id": 187056,
"author": "Dean Rather",
"author_id": 14966,
"author_p... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138157",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14966/"
] |
138,159 | <p>I'm new to PHP and I'm confused seeing some examples calling a function with a @ prefix like @mysql_ping().</p>
<p>What is it for? Googling / searching is not much of a help since @ gets discarded and 'alias' is not good enough keyword.</p>
| [
{
"answer_id": 138183,
"author": "Ross",
"author_id": 2025,
"author_profile": "https://Stackoverflow.com/users/2025",
"pm_score": 0,
"selected": false,
"text": "$test = @file_get_contents('nonexistant.file');\nif(!$test)\n{\n die('Failed');\n}\n"
},
{
"answer_id": 2778372,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138159",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15345/"
] |
138,162 | <p>I want to setup my local development machine so that any requests for <code>*.local</code> are redirected to <code>localhost</code>. The idea is that as I develop multiple sites, I can just add vhosts to Apache called <code>site1.local</code>, <code>site2.local</code> etc, and have them all resolve to <code>localhost</code>, while Apache serves a different site accordingly.</p>
<p>I am on Windows XP.</p>
<p>I tried adding </p>
<pre><code>127.0.0.1 *.local
</code></pre>
<p>to my <code>c:\windows\system32\drivers\etc\hosts</code> file, also tried:</p>
<pre><code>127.0.0.1 .local
</code></pre>
<p>Neither of which seem to work.</p>
<p>I know I can set them up on different port numbers, but that is a pain since it is hard to remember which port is which.</p>
<p>I don't want to have to setup a local DNS server or anything hard, any suggestions?</p>
| [
{
"answer_id": 272092,
"author": "jeremyasnyder",
"author_id": 33143,
"author_profile": "https://Stackoverflow.com/users/33143",
"pm_score": 6,
"selected": false,
"text": " LoadModule vhost_alias_module modules/mod_vhost_alias.so\n\n NameVirtualHost *:80\n\n <Directory \"/xampp/sites\">... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138162",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20851/"
] |
138,174 | <p>I'm considering supporting both <strong><a href="http://textism.com/tools/textile/" rel="nofollow noreferrer">Textile</a></strong> and <strong><a href="http://daringfireball.net/projects/markdown/" rel="nofollow noreferrer">Markdown</a></strong> on a current project. I would prefer not forcing users to choose one or the other. Is there a way to auto-detect which the user is using? How would you go about this? I'd like to find / develop both a JavaScript and a PHP solution so I can provide live previews as well as process the user input on the server-side.</p>
| [
{
"answer_id": 138491,
"author": "Vegard Larsen",
"author_id": 1606,
"author_profile": "https://Stackoverflow.com/users/1606",
"pm_score": 2,
"selected": false,
"text": "h1. Header\n\np. Paragraph\n"
},
{
"answer_id": 138537,
"author": "Lasar",
"author_id": 9438,
"aut... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138174",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11577/"
] |
138,177 | <p>I use several referenced tables with integer primary keys. Now I want to change ints to GUIDs leaving all references intact. What is the easiest way to do it?</p>
<p>Thank you!</p>
<p><strong>Addition</strong></p>
<p>I do understand the process in general, so I need more detailed advices, for example, how to fill new GUID column. Using default value newid() is correct, but what for already existing rows?</p>
| [
{
"answer_id": 138185,
"author": "Glenn Slaven",
"author_id": 2975,
"author_profile": "https://Stackoverflow.com/users/2975",
"pm_score": 3,
"selected": false,
"text": "UPDATE foreignTable f\nSET f.guidCol = p.guidCol\nFROM primaryTable p\nWHERE p.intCol = f.intCol\n"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/138177",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11256/"
] |
138,194 | <p>In the Flex framework a custom preloader can be used while the site is loading.</p>
<p>In the <a href="http://livedocs.adobe.com/flex/3/html/help.html?content=app_container_4.html" rel="nofollow noreferrer">Adobe docs</a> it specifies that '<strong>the progress bar [preloader] is displayed if less than half of the application is downloaded after 700 milliseconds of downloading.</strong>'</p>
<p>However I ALWAYS want the preloader to appear instantly since I know that 95% of our users are first time visitors and the site is over 500kb. I dont want people to have to wait .7 seconds for the preloader animation to appear.</p>
<p>I would think in theory that it is possible to 'monkey patch' the framework to remove this .7 second limitation. I dont have time to figure out how, and I've never done it before.</p>
<p>Anybody help?</p>
| [
{
"answer_id": 138247,
"author": "Simon Buchan",
"author_id": 20135,
"author_profile": "https://Stackoverflow.com/users/20135",
"pm_score": 1,
"selected": false,
"text": "showDisplayForDownloading"
},
{
"answer_id": 138373,
"author": "Community",
"author_id": -1,
"aut... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138194",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/16940/"
] |
138,203 | <p>Is it possible for a stand alone executable to generate a report and output it as PDF (or one of the other export options available from the report viewer) without displaying the ReportViewer control? </p>
<p>The report definition should be embedded in the executable and should not use the Reporting Services web service.</p>
| [
{
"answer_id": 138222,
"author": "Biri",
"author_id": 968,
"author_profile": "https://Stackoverflow.com/users/968",
"pm_score": 2,
"selected": false,
"text": "ReportViewer rv = new ReportViewer();\nrv.LocalReport.ReportPath = \"templatepath\";\n// or use file from resource with rv.LocalR... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138203",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/966/"
] |
138,250 | <p>If I open an image with <code>open("image.jpg")</code>, how can I get the RGB values of a pixel assuming I have the coordinates of the pixel?</p>
<p>Then, how can I do the reverse of this? Starting with a blank graphic, 'write' a pixel with a certain RGB value?</p>
<p>I would prefer if I didn't have to download any additional libraries.</p>
| [
{
"answer_id": 138260,
"author": "David Webb",
"author_id": 3171,
"author_profile": "https://Stackoverflow.com/users/3171",
"pm_score": 9,
"selected": true,
"text": "from PIL import Image\n\nim = Image.open('dead_parrot.jpg') # Can be many different formats.\npix = im.load()\nprint im.si... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138250",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2592/"
] |
138,251 | <p>I am trying to access a Windows Media Player library from ASP.NET.</p>
<p>The following code:</p>
<p>WMPLib.WindowsMediaPlayer mplayer = new WMPLib.WindowsMediaPlayer();</p>
<p>WMPLib.IWMPStringCollection list = mplayer.mediaCollection.getAttributeStringCollection("artist", "audio");</p>
<p>Returns an non-empty list when run using the VS2005 development web server but an empty list when using IIS.</p>
<p>Setting impersonation with:</p>
<p>System.Security.Principal.WindowsImpersonationContext impersonationContext = ((System.Security.Principal.WindowsIdentity)User.Identity).Impersonate();</p>
<p>Doesn't help. It seems that WMPLib still doesn't thinks its running as a user who has a library. </p>
<p>Is there a way to get around this?</p>
| [
{
"answer_id": 140939,
"author": "Dylan Beattie",
"author_id": 5017,
"author_profile": "https://Stackoverflow.com/users/5017",
"pm_score": 1,
"selected": false,
"text": "<system.web>\n<identity impersonate=\"true\" userName=\"MYDOMAIN\\myuser\" password=\"p@ssw0rd\" />\n</system.web>\n"
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138251",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22590/"
] |
138,261 | <p>I am having a table Table1 with columns id1, id2, id3 all the columns are nullable</p>
<p>I may enter null or value to all columns in rows.</p>
<p>My question is I need to select the rows whose all the column values should not be null.</p>
<p>Thanks</p>
<hr>
<p>There are totally around 300 columns in the table. I can't do the <code>is null</code> property for all the columns in <code>where</code> condition.</p>
| [
{
"answer_id": 138276,
"author": "James",
"author_id": 7837,
"author_profile": "https://Stackoverflow.com/users/7837",
"pm_score": 1,
"selected": false,
"text": ""
},
{
"answer_id": 138792,
"author": "Lasse V. Karlsen",
"author_id": 267,
"author_profile": "https://Sta... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138261",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22162/"
] |
138,273 | <p>I have recently run across these terms few times but I am quite confused how they work and when they are usualy implemented?</p>
| [
{
"answer_id": 138472,
"author": "Patrick McKenzie",
"author_id": 15046,
"author_profile": "https://Stackoverflow.com/users/15046",
"pm_score": 6,
"selected": false,
"text": "put(key,value)"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/138273",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3515/"
] |
138,302 | <p>When using SQLBulkCopy on a table with a GUID primary key and default newsequentialid()</p>
<p>e.g</p>
<pre><code>CREATE TABLE [dbo].[MyTable](
[MyPrimaryKey] [uniqueidentifier] NOT NULL CONSTRAINT [MyConstraint] DEFAULT (newsequentialid()),
[Status] [int] NULL,
[Priority] [int] NULL,
CONSTRAINT [PK_MyTable] PRIMARY KEY NONCLUSTERED
(
[MyPrimaryKey] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
</code></pre>
<p>wIth the C# code</p>
<pre><code> tran = connection.BeginTransaction();
SqlBulkCopy sqlCopy = new SqlBulkCopy(connection,SqlBulkCopyOptions.Default, tran);
sqlCopy.DestinationTableName = "MyTable";
sqlCopy.WriteToServer(dataTable);
</code></pre>
<p>Gives you an error...</p>
<p>Column 'MyPrimaryKey' does not allow DBNull.Value</p>
<p>I've tried fiddling the the SqlBulkCopyOptions. The only thing that works is setting the MyPrimaryKey field to allow nulls and removing the primary key.</p>
<p>Anyone know if there is a workaround for this issue?
Or can you verify that there is no workaround (other than changing the table structure)?</p>
| [
{
"answer_id": 139850,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 4,
"selected": false,
"text": "sqlCopy.ColumnMappings.Clear();\n"
},
{
"answer_id": 30249522,
"author": "DCShannon",
"author_id": 2449863,
... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138302",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
138,309 | <p>I have made a SVG image, or more like mini application, for viewing graphs of data. I want to include this in a HTML page, and call methods on the SVG image.</p>
<p>Example:</p>
<pre><code><object id="img" data="image.svg" width="500" height="300"/>
<script>document.getElementById("img").addData([1,23,4]);</script>
</code></pre>
<p>Is it at all possible to call methods on the SVG document? If so, how do I declare the methods to expose in the SVG file, and how do I call them from the HTML document?</p>
| [
{
"answer_id": 138358,
"author": "Staale",
"author_id": 3355,
"author_profile": "https://Stackoverflow.com/users/3355",
"pm_score": 5,
"selected": true,
"text": "<script>document.method = function() {}</script>\n"
},
{
"answer_id": 144236,
"author": "Pete Karl II",
"autho... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138309",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3355/"
] |
138,311 | <p>The CSRF prevention built in to Rails is causing some problems for some automated load testing we are doing, and I want to turn it off for the duration of the process. How do I do this?</p>
| [
{
"answer_id": 138372,
"author": "Patrick McKenzie",
"author_id": 15046,
"author_profile": "https://Stackoverflow.com/users/15046",
"pm_score": 6,
"selected": true,
"text": "#I go in application.rb\nself.allow_forgery_protection = false\n"
},
{
"answer_id": 7564903,
"author":... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138311",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7473/"
] |
138,313 | <p>I would like to create a page where all images which reside on my website are listed with title and alternative representation.</p>
<p>I already wrote me a little program to find and load all HTML files, but now I am stuck at how to extract <code>src</code>, <code>title</code> and <code>alt</code> from this HTML:</p>
<pre><code><img <b>src</b>="/image/fluffybunny.jpg" <b>title</b>="Harvey the bunny" <b>alt</b>="a cute little fluffy bunny" /></code></pre>
<p>I guess this should be done with some regex, but since the order of the tags may vary, and I need all of them, I don't really know how to parse this in an elegant way (I could do it the hard char by char way, but that's painful).</p>
| [
{
"answer_id": 138614,
"author": "Stefan Gehrig",
"author_id": 11354,
"author_profile": "https://Stackoverflow.com/users/11354",
"pm_score": 6,
"selected": false,
"text": "$doc=new DOMDocument();\n$doc->loadHTML(\"<html><body>Test<br><img src=\\\"myimage.jpg\\\" title=\\\"title\\\" alt=\... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138313",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7021/"
] |
138,318 | <p>here is my directory structure.</p>
<p>/user/a
/user/b
/user/b</p>
<p>inside folder a,b,c there is a file person.java (it is the Same file, just a one line modification.</p>
<p>now, on my shell, im on my /user/ directory and i try to do </p>
<pre><code> javac */person.java
</code></pre>
<p>the shell returns the following error,</p>
<p>person.java:14: duplicate class: person</p>
<p>Is there anything to resolve this?</p>
| [
{
"answer_id": 138329,
"author": "Horst Gutmann",
"author_id": 22312,
"author_profile": "https://Stackoverflow.com/users/22312",
"pm_score": 4,
"selected": true,
"text": "find . -name '*.java' -exec javac {} \\;"
},
{
"answer_id": 138354,
"author": "PierreBdR",
"author_id... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138318",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/17085/"
] |
138,321 | <p>I unpacked a zip-file delivery into a clearcase view. Now I want to add the complete file tree to the repository. The GUI only provides an "Add to source control ..." for individual files/directories. Do you know how to recursively add the whole tree?</p>
<p>(I'm on a Windows system, but have Cygwin installed.)</p>
| [
{
"answer_id": 138325,
"author": "prakash",
"author_id": 123,
"author_profile": "https://Stackoverflow.com/users/123",
"pm_score": 2,
"selected": false,
"text": "clearfsimport –recurse /usr/src/projectx /vobs/projectx/src\n"
},
{
"answer_id": 144310,
"author": "VonC",
"au... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138321",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20668/"
] |
138,353 | <p>In wxPython, if I create a list of radio buttons and place the list initially, is it possible to change the contents in that list later?</p>
<p>For example, I have a panel that uses a boxSizer to place the widgets initially. One of those widgets is a list of radio buttons (I have also tried a normal radiobox). I would like to dynamically change the list based on variables from another class.</p>
<p>However, once the list is placed in the sizer, it's effectively "locked"; I can't just modify the list and have the changes appear. If I try re-adding the list to the sizer, it just gets put in the top left corner of the panel.</p>
<p>I'm sure I could hide the original list and manually place the new list in the same position but that feels like a kludge. I'm sure I'm making this harder than it is. I'm probably using the wrong widgets for this, much less the wrong approach, but I'm building this as a learning experience.</p>
<pre><code> class Job(wiz.WizardPageSimple):
"""Character's job class."""
def __init__(self, parent, title, attribs):
wiz.WizardPageSimple.__init__(self, parent)
self.next = self.prev = None
self.sizer = makePageTitle(self, title)
self.charAttribs = attribs
#---Create widgets
self.Job_list = ["Aircraft Mechanic", "Vehicle Mechanic", "Electronics Specialist"]
box1_title = wx.StaticBox( self, -1, "" )
box1 = wx.StaticBoxSizer( box1_title, wx.VERTICAL )
grid1 = wx.BoxSizer(wx.VERTICAL)
for item in self.Job_list:
radio = wx.RadioButton(self, -1, item)
grid1.Add(radio)
##Debugging
self.btn = wx.Button(self, -1, "click")
self.Bind(wx.EVT_BUTTON, self.eligibleJob, self.btn)
#---Place widgets
self.sizer.Add(self.Job_intro)
self.sizer.Add(self.btn)
box1.Add(grid1)
self.sizer.Add(box1)
def eligibleJob(self, event):
"""Determine which Jobs a character is eligible for."""
if self.charAttribs.intelligence >= 12:
skillList = ["Analyst", "Interrogator", "Fire Specialist", "Aircraft Pilot"]
for skill in skillList:
self.Job_list.append(skill)
print self.Job_list ##Debugging
#return self.Job_list
</code></pre>
| [
{
"answer_id": 139009,
"author": "DzinX",
"author_id": 18745,
"author_profile": "https://Stackoverflow.com/users/18745",
"pm_score": 2,
"selected": true,
"text": "def addNewSkills(self, newSkillList):\n '''newSkillList is a list of skill names you want to add'''\n for skillName in ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138353",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18676/"
] |
138,355 | <p>I have a third party .NET Assembly and a large Java application. I need to call mothods provided by the .NET class library from the Java application. The assembly is not COM-enabled.
I have searched the net and so far i have the following:</p>
<p>C# code (cslib.cs):</p>
<pre><code>using System;
namespace CSLib
{
public class CSClass
{
public static void SayHi()
{
System.Console.WriteLine("Hi");
}
}
}
</code></pre>
<p>compiled with (using .net 3.5, but the same happens when 2.0 is used):</p>
<pre><code>csc /target:library cslib.cs
</code></pre>
<p>C++ code (clib.cpp):</p>
<pre><code>#include <jni.h>
#using <CSLib.dll>
using namespace CSLib;
extern "C" _declspec(dllexport) void Java_CallCS_callCS(JNIEnv* env, jclass cls) {
CSLib::CSClass::SayHi();
}
</code></pre>
<p>compiled with (using VC 2008 tools, but the same happens when 2003 tools are used):</p>
<pre><code>cl /clr /LD clib.cpp
mt -manifest clib.dll.manifest -outputresource:clib.dll;2
</code></pre>
<p>Java code (CallCS.java):</p>
<pre><code>class CallCS {
static {
System.loadLibrary("clib");
}
private static native void callCS();
public static void main(String[] args) {
callCS();
}
}
</code></pre>
<p>When I try to run the java class, the Java VM crashes while invoking the method (it is able to load the library):</p>
<pre>
#
# An unexpected error has been detected by Java Runtime Environment:
#
# Internal Error (0xe0434f4d), pid=3144, tid=3484
#
# Java VM: Java HotSpot(TM) Client VM (10.0-b19 mixed mode, sharing windows-x86)
# Problematic frame:
# C [kernel32.dll+0x22366]
#
...
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j CallCS.callCS()V+0
j CallCS.main([Ljava/lang/String;)V+0
v ~StubRoutines::call_stub
</pre>
<p>However, if I create a plain cpp application that loads clib.dll and calls the exported function Java_CallCS_callCS, everything is OK.
I have tried this on both x86 and x64 environments and the result is the same. I have not tried other versions of Java, but I need the code to run on 1.5.0.</p>
<p>Moreover, if I modify clib.cpp to call only System methods everything works fine even from Java:</p>
<pre><code>#include <jni.h>
#using <mscorlib.dll>
using namespace System;
extern "C" _declspec(dllexport) void Java_CallCS_callCS(JNIEnv* env, jclass cls) {
System::Console::WriteLine("It works");
}
</code></pre>
<p>To wrap up:</p>
<ol>
<li>I am ABLE to call System methods from Java -> clib.dll -> mscorlib.dll</li>
<li>I am ABLE to call any methods from CPPApp -> clib.dll -> cslib.dll</li>
<li>I am UNABLE to call any methods from Java -> clib.dll -> cslib.dll</li>
</ol>
<p>I am aware of a workaround that uses 1. above - I can use reflection to load the assmebly and invoke desired methods using only System calls, but the code gets messy and I am hoping for a better solution. </p>
<p>I know about dotnetfromjava project, which uses the reflection method, but prefer not to add more complexity than needed. I'll use something like this if there is no other way, however.</p>
<p>I have looked at ikvm.net also, but my understanding is that it uses its own JVM (written in C#) to do the magic. However, running the entire Java application under its VM is no option for me.</p>
<p>Thanks.</p>
| [
{
"answer_id": 17556542,
"author": "dusselduck22",
"author_id": 2565905,
"author_profile": "https://Stackoverflow.com/users/2565905",
"pm_score": 0,
"selected": false,
"text": " //C# code\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Reflecti... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138355",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22602/"
] |
138,361 | <p>Or is it now the other way around?</p>
<p>From what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to test it by myself.</p>
<p>Thought any of you could explain these differences in detail or point me to the right place for information on this.</p>
| [
{
"answer_id": 2553416,
"author": "rks",
"author_id": 306058,
"author_profile": "https://Stackoverflow.com/users/306058",
"pm_score": -1,
"selected": false,
"text": "for (int i=0; i<1000; i++)\n{\n StreamReader str = new StreamReader(\"file.csv\");\n StreamWriter stw = new StreamWr... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138361",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7839/"
] |
138,371 | <p>What are (if any)the implied assumptions or restrictions and the differences of designing like:</p>
<p>A) this:</p>
<pre><code>class SampleClass1
{
IWorker workerA;
IWorker workerB;
void setWorkerA(IWorker w);
void setWorkerB(IWorker w);
WorkResult doWork();
}
</code></pre>
<p>B) versus this:</p>
<pre><code>class SampleClass2
{
WorkResult doWork(IWorker workerA, IWorker workerB);
}
</code></pre>
<p>I know it depends on the specific project but what if the above class is a part of a small framework? The first Class is able to maintain state and separate the steps more naturaly but Second class ensures "real time communication" with the external caller more naturaly since Worker are passed each time doWork() is called.</p>
<p>Are there any recommended usages or generic practices that guide the choice between the two above ways? Thanks.</p>
| [
{
"answer_id": 138403,
"author": "Konrad Rudolph",
"author_id": 1968,
"author_profile": "https://Stackoverflow.com/users/1968",
"pm_score": 0,
"selected": false,
"text": "WorkDelegate"
}
] | 2008/09/26 | [
"https://Stackoverflow.com/questions/138371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11906/"
] |
138,374 | <p>I'm attempting to do an AJAX call (via JQuery) that will initiate a fairly long process. I'd like the script to simply send a response indicating that the process has started, but JQuery won't return the response until the PHP script is done running.</p>
<p>I've tried this with a "close" header (below), and also with output buffering; neither seems to work. Any guesses? or is this something I need to do in JQuery?</p>
<pre><code><?php
echo( "We'll email you as soon as this is done." );
header( "Connection: Close" );
// do some stuff that will take a while
mail( 'dude@thatplace.com', "okay I'm done", 'Yup, all done.' );
?>
</code></pre>
| [
{
"answer_id": 138750,
"author": "Liam",
"author_id": 18333,
"author_profile": "https://Stackoverflow.com/users/18333",
"pm_score": 2,
"selected": false,
"text": "mkdir test\nchmod -R 777 test\ncd test\n"
},
{
"answer_id": 139306,
"author": "Morgan ARR Allen",
"author_id"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138374",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/82944/"
] |
138,379 | <p>What happens if I use <a href="http://msdn.microsoft.com/en-us/library/windows/desktop/bb762181%28v=vs.85%29.aspx" rel="nofollow noreferrer">SHGetFolderPath</a> api call in a 32 bit system with CSIDL_PROGRAM_FILESx86 folder id instead of the CSIDL_PROGRAM_FILES id?</p>
<p>Theoretically CSIDL_PROGRAM_FILESx86 should map to <code>C:\program files (x86)</code> in a 64 bit system but what does it map to in a 32 bit system where this path doesn't exist?</p>
| [
{
"answer_id": 138473,
"author": "Magnus Johansson",
"author_id": 3584,
"author_profile": "https://Stackoverflow.com/users/3584",
"pm_score": 4,
"selected": true,
"text": "The interpretation of certain KNOWNFOLDERID values depends on whether the folder is part of a 32-bit or 64-bit appli... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138379",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14587/"
] |
138,383 | <p>Sometimes coloring a logfile or other gives a good overview when looking for <em>stuff</em> and <em>behaviors</em></p>
<p>I just saw that grep have a coloring feature</p>
<pre><code>grep -C 99999 --color <regexp> <filename>
</code></pre>
<p>What other methods are there?</p>
| [
{
"answer_id": 138528,
"author": "epatel",
"author_id": 842,
"author_profile": "https://Stackoverflow.com/users/842",
"pm_score": 4,
"selected": false,
"text": "#include <stdio.h>\n#include <regex.h>\n\n#define MAX_LINE 4096\n\n#define RESET \"\\033[0m\"\n#define BLACK \"\\033[30m\" ... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138383",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/842/"
] |
138,394 | <p>I'm trying to fix a non-responsive USB device that's masquerading as a virtual COM port. Manual replugging works, but there may be up to 12 of these units. Is there an API command to do the programmatic equivalent of the unplug/replug cycle?</p>
| [
{
"answer_id": 14216048,
"author": "shahar_m",
"author_id": 662770,
"author_profile": "https://Stackoverflow.com/users/662770",
"pm_score": 2,
"selected": false,
"text": "public bool ResetDevice( IntPtr hDevInfo, IntPtr devInfoData ) \n// Need to add \n// public const int DICS_PROPCHAN... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138394",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
138,411 | <p>Is there any way of knowing if the user closes a tab in a web browser? Specifically IE7, but also FireFox and others as well. I would like to be able to handle this situation from our asp code if the current tab containing our web site closes.</p>
| [
{
"answer_id": 146826,
"author": "Nickolay",
"author_id": 1026,
"author_profile": "https://Stackoverflow.com/users/1026",
"pm_score": 0,
"selected": false,
"text": "XMLHttpRequest"
},
{
"answer_id": 193727,
"author": "eyelidlessness",
"author_id": 17964,
"author_profi... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138411",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20315/"
] |
138,412 | <p>I can't get my GridView to enable a user to sort a column of data when I'm using a custom SqlDataSource.</p>
<p>I have a GridView in which the code in the ASP reference to it in the HTML is minimal:</p>
<pre><code><asp:GridView id="grid" runat="server" AutoGenerateColumns="False" AllowSorting="True">
</asp:GridView>
</code></pre>
<p>In the code-behind I attach a dynamically-created SqlDataSource (the columns it contains are not always the same so the SQL used to create it is constructed at runtime). For example:</p>
<p>I set up the columns...</p>
<pre><code>BoundField column = new BoundField();
column.DataField = columnName;
column.HeaderText = "Heading";
column.SortExpression = columnName;
grid.Columns.Add(column);
</code></pre>
<p>the data source...</p>
<pre><code>SqlDataSource dataSource = new SqlDataSource(
"System.Data.SqlClient",
connectionString,
generatedSelectCommand);
</code></pre>
<p>then the gridview...</p>
<pre><code>grid.DataSource = dataSource;
grid.DataKeyNames = mylistOfKeys;
grid.DataBind();
</code></pre>
<p>At the moment nothing happens when a user clicks on a column heading when I'd expect it to sort the column data. Anyone any ideas what I'm missing?</p>
<p>If there's a nicer way of doing this that would be helpful too as this looks messy to me!</p>
| [
{
"answer_id": 138492,
"author": "Keith",
"author_id": 905,
"author_profile": "https://Stackoverflow.com/users/905",
"pm_score": 3,
"selected": true,
"text": "<asp:GridView AllowSorting=\"True\" OnSorting=\"gvName_Sorting\" ...\n"
},
{
"answer_id": 2965130,
"author": "Martin"... | 2008/09/26 | [
"https://Stackoverflow.com/questions/138412",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22185/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.