qid int64 4 22.2M | question stringlengths 18 48.3k | answers list | date stringlengths 10 10 | metadata list |
|---|---|---|---|---|
323,230 | <p>We have a JavaEE server and servlets providing data to mobile clients (first JavaME, now soon iPhone). The servlet writes out data using the following code:</p>
<pre><code>DataOutputStream dos = new DataOutputStream(out);
dos.writeInt(someInt);
dos.writeUTF(someString);
</code></pre>
<p>... and so on</p>
<p>This data is returned to the client as bytes in the HTTP response body, to reduce the number of bytes transferred.</p>
<p>In the iPhone app, the response payload is loaded into NSData object. Now, after spending hours and hours trying to figure out how to read the data out in the Objective-C application, I'm almost ready to give up, as I haven't found any good way to read the data into NSInteger and NSString (as corresponding to above protocol)</p>
<p>Would anyone have any pointers how to read stuff out from a binary protocol written by a java app? Any help is greatly appreciated!</p>
<p>Thanks!</p>
| [
{
"answer_id": 923499,
"author": "Adam Rosenfield",
"author_id": 9530,
"author_profile": "https://Stackoverflow.com/users/9530",
"pm_score": 2,
"selected": false,
"text": "DataOutputStream"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323230",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,260 | <p>Please let me know how can I remove default banner of web server from response - Apache http1.1 coyote</p>
| [
{
"answer_id": 323364,
"author": "Pierre-Yves Gillier",
"author_id": 2692,
"author_profile": "https://Stackoverflow.com/users/2692",
"pm_score": 2,
"selected": false,
"text": "ServerSignature Off\n"
},
{
"answer_id": 8735831,
"author": "Leif Wickland",
"author_id": 175251... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323260",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,264 | <p>Is it possible (and if yes, how) to bypass DNS when doing a HTTP request ?</p>
<p>I want to hit directly a front-end with an HTTP request, without getting through NLB but with the correct host header.
As I have the IP of my server, I just need to bypass the DNS.</p>
<p>I tried to use WebRequest, replacing the URL with the IP and setting the Host header, but this header is protected.</p>
<p>How can I do that ? Do I need to create the HTTP request myself ?</p>
<p>Note: editing host file is not an option</p>
| [
{
"answer_id": 323555,
"author": "Martin Brown",
"author_id": 20553,
"author_profile": "https://Stackoverflow.com/users/20553",
"pm_score": 3,
"selected": false,
"text": "HttpWebRequest request = (HttpWebRequest)WebRequest.Create(\"http://127.0.0.1\");\nRequest.Host = \"www.example.com\"... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323264",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22970/"
] |
323,265 | <p>I try <code>Request.Form.Set(k, v)</code> but it's throwing exception </p>
<blockquote>
<p>Collection is read-only</p>
</blockquote>
| [
{
"answer_id": 323312,
"author": "annakata",
"author_id": 13018,
"author_profile": "https://Stackoverflow.com/users/13018",
"pm_score": 5,
"selected": true,
"text": "Request.Querystring"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323265",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/441493/"
] |
323,271 | <p>I have a HTML application, partially HTML, partially VBscript, disguised as a form. What it does is it opens a few local files, runs a DOS box containing GAWK and presents a text file as its result. I wish to expand upon it by letting it create a bitmap image with the results in a stacked bar graph, for instance as a .BMP file. But I'm stumped. I haven't the faintest idea where to start.</p>
| [
{
"answer_id": 323321,
"author": "Tomalak",
"author_id": 18771,
"author_profile": "https://Stackoverflow.com/users/18771",
"pm_score": 0,
"selected": false,
"text": "<img>"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323271",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,284 | <p>currently i am forcing my WPF app to use the luna theme no matter what, with this XAML code</p>
<pre><code><Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Styles.xaml" />
<ResourceDictionary Source="NavigationCommands.xaml" />
<ResourceDictionary Source="/RibbonControlsLibrary;component/Themes/Office2007Blue.xaml"/>
<ResourceDictionary Source="/PresentationFramework.Luna, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, ProcessorArchitecture=MSIL;;component/Themes/luna.normalcolor.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</code></pre>
<p>and now i want to extend the style of every textbox with this validation trigger</p>
<pre><code><Style TargetType="TextBox">
<Style.Triggers>
<Trigger Property="Validation.HasError" Value="true">
<Setter Property="Background" Value="#d3e1f3"></Setter>
<Setter Property="ToolTip"
Value="{Binding RelativeSource={RelativeSource Self},
Path=(Validation.Errors)[0].ErrorContent}"/>
</Trigger>
</Style.Triggers>
</Style>
</code></pre>
<p>but this trigger does not work, because i forced the luna theme. (without the forced theme every thing works as it should, but doesn't look as it should :( )
is there some way to force the luna theme and extend it's style? probably over the BasedOn property?</p>
<p>atm i defined a key for the style in question and added it to every textbox by hand, that works but isn't the prettiest way to go.</p>
<p>tia</p>
| [
{
"answer_id": 324176,
"author": "Jobi Joy",
"author_id": 8091,
"author_profile": "https://Stackoverflow.com/users/8091",
"pm_score": 1,
"selected": false,
"text": "<Style x:Key=\"{x:Type TextBox}\" TargetType=\"{x:Type TextBox}\">\n"
},
{
"answer_id": 325322,
"author": "Arct... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323284",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12406/"
] |
323,285 | <p>I'm working with C and through a socket I will be receiving a message with one space in it, I need to split the string into parts at the space. How would I go about doing this?</p>
| [
{
"answer_id": 323290,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 5,
"selected": true,
"text": "strtok()"
},
{
"answer_id": 323305,
"author": "unwind",
"author_id": 28169,
"author_profile": "https://Stac... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323285",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2128/"
] |
323,287 | <p>Are there any guidelines/best practices for deciding what type of data should be stored in the database?</p>
<p>For ex., is it ok to use database to store</p>
<ol>
<li>Application logs </li>
<li>Configuration details (like server IP addresses etc.)</li>
<li>System information (e.g., names of shell scripts, scheduling information for batch jobs, batch jobs status etc.)</li>
</ol>
<p>I have seen applications that use database for storing these. Is this acceptable? What are the pros and cons of such a design?</p>
| [
{
"answer_id": 553787,
"author": "MattGrommes",
"author_id": 3098,
"author_profile": "https://Stackoverflow.com/users/3098",
"pm_score": 0,
"selected": false,
"text": "app.properties"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323287",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24424/"
] |
323,294 | <p>I'm having a bit of a problem with converting the result of a MySQL query to a Java class when using SUM.</p>
<p>When performing a simple SUM in MySQL</p>
<pre><code>SELECT SUM(price) FROM cakes WHERE ingredient = 'chocolate';
</code></pre>
<p>with <code>price</code> being an integer, it appears that the <code>SUM</code> sometimes returns a string and sometimes an integer, depending on the version of the JDBC driver.</p>
<p>Apparently the server does tell the JDBC driver that the result of <code>SUM</code> is a string, and the JDBC driver sometimes 'conveniently' converts this to an integer. (see <a href="http://marc.info/?l=mysql-java&m=116295785422117&w=2" rel="nofollow noreferrer">Marc Matthews' explanation</a>).</p>
<p>The Java code uses some <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/beans/BeanInfo.html" rel="nofollow noreferrer">BeanInfo</a> and <a href="http://java.sun.com/j2se/1.4.2/docs/api/java/beans/Introspector.html" rel="nofollow noreferrer">Introspection</a> to automagically fill in a (list of) bean(s) with the result of a query. But this obviously can't work if the datatypes differ between servers where the application is deployed.</p>
<p>I don't care wether I get a string or an integer, but I'd like to always have the same datatype, or at least know in advance which datatype I'll be getting. </p>
<p>Is there some way to know which datatype will be returned by a MySQL <code>SUM</code> from within the Java code? Or does anyone know some better way to deal with this?</p>
| [
{
"answer_id": 323307,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 4,
"selected": true,
"text": "SELECT CAST(SUM(price) AS SIGNED) FROM cakes WHERE ingredient = 'marshmallows';\n"
},
{
"answer_id": 323410,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323294",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/5822/"
] |
323,314 | <p>What is the best way to convert from Pascal Case (upper Camel Case) to a sentence.</p>
<p>For example starting with</p>
<pre><code>"AwaitingFeedback"
</code></pre>
<p>and converting that to</p>
<pre><code>"Awaiting feedback"
</code></pre>
<p>C# preferable but I could convert it from Java or similar.</p>
| [
{
"answer_id": 323324,
"author": "schnaader",
"author_id": 34065,
"author_profile": "https://Stackoverflow.com/users/34065",
"pm_score": 1,
"selected": false,
"text": "NewString = \"\";\nLoop through every char of the string (skip the first one)\n If char is upper-case ('A'-'Z')\n ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323314",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6369/"
] |
323,323 | <p>Can someone tell me what Strong typing and weak typing means and which one is better?</p>
| [
{
"answer_id": 323472,
"author": "JoeBloggs",
"author_id": 34097,
"author_profile": "https://Stackoverflow.com/users/34097",
"pm_score": 6,
"selected": false,
"text": "$message = \"You are visitor number \".$count;\n"
},
{
"answer_id": 28394605,
"author": "miksiii",
"auth... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323323",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30234/"
] |
323,342 | <p>I'd like to sort on a column in the result of a stored procedure without having to add the Order By clause in the stored procedure. I don't want the data to be sorted after I have executed the query, sorting should be part of the query if possible. I have the following code:</p>
<pre><code>public static DataTable RunReport(ReportQuery query)
{
OffertaDataContext db = new OffertaDataContext();
Report report = (from r in db.Reports where r.Id == (int)query.ReportId select r).Single();
//???: check security clearance.
DataSet dataSet = new DataSet();
/*
doesn't work, I guess the "Result" table hasn't been created yet;
if(!string.IsNullOrEmpty(query.SortField))
{
dataSet.DefaultViewManager.DataViewSettings["Result"].Sort = query.SortField + " " + (query.SortAscending ? "ASC" : "DESC");
}
*/
using (SqlConnection conn = new SqlConnection(Config.ConnectionString))
{
conn.Open();
using (SqlCommand exec = conn.CreateCommand())
{
using (SqlDataAdapter adapter = new SqlDataAdapter())
{
exec.Connection = conn;
exec.CommandType = CommandType.StoredProcedure;
exec.CommandText = report.ReportProc;
adapter.SelectCommand = exec;
try
{
adapter.Fill(dataSet, query.Skip, query.Take, "Result");
}
catch (Exception e)
{
throw e;
}
finally
{
conn.Close();
}
return dataSet.Tables["Result"];
}
}
}
}
</code></pre>
<p>How do I add sorting? </p>
| [
{
"answer_id": 323374,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 1,
"selected": false,
"text": "var qry = from row in ctx.SomeMethod(args)\n order by row.Name, row.Key\n select row;\n"
},
{
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323342",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40939/"
] |
323,363 | <pre><code>>rails -v
Rails 1.2.6
>ruby -v
ruby 1.8.6 (2007-03-13 patchlevel 0) [i386-mswin32]
</code></pre>
<p>When I run a test fixture (that tests a rails model class) like this, it takes 20-30 secs to start executing these tests (show the "Loaded suite..."). What gives?</p>
<pre><code>>ruby test\unit\category_test.rb
require File.dirname(__FILE__) + '/../test_helper'
class CategoryTest < Test::Unit::TestCase
def setup
Category.delete_all
end
def test_create
obCategoryEntry = Category.new({:name=>'Apparel'})
assert obCategoryEntry.save, obCategoryEntry.errors.full_messages.join(', ')
assert_equal 1, Category.count
assert_not_nil Category.find(:all, :conditions=>"name='Apparel'")
end
#.. 1 more test here
end
</code></pre>
<p>This one is Rails using a MySql DB with no fixtures. This time it clocked 30secs+ to startup. </p>
| [
{
"answer_id": 323442,
"author": "a2800276",
"author_id": 27408,
"author_profile": "https://Stackoverflow.com/users/27408",
"pm_score": 0,
"selected": false,
"text": "(11:39) ~/tmp $ cat test_unit.rb \nrequire 'test/unit'\nclass MyTest < Test::Unit::TestCase\n def test_test\n assert_... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323363",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1695/"
] |
323,367 | <p>I'm trying to make a BEA Portal website XHTML compliant, because this has been written in the contract with the client, and I'm stuck on this problem: BEA renders <code><meta></code> and <code><link></code> tags without the closing slash, i.e. <code><link/></code> and <code><meta/></code> as it is required by XHTML.</p>
<p>When I look at the documentation from BEA it seems that it should be possible to make it render the tags with a closing slash: <a href="http://edocs.bea.com/wlp/docs81/lookandfeel/lookandfeel.html#999045" rel="nofollow noreferrer">The skin.properties file (edocs.bea.com)</a>.</p>
<p>Is it possible to change the redering with a configuration directive? Or perhaps, to hook into the underlying redering method so that I can fix it?</p>
| [
{
"answer_id": 323442,
"author": "a2800276",
"author_id": 27408,
"author_profile": "https://Stackoverflow.com/users/27408",
"pm_score": 0,
"selected": false,
"text": "(11:39) ~/tmp $ cat test_unit.rb \nrequire 'test/unit'\nclass MyTest < Test::Unit::TestCase\n def test_test\n assert_... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323367",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/37147/"
] |
323,371 | <p>A friend of mine asked me today if there is any open-source or commercially available Webmail/Email "engine". When I asked her what she meant by engine, I got a list of features her boss asked for - </p>
<ul>
<li>Web interface to login & access e-mails</li>
<li>Ability to send/receive/forward e-mails using the web interface </li>
<li>Ability to compose and save drafts using the web interface</li>
<li>Ability to delete emails, empty deleted items folder using the web interface</li>
<li>Ability to search e-mails (by Sender's e-mail, Subject, Content)</li>
<li>Maintain and manage a contacts list (of e-mail addresses) using the web interface</li>
<li>Allow users to synchronise their e-mails with iPhone/Windows Mobile smartphones</li>
</ul>
<p>I found <a href="http://anmar.eu.org/projects/sharpwebmail/" rel="nofollow noreferrer">SharpWebMail</a> to have some of the features, although it has not had updates in recent times, last update was in April 2006. I am inclined towards using ASP.NET, the proposal is to primarily use the e-mail in conjunction with an intranet (developed in ASP.NET). If you have any suggestions, please let me know.</p>
<p>indy</p>
| [
{
"answer_id": 323442,
"author": "a2800276",
"author_id": 27408,
"author_profile": "https://Stackoverflow.com/users/27408",
"pm_score": 0,
"selected": false,
"text": "(11:39) ~/tmp $ cat test_unit.rb \nrequire 'test/unit'\nclass MyTest < Test::Unit::TestCase\n def test_test\n assert_... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323371",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32649/"
] |
323,397 | <p>Part of my application maps resources stored in a number of locations onto web URLs like this:</p>
<pre><code>http://servername/files/path/to/my/resource/
</code></pre>
<p>The resources location is modelled after file paths and as a result there can be an unlimited level of nesting. Is it possible to construct an MVC route that matches this so that I get the path in its entirety passed into my controller? Either as a single string or possibly as an params style array of strings.</p>
<p>I guess this requires a match on the files keyword, followed by some sort of wildcard. Though I have no idea if MVC supports this. </p>
| [
{
"answer_id": 323460,
"author": "Garry Shutler",
"author_id": 6369,
"author_profile": "https://Stackoverflow.com/users/6369",
"pm_score": 6,
"selected": true,
"text": "\"Files/{*path}\"\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323397",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28882/"
] |
323,403 | <p>Is there a way to mount a folder on the hard disk as a device in Finder. The intend here is to provide the user with an easy way to get to a folder that my application uses to store data. I don't want my user to go searching for data in Application Data. I would rather allow them to make this data available as a mounted volume or device in Finder. I would also like this volume or device to be read/write, so that if the user makes any changes to the data files, the changes will get reflected in the original folder.</p>
<p>Is there a way to do this in cocoa, carbon or applescript.</p>
| [
{
"answer_id": 323663,
"author": "Kornel",
"author_id": 27009,
"author_profile": "https://Stackoverflow.com/users/27009",
"pm_score": 1,
"selected": false,
"text": "~/Documents/"
},
{
"answer_id": 32356645,
"author": "Kiko Albiol Colomer",
"author_id": 5190397,
"autho... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323403",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,405 | <p>I try to migrate a Windows SVN Server to Linux.<br>
I have configured Apache to validate against AD for Useraccess so only AD Users can logon.<br>
Now i have to set permissions for repositories with authz files.<br>
When i set permission with AD username it works, but AD groups it doesn't.</p>
<p>The authz file looks like the following:</p>
<pre><code>[test:/]
user1=rw #That works
[test2:/]
@usergroup=rw #No access for the groupmembers
</code></pre>
<p>When I create groups inside the authz file and asign AD users, that internal group works fine, but i can't administer groups in 2 locations, there just to much changes made every day.</p>
<p>Has anyone an idea, how to use AD groups inside authz files?</p>
| [
{
"answer_id": 323431,
"author": "Davide Gualano",
"author_id": 28582,
"author_profile": "https://Stackoverflow.com/users/28582",
"pm_score": 2,
"selected": false,
"text": "[groups]\nusergroup = user1, user2, user3\n\n[test:/]\nuser1 = rw\n\n[test2:/]\nusergroup = rw\n"
},
{
"ans... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323405",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,407 | <p>How does the C/C++ compiler manipulate the escape character ["\"] in source code? How is compiler grammar written for processing that character? What does the compiler do after encountering that character?</p>
| [
{
"answer_id": 323454,
"author": "qrdl",
"author_id": 28494,
"author_profile": "https://Stackoverflow.com/users/28494",
"pm_score": 1,
"selected": false,
"text": "\\n"
},
{
"answer_id": 323486,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323407",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38038/"
] |
323,413 | <p>I have an app that needs to handle very large strings between a SQL Server database and .NET code. I have a LINQ query that generates the strings when saving them <i>to</i> the database, but when trying to create the strings <i>from</i> the database, the app crashes with an OutOfMemoryException because of the size of the strings.</p>
<p>Do I have to do something to make the LINQ generated code avoid that? Using some kind of compression might be an option, but would like to avoid that for performance reasons.</p>
| [
{
"answer_id": 323425,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 2,
"selected": true,
"text": "ExecuteReader()"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323413",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41304/"
] |
323,419 | <p>Do you know a simple script to count NLOCs (netto lines of code). The script should count lines of C Code. It should not count empty lines or lines with just braces. But it doesn't need to be overly exact either.</p>
| [
{
"answer_id": 323531,
"author": "PhiLho",
"author_id": 15459,
"author_profile": "https://Stackoverflow.com/users/15459",
"pm_score": 2,
"selected": false,
"text": "perl -pe \"s/^\\s*[{}]?\\s*\\n//\" Dialog.java | wc -l\n"
},
{
"answer_id": 324732,
"author": "Jonathan Leffler... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323419",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20668/"
] |
323,424 | <p>I am using python 2.6 on XP. I have just installed py2exe, and I can successfully create a simple hello.exe from a hello.py. However, when I try using py2exe on my real program, py2exe produces a few information messages but fails to generate anything in the dist folder. </p>
<p>My setup.py looks like this:</p>
<pre class="lang-py prettyprint-override"><code>from distutils.core import setup
import py2exe
setup(console=['ServerManager.py'])
</code></pre>
<p>and the py2exe output looks like this:</p>
<pre class="lang-none prettyprint-override"><code>python setup.py py2exe
running py2exe
creating C:\DevSource\Scripts\ServerManager\build
creating C:\DevSource\Scripts\ServerManager\build\bdist.win32
...
...
creating C:\DevSource\Scripts\ServerManager\dist
*** searching for required modules ***
*** parsing results ***
creating python loader for extension 'wx._misc_' (C:\Python26\lib\site-packages\wx-2.8-msw-unicode\wx\_misc_.pyd -> wx._misc_.pyd)
creating python loader for extension 'lxml.etree' (C:\Python26\lib\site-packages\lxml\etree.pyd -> lxml.etree.pyd)
...
...
creating python loader for extension 'bz2' (C:\Python26\DLLs\bz2.pyd -> bz2.pyd)
*** finding dlls needed ***
</code></pre>
<p>py2exe seems to have found all my imports (though I was a bit surprised to see win32 mentioned, as I am not explicitly importing it). Also, my program starts up quite happily with this command:</p>
<pre class="lang-none prettyprint-override"><code>python ServerManager.py
</code></pre>
<p>Clearly I am doing something fundamentally wrong, but in the absence of any error messages from py2exe I have no idea what.</p>
| [
{
"answer_id": 325456,
"author": "Charles Anderson",
"author_id": 11677,
"author_profile": "https://Stackoverflow.com/users/11677",
"pm_score": 6,
"selected": true,
"text": "*** finding dlls needed ***\nerror: MSVCP90.dll: No such file or directory\n"
},
{
"answer_id": 774715,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323424",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11677/"
] |
323,426 | <p>I would like to provide the raw text referring to an environment variable to a command instead of evaluating the environment variable.</p>
<p>I need this to configure BizTalk from the command line, for example:</p>
<p>BTSTask.exe AddResource -ApplicationName:App1
-Type:System.BizTalk:BizTalkAssembly -Overwrite
-Source:..\Schemas\bin\development\App1.Schemas.dll
-Destination:%BTAD_InstallDir%\App1.Schemas.dll</p>
<p>This command adds a resource to a BizTalk application. I want the destination to be %BTAD_InstallDir%\App1.Schemas.dll, however at present it is evaluating the environment variable (to nothing) and using \App1.Schemas.dll.</p>
<p>Is it possible to escape or disable the evaluation of this environment variable while parsing\executing this command?</p>
<p>I have tried escaping the first and both percentage characters with a carrot (^), however this did not stop the evaluation.</p>
<p><b>[EDIT]</b> When I execute this at the command prompt it doesn't replace the environment variable, however it does when I run it as a script, any thoughts as to why this is different?</p>
| [
{
"answer_id": 323466,
"author": "PhiLho",
"author_id": 15459,
"author_profile": "https://Stackoverflow.com/users/15459",
"pm_score": 1,
"selected": false,
"text": "C:\\PrgCmdLine\\Unix\\echo.exe \"%\"JAVA_HOME\"%\"\n"
},
{
"answer_id": 323516,
"author": "VonC",
"author_i... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323426",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23940/"
] |
323,462 | <p>This is driving me nuts so any advice from fellow users would be welcome. I am using Subversion, with a copy of VisualSVN 1.6.1 installed on a Windows server. On my PC I am using a combination of TortoiseSVN and the wonderful AnkhSVN Visual Studio plugin. Everything works like a dream, but now I am trying use the <code>svn:keywords</code> feature so I can include <code>$Id$</code> at the top of all my source files. Now, for existing files I can edit the SVN properties and add this keyword and it all works fine, but I want this done automatically for new files - and I cannot make it work.</p>
<p>According to the documentation you need to edit a special Subversion Config file located in your <code>C:\Documents and Settings\<user>\Application Data\Subversion</code> folder. My PC already had a copy of this file, so I changed it to look like this:</p>
<pre><code>[miscellany]
enable-auto-props = yes
[auto-props]
*.cpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.hpp = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.rc2 = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.cc = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.c = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.h = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.wsf = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.js = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.htm = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.html = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
*.css = svn:eol-style=native;svn:keywords=Author Date Id HeadURL Revision
</code></pre>
<p>I then added a new file to an existing Visual Studio project (from within Visual Studio), added <code>$Id$</code> to the top and committed it - but, alas, the <code>svn:keywords</code> property is not being set.</p>
<p>Does anyone know how to get this working? I even tried adding settings to the registry (in <code>HKEY_CURRENT_USER\Software\Tigris.org\Subversion\Config</code>) but still no joy. I then tried messing with Config files on the SVN server itself, but nothing seems to work.</p>
<p>I have obviously missed something blindingly obvious!</p>
| [
{
"answer_id": 323489,
"author": "LenW",
"author_id": 41292,
"author_profile": "https://Stackoverflow.com/users/41292",
"pm_score": 3,
"selected": false,
"text": "[auto-props]\n*.cpp = svn:eol-style=native;svn:keywords=\"Author Date Id HeadURL Revision\"\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323462",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9236/"
] |
323,503 | <p>I've got a DataTable containing a sitemap hierarchy with the following columns:</p>
<ul>
<li>ItemId</li>
<li>ParentId</li>
<li>Name</li>
<li>Url</li>
</ul>
<p>I need to generate a set of nested lists in HTML (left the anchor elements out for clarity):</p>
<pre><code><ul>
<li>Item 1</li>
<li>Item 2</li>
<ul>
<li>Sub Item 1</li>
<li class="current">Sub Item 2</li>
</ul>
<li>Item 3</li>
</ul>
</code></pre>
<p>The tree should only contain branches that lead to the 'current' node/page (so using the above example any child items that Item '1' or '3' have are not displayed. Can anyone help out with some pseudo code / code example that can traverse the tree from the leaf to root building the HTML as it goes? Thanks.</p>
| [
{
"answer_id": 323602,
"author": "Bork Blatt",
"author_id": 5381,
"author_profile": "https://Stackoverflow.com/users/5381",
"pm_score": 0,
"selected": false,
"text": "'# OMITTED: Code to retrieve the record for the current node, and read all info about it.\n'# Note: field values are read... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323503",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/14072/"
] |
323,506 | <p>The developer environment db server is SqlServer 2005 (developer edition)</p>
<p>Is there any way to make sure my SQL Queries will run in SqlServer 2000?</p>
<p>This database is set to Compatibility level "SQL Server 2000 (80)" but some queries that run without problems in the development system can not run in the Test Server (SqlServer).</p>
<p>(The problems seems to be in subqueries)</p>
| [
{
"answer_id": 325179,
"author": "Kaniu",
"author_id": 3236,
"author_profile": "https://Stackoverflow.com/users/3236",
"pm_score": 0,
"selected": false,
"text": "SELECT * FROM Loans WHERE EXISTS (SELECT * FROM Collaterals WHERE LOAN_NUMBER=Loans.LOAN_NUMBER)\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323506",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28207/"
] |
323,515 | <p>I'm trying to store in a variable the name of the current file that I've opened from a folder.</p>
<p>How can I do that?
I've tried <code>cwd = os.getcwd()</code> but this only gives me the path of the folder, and I need to store the name of the opened file.</p>
<p>Can you please help me?</p>
| [
{
"answer_id": 323522,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 6,
"selected": false,
"text": "Python 2.5.1 (r251:54863, Jul 31 2008, 22:53:39)\n[GCC 4.1.2 (Ubuntu 4.1.2-0ubuntu4)] on linux2\nType \"help\", \"co... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323515",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,517 | <p>We need to see what methods/fields an object has in Javascript.</p>
| [
{
"answer_id": 323529,
"author": "Ken",
"author_id": 20074,
"author_profile": "https://Stackoverflow.com/users/20074",
"pm_score": 7,
"selected": false,
"text": "console.debug(myObject);\n"
},
{
"answer_id": 323809,
"author": "nickf",
"author_id": 9021,
"author_profil... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323517",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/30759/"
] |
323,521 | <p>in windows I am able to use winmerge as the external diff tool for hg using <i>mercurial.ini</i>,etc.
<br>
Using some options switch that you can find in web(I think it's a japanese website)
Anyway, here
for example:</p>
<pre>hg winmerge -r1 -r2</pre>
<p>will list file(s) change(s) between rev1 and rev2 in winmerge. I can just click which file to diff </p>
<p>but for bc3:</p>
<pre>hg bcomp -r1 -r2</pre>
<p>will make bc3 open a dialog which stated that a temp dir can't be found.</p>
<p>The most I can do using bc3 and hg is</p>
<pre> hg bcomp -r1 -r2 myfile.cpp </pre>
<p>which will open diff between rev1 and rev2 of myfile.cpp</p>
<p>So,it seems that hg+bc3 can't successfully acknowledge of all files change between revision.
Only able to diff 1 file at a time.
<br>
Anyone can use bc3 + hg better ?
<br></p>
<p>edit: Problem Solved !
<br></p>
<p>Got the solution from http://www.scootersoftware.com/support.php?zz=kb_vcs.php>scooter support page.
I have to use <i>bcompare</i> instead of <i>bcomp</i>
Here's a snippet of my mercurial.ini</p>
<pre>
[extensions]
hgext.win32text =
;mhd adds
hgext.extdiff =
;mhd adds for bc
[extdiff]
cmd.bc3 = bcompare
opts.bc3 = /ro
;mhd adds for winmerge
;[extdiff]
;cmd.winmerge = WinMergeU
;opts.winmerge = /r /e /x /ub
</pre>
| [
{
"answer_id": 499666,
"author": "mrrage",
"author_id": 8631,
"author_profile": "https://Stackoverflow.com/users/8631",
"pm_score": 2,
"selected": false,
"text": "[extensions]\nextdiff =\n\n[extdiff]\ncmd.bc3 = C:\\Program Files\\Beyond Compare 3\\BCompare.exe\nopts.bc3 = /ro\n"
},
{... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323521",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38515/"
] |
323,536 | <p>How can I get a full list of Groups in my Active Directory?</p>
| [
{
"answer_id": 323578,
"author": "Stefan",
"author_id": 19307,
"author_profile": "https://Stackoverflow.com/users/19307",
"pm_score": 6,
"selected": true,
"text": "using System.DirectoryServices; \n\npublic class test\n{\n\n private void main()\n {\n foreach (string @group i... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323536",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36026/"
] |
323,551 | <p>I have a WCF service with the following configuration:</p>
<pre><code><system.serviceModel>
<behaviors>
<serviceBehaviors>
<behavior name="MetadataEnabled">
<serviceDebug includeExceptionDetailInFaults="true" />
<serviceMetadata httpGetEnabled="true" />
</behavior>
</serviceBehaviors>
</behaviors>
<services>
<service behaviorConfiguration="MetadataEnabled" name="MyNamespace.MyService">
<endpoint name="BasicHttp"
address=""
binding="basicHttpBinding"
contract="MyNamespace.IMyServiceContract" />
<endpoint name="MetadataHttp"
address="contract"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<host>
<baseAddresses>
<add baseAddress="http://localhost/myservice" />
</baseAddresses>
</host>
</service>
</services>
</system.serviceModel>
</code></pre>
<p>When hosting the service in the <strong>WcfSvcHost.exe</strong> process, if I browse to the URL:</p>
<blockquote>
<p><a href="http://localhost/myservice/contract" rel="noreferrer">http://localhost/myservice/contract</a></p>
</blockquote>
<p>where the service metadata is available I get an <strong>HTTP 400 Bad Request</strong> error.<br/><br/>
By inspecting the WCF logs I found out that an <strong>System.Xml.XmlException</strong> exception is being thrown with the message: "<em>The body of the message cannot be read because it is empty.</em>"<br/>Here is an extract of the log file:</p>
<pre><code><Exception>
<ExceptionType>
System.ServiceModel.ProtocolException, System.ServiceModel, Version=3.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
</ExceptionType>
<Message>There is a problem with the XML that was received from the network. See inner exception for more details.</Message>
<StackTrace>
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, ItemDequeuedCallback callback)
at System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContextCore(IAsyncResult result)
at System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContext(IAsyncResult result)
at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.ListenerAsyncResult.WaitCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
<InnerException>
<ExceptionType>System.Xml.XmlException, System.Xml, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</ExceptionType>
<Message>The body of the message cannot be read because it is empty.</Message>
<StackTrace>
at System.ServiceModel.Channels.HttpRequestContext.CreateMessage()
at System.ServiceModel.Channels.HttpChannelListener.HttpContextReceived(HttpRequestContext context, ItemDequeuedCallback callback)
at System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContextCore(IAsyncResult result)
at System.ServiceModel.Channels.SharedHttpTransportManager.OnGetContext(IAsyncResult result)
at System.ServiceModel.Diagnostics.Utility.AsyncThunk.UnhandledExceptionFrame(IAsyncResult result)
at System.Net.LazyAsyncResult.Complete(IntPtr userToken)
at System.Net.LazyAsyncResult.ProtectedInvokeCallback(Object result, IntPtr userToken)
at System.Net.ListenerAsyncResult.WaitCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* nativeOverlapped)
at System.Threading._IOCompletionCallback.PerformIOCompletionCallback(UInt32 errorCode, UInt32 numBytes, NativeOverlapped* pOVERLAP)
</StackTrace>
</InnerException>
</Exception>
</code></pre>
<p>If I instead browse to the URL:</p>
<blockquote>
<p><a href="http://localhost/myservice?wsdl" rel="noreferrer">http://localhost/myservice?wsdl</a></p>
</blockquote>
<p>everything works just fine and I get the WSDL contract. At this point, I can also remove the <em>"MetadataHttp"</em> metadata endpoint completely, and it wouldn't make any difference.</p>
<p>I'm using .NET 3.5 SP1. Does anyone have an idea of what could be wrong here?</p>
| [
{
"answer_id": 323574,
"author": "Enrico Campidoglio",
"author_id": 26396,
"author_profile": "https://Stackoverflow.com/users/26396",
"pm_score": 5,
"selected": true,
"text": "<serviceBehaviors>\n <behavior name=\"MetadataEnabled\">\n <serviceMetadata httpGetEnabled=\"true\" />... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323551",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/26396/"
] |
323,556 | <pre><code>A.Event1 := nil;
A.Event2 := nil;
try
...
finally
A.Event1 := MyEvent1;
A.Event2 := MyEvent2;
end;
</code></pre>
<p>Can something go wrong with it?</p>
<p><strong>EDIT:</strong></p>
<p>I've accepted Barry's answer because it answered exactly what I asked, but Vegar's answer is also correct depending on the scenario, sadly I can't accept both.</p>
| [
{
"answer_id": 323781,
"author": "Vegar",
"author_id": 11956,
"author_profile": "https://Stackoverflow.com/users/11956",
"pm_score": 3,
"selected": false,
"text": "procedure TMyObject.Traverse;\nbegin\n inc(FTraverseFlag);\n try\n ...\n finally\n dec(FTracerseFlag);\n end;\nend... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323556",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/727/"
] |
323,558 | <p>Here's a relatively common task for me, and, I think, for many a .NET programmer:<br>
I want to use the .NET ThreadPool for scheduling worker threads that need to process a given type of tasks.</p>
<p>As a refresher, the signatures for the queueing method of the ThreadPool and its associated delegate are:</p>
<pre><code>public static bool QueueUserWorkItem (
WaitCallback callBack,
Object state
)
public delegate void WaitCallback (Object state)
</code></pre>
<p>Therefore, a typical generic worker thread class would look something like:</p>
<pre><code>public class Worker<T> {
public void schedule(T i_task) {
ThreadPool.QueueUserWorkItem(execute, i_task)
}
private void execute(Object o){
T task = (T)o; //What happened to the type safety?
executeTask(task);
}
private void executeTask(T i_task){
//process i_task
}
}
</code></pre>
<p>Notice the type of the <code>state</code> parameter? It's <em><code>Object</code></em> !</p>
<p>What's the compelling reason why the .NET team chose not to make the <code>QueueUserWorkItem</code> method (or the whole <code>ThreadPool</code> class) generic? I can't believe they just overlooked it.</p>
<p>Here's how I'd like to see it:</p>
<pre><code>//in the ThreadPool class:
public static bool QueueUserWorkItem<T> (
WaitCallback<T> callBack,
T state
)
public delegate void WaitCallback<T> (T state)
</code></pre>
<p>This would make the worker class type-safe (and a lot clearer, IMHO):</p>
<pre><code>public class Worker<T> {
public void schedule(T i_task) {
ThreadPool.QueueUserWorkItem<T>(execute, i_task)
}
private void execute(T i_task){
//process i_task
}
}
</code></pre>
<p>I must be missing something.</p>
| [
{
"answer_id": 323565,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 3,
"selected": false,
"text": "static void QueueItem<T>(Action<T> action, T state)\n{\n ThreadPool.QueueUserWorkItem(delegate { action(state); });\n... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323558",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11545/"
] |
323,561 | <p>I know how to disable <a href="https://stackoverflow.com/questions/303488/in-php-how-can-you-clear-a-wsdl-cache">WSDL-cache</a> in PHP, but what about force a re-caching of the WSDL? </p>
<p>This is what i tried: I run my code with caching set to disabled, and the new methods showed up as espected. Then I activated caching, but of some reason my old non-working wsdl showed up again. So: how can I force my new WSDL to overwrite my old cache?</p>
| [
{
"answer_id": 323582,
"author": "Greg",
"author_id": 24181,
"author_profile": "https://Stackoverflow.com/users/24181",
"pm_score": 1,
"selected": false,
"text": "$limit = ini_get('soap.wsdl_cache_limit');\nini_set('soap.wsdl_cache_limit', 0);\nini_set('soap.wsdl_cache_limit', $limit);\n... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323561",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36975/"
] |
323,562 | <p>I have the following code in Visual Studio 2005.</p>
<pre><code> Dim OutFile As System.IO.StreamWriter
Try
OutFile = New System.IO.StreamWriter(Filename)
// Do stuff with OutFile
Catch Ex As Exception
// Handle Exception
Finally
If OutFile IsNot Nothing Then OutFile.Close()
End Try
</code></pre>
<p>But VS2005 brings up the warning for the line "If OutFile IsNot.." that </p>
<blockquote>
<p>Variable 'OutFile' is used before it has been assigned a value. A null reference exception could result at runtime.</p>
</blockquote>
<p>Is there some way of removing this warning by subtly altering the code or is there just a better way of doing what I'm trying to do?</p>
<p>Thanks</p>
<p>Rob</p>
| [
{
"answer_id": 323566,
"author": "tvanfosson",
"author_id": 12950,
"author_profile": "https://Stackoverflow.com/users/12950",
"pm_score": 5,
"selected": true,
"text": "Dim OutFile As System.IO.StreamWriter\nOutFile = Nothing\nTry\n OutFile = New System.IO.StreamWriter(Filename)\n //... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323562",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41338/"
] |
323,567 | <p>From index.jsp code, </p>
<pre><code>statement.executeQuery("select * from fus where tester_num like 'hf60' ") ;
</code></pre>
<p>Example I want "hf60" to be a variable(userinput), wherein USER must input/write data from input text then submit and get the data so that the result will be </p>
<pre><code>("select * from fus where tester_num like 'userinput' ")
</code></pre>
<p>Where should I insert that code, Is it in InsertServlet .java or in Index.jsp.? or make another filename.java code? Please help. Thanks;)</p>
<p><strong>Index.jsp</strong></p>
<pre><code><%@ page import="java.sql.*" %>
<% Class.forName("oracle.jdbc.driver.OracleDriver"); %>
<HTML>
<HEAD>
<TITLE>SHIFT REPORT </TITLE>
</HEAD>
<BODY BGCOLOR=##342D7E>
<CENTER>
<H2><FONT COLOR="#ECD672" FACE="Verdana" >SHIFT REPORT</FONT></H2></CENTER>
<hr>
<%
Connection connection=DriverManager.getConnection ("jdbc:oracle:thin:@oradev2.*****.com:1521:RPADB","shift_admin", //
"shift_admin"
);
Statement statement = connection.createStatement() ;
//**Should I input the codes here?**
ResultSet resultset =
statement.executeQuery("select * from fus where tester_num like 'hf60") ;
%>
<TABLE BORDER="1" BGCOLOR="CCFFFF" width='200%' cellspacing='1' cellpadding='0' bordercolor="black" border='1'>
<TR>
<TH bgcolor='#DAA520'> <font size='2'>RECORD NUMBER</TH>
<TH bgcolor='#DAA520'><font size='2'>TESTER NUMBER</TH>
<TH bgcolor='#DAA520'><font size='2'>DATE</TH>
<TH bgcolor='#DAA520'><font size='2'>TIME</TH>
<TH bgcolor='#DAA520'><font size='2'>SYSTEM TYPE</TH>
<TH bgcolor='#DAA520'><font size='2'>PACKAGE</TH>
<TH bgcolor='#DAA520'><font size='2'>SOCKETS</TH>
<TH bgcolor='#DAA520'><font size='2'>VALIDATED BY</TH>
</TR>
<% while(resultset.next()){ %>
<TR>
<TD> <font size='2'><center><%= resultset.getLong(1) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(2) %></center></TD>
<TD> <font size='2'><center><%= resultset.getDate(3) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(4) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(5) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(6) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(7) %></center></TD>
<TD> <font size='2'><center><%= resultset.getString(8) %></center></TD>
</TR>
<% } %>
</TABLE>
</BODY>
</HTML>
</code></pre>
<p><strong>InsertServlet.java</strong></p>
<pre><code>package fusion.shift.servlets.db;
import java.sql.*;
import java.io.*;
import javax.servlet.*;
import javax.servlet.http.*;
public class InsertServlet extends HttpServlet {
public void init(ServletConfig config) throws ServletException {
super.init(config);
}
public void destroy() {
}
public boolean processRequest(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{
String rec_num = request.getParameter("rec_num");
String tester_num = request.getParameter("tester_num");
String t_date = request.getParameter("t_date");
String t_time = request.getParameter("t_time");
String sys_type = request.getParameter("sys_type");
String packages = request.getParameter("package");
String sockets = request.getParameter("sockets");
String sockets = request.getParameter("val");
Connection con = null;
Statement stmt = null;
ResultSet rs = null;
PreparedStatement ps = null;
try {
Class.forName("oracle.jdbc.driver.OracleDriver");
con=DriverManager.getConnection("jdbc:oracle:thin:@oradev2.*****.com:1521:RPADB","shift_admin", //
"shift_admin"
);
String sql;
sql = "INSERT INTO fusion_shiftrpt(RECORD_NUM, TESTER_NUM, T_DATE, T_TIME, SYSTEM_TYPE, PACKAGE, SOCKETS,VAL) VALUES (?,?,?,?,?,?,?,?)";
ps = con.prepareStatement(sql);
stmt = con.createStatement();
ps.setString(1, rec_num);
.0+ ps.setString(2, tester_num);
ps.setString(3, t_date);
ps.setString(4, t_time);
ps.setString(5, sys_type);
ps.setString(6, packages);
ps.setString(7, sockets);
ps.setString(8, val);
ps.executeUpdate();
} catch (SQLException e) {
throw new ServletException(e);
} catch (ClassNotFoundException e) {
throw new ServletException(e);
} finally {
try {
if(rs != null)
rs.close();
if(stmt != null)
stmt.close();
if(ps != null)
ps.close();
if(con != null)
con.close();
} catch (SQLException e) {}
}
return(true);
}
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request,response);
}
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request,response);
//String url = request.getRequestURI();
//System.out.println(url);
}
}
</code></pre>
| [
{
"answer_id": 323587,
"author": "carson",
"author_id": 25343,
"author_profile": "https://Stackoverflow.com/users/25343",
"pm_score": 2,
"selected": false,
"text": "JSP"
},
{
"answer_id": 334636,
"author": "James Schek",
"author_id": 17871,
"author_profile": "https://... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323567",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28607/"
] |
323,572 | <p>I have the following route defined</p>
<pre><code> routes.MapRoute(
"ItemName",
"{controller}/{action}/{projectName}/{name}",
new { controller = "Home", action = "Index", name = "", projectName = "" }
);
</code></pre>
<p>This route actually works, so if I type in the browser</p>
<pre><code>/Milestone/Edit/Co-Driver/Feature complete
</code></pre>
<p>It correctly goes to the Milestone controller, the edit action and passes the values.</p>
<p>However, if I try and construct the link in the view with a url.action - </p>
<pre><code><%=Url.Action("Edit", "Milestone", new {name=m.name, projectName=m.Project.title})%>
</code></pre>
<p>I get the following url</p>
<pre><code>Milestone/Edit?name=Feature complete&projectName=Co-Driver
</code></pre>
<p>It still works, but isn't very clean. Any ideas?</p>
| [
{
"answer_id": 324537,
"author": "idursun",
"author_id": 5984,
"author_profile": "https://Stackoverflow.com/users/5984",
"pm_score": 0,
"selected": false,
"text": "Html.RouteLink(\"Edit\",\"ItemName\", new {name=m.name, projectName=m.Project.title});\n"
},
{
"answer_id": 324557,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323572",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/3193/"
] |
323,585 | <p>I'm using WCF and want to upload a large file from the client to the server. I have investigated and decided to follow the chunking approach outlined at <a href="http://msdn.microsoft.com/en-us/library/aa717050.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa717050.aspx</a></p>
<p>However, this approach (just like streaming) restricts the contract to limited method signitures:</p>
<pre><code>[OperationContract(IsOneWay=true)]
[ChunkingBehavior(ChunkingAppliesTo.InMessage)]
void UploadStream(Stream stream);
</code></pre>
<p>The sample uses the rather convenient example of uploading a file from a fixed path and saving it to a fixed path on the server. Therefore, my question is how do I pass additional parameters to specify things like filename, filepath etc.</p>
<p>eg. I would like something like:</p>
<pre><code>[OperationContract(IsOneWay=true)]
[ChunkingBehavior(ChunkingAppliesTo.InMessage)]
void UploadStream(Stream stream, String filePath);
</code></pre>
<p>Thanks in advance,
Mark.</p>
| [
{
"answer_id": 323666,
"author": "JacobE",
"author_id": 30056,
"author_profile": "https://Stackoverflow.com/users/30056",
"pm_score": 2,
"selected": false,
"text": "[OperationContract(IsInitiating = true)]\nvoid InitializeUploadService(string filename);\n\n[OperationContract(IsOneWay = t... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323585",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,599 | <p>I haven't played with CSS for too long a time and am without references at the moment. My question should be fairly easy but googling isn't bringing up a sufficient answer. So, adding to the collective knowledge...</p>
<pre><code>|#header---------------------------------------------------------------|
| TITLE |
|#sub-title------------------------------------------------------------|
|bread > crumb | username logout |
|#sub-left | #sub-right|
|---------------------------------|------------------------------------|
</code></pre>
<p>That's what I'm wanting my layout to be. The heading anyways. I wanted sub-title to contain sub-left AND sub-right. What css rules do I use to ensure a div is bound by the attributes of another div. In this case, how do I ensure that sub-left and sub-right stay within sub-title? </p>
| [
{
"answer_id": 323617,
"author": "Jack Ryan",
"author_id": 28882,
"author_profile": "https://Stackoverflow.com/users/28882",
"pm_score": -1,
"selected": false,
"text": "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01//EN\" \"http://www.w3.org/TR/html4/strict.dtd\">\n<html>\n <head>\n ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323599",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/10583/"
] |
323,604 | <p>When designing a file format for recording binary data, what attributes would you think the format should have? So far, I've come up with the following important points:</p>
<ul>
<li>have some "magic bytes" at the beginning, to be able to recognize the files (in my specific case, this should also help to distinguish the files from "legacy" files)</li>
<li>have a file version number at the beginning, so that the file format can be changed later without breaking compatibility</li>
<li>specify the endianness and size of all data items; or: include some space to describe endianness/size of data (I would tend towards the former)</li>
<li>possibly reserve some space for further per-file attributes that might be necessary in the future?</li>
</ul>
<p>What else would be useful to make the format more future-proof and minimize headache in the future?</p>
| [
{
"answer_id": 323660,
"author": "atzz",
"author_id": 23252,
"author_profile": "https://Stackoverflow.com/users/23252",
"pm_score": 4,
"selected": false,
"text": "1 byte = record type\n3 bytes = record length\nfollowed by record content\n"
},
{
"answer_id": 323785,
"author":... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323604",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/2148773/"
] |
323,608 | <p>Can anyone please help me to get all the domains in Active Directory. I have tried many times, but all the programs are listing only the current working domain. </p>
<p>How can I do this?</p>
| [
{
"answer_id": 324416,
"author": "LeeMobile",
"author_id": 26861,
"author_profile": "https://Stackoverflow.com/users/26861",
"pm_score": 3,
"selected": false,
"text": "Domain domain = Domain.GetDomain(new DirectoryContext(DirectoryContextType.Domain, \"yourDomain\", \"username\", \"passw... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323608",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/201406/"
] |
323,613 | <p>This is more of an academic inquiry than a practical question. Are there any language or framework features that can, or will in future, allow a heterogeneous typed dcitionary, e.g. </p>
<pre><code>myDict.Add("Name", "Bill");
myDict.Add("Height", 1.2);
</code></pre>
<p>where myDict now contains not two <code>object</code> types as values, but one <code>string</code> and one <code>double</code>? I could then retrieve my <code>double</code> with </p>
<pre><code>double dbl = myDict["Height"];
</code></pre>
<p>and expect a double or an exception to be thrown?</p>
<p>Please note: The Name and Height values are not necessarily of the same object.</p>
| [
{
"answer_id": 323628,
"author": "Ali Ersöz",
"author_id": 4215,
"author_profile": "https://Stackoverflow.com/users/4215",
"pm_score": 1,
"selected": false,
"text": "Dictionary<object, object>"
},
{
"answer_id": 323661,
"author": "Marc Gravell",
"author_id": 23354,
"a... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323613",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] |
323,640 | <p>In C#, can I convert a string value to a string literal, the way I would see it in code? I would like to replace tabs, newlines, etc. with their escape sequences.</p>
<p>If this code:</p>
<pre><code>Console.WriteLine(someString);
</code></pre>
<p>produces:</p>
<pre><code>Hello
World!
</code></pre>
<p>I want this code:</p>
<pre><code>Console.WriteLine(ToLiteral(someString));
</code></pre>
<p>to produce:</p>
<pre><code>\tHello\r\n\tWorld!\r\n
</code></pre>
| [
{
"answer_id": 323670,
"author": "Cristian Diaconescu",
"author_id": 11545,
"author_profile": "https://Stackoverflow.com/users/11545",
"pm_score": 5,
"selected": false,
"text": "string"
},
{
"answer_id": 323927,
"author": "rfgamaral",
"author_id": 40480,
"author_profi... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323640",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15454/"
] |
323,650 | <p>I have this code</p>
<pre><code>while($row = mysql_fetch_row($result))
{
echo '<tr>';
$pk = $row[0]['ARTICLE_NO'];
foreach($row as $key => $value)
{
echo '<td><a href="#" onclick="GetAuctionData(\''.$pk.'\')">' . $value . '</a></td>';
}
</code></pre>
<p>which gets pk. pk is then passed on to the axjax part with this:</p>
<pre><code>function GetAuctionData(pk)
{
.....
var url="get_auction.php?"
url=url+"cmd=GetAuctionData&pk="+pk;
</code></pre>
<p>And finally used in a separate php file with:</p>
<pre><code>$pk = $_GET["pk"];
$sql="SELECT * FROM Auctions WHERE ARTICLE_NO ='$pk'";
</code></pre>
<p>the second php file works fine when using it by itself and passing parameters. Likewise there are no errors anywhere. The problem seems to be with passing or generating $pk, as the links in the output file result in $pk being incremednted by 2, eg 4, 6, 8 etc</p>
<p>I can not understand why this is happening.</p>
| [
{
"answer_id": 323676,
"author": "troelskn",
"author_id": 18180,
"author_profile": "https://Stackoverflow.com/users/18180",
"pm_score": 0,
"selected": false,
"text": "$pk = $row[0]['ARTICLE_NO'];\n"
},
{
"answer_id": 323688,
"author": "benlumley",
"author_id": 39161,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323650",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
323,653 | <p>I need to monitor number of the facebook group users and display it on the website. I know that it is possible to get User IDs using their API, but they are limited to 500 only (if the total number of members is 500+). </p>
<p>What would be the easiest way to get total number of members that signed up to a Facebook Group that I'd set up? Is this at all possible?</p>
| [
{
"answer_id": 488092,
"author": "rfunduk",
"author_id": 210,
"author_profile": "https://Stackoverflow.com/users/210",
"pm_score": 0,
"selected": false,
"text": "Groups.getMembers"
},
{
"answer_id": 8371927,
"author": "Madarco",
"author_id": 108117,
"author_profile": ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323653",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,668 | <p>The title is a bit abstract so maybe it is easier to explain with a specific example:</p>
<p>I find it useful to have my exception classes take an enum parameter instead of a string message. </p>
<pre><code>throw new SpecificException(SpecificExceptionCode.ThisThingWentWrong);
</code></pre>
<p>There are few reasons for this, including:</p>
<ul>
<li>I can encapulate all the logic for accessing localized string resources in one place</li>
<li>I can easily make sure I have string resources for all my exception messages</li>
<li>Checking for correct exception messages in unit tests is simpler</li>
</ul>
<p>I would like to write a base class for this type of exception. Derived exception classes generally just want to provide their own System.Resources.ResourceManager but may also provide additional constructors. The trouble comes because I can only call static methods in calls to base class constructors. This leads me to something like:</p>
<pre><code>public abstract class BaseException : ApplicationException
{
protected static ResourceManager m_resources;
public BaseException(System.Enum errorCode, params object[] messageArgs)
: base(ProcessError(errorCode, messageArgs))
{}
private static string ProcessError(Enum errorCode, params object[] messageArgs)
{
string errorMessage = m_resources.GetString(errorCode.ToString());
// Handling of messageArgs and trace logging
// ....
return finalError;
}
}
</code></pre>
<p>and </p>
<pre><code>public class SpecificException : BaseException
{
static SpecificException()
{
m_resources = //.. Get an appropriate resource manager instance
}
public SpecificException(SpecificExceptionCode errorCode, params object[] messageArgs)
: base(errorCode, messageArgs)
{}
}
</code></pre>
<p>This works, but I am unhappy with it as there is no compile time hint that the derived class must provide its own <code>System.ResourceManager</code>. I would like to have a base class such as:</p>
<pre><code>public abstract class BaseException : ApplicationException
{
protected abstract static ResourceManager Resources{get;}
public BaseException(System.Enum errorCode, params object[] messageArgs)
: base(ProcessError(errorCode, messageArgs))
{}
private static string ProcessError(Enum errorCode, params object[] messageArgs)
{
string errorMessage = Resources.GetString(errorCode.ToString());
// Handling of messageArgs and trace logging
// ....
return finalError;
}
}
</code></pre>
<p>...but I cannot have an abstract static method. Is there a better way?</p>
| [
{
"answer_id": 323687,
"author": "Grzenio",
"author_id": 5363,
"author_profile": "https://Stackoverflow.com/users/5363",
"pm_score": 0,
"selected": false,
"text": "protected abstract static ResourceManager Resources{get;}\n"
},
{
"answer_id": 323692,
"author": "Marc Gravell",... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323668",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24770/"
] |
323,689 | <p>I occasionally see the list slice syntax used in Python code like this:</p>
<pre><code>newList = oldList[:]
</code></pre>
<p>Surely this is just the same as:</p>
<pre><code>newList = oldList
</code></pre>
<p>Or am I missing something?</p>
| [
{
"answer_id": 323698,
"author": "ConcernedOfTunbridgeWells",
"author_id": 15401,
"author_profile": "https://Stackoverflow.com/users/15401",
"pm_score": 6,
"selected": false,
"text": "[:]"
},
{
"answer_id": 323733,
"author": "Deinumite",
"author_id": 5219,
"author_pro... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323689",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11677/"
] |
323,697 | <p>I need to test a url that it <strong>does not</strong> end with <code>.asp</code></p>
<p>So <code>test</code>, <code>test.html</code> and <code>test.aspx</code> should match, but <code>test.asp</code> should not match.</p>
<p>Normally you'd test if the url <strong>does</strong> end with .asp and negate the fact that it matched using the NOT operator in code:</p>
<pre><code>if(!regex.IsMatch(url)) { // Do something }
</code></pre>
<p>In that case the regular expression would be <code>\.asp$</code> but in this case I need the regular expression to result in a match. </p>
<hr>
<p>Background: I need to use the regular expression as a route contraint in the ASP.NET MVC <code>RouteCollection.MapRoute</code> extension method. The route needs to match all controllers but it should fall through when the controller in the url ends with .asp</p>
| [
{
"answer_id": 323723,
"author": "Winston Smith",
"author_id": 35086,
"author_profile": "https://Stackoverflow.com/users/35086",
"pm_score": 2,
"selected": false,
"text": "^((?!\\.asp$).)*$\n"
},
{
"answer_id": 323756,
"author": "Jan Goyvaerts",
"author_id": 33358,
"a... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323697",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/4830/"
] |
323,704 | <p>Does anyone know of a definitive list of LINQ to SQL query limitations that are not trapped at compile time, along with (where possible) workarounds for the limitations?</p>
<p>The list we have so far is:</p>
<ul>
<li>Calling methods such as <code>.Date</code> on <code>DateTime</code>
<ul>
<li>no workaround found</li>
</ul></li>
<li><code>string.IsNullOrEmpty</code>
<ul>
<li>simple, just use <code>== ""</code> instead</li>
</ul></li>
<li><code>.Last()</code>
<ul>
<li>we used <code>.OrderByDescending(x => x.WhateverProperty).First()</code></li>
</ul></li>
</ul>
| [
{
"answer_id": 482956,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 5,
"selected": true,
"text": "DateTime"
},
{
"answer_id": 483261,
"author": "Zhaph - Ben Duguid",
"author_id": 33051,
"author_pr... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323704",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] |
323,741 | <p>I have an existing ASP.NET 2.0 website, stored in Team Foundation Server 2005. Some of the pages/controls are encoded as ANSI (according to Notepad++) and the Content-Type header is set to:</p>
<pre><code><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"/>
</code></pre>
<p>I would like to change all pages to UTF-8, and therefore the Content-Type header to:</p>
<pre><code><meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
</code></pre>
<p>Other than changing the meta element, I assume I also need to change the encoding of all the files. I can do this in Notepad++ though if anyone has any quicker methods, please mention them.</p>
<p><strong>What sort of problems might I face when it comes to merging/comparing in TFS?</strong></p>
| [
{
"answer_id": 323760,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 2,
"selected": false,
"text": "for fn in os.listdir(srcdir):\n data = open(srcdir+\"\\\\\"+fn, \"rb\").read().decode(\"windows-1252\")\n da... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323741",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12124/"
] |
323,742 | <p>Which one would you use to draw stuff on a winform? Format32bppRgb or Format24bppRgb or something else?</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.drawing.imaging.pixelformat.aspx" rel="nofollow noreferrer">in any .net version</a></p>
<pre><code>Format24bppRgb
Specifies that the format is 24 bits per pixel; 8 bits each are used for the red, green, and blue components.
Format32bppRgb
Specifies that the format is 32 bits per pixel; 8 bits each are used for the red, green, and blue components. The remaining 8 bits are not used.
</code></pre>
| [
{
"answer_id": 323760,
"author": "Martin v. Löwis",
"author_id": 33006,
"author_profile": "https://Stackoverflow.com/users/33006",
"pm_score": 2,
"selected": false,
"text": "for fn in os.listdir(srcdir):\n data = open(srcdir+\"\\\\\"+fn, \"rb\").read().decode(\"windows-1252\")\n da... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323742",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40868/"
] |
323,750 | <p>Is there a way to access a <code>list</code>'s (or <code>tuple</code>'s, or other iterable's) next or previous element while looping through it with a <code>for</code> loop?</p>
<pre><code>l = [1, 2, 3]
for item in l:
if item == 2:
get_previous(l, item)
</code></pre>
| [
{
"answer_id": 323802,
"author": "Aaron Digulla",
"author_id": 34088,
"author_profile": "https://Stackoverflow.com/users/34088",
"pm_score": -1,
"selected": false,
"text": "def get_previous(l, item):\n idx = l.find(item)\n return None if idx == 0 else l[idx-1]\n"
},
{
"answ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323750",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/985/"
] |
323,763 | <p>I'm wondering if it's possible to define a foreign key in a models.py file in Django that is a reference to a table in another app?</p>
<p>In other words, I have two apps, called cf and profiles, and in cf/models.py I have (amongst other things):</p>
<pre><code>class Movie(models.Model):
title = models.CharField(max_length=255)
</code></pre>
<p>and in profiles/models.py I want to have:</p>
<pre><code>class MovieProperty(models.Model):
movie = models.ForeignKey(Movie)
</code></pre>
<p>But I can't get it to work. I've tried:</p>
<pre><code> movie = models.ForeignKey(cf.Movie)
</code></pre>
<p>and I've tried importing cf.Movie at the beginning of models.py, but I always get errors, such as:</p>
<pre><code>NameError: name 'User' is not defined
</code></pre>
<p>Am I breaking the rules by trying to tie two apps together in this way, or have I just got the syntax wrong?</p>
| [
{
"answer_id": 323900,
"author": "Ben",
"author_id": 11522,
"author_profile": "https://Stackoverflow.com/users/11522",
"pm_score": 3,
"selected": false,
"text": "import"
},
{
"answer_id": 323905,
"author": "Michael Warkentin",
"author_id": 422277,
"author_profile": "h... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323763",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11522/"
] |
323,782 | <p>It' possible to use Junitperf with junit4?
I've a simplet Junit4 test class with several tests and I want to do a TimedTest on single test of that class. How can I do that?</p>
<p>To be more clear my Junit4 class is something like:</p>
<pre><code>public class TestCitta {
@Test
public void test1 {}
@Test
public void test2 {}
}
</code></pre>
<p>with junit3 i shold write something like:</p>
<pre><code>public class TestCittaPerformance {
public static final long toleranceInMillis = 100;
public static Test suite() {
long maxElapsedTimeInMillis = 1000 + toleranceInMillis;
Test testCase = new TestCitta("test2");
Test timedTest = new TimedTest(testCase, maxElapsedTimeInMillis);
return timedTest;
}
public static void main(String args[]) {
junit.textui.TestRunner.run(suite());
}
}
</code></pre>
<p>with Junit4?</p>
| [
{
"answer_id": 6095814,
"author": "sandeep",
"author_id": 765814,
"author_profile": "https://Stackoverflow.com/users/765814",
"pm_score": 1,
"selected": false,
"text": "@Test(timeout=1000)"
},
{
"answer_id": 8092158,
"author": "davyjonestech",
"author_id": 1041416,
"a... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323782",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
323,790 | <p>I have a project with several sources directories : </p>
<pre><code>src/A
/B
/C
</code></pre>
<p>In each, the Makefile.am contains </p>
<pre><code>AM_CXXFLAGS = -fPIC -Wall -Wextra
</code></pre>
<p>How can avoid repeating this in each source folder ? </p>
<p>I tried to modifiy src/Makefile.am and the configure.in, but without success. I thought I could use AC_PROG_CXX to set the compilation flags globally but can't find much documentation on how to use those macro (do you have any pointer to such a documentation ?).</p>
<p>Thanks in advance</p>
| [
{
"answer_id": 325436,
"author": "adl",
"author_id": 27835,
"author_profile": "https://Stackoverflow.com/users/27835",
"pm_score": 6,
"selected": true,
"text": "Makefile.am"
},
{
"answer_id": 36060425,
"author": "Sergei Krivonos",
"author_id": 525578,
"author_profile"... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323790",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] |
323,816 | <blockquote>
<p>Write a class ListNode which has the following properties:</p>
<ul>
<li>int value;</li>
<li>ListNode *next;</li>
</ul>
<p>Provide the following functions:</p>
<ul>
<li>ListNode(int v, ListNode *l)</li>
<li>int getValue();</li>
<li>ListNode* getNext();</li>
<li>void insert(int i);</li>
<li>bool listcontains(int j);</li>
</ul>
<p>Write a program which asks the user to enter some integers and stores them as
ListNodes, and then asks for a number which it should seek in the list.</p>
</blockquote>
<p>Here is my code:</p>
<pre><code>#include <iostream>
using namespace std;
class ListNode
{
private:
struct Node
{
int value;
Node *next;
} *lnFirst;
public:
ListNode();
int Length();
void DisplayList();
void Insert( int num );
bool Contains( int num );
int GetValue( int num );
};
ListNode::ListNode()
{
lnFirst = NULL;
}
int ListNode::Length()
{
Node *lnTemp;
int intCount = 0;
for( lnTemp=lnFirst ; lnTemp != NULL ; lnTemp = lnTemp->next )
{
intCount++;
}
return intCount;
}
void ListNode::DisplayList()
{
Node *lnTemp;
for( lnTemp = lnFirst ; lnTemp != NULL ; lnTemp = lnTemp->next )
cout<<endl<<lnTemp->value;
}
void ListNode::Insert(int num)
{
Node *lnCurrent, *lnNew;
if( lnFirst == NULL )
{
lnFirst = new Node;
lnFirst->value = num;
lnFirst->next = NULL;
}
else
{
lnCurrent = lnFirst;
while( lnCurrent->next != NULL )
lnCurrent = lnCurrent->next;
lnNew = new Node;
lnNew->value = num;
lnNew->next = NULL;
lnCurrent->next = lnNew;
}
}
bool ListNode::Contains(int num)
{
bool boolDoesContain = false;
Node *lnTemp,*lnCurrent;
lnCurrent = lnFirst;
lnTemp = lnCurrent;
while( lnCurrent!=NULL )
{
if( lnCurrent->value == num )
{
boolDoesContain = true;
return boolDoesContain;
}
lnTemp = lnCurrent;
lnCurrent = lnCurrent->next;
}
return boolDoesContain;
}
int ListNode::GetValue(int num)
{
Node *lnTemp;
int intCount = 1;
for( lnTemp=lnFirst; lnTemp != NULL; lnTemp = lnTemp->next )
{
if (intCount == num)
{
return lnTemp->value;
}
intCount++;
}
}
int main()
{
cout << "Input integers below. Input the integer -1 to stop inputting.\n\n";
ListNode lnList;
int intNode = 1, intInput = 0;
while (intInput != -1) {
cout << "Please input integer number " << intNode << ": "; cin >> intInput;
intNode++;
if (intInput != -1) { lnList.Insert(intInput); }
}
lnList.DisplayList();
cout << "\n\n";
int intListLength = lnList.Length();
cout << "Which value do you wish to recall? (Between 1 and " << intListLength << "): "; cin >> intNode;
if ( intNode >= 1 && intNode <= intListLength ) {
cout << "Value at position " << intNode << " is " << lnList.GetValue(intNode) << ".";
} else {
cout << "No such position in the list. Positions run from 1 to " << intListLength << ". You asked for " << intNode << ".";
}
cout << "\n\nCheck if the following value is in the list: "; cin >> intNode;
bool IsThere = lnList.Contains(intNode);
if (IsThere) {
cout << intNode << " is in the list.";
} else {
cout << intNode << " is not in the list.";
}
cout << "\n\n";
system("pause");
return 0;
}
</code></pre>
<p>Where can we improve this?</p>
| [
{
"answer_id": 323832,
"author": "Cyrille Ka",
"author_id": 39622,
"author_profile": "https://Stackoverflow.com/users/39622",
"pm_score": 2,
"selected": false,
"text": "cout << \"Please input integer number \" << intNode << \": \"; cin >> intInput;\n"
},
{
"answer_id": 323848,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323816",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/135/"
] |
323,817 | <p>I query all security groups in a specific domain using </p>
<pre><code>PrincipalSearchResult<Principal> results = ps.FindAll();
</code></pre>
<p>where ps is a PrincipalSearcher.</p>
<p>I then need to iterate the result (casting it to a GroupPrincipal first ) and locate the ones that contains a specific string in the notes field.</p>
<p>But the Notes field from AD is appearently not a public field in the GroupPrincipal class, doh.
What am I doing wrong ?</p>
<p>Update:
I have given up on this one. It seems like there is no way to access that pesky Notes field.</p>
| [
{
"answer_id": 1983762,
"author": "Brad",
"author_id": 241316,
"author_profile": "https://Stackoverflow.com/users/241316",
"pm_score": 3,
"selected": false,
"text": "// Get the underlying directory entry from the principal\nSystem.DirectoryServices.DirectoryEntry UnderlyingDirectoryObjec... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323817",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23499/"
] |
323,829 | <p>This code</p>
<pre><code>select.select([sys.stdin], [], [], 1.0)
</code></pre>
<p>does exactly what I want on Linux, but not in Windows.</p>
<p>I've used <code>kbhit()</code> in <code>msvcrt</code> before to see if data is available on stdin for reading, but in this case it always returns <code>0</code>. Additionally <code>msvcrt.getch()</code> returns <code>'\xff'</code> whereas <code>sys.stdin.read(1)</code> returns <code>'\x01'</code>. It seems as if the msvcrt functions are not behaving properly.</p>
<p>Unfortunately I can't use TCP sockets as I'm not in control of the application talking my Python program.</p>
| [
{
"answer_id": 323902,
"author": "S.Lott",
"author_id": 10661,
"author_profile": "https://Stackoverflow.com/users/10661",
"pm_score": 2,
"selected": false,
"text": "someprocess | python myprogram.py"
},
{
"answer_id": 3541638,
"author": "ideawu",
"author_id": 427640,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323829",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22847/"
] |
323,834 | <p>I am wondering how I should properly get rid of branches that no longer have any purpose. Right now even if i delete them and commit they are still listed as branches in the properties windows for a particular branching root (directory). If I select merge I don't get an option to merge to the deleted branch which obviously is as expected but therefore I am puzzled about the branch still showing up in the properties window.</p>
<p>Any explanation on this behavior would be greatly appreciated.</p>
| [
{
"answer_id": 323962,
"author": "Damien Ryan",
"author_id": 12565,
"author_profile": "https://Stackoverflow.com/users/12565",
"pm_score": 4,
"selected": false,
"text": "tf destroy"
},
{
"answer_id": 10644444,
"author": "Mike Q",
"author_id": 1402135,
"author_profile"... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323834",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/32313/"
] |
323,837 | <p>I've been working a little with DevExpress CodeRush and Refactor! Pro this week, and I picked up a commentor plug-in that will automatically generate comments as you type code.</p>
<p>I don't want to go into how good a job it does of picking out basic meaning (pretty good, actually) but it's default implementation does raise a question.</p>
<p>By default, typing a } character to close a block will result in the plugin adding a comment like the following...</p>
<pre><code>using(MyType myType = new MyType())
{
myType.doWork();
} // using
</code></pre>
<p>(i.e. adding a comment to the closing brace labelling where it was opened.)</p>
<p>While I can see that there are instances where this behaviour may be of great use, I feel that the resultant code looks very untidy with all the additional commenting.</p>
<p>I was wondering what other people;'s take on this kind of comment was. Not just from an academic standpoint, but if I get a good number of negative comments about them I can decide whether to inflict them upon my co-workers or strip them out.</p>
| [
{
"answer_id": 323853,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 2,
"selected": false,
"text": "<div id=\"content\">\n <div id=\"columns\">\n <div class=\"column\">\n\n <!-- .. snip a lot of lines .. -... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323837",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/377/"
] |
323,842 | <p>I am fairly new to MySQL and have a project in which I need to design a database that will store responses from an online questionnaire. Reports will need to be written from the data. Does anyone have any tips on what type of fields to use? The questions will either have a Yes No answer, a choice of 4 options from very satisfied to very dis-satisfied or multipul choice. It's mainly the choice questions that I'm unsure on, as I will need to be able to product a report to show the percentage of satisfied customers. I know it's probably really basic, but I don't want to get it wrong.</p>
| [
{
"answer_id": 323853,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": 2,
"selected": false,
"text": "<div id=\"content\">\n <div id=\"columns\">\n <div class=\"column\">\n\n <!-- .. snip a lot of lines .. -... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323842",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41378/"
] |
323,866 | <p>I have a program that can have a lot of parameters (we have over +30 differents options).</p>
<p>Example:
<code>myProgram.exe -t alpha 1 -prod 1 2 -sleep 200</code></p>
<p>This is 3 Commands (from command pattern object at the end) that each contain some parameters. Inside the code we parse all command (start with -) and get a list of string (split all space) for the parameters. So in fact, we have : string-->Collection of String parameters for each command.</p>
<p>For the moment, we use string comparison and we can get the whole thing works (instance the concrete command and return the ICommand interface). The problem is we require to do a lot of IF everytime to get the good command.</p>
<p>Do you have some pattern that can be used to extract all parameters from an EXE without using a lot of IF?</p>
<p>The code is in C# but I think the logic can be any other language too...</p>
| [
{
"answer_id": 323920,
"author": "Stefan",
"author_id": 19307,
"author_profile": "https://Stackoverflow.com/users/19307",
"pm_score": 0,
"selected": false,
"text": "private void Main() \n{ \nstring c = \"-t alpha 1 -prod 1 2 -sleep 200\"; \n\nforeach (string incommand in Strings.Split(c,... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323866",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/13913/"
] |
323,874 | <p>I have the following problem:</p>
<p>I open the dialog, open the SIP keyboard to fill the form and then minimize the SIP. Then when I close the current dialog and return to the main dialog the SIP keyboard appears again. Does anyone know how could I show/hide SIP keyboard programatically or better what could be done to solve the described problem. Once the user minimizes the keyboard it should not appear on the screen on dialog switching.</p>
<p>Thanks!</p>
| [
{
"answer_id": 437481,
"author": "Malx",
"author_id": 51086,
"author_profile": "https://Stackoverflow.com/users/51086",
"pm_score": 0,
"selected": false,
"text": "void CAaa::OnActivate( UINT nState, CWnd* pWndOther, BOOL bMinimized )\n{\nif(nState == WA_ACTIVE || nState == WA_CLICKACTIVE... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323874",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22996/"
] |
323,901 | <p>I have recently converted 10 JavaScript files into one file, which I then run a JavaScript compiler on. I just had a bug where I had reused a function name.</p>
<p>Is there a tool to check for duplicate rows/function names in the combined file?</p>
<p>Or should I create a little program?</p>
| [
{
"answer_id": 324010,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 0,
"selected": false,
"text": "cat file.js | grep -o \"function\\([[:space:]]\\+[a-zA-Z0-9_]\\+\\)\\?[[:space:]]*(\" | sort | uniq -c | sort -n\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323901",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/24459/"
] |
323,907 | <p>I have this code, which works fine, but I would like to be able to make it so when an image appears the text layer disapears, and there would be a link to bring the xt back and remove the image. How would I do this..., something to do with changing isibility and overlaying?</p>
<pre><code><html>
<script type="text/javascript">
//<!--
function sbox(boxName, xname) {
theBox = document.getElementById(boxName);
theBox.className = xname;
}
//-->
</script>
<style>
#main {
position: absolute;
width: 800px;
height: 600px;
}
.test1 {
position: absolute;
top: 20px;
width: 80px;
height: 80px;
border-style: solid;
border-color: green;
}
.test2 {
position: absolute;
top: 120px;
width: 80px;
height: 80px;
border-style: solid;
border-color: red;
}
.test3 {
position: absolute;
top: 220px;
width: 80px;
height: 80px;
border-style: solid;
border-color: blue;
}
.test4 {
position: absolute;
top: 320px;
width: 80px;
height: 80px;
border-style: solid;
border-color: black;
}
.test5 {
position: absolute;
top: 20px;
width: 80px;
height: 80px;
border-style: solid;
border-color: yellow;
}
#test6 {
width: 80px;
height: 80px;
border-style: solid;
border-color: green;
}
#test7 {
width: 80px;
height: 80px;
border-style: solid;
border-color: green;
}
</style>
<div class="test1" id="test1">
<a href="#" onclick="sbox('test1', 'test5'); return false;">test1</a>
</div>
<div class="test2" id="test2">test2</div>
<div class="test3" id="test3">test3</div>
<div class="test4" id="test4">test4</div>
</html>
</code></pre>
| [
{
"answer_id": 324010,
"author": "Draemon",
"author_id": 26334,
"author_profile": "https://Stackoverflow.com/users/26334",
"pm_score": 0,
"selected": false,
"text": "cat file.js | grep -o \"function\\([[:space:]]\\+[a-zA-Z0-9_]\\+\\)\\?[[:space:]]*(\" | sort | uniq -c | sort -n\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323907",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1246613/"
] |
323,922 | <p>I want to create maintainable code, but this inheritance situation is causing me problems.</p>
<p>The issue is with my 2nd database helper class named <b>InitUserExtension</b>.</p>
<p>Since UserExtension inherits from User, I have to make sure that I <b>mirror</b> any changes in my InitUser helper to InitUserExtension.</p>
<p>I really don't like this as <b>its prone to bugs, what's the solution?</b></p>
<p>My class definitions:</p>
<pre><code>public class User
{
public string Name {get; set; }
public string Age { get; set; }
}
public class UserExtension : User
{
public string Lastname {get; set; }
public string Password {get; set; }
}
</code></pre>
<p>My database helpers:</p>
<pre><code>public static SqlDataReader InitUser(SqlDataReader dr)
{
User user = new User();
user.Name = Convert.ToString(dr["name"]);
user.Age ...
}
public static SqlDataReader InitUserExtension(SqlDataReader dr)
{
UserExtension user = new UserExtension();
// note: mirror attributes from User
user.Name = Convert.ToString(dr["name"]);
user.Age ...
user.Lastname = Convert.ToString(dr["lastname"]);
user.Password = ....;
}
</code></pre>
| [
{
"answer_id": 323947,
"author": "vfilby",
"author_id": 24279,
"author_profile": "https://Stackoverflow.com/users/24279",
"pm_score": 1,
"selected": false,
"text": "InitUser"
},
{
"answer_id": 323958,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "ht... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323922",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39677/"
] |
323,928 | <p>There are two pictureboxes with two different images.</p>
<p>If I click on one picture box, the image in it should be cleared.</p>
<p>To make the matters worse, both of the picture boxes have only one common event handler.
How can I know which picturebox generated the event? I would appreciate source code in C++-CLI</p>
<p>I need to know what to write inside the function:</p>
<pre><code>private: System::Void sqaure_Click(System::Object^ sender, System::EventArgs^ e) {
}
</code></pre>
<p>EDIT: The problem is that when I try to cast sender to picurebox, it gives an error saying that the types cannot be converted.</p>
| [
{
"answer_id": 325980,
"author": "Toji",
"author_id": 25968,
"author_profile": "https://Stackoverflow.com/users/25968",
"pm_score": 3,
"selected": true,
"text": "PictureBox ^pb = safe_cast<PictureBox^>(sender);\nif(pb != null) {\n // logic goes here\n}\n"
},
{
"answer_id": 326... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323928",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/184/"
] |
323,955 | <p>How do you combine two jQuery search results? eg:</p>
<pre><code>var $allFoos = $('.foo'),
$allBars = $('.bar')
$allFoosAndBars = $allFoos + $allBars;
</code></pre>
<p>Obviously, I just made up that last line, but I hope it makes it sorta clear what I mean. To be clear, the example is greatly simplified, and it could be any arbitrary sets i'm talking about, so <code>$('.foo, .bar')</code> is <em>not</em> what I'm after.</p>
| [
{
"answer_id": 323969,
"author": "Simon",
"author_id": 33036,
"author_profile": "https://Stackoverflow.com/users/33036",
"pm_score": 9,
"selected": true,
"text": "var $foos = $('.foo');\n\nvar $foosAndBars = $foos.add('.bar');\n"
},
{
"answer_id": 64350309,
"author": "Dylan K... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323955",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/9021/"
] |
323,957 | <p>I need to edit <code>/etc/sudoers</code> from a script to add/remove stuff from white lists.</p>
<p>Assuming I have a command that would work on a normal file, how could I apply it to <code>/etc/sudoers</code>?</p>
<p>Can I copy and modify it, then have <code>visudo</code> replace the original with the modified copy? By providing my own script in <code>$EDITOR</code>?</p>
<p>Or can I just use the same locks and <code>cp</code>?</p>
<p>The question is more about potential issues than about just finding something that works.</p>
| [
{
"answer_id": 324009,
"author": "Brian C. Lane",
"author_id": 27461,
"author_profile": "https://Stackoverflow.com/users/27461",
"pm_score": 5,
"selected": false,
"text": "#!/bin/sh\nif [ -f \"/etc/sudoers.tmp\" ]; then\n exit 1\nfi\ntouch /etc/sudoers.tmp\nedit_sudoers /tmp/sudoers.n... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323957",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/23420/"
] |
323,972 | <p>Is it possible to terminate a running thread without setting/checking any flags/semaphores/etc.?</p>
| [
{
"answer_id": 325528,
"author": "Philippe F",
"author_id": 13618,
"author_profile": "https://Stackoverflow.com/users/13618",
"pm_score": 11,
"selected": true,
"text": "import threading\n\nclass StoppableThread(threading.Thread):\n \"\"\"Thread class with a stop() method. The thread i... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323972",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/28121/"
] |
323,977 | <p>i'm trying to use the GeoKit plugin to calculate the distance between 2 points. So the idea is, i do a search for an article, and the results i want to order by distance. So i have a form where I enter the article (that im looking for) and my address. Then rails must find all articles that match with my query and order by address.</p>
<p>So now, i have two models: Article and User. Articles belongs_to User and User has_many Articles. At the User model i have the info related with my latitude and longitude.</p>
<p>So my Article object has three fields:</p>
<ul>
<li>id</li>
<li>name</li>
<li>user_id (FK to User model)</li>
</ul>
<p>And my user model has four fields</p>
<ul>
<li>id</li>
<li>name</li>
<li>lat (latitude)</li>
<li>lng (longitude)</li>
</ul>
<p>OK, to have access to the user info thru articles i do the query:</p>
<pre><code>@articles = Article.find(:all,:conditions=>"vectors @@ to_tsquery('büch')",:joins=>" INNER JOIN users ON users.id = articles.user_id",:include=>:user,:origin=>"Augustusplatz,8,leipzig,germany")
</code></pre>
<p>it works. But when i wanna add an :order=>'distance ASC' it fails because the order by query is using a Article.lat, and Article.lng fields to calculate the distance, but these fields lat and lng, are User object's members and not Article member.</p>
<p>BTW if I get the query generated by rails and i change the order by clause where uses articles.lat/lng to users.lat/lng it works.</p>
| [
{
"answer_id": 324067,
"author": "Stein G. Strindhaug",
"author_id": 26115,
"author_profile": "https://Stackoverflow.com/users/26115",
"pm_score": 3,
"selected": true,
"text": "if(!(foo != !bar & (!baz)))"
},
{
"answer_id": 324088,
"author": "VP.",
"author_id": 18642,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323977",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/18642/"
] |
323,982 | <p>I want to parse this XML Document <a href="http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland" rel="nofollow noreferrer">http://www.google.de/ig/api?weather=Braunschweig,%20Deutschland</a> I want to be able to read out condition, temp_c and humidity. All this I want to do inside of JavaScript without using any server sided scripts such as PHP and I want it to work on modern browsers as well as IE7 and if without many problems IE6
EDIT:
A solution without a framework would be ideal</p>
| [
{
"answer_id": 324016,
"author": "Paul Tomblin",
"author_id": 3333,
"author_profile": "https://Stackoverflow.com/users/3333",
"pm_score": 1,
"selected": false,
"text": "var xmlDoc = this.req.responseXML.documentElement;\nvar tStatus = xmlDoc.getElementsByTagName(\"status\")[0].firstChild... | 2008/11/27 | [
"https://Stackoverflow.com/questions/323982",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19929/"
] |
323,987 | <p>Quick question: Would it be a good or a bad idea to implement my domain-driven design style repositories as singletons? Why?</p>
<p>Or should I maybe use a dependency injector container to manage my repositories and decide if they are singletons or not?</p>
<p>I'm still reading <em>DDD Quickly</em>, and would like to see some good repository examples.</p>
| [
{
"answer_id": 323990,
"author": "kͩeͣmͮpͥ ͩ",
"author_id": 26479,
"author_profile": "https://Stackoverflow.com/users/26479",
"pm_score": 2,
"selected": false,
"text": "UserRepository.Instance.Find(userId);\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/323987",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/22621/"
] |
324,014 | <p>I've written an image processing script in php which is run as a cron scheduled task (in OSX). To avoid overloading the system, the script checks the system load (using 'uptime') and only runs when load is below a predefined threshold.</p>
<p>I've now ported this over to Windows (2003 Server) and am looking for a similar command line function to report system load as an integer or float.</p>
| [
{
"answer_id": 324114,
"author": "ringmaster",
"author_id": 40413,
"author_profile": "https://Stackoverflow.com/users/40413",
"pm_score": 0,
"selected": false,
"text": "pve.exe -o\"%n\\t%c\"\n"
},
{
"answer_id": 368299,
"author": "Community",
"author_id": -1,
"author_... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324014",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12280/"
] |
324,032 | <p>After creating a translucent window (<a href="http://stormsilver.net/itunescheck/browser/tags/0.91/TransparentWindow.m?rev=25" rel="noreferrer">based on example code by Matt Gemmell</a>) I want to get keyboard events in this window. It seems that there are only keyboard events when my application is the active application while I want keyboard events even when my application isn't active but the window is visible.</p>
<p>Basically I want behavior like that provided by the Quicksilver application (by blacktree).</p>
<p>Does anybody have any hints on how to do this?</p>
| [
{
"answer_id": 324162,
"author": "e.James",
"author_id": 33686,
"author_profile": "https://Stackoverflow.com/users/33686",
"pm_score": 2,
"selected": false,
"text": "GetEventMonitorTarget()"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324032",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/15745/"
] |
324,041 | <p>I have a folder with these files:</p>
<pre><code>alongfilename1.txt <--- created first
alongfilename3.txt <--- created second
</code></pre>
<p>When I run <strong>DIR /x</strong> in command prompt, I see these short names assigned:</p>
<pre><code>ALONGF~1.TXT alongfilename1.txt
ALONGF~2.TXT alongfilename3.txt
</code></pre>
<p>Now, if I add another file:</p>
<pre><code>alongfilename1.txt
alongfilename2.txt <--- created third
alongfilename3.txt
</code></pre>
<p>I see this:</p>
<pre><code>ALONGF~1.TXT alongfilename1.txt
ALONGF~3.TXT alongfilename2.txt
ALONGF~2.TXT alongfilename3.txt
</code></pre>
<p>Fine. It seems to be assigning the "~#" according to the date/time that I created the file. Is this correct?</p>
<p>Now, if I delete "alongfilename1.txt", the other two files <strong>keep their short names</strong>.</p>
<pre><code>ALONGF~3.TXT alongfilename2.txt
ALONGF~2.TXT alongfilename3.txt
</code></pre>
<p>When will that ID (in this case, ~1) be released for use in another shortname. Will it ever? </p>
<p>Also, is it possible that a file on my machine has a short name of X, whereas the same file has a short name of Y on another machine? I'm particularly concerned for installations whose custom actions utilize DOS short names.</p>
<p>Thanks, guys.</p>
| [
{
"answer_id": 324064,
"author": "Piskvor left the building",
"author_id": 19746,
"author_profile": "https://Stackoverflow.com/users/19746",
"pm_score": 4,
"selected": true,
"text": "counter = 1\nstripped_filename = strip_dots(strip_non_ascii_characters(filename))\nshortfn = first_6_char... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324041",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21263/"
] |
324,043 | <p>Assuming a largish template library with around 100 files containing around 100 templates with overall more than 200,000 lines of code. Some of the templates use multiple inheritance to make the usage of the library itself rather simple (i.e. inherit from some base templates and only having to implement certain business rules).</p>
<p>All that exists (grown over several years), "works" and is used for projects.</p>
<p>However, compilation of projects using that library consumes a growing amount of time and it takes quite some time to locate the source for certain bugs. Fixing often causes unexpected side effects or is quite difficult, because some interdependent templates need changing. Testing is nearly impossible due to the sheer amount of functions.</p>
<p>Now, I would really like to simplify the architecture to use less templates and more specialized smaller classes.</p>
<p>Is there any proven way to go about that task? What would be a good place to start?</p>
| [
{
"answer_id": 324119,
"author": "Johannes Schaub - litb",
"author_id": 34509,
"author_profile": "https://Stackoverflow.com/users/34509",
"pm_score": 2,
"selected": false,
"text": "list<1, 3, 3, 1, 3>"
},
{
"answer_id": 324606,
"author": "Michel",
"author_id": 31122,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324043",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1398/"
] |
324,045 | <p>Using the .net framework you have the option to create temporary files with</p>
<pre><code>Path.GetTempFileName();
</code></pre>
<p>The MSDN doesn't tell us what happens to temporary files. I remember reading somewhere that they are deleted by the OS when it gets a restart. Is this true?</p>
<p>If the files aren't deleted by the OS, why are they called temporary? They are normal files in a normal directory. </p>
| [
{
"answer_id": 324051,
"author": "Marc Gravell",
"author_id": 23354,
"author_profile": "https://Stackoverflow.com/users/23354",
"pm_score": 3,
"selected": false,
"text": "sealed class TempFile : IDisposable { // formatted for space\n string path;\n public string Path {\n get... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324045",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/21634/"
] |
324,047 | <p>In an ASP.NET 3.5 site we have a relatively standard payment checkout progess that contains a number of pages that need to be visited in sequence (shopping basket, payment details etc)</p>
<p>Each page has a "Continue" button that redirects to the next page in the sequence.</p>
<p>I would like a way of managing the page sequence so that:</p>
<ol>
<li>I can have a Master page that defines the "Continue" button and its code-behind OnClick event handler</li>
<li>If the user attempts to visit a page out of sequence (by typing the URL directly into their browser, for example) they get redirected to the correct page</li>
<li>This page sequence is nicely defined in one place in my code (in an enum for example)</li>
</ol>
| [
{
"answer_id": 329970,
"author": "IrishChieftain",
"author_id": 31444,
"author_profile": "https://Stackoverflow.com/users/31444",
"pm_score": 1,
"selected": false,
"text": "protected void Page_Load(object sender, EventArgs e)\n{\n if (!IsPostBack)\n {\n Session[\"PreviousPag... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324047",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/39709/"
] |
324,053 | <p>I'm trying to find out how much memory my objects take to see how many of them are ending up on the <a href="https://learn.microsoft.com/en-us/dotnet/standard/garbage-collection/large-object-heap" rel="nofollow noreferrer">Large Object Heap</a> (which is anything over 85,000 bytes).</p>
<p>Is it as simple as adding 4 for an int, 8 for a long, 4 (or 8 if you're on 64 bit) for any reference types etc for each object, or are there overheads for methods, properties, etc.?</p>
| [
{
"answer_id": 324100,
"author": "Barry Kelly",
"author_id": 3712,
"author_profile": "https://Stackoverflow.com/users/3712",
"pm_score": 2,
"selected": false,
"text": "Single, Int32, UInt32 - 4\nIntPtr, UIntPtr, pointers, references - 4 on 32-bit, 8 on 64-bit\nDouble, Int64, UInt64 - 8\... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324053",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/6713/"
] |
324,062 | <p>I'm looking for a syntax highlighter cum code formatter for my blog on BlogSpot. I've tried several today, but the all want to include <code><style></code> tags, or reference a stylesheet. I'm looking for one that is ideal for segments of code, and includes styling inline. Any suggestions?</p>
| [
{
"answer_id": 324075,
"author": "Ali Afshar",
"author_id": 28380,
"author_profile": "https://Stackoverflow.com/users/28380",
"pm_score": 0,
"selected": false,
"text": "pygmentize -f png -o mysource.png mysource.cs \n"
},
{
"answer_id": 324190,
"author": "Paul Fisher",
"a... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324062",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/8741/"
] |
324,066 | <p>I have a BasePage class which all other pages derive from:</p>
<pre><code>public class BasePage
</code></pre>
<p>This BasePage has a constructor which contains code which must always run:</p>
<pre><code>public BasePage()
{
// Important code here
}
</code></pre>
<p>I want to force derived classes to call the base constructor, like so:</p>
<pre><code>public MyPage
: base()
{
// Page specific code here
}
</code></pre>
<p><strong>How can I enforce this (preferably at compile time)?</strong></p>
| [
{
"answer_id": 324078,
"author": "Jon Skeet",
"author_id": 22656,
"author_profile": "https://Stackoverflow.com/users/22656",
"pm_score": 6,
"selected": true,
"text": "this(...)"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324066",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/12124/"
] |
324,080 | <p>I'm extending the functionality of a class with a subclass, and I'm doing some dirty stuff that make superclass methods dangerous (app will hang in a loop) in the context of the subclass. I know it's not a genius idea, but I'm going for the low-hanging fruit, right now it's gonna save me some time. Oh it's a dirty job, but someone's gotta do it. </p>
<p>Bottom line, I need to either block that method from outside, or throw an exception when it's called directly to the superclass. (But I still use it from the subclass, except with care).</p>
<p>What would be the best way to do this?</p>
<p>UPDATE ---</p>
<p>So this is what I went for. I'm not self-answering, as Boaz' answer mentions multiple valid ways to do this, this is just the way that suited me. In the subclass, I overrode the method like this:</p>
<pre><code>- (int)dangerousMethod
{
[NSException raise:@"Danger!" format:@"Do not call send this method directly to this subclass"];
return nil;
}
</code></pre>
<p>I'm marking this as answered, but evidently that doesn't mean it's closed, further suggestions are welcome.</p>
| [
{
"answer_id": 324201,
"author": "Community",
"author_id": -1,
"author_profile": "https://Stackoverflow.com/users/-1",
"pm_score": 1,
"selected": false,
"text": "@implementation MyClass\n-(void)myMethod:(NSString *)txt{\n if([self class] != [MyClass class]) return;\n NSLog(@\"Hello... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324080",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36182/"
] |
324,085 | <p>I want to know how to set a Publishing page content through the code (MOSS 2007).<br>
This is how I've created the page:</p>
<pre><code>PublishingPage page = publishingWeb.GetPublishingPages().Add("MyPage.aspx", pageLayout);
SPFile pageFile = page.ListItem.File;
page.Title = "My Page";
page.Update();
</code></pre>
<p>But my attempts of setting it's content didn't work.</p>
| [
{
"answer_id": 324313,
"author": "Pedrin",
"author_id": 36183,
"author_profile": "https://Stackoverflow.com/users/36183",
"pm_score": 3,
"selected": false,
"text": "string content = \"Welcome to <strong>My Page</strong>\";\npage.ListItem[FieldId.PublishingPageContent] = content;\n"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324085",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/36183/"
] |
324,091 | <p>I saw something about needing to have the assembly available for the type of the first argument passed to the function. I think it is, I can't figure out what am I missing.</p>
<p>This code is in a service. I was running the service under the 'NETWORK SERVICES' user account, when I changed the account to that of the session I was logged on with it worked ok. But, what's the difference, and how can I get it to work for the NETWORK SERVICES user.</p>
| [
{
"answer_id": 12169675,
"author": "Haukman",
"author_id": 793493,
"author_profile": "https://Stackoverflow.com/users/793493",
"pm_score": 0,
"selected": false,
"text": "<configuration>\n <runtime>\n <assemblyBinding xmlns=\"urn:schemas-microsoft-com:asm.v1\">\n <probing private... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324091",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11898/"
] |
324,099 | <p>I know each iPhone has a electronic identifier other than the phone # or ESN - how do I call it and what does it return?</p>
| [
{
"answer_id": 324121,
"author": "Rob Drimmie",
"author_id": 24213,
"author_profile": "https://Stackoverflow.com/users/24213",
"pm_score": 3,
"selected": false,
"text": "[[UIDevice currentDevice] uniqueIdentifier]"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324099",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/38953/"
] |
324,102 | <p>I'm building a full-screen demo where I need to simulate a YouTube video. I dragged a video that plays an external .flv file.</p>
<p>It works fine if the stage isn't set to full-screen. But I need to set the stage to full-screen like this:</p>
<pre><code>stage.displayState = StageDisplayState.FULL_SCREEN;
stage.scaleMode = StageScaleMode.NO_SCALE;
</code></pre>
<p>The problem is that when the animation reaches the video the screen goes black and the video doesn't play. I already setting an instance name and tried putting the following code on the frame's actions:</p>
<pre><code>video.fullScreenTakeOver = false;
</code></pre>
<p>But it doesn't affect the issue.</p>
<p>Is there anyway to have the stage in full-screen mode and play the video at it's normal size?</p>
<p>Thaks</p>
<p>I'm using Flash CS3 Pro and generating a .exe.</p>
| [
{
"answer_id": 4167405,
"author": "geepers",
"author_id": 506066,
"author_profile": "https://Stackoverflow.com/users/506066",
"pm_score": 1,
"selected": false,
"text": "flvPlayback"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324102",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
324,105 | <p>Can anyone point me out, how can I parse/evaluate HQL and get map where key is table alias and value - full qualified class name.</p>
<p>E.g. for HQL</p>
<blockquote>
<p>SELECT a.id from Foo a INNER JOIN a.test b</p>
</blockquote>
<p>I wish to have pairs:</p>
<p>a, package1.Foo</p>
<p>b. package2.TestClassName</p>
<p>It's relatively easy to do for result set</p>
<blockquote>
<pre><code>HQLQueryPlan hqlPlan = ((SessionFactoryImpl)sf).getQueryPlanCache().getHQLQueryPlan( getQueryString(), false, ((SessionImpl)session).getEnabledFilters() );
String[] aliases = hqlPlan.getReturnMetadata().getReturnAliases();
Type[] types = hqlPlan.getReturnMetadata().getReturnTypes();
</code></pre>
</blockquote>
<p>See <a href="http://www.hibernate.org/389.html" rel="nofollow noreferrer">details here</a>.</p>
| [
{
"answer_id": 381210,
"author": "Rolf Rander",
"author_id": 47402,
"author_profile": "https://Stackoverflow.com/users/47402",
"pm_score": 3,
"selected": true,
"text": "QueryTranslator[] translators = hqlPlan.getTranslators();\nAST ast = (AST)((QueryTranslatorImpl)translators[0]).getSqlA... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324105",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/19347/"
] |
324,132 | <p>Imagine I have the following:</p>
<pre><code>inFile = "/adda/adas/sdas/hello.txt"
# that instruction give me hello.txt
Name = inFile.name.split("/") [-1]
# that one give me the name I want - just hello
Name1 = Name.split(".") [0]
</code></pre>
<p>Is there any chance to simplify that doing the same job in just one expression?</p>
| [
{
"answer_id": 324139,
"author": "Vinko Vrsalovic",
"author_id": 5190,
"author_profile": "https://Stackoverflow.com/users/5190",
"pm_score": 1,
"selected": false,
"text": ">>> inFile = \"/adda/adas/sdas/hello.txt\"\n>>> inFile.split('/')[-1]\n'hello.txt'\n>>> inFile.split('/')[-1].split(... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324132",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
324,134 | <p>I have a plugin project I've been developing for a few years where the plugin works with numerous combinations of [primary application version, 3rd party library version, 32-bit vs. 64-bit]. Is there a (clean) way to use autotools to create a single makefile that builds all versions of the plugin. </p>
<p>As far as I can tell from skimming through the autotools documentation, the closest approximation to what I'd like is to have N independent copies of the project, each with its own makefile. This seems a little suboptimal for testing and development as (a) I'd need to continually propagate code changes across all the different copies and (b) there is a lot of wasted space in duplicating the project so many times. Is there a better way?</p>
<p><strong>EDIT:</strong> </p>
<p>I've been rolling my own solution for a while where I have a fancy makefile and some perl scripts to hunt down various 3rd party library versions, etc. As such, I'm open to other non-autotools solutions. For other build tools, I'd want them to be very easy for end users to install. The tools also need to be smart enough to hunt down various 3rd party libraries and headers without a huge amount of trouble. I'm mostly looking for a linux solution, but one that also works for Windows and/or the Mac would be a bonus. </p>
| [
{
"answer_id": 324156,
"author": "Gregor",
"author_id": 26153,
"author_profile": "https://Stackoverflow.com/users/26153",
"pm_score": 1,
"selected": false,
"text": "env.ParseConfig('pkg-config --cflags --libs glib-2.0')\n"
},
{
"answer_id": 324372,
"author": "Jonathan Leffler... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324134",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/25050/"
] |
324,163 | <p>We are deciding the naming convention for tables, columns, procedures, etc. at our development team at work. The singular-plural table naming <em>has already been decided</em>, we are using singular. We are discussing whether to use a prefix for each table name or not. I would like to read suggestions about using a prefix or not, and why.</p>
<p>Does it provide any security at all (at least one more obstacle for a possible intruder)? I think it's generally more comfortable to name them with a prefix, in case we are using a table's name in the code, so to not confuse them with variables, attributes, etc. But I would like to read opinions from more experienced developers.</p>
| [
{
"answer_id": 324197,
"author": "nickf",
"author_id": 9021,
"author_profile": "https://Stackoverflow.com/users/9021",
"pm_score": -1,
"selected": false,
"text": " stnUsers = 'users';\n stnPosts = 'posts';\n"
},
{
"answer_id": 953088,
"author": "Anthony Mastrean",
"author... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324163",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1492/"
] |
324,167 | <p>Assuming a variable contains spaces, newlines, and tabs followed by some text, why does this:</p>
<pre><code>${var#"${var%%[![:space:]]*}"} # strip var of everything
# but whitespace
# then remove what's left
# (i.e. the whitespace) from var
</code></pre>
<p>remove the white space and leave the text, but this:</p>
<pre><code>${var##[:space:]*} # strip all whitespace from var
</code></pre>
<p>does not?</p>
| [
{
"answer_id": 324221,
"author": "flolo",
"author_id": 36472,
"author_profile": "https://Stackoverflow.com/users/36472",
"pm_score": 6,
"selected": true,
"text": "var=\" This is a test \""
},
{
"answer_id": 14726232,
"author": "Bryant Hansen",
"author_id": 2046366,
... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324167",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1094969/"
] |
324,168 | <p>All,</p>
<p>this is my code</p>
<pre><code>//declare string pointer
BSTR markup;
//initialize markup to some well formed XML <-
//declare and initialize XML Document
MSXML2::IXMLDOMDocument2Ptr pXMLDoc;
HRESULT hr;
hr = pXMLDoc.CreateInstance(__uuidof(MSXML2::DOMDocument40));
pXMLDoc->async = VARIANT_FALSE;
pXMLDoc->validateOnParse = VARIANT_TRUE;
pXMLDoc->preserveWhiteSpace = VARIANT_TRUE;
//load markup into XML document
vtBoolResult = pXMLDoc->loadXML(markup);
//do some changes to the XML file<-
//get back string from XML doc
markup = pXMLDoc->Getxml(); //<-- this retrieves RUBBISH
</code></pre>
<p>At this point my string is mangled (just a few chinese characters at the start then rubbish) . Looks like an encoding issue.</p>
<p>I also tried the following:</p>
<pre><code>_bstr_t superMarkup = _bstr_t(markup);
//did my stuff
superMarkup = pXMLDoc->Getxml();
markup = superMarkup;
</code></pre>
<p>but still I am getting the same result.</p>
<p>Even if I call GetXML() without changing anything in the xml document I still get rubbish.</p>
<p>At this point if I try to assign the mangled pointer to another pointer it will trow an error:</p>
<blockquote>
<p>Attempted to restore write protected
memory. this is often an indication
that other memory is corrupted. </p>
</blockquote>
<p>Any suggestion?</p>
<p>EDIT1:</p>
<p><strong>I found out this is happening in relation to the size of the XML string.
If it happens on a given XML string and I reduce the size (keeping the same schema) it will work fine. Looks like MSXML2::DOMDocument40 has a limitation on size?
In detail it happens if I have more than 16407 characters. I have one more GetXML will retrieve RUBBISH - if it's <= 16407 everything works fine.</strong></p>
<p>EDIT2:</p>
<p><strong>Roddy was right - I was missing that <code>_bstr_t</code> is a class ...</strong></p>
<p>Rings any bell?</p>
<p>Cheers</p>
| [
{
"answer_id": 324343,
"author": "Roddy",
"author_id": 1737,
"author_profile": "https://Stackoverflow.com/users/1737",
"pm_score": 3,
"selected": true,
"text": " BSTR Markup;\n"
},
{
"answer_id": 324475,
"author": "Eugenio Miró",
"author_id": 41236,
"author_profile": ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324168",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/1311500/"
] |
324,171 | <p>trying to mount an smb share on OS X so that the 'www' user can read files from there.</p>
<p>the SMB share is accessible via an Active Directory account. I can mount the share through the Finder (cmd-k ...)</p>
<p>my basic approach is</p>
<pre><code># 1) create mountpoint
sudo mkdir /Volumes/www_mdisk
# 2) permissions for mountpoint
sudo chown www:www /Volumes/www_mdisk; sudo chmod 777 /Volumes/www_mdisk
# 3) make a link from apache docroot to mountpoint (http.conf FollowSymlinks is on)
cd /Library/WebServer/Documents; ln -s /Volumes/www_mdisk mdisk
# 4) mount the SMB share using the Active Directory user 'ad_user'
sudo mount_smbfs -O www/www '//DOMAIN;ad_user@smbshare_host/sharepath'
</code></pre>
<p>step 4 fails though. I have read the manpages, tried many different combinations (with or without -O switch), but can't get it to work</p>
<p>can you help me get it right?
thanks!</p>
| [
{
"answer_id": 325413,
"author": "captnswing",
"author_id": 41404,
"author_profile": "https://Stackoverflow.com/users/41404",
"pm_score": 2,
"selected": false,
"text": "# 4) mount the SMB share using the Active Directory user 'ad_user'\nsudo mount_smbfs -O www/www -u 70 -g 70 '//DOMAIN;a... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324171",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/41404/"
] |
324,178 | <p>We are looking at various options in porting our persistence layer from Oracle to another database and one that we are looking at is MS SQL. However we use Oracle sequences throughout the code and because of this it seems moving will be a headache. I understand about @identity but that would be a massive overhaul of the persistence code. </p>
<p>Is it possible in SQL Server to create a function which could handle a sequence? </p>
| [
{
"answer_id": 324202,
"author": "devio",
"author_id": 21336,
"author_profile": "https://Stackoverflow.com/users/21336",
"pm_score": 2,
"selected": true,
"text": "INSERT INTO SequenceTable (dummy) VALUES ('X');\nSELECT @ID = SCOPE_IDENTITY();\nINSERT INTO RealTable (ID, datacolumns) VALU... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324178",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/11802/"
] |
324,200 | <p>I have developed a framework that is used by several teams in our organisation. Those "modules", developed on top of this framework, can behave quite differently but they are all pretty resources consuming even though some are more than others. They all receive data in input, analyse and/or transform it, and send it further. </p>
<p>We planned to buy new hardware and my boss asked me to define and implement a benchmark based on the modules in order to compare the different offers we have got. </p>
<p>My idea is to simply start sequentially each module with a well chosen bunch of data as input. </p>
<p>Do you have any advice? Any remarks on this simple procedure? </p>
| [
{
"answer_id": 32678022,
"author": "user7610",
"author_id": 1047788,
"author_profile": "https://Stackoverflow.com/users/1047788",
"pm_score": 0,
"selected": false,
"text": "time"
}
] | 2008/11/27 | [
"https://Stackoverflow.com/questions/324200",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/20986/"
] |
324,214 | <p>I am currently running the following code based on Chapter 12.5 of the Python Cookbook:</p>
<pre><code>from xml.parsers import expat
class Element(object):
def __init__(self, name, attributes):
self.name = name
self.attributes = attributes
self.cdata = ''
self.children = []
def addChild(self, element):
self.children.append(element)
def getAttribute(self,key):
return self.attributes.get(key)
def getData(self):
return self.cdata
def getElements(self, name=''):
if name:
return [c for c in self.children if c.name == name]
else:
return list(self.children)
class Xml2Obj(object):
def __init__(self):
self.root = None
self.nodeStack = []
def StartElement(self, name, attributes):
element = Element(name.encode(), attributes)
if self.nodeStack:
parent = self.nodeStack[-1]
parent.addChild(element)
else:
self.root = element
self.nodeStack.append(element)
def EndElement(self, name):
self.nodeStack.pop()
def CharacterData(self,data):
if data.strip():
data = data.encode()
element = self.nodeStack[-1]
element.cdata += data
def Parse(self, filename):
Parser = expat.ParserCreate()
Parser.StartElementHandler = self.StartElement
Parser.EndElementHandler = self.EndElement
Parser.CharacterDataHandler = self.CharacterData
ParserStatus = Parser.Parse(open(filename).read(),1)
return self.root
</code></pre>
<p>I am working with XML documents of about 1 GB in size. Does anyone know a faster way to parse these?</p>
| [
{
"answer_id": 324483,
"author": "bhadra",
"author_id": 30289,
"author_profile": "https://Stackoverflow.com/users/30289",
"pm_score": 4,
"selected": false,
"text": "cElementTree"
},
{
"answer_id": 326541,
"author": "Steen",
"author_id": 1448983,
"author_profile": "htt... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324214",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/7743/"
] |
324,220 | <p>I am looking for an inverse version of "RunOnceEx".</p>
<p>RunOnceEx does run some program, before the user's shell(desktop&taskbar) start. The login progress will not continue before the runonceex complete.</p>
<p>I want to do exact the same but on user logout.
When she/he logout, all running program shutdown, leaving shell(desktop&taskbar), then ""I wish my program will be execute this moment"", finally logout.</p>
<p>I think it is possible because the "mobsync.exe" is doing that. But I cannot find where and how to do it.</p>
| [
{
"answer_id": 324238,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": false,
"text": "gpedit.msc"
},
{
"answer_id": 1908497,
"author": "Pratap .R",
"author_id": 231511,
"author_profile": "https... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324220",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/40214/"
] |
324,222 | <p>I have got a simple page with a HtmlInputHidden field. I use Javascript to update that value and, when posting back the page, I want to read the value of that HtmlInputHidden field. The Value property of that HtmlInputHidden field is on postback the default value (the value it had when the page was created, not the value reflected through the Javascript). I also tried to Register the HtmlInputHidden field with ScriptManager.RegisterHiddenField(Page, "MyHtmlImputHiddenField", "initialvalue") but it still only lets me read the 'initialvalue' even though I (through javascript) can inspect that the value has changed.</p>
<p>I tried to hardcoded the rowid and, to my surprise, after postback gridview was exactly the same before the delete but the record was deleted from the database. (I´ve called the databind method). </p>
<pre><code> protected void gridViewDelete(object sender, GridViewDeleteEventArgs e)
{
bool bDelete = false;
bool bCheck = false;
if (hfControl.Value != "1")
{
// check relationship
bCheck = validation_method(.......);
if (bCheck)
{
bDelete = true;
}
}
else
{
hfControl.Value = "";
bDelete = true;
}
if (bDelete)
{
//process delete
}
else
{
string script = string.Empty;
script += " var x; ";
script += " x = confirm('are u sure?'); ";
script += " if (x){ " ;
script += " document.getElementById('hfControl').value = '1'; ";
script += " setTimeOut(__doPostBack('gridView','Delete$"
+ e.RowIndex + "'),0);";
script += " } ";
ScriptManager.RegisterClientScriptBlock(this,
Page.GetType()
, "confirm"
, script
,true);
}
}
</code></pre>
| [
{
"answer_id": 324238,
"author": "VonC",
"author_id": 6309,
"author_profile": "https://Stackoverflow.com/users/6309",
"pm_score": 3,
"selected": false,
"text": "gpedit.msc"
},
{
"answer_id": 1908497,
"author": "Pratap .R",
"author_id": 231511,
"author_profile": "https... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324222",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/-1/"
] |
324,231 | <p>Here's the issue:</p>
<p>I have a hook in IE that reacts on <code>WebBrowser.OnNavigateComplete2</code> event to parse the content of the document for some precise info.</p>
<p>That document contains frames, so I look into the <code>HTMLDocument.frames</code>. For each one, I look into the document.body.outerHTML property to check for the content. </p>
<p>Problem is, the string I'm looking for never shows there, whereas it is displayed in the finale page. So, am I looking in the wrong place? If it is displayed when the page is fully loaded, then it's downloaded at some point, right? But in which object should I look ?</p>
<p>BTW, I Don't know if that is of any importance, but the page I'm searching into comes from a ASP.NET application.</p>
<pre><code>public void OnNavigateComplete2(object pDisp, ref object url)
{
document = (HTMLDocument)webBrowser.Document;
mshtml.FramesCollection frames = document.frames;
for (int i = 0; i < frames.length; i++)
{
object refIdx = i;
IHTMLWindow2 frame = (IHTMLWindow2)frames.item(ref refIdx);
string frameContent = frame.document.body.outerHTML;
}
}
</code></pre>
<p>Thank your for your help.</p>
<hr>
<p>@rams
This event is launched many times for each page, so I figured it was each time a framed is loaded, even if i don't get to catch the one I'm looking for. If not, what would be the event to catch the frames content?</p>
<p>What I want to do is detect some precise info on a precise frame, then save it. later, a web page is loaded triggered by some user action, where I need the info I got from parsing the frame.</p>
| [
{
"answer_id": 341537,
"author": "rams",
"author_id": 3635,
"author_profile": "https://Stackoverflow.com/users/3635",
"pm_score": 3,
"selected": true,
"text": "iFrame frm = document.frames(<your frame id>);\n\nint readyState=0;\n\nwhile(frm.readystate !=4){\n// do nothing. be careful to ... | 2008/11/27 | [
"https://Stackoverflow.com/questions/324231",
"https://Stackoverflow.com",
"https://Stackoverflow.com/users/29568/"
] |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.