qid
int64
4
22.2M
question
stringlengths
18
48.3k
answers
list
date
stringlengths
10
10
metadata
list
114,306
<p>It's very painful to add multiple tickets to Trac or to have it as your own todo list. That causes people to use their own task management tools so tasks are then spread all around.</p> <p>Is there any plugin or macro that would quicken the process of adding a ticket?</p>
[ { "answer_id": 1344978, "author": "johntellsall", "author_id": 143880, "author_profile": "https://Stackoverflow.com/users/143880", "pm_score": 3, "selected": false, "text": "#!/usr/bin/env python\n\n'''\ntrac-bug: add bug/feature to current Trac project, from the command line.\nSpecify T...
2008/09/22
[ "https://Stackoverflow.com/questions/114306", "https://Stackoverflow.com", "https://Stackoverflow.com/users/189/" ]
114,332
<p>I've had a <em>serious</em> issue with my Visual Studio 2008 setup. I receive the ever-so-useful error 'A problem has been encountered while loading the setup components. Canceling setup.' whenever I try to uninstall, reinstall or repair Visual Studio 2008 (team system version). If I can't resolve this issue I have no choice but to completely wipe my computer and start again which will take all day long! I've recently received very strange errors when trying to build projects regarding components running out of memory (despite having ~2gb physical memory free at the time) which has rendered my current VS install useless.</p> <p>Note I installed VS2005 shell version using the vs_setup.msi file in the SQL Server folder <em>after</em> I had installed VS2008, in order to gain access to the SQL Server 2005 Reporting Services designer in Business Intelligence Development Studio (this is inexplicably unavailable in VS2008).</p> <p>Does anyone have any solutions to this problem?</p> <p><strong>P.S.</strong>: I know this isn't directly related to programming, however I feel this <em>is</em> appropriate to SO as it is directly related to my <em>ability</em> to program at all!</p> <p><strong>Note</strong>: A colleague found a solution to this problem, hopefully this should help others with this problem.</p>
[ { "answer_id": 1827236, "author": "Andrew", "author_id": 5662, "author_profile": "https://Stackoverflow.com/users/5662", "pm_score": 3, "selected": false, "text": "KB972221" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114332", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3394/" ]
114,339
<p>If I want to manipulate an HTML tag's properties on the server within an aspx page based on a master page i.e. </p> <pre><code>&lt;a href="#" runat="server" ID="myLink"&gt;My Link&lt;/a&gt; </code></pre> <p>For example to give the link a different class depending on the current page i.e.</p> <pre><code>if (Path.GetFileName(Request.PhysicalPath) == "MyPage") { myLink.Attributes.Add("class","active"); } </code></pre> <p>.NET changes the ID property of the link to something like</p> <pre><code>&lt;a href="#" ID="ct100-foo-myLink"&gt;My Link&lt;/a&gt; </code></pre> <p>Is there any way of stopping this from happening and keeping the original ID?</p> <p>Thanks in advance</p>
[ { "answer_id": 114357, "author": "Giovanni Galbo", "author_id": 4050, "author_profile": "https://Stackoverflow.com/users/4050", "pm_score": 0, "selected": false, "text": "public abstract string SetControlID(string name, System.Web.UI.Control control);\n" }, { "answer_id": 114363,...
2008/09/22
[ "https://Stackoverflow.com/questions/114339", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12918/" ]
114,398
<p>After rebooting the Windows 2003 Server with the IIS I receive the follow error message:</p> <blockquote> <p>Cannot connect to the configuration database</p> </blockquote> <p>in the browser. The error occur on different pages and with different clients. that I think it is a server problem.</p> <p>What can I do to solve this error?</p>
[ { "answer_id": 249494, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "<!-- Web.Config Configuration File -->\n<configuration>\n <system.web>\n <customErrors mode=\"RemoteOnly\"/>\n </system.w...
2008/09/22
[ "https://Stackoverflow.com/questions/114398", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12631/" ]
114,419
<p>The following two C# code snippets produce different results (assuming the variable level is used both before and after the recursive call). Why?</p> <pre><code>public DoStuff(int level) { // ... DoStuff(level++); // ... } </code></pre> <p>,</p> <pre><code>public DoStuff(int level) { // ... DoStuff(level+1); // ... } </code></pre> <p>After reading some of the responses below I thought it would be worthwhile posting the stack traces for level++, ++level and level+1 to highlight how deceiving this problem is.</p> <p>I've simplified them for this post. The recursive call sequence starts with DoStuff(1). </p> <p>// level++</p> <pre><code>DoStuff(int level = 1) DoStuff(int level = 2) DoStuff(int level = 2) DoStuff(int level = 2) </code></pre> <p>// ++level</p> <pre><code>DoStuff(int level = 4) DoStuff(int level = 4) DoStuff(int level = 3) DoStuff(int level = 2) </code></pre> <p>// level+1</p> <pre><code>DoStuff(int level = 4) DoStuff(int level = 3) DoStuff(int level = 2) DoStuff(int level = 1) </code></pre>
[ { "answer_id": 114441, "author": "Markus Schnell", "author_id": 20668, "author_profile": "https://Stackoverflow.com/users/20668", "pm_score": 1, "selected": false, "text": "level++" }, { "answer_id": 114446, "author": "Frederik Slijkerman", "author_id": 12416, "author...
2008/09/22
[ "https://Stackoverflow.com/questions/114419", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1199234/" ]
114,431
<p>I am trying to display a live word count in the vim statusline. I do this by setting my status line in my .vimrc and inserting a function into it. The idea of this function is to return the number of words in the current buffer. This number is then displayed on the status line. This should work nicely as the statusline is updated at just about every possible opportunity so the count will always remain 'live'. </p> <p>The problem is that the function I have currently defined is slow and so vim is obviously sluggish when it is used for all but the smallest files; due to this function being executed so frequently.</p> <p>In summary, does anyone have a clever trick for producing a function that is blazingly fast at calculating the number of words in the current buffer and returning the result?</p>
[ { "answer_id": 116454, "author": "Mikael Jansson", "author_id": 18753, "author_profile": "https://Stackoverflow.com/users/18753", "pm_score": 2, "selected": false, "text": "updatetime" }, { "answer_id": 120386, "author": "Greg Sexton", "author_id": 20388, "author_prof...
2008/09/22
[ "https://Stackoverflow.com/questions/114431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20388/" ]
114,457
<p>What are the consequences of running a Java class file compiled in JDK 1.4.2 on JRE 1.6 or 1.5?</p>
[ { "answer_id": 114557, "author": "Heath Borders", "author_id": 9636, "author_profile": "https://Stackoverflow.com/users/9636", "pm_score": 1, "selected": false, "text": "String s = \"string1\" + \"string2\";\n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114457", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15177/" ]
114,493
<p>I know the range name of the start of a list - <code>1</code> column wide and <code>x</code> rows deep.</p> <p>How do I calculate <code>x</code>?</p> <p>There is more data in the column than just this list. However, this list is contiguous - there is nothing in any of the cells above or below or either side beside it.</p>
[ { "answer_id": 114513, "author": "GSerg", "author_id": 11683, "author_profile": "https://Stackoverflow.com/users/11683", "pm_score": 5, "selected": true, "text": "Function ListRowCount(ByVal FirstCellName as String) as Long\n With thisworkbook.Names(FirstCellName).RefersToRange\n ...
2008/09/22
[ "https://Stackoverflow.com/questions/114493", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10326/" ]
114,501
<p>I want to set a background image for a div, in a way that it is in the upper <strong>RIGHT</strong> of the div, but with a fixed <code>10px</code> distance from top and right.</p> <p>Here is how I would do that if wanted it in the upper <strong>LEFT</strong> of the div:</p> <pre>background: url(images/img06.gif) no-repeat 10px 10px;</pre> <p>Is there anyway to achieve the same result, but showing the background on the upper <strong>RIGHT</strong>?</p>
[ { "answer_id": 114517, "author": "mathieu", "author_id": 971, "author_profile": "https://Stackoverflow.com/users/971", "pm_score": 3, "selected": false, "text": "background: url(images/img06.gif) no-repeat top right;\n" }, { "answer_id": 114522, "author": "Justin Poliey", ...
2008/09/22
[ "https://Stackoverflow.com/questions/114501", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6476/" ]
114,504
<p>Eg. can I write something like this code:</p> <pre><code>public void InactiveCustomers(IEnumerable&lt;Guid&gt; customerIDs) { //... myAdoCommand.CommandText = "UPDATE Customer SET Active = 0 WHERE CustomerID in (@CustomerIDs)"; myAdoCommand.Parameters["@CustomerIDs"].Value = customerIDs; //... } </code></pre> <p>The only way I know is to Join my IEnumerable and then use string concatenation to build my SQL string.</p>
[ { "answer_id": 114562, "author": "hollystyles", "author_id": 2083160, "author_profile": "https://Stackoverflow.com/users/2083160", "pm_score": -1, "selected": false, "text": " Create procedure usp_DeactivateCustomers \n @inactive varchar(50) /*or whatever values are required to ide...
2008/09/22
[ "https://Stackoverflow.com/questions/114504", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8547/" ]
114,521
<p>I am creating a <code>gridView</code> that allows adding new rows by adding the controls necessary for the insert into the <code>FooterTemplate</code>, but when the <code>ObjectDataSource</code> has no records, I add a dummy row as the <code>FooterTemplate</code> is only displayed when there is data.</p> <p>How can I hide this dummy row? I have tried setting <code>e.row.visible = false</code> on <code>RowDataBound</code> but the row is still visible.</p>
[ { "answer_id": 114612, "author": "mattlant", "author_id": 14642, "author_profile": "https://Stackoverflow.com/users/14642", "pm_score": 0, "selected": false, "text": "e.Row.Height = Unit.Pixel(0);\n" }, { "answer_id": 114699, "author": "Serhat Ozgel", "author_id": 31505, ...
2008/09/22
[ "https://Stackoverflow.com/questions/114521", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2808/" ]
114,525
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-function-functionname">JavaScript: var functionName = function() {} vs function functionName() {}</a> </p> </blockquote> <p>What's the difference between:</p> <pre><code>function sum(x, y) { return x+y; } // and var sum = function (x, y) { return x+y; } </code></pre> <p>Why is one used over the other?</p>
[ { "answer_id": 114573, "author": "Daniel James", "author_id": 2434, "author_profile": "https://Stackoverflow.com/users/2434", "pm_score": 3, "selected": false, "text": "var y = sum(1, 2);\n\nfunction sum(x, y) {\n return x + y;\n}\n" }, { "answer_id": 114579, "author": "niX...
2008/09/22
[ "https://Stackoverflow.com/questions/114525", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3983/" ]
114,527
<p>I'm really new to .NET, and I still didn't get the hang about how configuration files work.</p> <p>Every time I search on Google about it I get results about web.config, but I'm writing a Windows Forms application.</p> <p>I figured out that I need to use the System.Configuration namespace, but the documentation isn't helping.</p> <p>How do I define that my configuration file is XYZ.xml? Or does it have a "default" name for the configuration file? I still didn't get that.</p> <p>Also, how do I define a new section? Do I really need to create a class which inherits from ConfigurationSection?</p> <p>I would like to just have a configuration file with some values like this:</p> <pre><code>&lt;MyCustomValue&gt;1&lt;/MyCustomValue&gt; &lt;MyCustomPath&gt;C:\Some\Path\Here&lt;/MyCustomPath&gt; </code></pre> <p>Is there a simple way to do it? Can you explain in a simple way how to read and write from/to a simple configuration file?</p>
[ { "answer_id": 114552, "author": "Chris James", "author_id": 3193, "author_profile": "https://Stackoverflow.com/users/3193", "pm_score": 8, "selected": true, "text": "<configuration>\n <appSettings>\n <add key=\"MyKey\" value=\"false\"/>\n" }, { "answer_id": 114578, "author"...
2008/09/22
[ "https://Stackoverflow.com/questions/114527", "https://Stackoverflow.com", "https://Stackoverflow.com/users/727/" ]
114,541
<p>I want to write a <a href="http://getsongbird.com/" rel="noreferrer">Songbird</a> extension binds the multimedia keys available on all Apple Mac OS X platforms. Unfortunately this isn't an easy google search and I can't find any docs.</p> <p>Can anyone point me resources on accessing these keys or tell me how to do it?</p> <p>I have extensive programming experience, but this will be my first time coding in both MacOSX and <a href="http://wiki.songbirdnest.com/Developer/Developer_Intro/Extensions" rel="noreferrer">XUL</a> (Firefox, etc), so any tips on either are welcome.</p> <p>Please note that these are not regular key events. I assume it must be a different type of system event that I will need to hook or subscribe to.</p>
[ { "answer_id": 115333, "author": "rami", "author_id": 9629, "author_profile": "https://Stackoverflow.com/users/9629", "pm_score": 0, "selected": false, "text": "xev" }, { "answer_id": 423534, "author": "Rhythmic Fistman", "author_id": 22147, "author_profile": "https:/...
2008/09/22
[ "https://Stackoverflow.com/questions/114541", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15948/" ]
114,543
<p>How can I horizontally center a <code>&lt;div&gt;</code> within another <code>&lt;div&gt;</code> using CSS?</p> <pre class="lang-html prettyprint-override"><code>&lt;div id=&quot;outer&quot;&gt; &lt;div id=&quot;inner&quot;&gt;Foo foo&lt;/div&gt; &lt;/div&gt; </code></pre>
[ { "answer_id": 114549, "author": "Justin Poliey", "author_id": 6967, "author_profile": "https://Stackoverflow.com/users/6967", "pm_score": 13, "selected": true, "text": "<div>" }, { "answer_id": 1180400, "author": "Sneakyness", "author_id": 142632, "author_profile": "...
2008/09/22
[ "https://Stackoverflow.com/questions/114543", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20403/" ]
114,555
<p>I'm fairly new to the world of versioning but would like to introduce Subversion into our small development team as we're finding that more and more we are working on the same projects/files. We primarily code in <code>PHP</code> on a <code>LAMP</code> environment (Red Hat Enterprise).</p> <p>What I'm looking for are some starting points to get me up and running such as installation/configuration guides for Red Hat. I use Dreamweaver <code>CS3</code> (I see that Subversion functions will be introduced in <code>CS4</code>) so would be willing to look at other PHP IDEs with Subversion integration, do you have any preferences? I'm open to suggestions.</p>
[ { "answer_id": 114662, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 2, "selected": true, "text": "svnadmin create --fs-type=fsfs" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114555", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13658/" ]
114,575
<p>I'm passing around some objects through web service and some of them contain java.sql.Date. Because Date doesn't have empty constructor it doesn't want to get serialized. </p> <p>First part of a question is easy: what is the best way to pass a date between client and service? </p> <p>Second part is bit trickier: Once I decide how to pass dates around, I can obviously declare date transient and make some wrapper class to pass dates as String or whatever, but how to apply same solution as transparently as possible to several classes that include Date? </p> <p>(I have a hunch that DynamicProxy thingy might be a solution, but reading documentation on Sun's site wasn't very helpful, so if it really is something in that direction, some clarification would be appreciated)</p> <p>Edit: I asked wrong question, sorry (some misunderstanding between me and coworker what is actually a problem). Problem occurs because of deserializing. So once I have date in xml format it tries to deserialize itself as GregorianCalendar. Other part of a question still remains: What is the best way to receive something (long timestamp or GregorianCalendar) and convert it to sql date, without making 10 different wrappers for 10 different classes. I'm using a NetBeans for code and wsdl generation. </p>
[ { "answer_id": 114641, "author": "paul", "author_id": 11249, "author_profile": "https://Stackoverflow.com/users/11249", "pm_score": 0, "selected": false, "text": "XMLEncoder encoder = new XMLEncoder(new FileOutputStream(file));\nencoder.setPersistenceDelegate(\n Rectangle.class, \n ...
2008/09/22
[ "https://Stackoverflow.com/questions/114575", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4433/" ]
114,586
<p>What is the smartest way to design a math parser? What I mean is a function that takes a math string (like: "2 + 3 / 2 + (2 * 5)") and returns the calculated value? I did write one in VB6 ages ago but it ended up being way to bloated and not very portable (or smart for that matter...). General ideas, psuedo code or real code is appreciated. </p>
[ { "answer_id": 55853186, "author": "gbenroscience", "author_id": 1845404, "author_profile": "https://Stackoverflow.com/users/1845404", "pm_score": 1, "selected": false, "text": " MathExpression expr = new MathExpression(\"(34+32)-44/(8+9(3+2))-22\"); \n System.out.println(\"result:...
2008/09/22
[ "https://Stackoverflow.com/questions/114586", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
114,658
<p>I keep hearing that </p> <pre><code>catch (Exception ex) </code></pre> <p>Is bad practise, however, I often use it in event handlers where an operation may for example go to network, allowing the possibility of many different types of failure. In this case, I catch all exceptions and display the error message to the user in a message box.</p> <p>Is this considered bad practise? There's nothing more I can do with the exception: I don't want it to halt the application, the user needs to know what happened, and I'm at the top level of my code. What else should I be doing?</p> <p>EDIT:</p> <p>People are saying that I should look through the stack of calls and handle errors specifically, because for example a StackOverflow exception cannot be handled meaningfully. However, halting the process is the <b>worst</b> outcome, I want to prevent that at all costs. If I can't handle a StackOverflow, so be it - the outcome will be no worse than not catching exceptions at all, and in 99% of cases, informing the user is the least bad option as far as I'm concerned.</p> <p>Also, despite my best efforts to work out all of the possible exceptions that can be thrown, in a large code-base it's likely that I would miss some. And for most of them the best defense is still to inform the user.</p>
[ { "answer_id": 114693, "author": "Rasmus Faber", "author_id": 5542, "author_profile": "https://Stackoverflow.com/users/5542", "pm_score": 6, "selected": true, "text": "catch (Exception ex){}\n" }, { "answer_id": 114726, "author": "aku", "author_id": 1196, "author_prof...
2008/09/22
[ "https://Stackoverflow.com/questions/114658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6448/" ]
114,698
<p>We have a lot of spreadsheets (xls) in our source code repository. These are usually edited with gnumeric or openoffice.org, and are mostly used to populate databases for unit testing with <a href="http://www.dbunit.org/" rel="noreferrer">dbUnit</a>. There are no easy ways of doing diffs on xls files that I know of, and this makes merging extremely tedious and error prone.</p> <p>I've tried to converting the spreadsheets to xml and doing a regular diff, but it really feels like it should be a last resort. </p> <p>I'd like to perform the diffing (and merging) with <code>git</code> as I do with text files. How would I do this, e.g. when issuing <code>git diff</code>?</p>
[ { "answer_id": 114759, "author": "Laurent", "author_id": 10786, "author_profile": "https://Stackoverflow.com/users/10786", "pm_score": 7, "selected": false, "text": "=if(Sheet1!A1 <> Sheet2!A1, \"X\", \"\")" }, { "answer_id": 12359446, "author": "Toby", "author_id": 23326...
2008/09/22
[ "https://Stackoverflow.com/questions/114698", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13365/" ]
114,725
<p>I’ve got a problem with Visual Basic (6) in combination with LDAP. When I try to connect to an LDAP store, I always get errors like ‘Bad Pathname’ or ‘Table does not exist’ (depending on what the code looks like).</p> <p>This is the part of the code I wrote to connect:</p> <pre><code>path = "LDAP://xx.xxx.xxx.xxx:xxx/" Logging.WriteToLogFile "Test1", logINFO Set conn = CreateObject("ADODB.Connection") conn.Provider = "ADsDSOObject" conn.Properties("User ID") = "USER_ID" conn.Properties("Password") = "PASSWORD" conn.Properties("Encrypt Password") = True conn.Properties("ADSI Flag") = 34 Logging.WriteToLogFile "Test2", logINFO conn.Open "Active Directory Provider" Logging.WriteToLogFile "Test3", logINFO Set rs = conn.Execute("&lt;" &amp; path &amp; "ou=Some,ou=Kindof,o=Searchbase&gt;;(objectclass=*);name;subtree") Logging.WriteToLogFile "Test4", logINFO </code></pre> <p>The logfile shows “Test1” , “Test2”, “Test3” and then “Table does not exist”, so it’s the line “Set rs = conn.Execute(…)” where things go wrong (pretty obvious…).</p> <p>In my code, I try to connect in a secure way. I found out it has nothing to do with SSL/certificates though, because it’s also not possible to establish an anonymous unsecured connection. Funny thing is: I wrote a small test app in .NET in five minutes. With that app I was able to connect (anonymously) and read results from the LDAP store, no problems at all.</p> <p>Does anyone have any experience with the combination LDAP and VB6 and maybe know what could be the problem? I googled and saw some example code snippets, but unfortunately none of them worked (same error messages as result). Thanks in advance!</p>
[ { "answer_id": 114790, "author": "Darrel Miller", "author_id": 6819, "author_profile": "https://Stackoverflow.com/users/6819", "pm_score": 2, "selected": false, "text": " Set oinfo = New ADSystemInfo\n sDomain = Split(oinfo.DomainDNSName, \".\")\n '-- Get Datasets from the Active...
2008/09/22
[ "https://Stackoverflow.com/questions/114725", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
114,728
<p>One of my DBs have grown closer to permitted size.</p> <p>Inorder to find out the table containing the max data, i used the following query:</p> <pre><code>exec sp_MSforeachtable @command1="print '?' exec sp_spaceused '?'" </code></pre> <p>It returned the culprit table comprising the max data.</p> <p>As a next step, i want to cleanup the rows based on the size. For this, i would like to order the rows based on size.</p> <p>How to achieve this using a query? Are there any tools to do this?</p>
[ { "answer_id": 114827, "author": "Casper", "author_id": 18729, "author_profile": "https://Stackoverflow.com/users/18729", "pm_score": 1, "selected": false, "text": "SELECT * \nFROM #TempTable\nOrder by dataSize desc\n" }, { "answer_id": 114856, "author": "Sam Saffron", "a...
2008/09/22
[ "https://Stackoverflow.com/questions/114728", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15425/" ]
114,733
<p>Do anyone have good ideas of how to modify the toolbar for the WinForms version of the ReportViewer Toolbar? That is, I want to remove some buttons and varius, but it looks like the solution is to create a brand new toolbar instead of modifying the one that is there.</p> <p>Like, I had to remove export to excel, and did it this way:</p> <pre><code> // Disable excel export foreach (RenderingExtension extension in lr.ListRenderingExtensions()) { if (extension.Name == "Excel") { //extension.Visible = false; // Property is readonly... FieldInfo fi = extension.GetType().GetField("m_isVisible", BindingFlags.Instance | BindingFlags.NonPublic); fi.SetValue(extension, false); } } </code></pre> <p>A bit trickysh if you ask me.. For removing toolbarbuttons, an possible way was to iterate through the Control array inside the ReportViewer and change the Visible property for the buttons to hide, but it gets reset all the time, so it is not an good way..</p> <p>WHEN do MS come with an new version btw?</p>
[ { "answer_id": 355705, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 3, "selected": false, "text": " private readonly string[] ZOOM_VALUES = { \"25%\", \"50%\", \"75%\", \"100%\", \"110%\", \"120%\", \"125%\", \"130%\", \"1...
2008/09/22
[ "https://Stackoverflow.com/questions/114733", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3308/" ]
114,772
<p>I need to create and add custom headers to an ASP.NET 2.0 application. The case is simulation of an SSO-login in our dev/test environment.</p> <p>When I try to add headers I run into the "Not supported on this platform." error. BigJim has a nice post on the subject here: <a href="http://bigjimindc.blogspot.com/2007/07/ms-kb928365-aspnet-requestheadersadd.html" rel="nofollow noreferrer">http://bigjimindc.blogspot.com/2007/07/ms-kb928365-aspnet-requestheadersadd.html</a></p> <p>The root of my problem lies in the fact that I need to simulate various persons logging into my application. Not just adding static data in a HttpModule. I need to take values from a couple of TextBoxes and transfer information from these into custom headers and then re-direct the user. The HttpModule stuff happens to early in the pipeline...</p> <p>Does anyone now if there exsist a simple redirect/proxy solution that one could use in a dev environment? Or have simple/beautiful way of doing it in code?</p>
[ { "answer_id": 114943, "author": "Jon Adams", "author_id": 2291, "author_profile": "https://Stackoverflow.com/users/2291", "pm_score": 0, "selected": false, "text": "Response.AddHeader()" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114772", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
114,804
<p>I want to write a real-time analysis tool for wireless traffic.</p> <p>Does anyone know how to read from a promiscuous (or sniffing) device in C? </p> <p>I know that you need to have root access to do it. I was wondering if anyone knows what functions are necessary to do this. Normal sockets don't seem to make sense here.</p>
[ { "answer_id": 115169, "author": "DGentry", "author_id": 4761, "author_profile": "https://Stackoverflow.com/users/4761", "pm_score": 5, "selected": true, "text": "s = socket(PF_PACKET, SOCK_RAW, htons(ETH_P_ALL))\n" }, { "answer_id": 229296, "author": "user30684", "author...
2008/09/22
[ "https://Stackoverflow.com/questions/114804", "https://Stackoverflow.com", "https://Stackoverflow.com/users/542226/" ]
114,814
<p>In Bash, how do I count the number of non-blank lines of code in a project?</p>
[ { "answer_id": 114835, "author": "Ben Hoffstein", "author_id": 4482, "author_profile": "https://Stackoverflow.com/users/4482", "pm_score": 2, "selected": false, "text": "awk '/^[[:space:]]*$/ {++x} END {print x}' \"$testfile\"\n" }, { "answer_id": 114836, "author": "Michael C...
2008/09/22
[ "https://Stackoverflow.com/questions/114814", "https://Stackoverflow.com", "https://Stackoverflow.com/users/10176/" ]
114,819
<p>Consider these classes.</p> <pre><code>class Base { ... }; class Derived : public Base { ... }; </code></pre> <p>this function</p> <pre><code>void BaseFoo( std::vector&lt;Base*&gt;vec ) { ... } </code></pre> <p>And finally my vector</p> <pre><code>std::vector&lt;Derived*&gt;derived; </code></pre> <p>I want to pass <code>derived</code> to function <code>BaseFoo</code>, but the compiler doesn't let me. How do I solve this, without copying the whole vector to a <code>std::vector&lt;Base*&gt;</code>?</p>
[ { "answer_id": 114833, "author": "Matt Price", "author_id": 852, "author_profile": "https://Stackoverflow.com/users/852", "pm_score": 3, "selected": false, "text": "template<typename T>\nvoid BaseFoo( const std::vector<T*>& vec)\n{\n ...\n}\n" }, { "answer_id": 114883, "autho...
2008/09/22
[ "https://Stackoverflow.com/questions/114819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19863/" ]
114,830
<p>One of the basic data structures in Python is the dictionary, which allows one to record "keys" for looking up "values" of any type. Is this implemented internally as a hash table? If not, what is it?</p>
[ { "answer_id": 114831, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 9, "selected": true, "text": ">>> a = {}\n>>> b = ['some', 'list']\n>>> hash(b)\nTraceback (most recent call last):\n File \"<stdin>\", line 1, in <modul...
2008/09/22
[ "https://Stackoverflow.com/questions/114830", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11575/" ]
114,847
<p>I'm trying to use the Stream.BeginWrite Async I/O API in .NET for a high-throughput situation with many short messages. As such, a scatter/gather API will reduce the number of context switches (and CPU usage) tremendously. Does this API use the LPBUFFERS Win32 API at all? Is there an alternative API for Scatter/Gather I/O?</p>
[ { "answer_id": 30565480, "author": "Evgeniy Berezovsky", "author_id": 709537, "author_profile": "https://Stackoverflow.com/users/709537", "pm_score": 2, "selected": false, "text": "SocketAsyncEventArgs" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114847", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13897/" ]
114,851
<p>I have the following code:</p> <pre><code>ListBox.DataSource = DataSet.Tables("table_name").Select("some_criteria = match") ListBox.DisplayMember = "name" </code></pre> <p>The <a href="http://msdn.microsoft.com/en-us/library/system.data.datatable.select(VS.80).aspx" rel="noreferrer"><code>DataTable.Select()</code> method</a> returns an array of <a href="http://msdn.microsoft.com/en-us/library/system.data.datarow(VS.80).aspx" rel="noreferrer"><code>System.Data.DataRow</code></a> objects.</p> <p>No matter what I specify in the <code>ListBox.DisplayMember</code> property, all I see is the ListBox with the correct number of items all showing as <code>System.Data.DataRow</code> instead of the value I want which is in the <code>"name"</code> column!</p> <p>Is it possible to bind to the resulting array from <code>DataTable.Select()</code>, instead of looping through it and adding each one to the <code>ListBox</code>?</p> <p>(I've no problem with looping, but doesn't seem an elegant ending!)</p>
[ { "answer_id": 114887, "author": "Josh", "author_id": 11702, "author_profile": "https://Stackoverflow.com/users/11702", "pm_score": 6, "selected": true, "text": "ListBox.DataSource = new DataView(DataSet.Tables(\"table_name\"), \"some_criteria = match\", \"name\", DataViewRowState.Curren...
2008/09/22
[ "https://Stackoverflow.com/questions/114851", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5662/" ]
114,859
<p>I use a custom Matrix class in my application, and I frequently add multiple matrices:</p> <pre><code>Matrix result = a + b + c + d; // a, b, c and d are also Matrices </code></pre> <p>However, this creates an intermediate matrix for each addition operation. Since this is simple addition, it is possible to avoid the intermediate objects and create the result by adding the elements of all 4 matrices at once. How can I accomplish this?</p> <p>NOTE: I know I can define multiple functions like <code>Add3Matrices(a, b, c)</code>, <code>Add4Matrices(a, b, c, d)</code>, etc. but I want to keep the elegancy of <code>result = a + b + c + d</code>.</p>
[ { "answer_id": 114905, "author": "Vinko Vrsalovic", "author_id": 5190, "author_profile": "https://Stackoverflow.com/users/5190", "pm_score": 2, "selected": false, "text": "Matrix Add3Matrices(a,b,c) //and so on \n" }, { "answer_id": 114952, "author": "Ian G", "author_id":...
2008/09/22
[ "https://Stackoverflow.com/questions/114859", "https://Stackoverflow.com", "https://Stackoverflow.com/users/976/" ]
114,872
<p>Given some JS code like that one here:</p> <pre><code> for (var i = 0; i &lt; document.getElementsByName('scale_select').length; i++) { document.getElementsByName('scale_select')[i].onclick = vSetScale; } </code></pre> <p>Would the code be faster if we put the result of getElementsByName into a variable before the loop and then use the variable after that?</p> <p>I am not sure how large the effect is in real life, with the result from <code>getElementsByName</code> typically having &lt; 10 items. I'd like to understand the underlying mechanics anyway.</p> <p>Also, if there's anything else noteworthy about the two options, please tell me.</p>
[ { "answer_id": 114904, "author": "Oli", "author_id": 12870, "author_profile": "https://Stackoverflow.com/users/12870", "pm_score": 5, "selected": true, "text": "var scale_select = document.getElementsByName('scale_select');\nfor (var i = 0; i < scale_select.length; i++)\n scale_select...
2008/09/22
[ "https://Stackoverflow.com/questions/114872", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
114,914
<p>We use <a href="http://hudson-ci.org/" rel="noreferrer">Hudson</a> as a continuous integration system to execute automated builds (nightly and based on CVS polling) of a lot of our projects.</p> <p>Some projects poll CVS every 15 minutes, some others poll every 5 minutes and some poll every hour.</p> <p>Every few weeks we'll get a build that fails with the following output:</p> <pre><code>FATAL: java.io.IOException: Too many open files java.io.IOException: java.io.IOException: Too many open files at java.lang.UNIXProcess.&lt;init&gt;(UNIXProcess.java:148) </code></pre> <p>The next build always worked (with 0 changes) so we always chalked it up to 2 build jobs being run at the same time and happening to have too many files open during the process.</p> <p>This weekend we had a build fail Friday night (automatic nightly build) with the message and every other nightly build also failed. Somehow this triggered Hudson to continuously build every project which failed until the issue was resolved. This resulted in a build every 30 minutes or so of every project until sometime Saturday night when the issue magically disappeared. </p>
[ { "answer_id": 114932, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 0, "selected": false, "text": "ulimit -n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/114914", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9518/" ]
114,928
<p>I'm firing off a Java application from inside of a C# <a href="http://en.wikipedia.org/wiki/.NET_Framework" rel="noreferrer">.NET</a> console application. It works fine for the case where the Java application doesn't care what the "default" directory is, but fails for a Java application that only searches the current directory for support files.</p> <p>Is there a process parameter that can be set to specify the default directory that a process is started in?</p>
[ { "answer_id": 114937, "author": "Dror Helper", "author_id": 11361, "author_profile": "https://Stackoverflow.com/users/11361", "pm_score": 9, "selected": true, "text": "...\nusing System.Diagnostics;\n...\n\nvar startInfo = new ProcessStartInfo();\n\n startInfo.WorkingDirectory = // wor...
2008/09/22
[ "https://Stackoverflow.com/questions/114928", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15689/" ]
114,953
<p>I'm writing a photo gallery webapp for a friend's wedding and they want a photo gallery for guests to submit the digital photos they take on the day. </p> <p>After evaluating all the options, I've decided the easiest thing for users would be to let them use a familiar interface (their email) and just have them send in the pictures as attachments.</p> <p>I've created an mailbox but now I need to connect and retrieve these attachments for automated processing for adding to the gallery system. But how? Are there any tutorials or prefab classes you've seen for doing this?</p>
[ { "answer_id": 114973, "author": "Armin Ronacher", "author_id": 19990, "author_profile": "https://Stackoverflow.com/users/19990", "pm_score": 3, "selected": true, "text": "xfilter" }, { "answer_id": 115017, "author": "DreamWerx", "author_id": 15487, "author_profile": ...
2008/09/22
[ "https://Stackoverflow.com/questions/114953", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12870/" ]
114,983
<p>Given:</p> <pre><code>DateTime.UtcNow </code></pre> <p>How do I get a string which represents the same value in an <a href="http://en.wikipedia.org/wiki/ISO_8601" rel="noreferrer">ISO 8601</a>-compliant format?</p> <p>Note that ISO 8601 defines a number of similar formats. The specific format I am looking for is:</p> <pre><code>yyyy-MM-ddTHH:mm:ssZ </code></pre>
[ { "answer_id": 114997, "author": "Iain", "author_id": 20457, "author_profile": "https://Stackoverflow.com/users/20457", "pm_score": 7, "selected": false, "text": "DateTime.UtcNow.ToString(\"s\")\n" }, { "answer_id": 115002, "author": "Wayne", "author_id": 8236, "autho...
2008/09/22
[ "https://Stackoverflow.com/questions/114983", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20457/" ]
114,996
<p>How can we connect a <code>PHP</code> script to <code>MS Access (.mdb)</code> file?</p> <p>I tried by including following <code>PHP</code> code:</p> <pre><code>$db_path = $_SERVER['DOCUMENT_ROOT'] . '\WebUpdate\\' . $file_name . '.mdb'; $cfg_dsn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" . $db_path; $odbcconnect = odbc_connect($cfg_dsn, '', ''); </code></pre> <p>But it failed and I received following error message:</p> <pre><code> Warning: odbc_connect() [function.odbc-connect]: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in C:\web\WebUpdate\index.php on line 41 </code></pre>
[ { "answer_id": 115009, "author": "Galwegian", "author_id": 3201, "author_profile": "https://Stackoverflow.com/users/3201", "pm_score": 4, "selected": true, "text": "<?php\n$db_conn = new COM(\"ADODB.Connection\");\n$connstr = \"DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=\". realpath(\...
2008/09/22
[ "https://Stackoverflow.com/questions/114996", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6561/" ]
115,008
<p>How to print line numbers to the log. Say when outputting some information to the log, I also want to print the line number where that output is in the source code. As we can see in the stack trace, it displays the line number where the exception has occurred. Stack trace is available on the exception object.</p> <p>Other alternative could be like manually including the line number when printing to the log. Is there any other way?</p>
[ { "answer_id": 115027, "author": "Simon Buchan", "author_id": 20135, "author_profile": "https://Stackoverflow.com/users/20135", "pm_score": 7, "selected": false, "text": "/** Get the current line number.\n * @return int - Current line number.\n */\npublic static int getLineNumber() {\n ...
2008/09/22
[ "https://Stackoverflow.com/questions/115008", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15177/" ]
115,031
<p>I have an assembly, written in C++\CLI, which uses some of enumerations, provided by .Net. It has such kind of properties: </p> <pre><code>property System::ServiceProcess::ServiceControllerStatus ^ Status { ServiceControllerStatus ^ get() { return (ServiceControllerStatus)_status-&gt;dwCurrentState; } } </code></pre> <p>it works fine, but when i use this assembly from my C# code, type of this property is </p> <pre><code>System.Enum </code></pre> <p>and i have to make type-cast</p> <pre><code> if ((ServiceControllerStatus)currentService.Status == ServiceControllerStatus.Running) //do smth </code></pre> <p>The question is simple: why is it so, and how to fix it ?</p>
[ { "answer_id": 115106, "author": "Jorge Ferreira", "author_id": 6508, "author_profile": "https://Stackoverflow.com/users/6508", "pm_score": 4, "selected": true, "text": "property System::ServiceProcess::ServiceControllerStatus Status \n{ \n System::ServiceProcess::ServiceControllerS...
2008/09/22
[ "https://Stackoverflow.com/questions/115031", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6698/" ]
115,039
<p>Suppose that the <strong>ApplicationSettings</strong> class is a general repository of settings that apply to my application such as TimeoutPeriod, DefaultUnitOfMeasure, HistoryWindowSize, etc... And let's say MyClass makes use of one of those settings - DefaultUnitOfMeasure.</p> <p>My reading of proper use of Inversion of Control Containers - and please correct me if I'm wrong on this - is that you define the dependencies of a class in its constructor:</p> <pre><code>public class MyClass { public MyClass(IDataSource ds, UnitOfMeasure default_uom) {...} } </code></pre> <p>and then call instantiate your class with something like</p> <pre><code>var mc = IoC.Container.Resolve&lt;MyClass&gt;(); </code></pre> <p>Where <strong>IDataSource</strong> has been assigned a concrete implementation and default_uom has been wired up to instantiate from the <strong>ApplicationSettings.DefaultUnitOfMeasure</strong> property. I've got to wonder however, if all these hoops are really that necessary to jump through. What trouble am I setting myself up for should I do</p> <pre><code>public class MyClass { public MyClass(IDataSource ds) { UnitOfMeasure duom = IoC.Container.Resolve&lt;UnitOfMeasure&gt;("default_uom"); } } </code></pre> <p>Yes, many of my classes end up with a dependency on <strong>IoC.Container</strong> but that is a dependency that most of my classes will have anyways. It seems like I maybe should make full use of it as long as the classes are coupled. Please Agile gurus, tell me where I'm wrong.</p>
[ { "answer_id": 119005, "author": "Brannon", "author_id": 5745, "author_profile": "https://Stackoverflow.com/users/5745", "pm_score": 2, "selected": false, "text": "public class MyClass {\n public MyClass(IDataSource ds) {\n UnitOfMeasure duom = IoC.Container.Resolve<UnitOfMeasu...
2008/09/22
[ "https://Stackoverflow.com/questions/115039", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5056/" ]
115,060
<p>I was reading a post by Brad Wilson (<a href="http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html" rel="nofollow noreferrer">http://bradwilson.typepad.com/blog/2008/08/partial-renderi.html</a>) on the new ViewEngine changes to MVC Preview 5 and thought that it would be great to be able to render a view to string for use in tests. I get the impression from the article that it may be possible to achieve this but cannot figure out how. </p> <p>I believe this would enable us to do away with some of our WatIn tests (which are slow and unreliable) as it would allow us to check that the View has rendered correctly by simply checking the string for expected values/text.</p> <p>Has anyone implemented something like this?</p>
[ { "answer_id": 31016901, "author": "Triet Doan", "author_id": 1814420, "author_profile": "https://Stackoverflow.com/users/1814420", "pm_score": 1, "selected": false, "text": "RenderPartialToString" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115060", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11557/" ]
115,095
<p>I have my web browsers set to save what I type into text boxes on forms. I have a lot of search terms stored in the text box of my browser and would like to get at it via a program of some sort before I clear these values out. There are far too many for me to go through one at a time. </p> <p>The web browser must store this data somewhere, does anyone know where? Is it possible to retrieve these values? <em>Firefox</em>, more so than IE -- but either, if anyone knows a script that can extract these values? Thanks.</p>
[ { "answer_id": 31016901, "author": "Triet Doan", "author_id": 1814420, "author_profile": "https://Stackoverflow.com/users/1814420", "pm_score": 1, "selected": false, "text": "RenderPartialToString" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115095", "https://Stackoverflow.com", "https://Stackoverflow.com/users/14728/" ]
115,103
<p>I am trying to implement position-sensitive zooming inside a <code>JScrollPane</code>. The <code>JScrollPane</code> contains a component with a customized <code>paint</code> that will draw itself inside whatever space it is allocated - so zooming is as easy as using a <code>MouseWheelListener</code> that resizes the inner component as required.</p> <p>But I also want zooming into (or out of) a point to keep that point as central as possible within the resulting zoomed-in (or -out) view (this is what I refer to as 'position-sensitive' zooming), similar to how zooming works in google maps. I am sure this has been done many times before - does anybody know the "right" way to do it under Java Swing?. Would it be better to play with <code>Graphic2D</code>'s transformations instead of using <code>JScrollPanes</code>?</p> <p>Sample code follows:</p> <pre><code>package test; import java.awt.*; import java.awt.event.*; import java.awt.geom.*; import javax.swing.*; public class FPanel extends javax.swing.JPanel { private Dimension preferredSize = new Dimension(400, 400); private Rectangle2D[] rects = new Rectangle2D[50]; public static void main(String[] args) { JFrame jf = new JFrame("test"); jf.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jf.setSize(400, 400); jf.add(new JScrollPane(new FPanel())); jf.setVisible(true); } public FPanel() { // generate rectangles with pseudo-random coords for (int i=0; i&lt;rects.length; i++) { rects[i] = new Rectangle2D.Double( Math.random()*.8, Math.random()*.8, Math.random()*.2, Math.random()*.2); } // mouse listener to detect scrollwheel events addMouseWheelListener(new MouseWheelListener() { public void mouseWheelMoved(MouseWheelEvent e) { updatePreferredSize(e.getWheelRotation(), e.getPoint()); } }); } private void updatePreferredSize(int n, Point p) { double d = (double) n * 1.08; d = (n &gt; 0) ? 1 / d : -d; int w = (int) (getWidth() * d); int h = (int) (getHeight() * d); preferredSize.setSize(w, h); getParent().doLayout(); // Question: how do I keep 'p' centered in the resulting view? } public Dimension getPreferredSize() { return preferredSize; } private Rectangle2D r = new Rectangle2D.Float(); public void paint(Graphics g) { super.paint(g); g.setColor(Color.red); int w = getWidth(); int h = getHeight(); for (Rectangle2D rect : rects) { r.setRect(rect.getX() * w, rect.getY() * h, rect.getWidth() * w, rect.getHeight() * h); ((Graphics2D)g).draw(r); } } } </code></pre>
[ { "answer_id": 2598320, "author": "xycf7", "author_id": 262537, "author_profile": "https://Stackoverflow.com/users/262537", "pm_score": 1, "selected": false, "text": "\nprivate void updatePreferredSize(int n, Point p) {\n double d = (double) n * 1.08;\n d = (n > 0) ? 1 / d : -d;\n ...
2008/09/22
[ "https://Stackoverflow.com/questions/115103", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15472/" ]
115,115
<p><strong>Has anyone had success automating testing directly on embedded hardware?</strong></p> <p>Specifically, I am thinking of automating a battery of unit tests for hardware layer modules. We need to have greater confidence in our hardware layer code. A lot of our projects use interrupt driven timers, ADCs, serial io, serial SPI devices (flash memory) etc..</p> <p><strong>Is this even worth the effort?</strong></p> <p>We typically target:</p> <p>Processor: 8 or 16 bit microcontrollers (some DSP stuff)<br> Language: C (sometimes c++). </p>
[ { "answer_id": 115162, "author": "Frank Krueger", "author_id": 338, "author_profile": "https://Stackoverflow.com/users/338", "pm_score": 4, "selected": false, "text": "TEST_EQUAL" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115115", "https://Stackoverflow.com", "https://Stackoverflow.com/users/445087/" ]
115,121
<p>Does anyone know why there is no <code>respond_to</code> block for generated <code>edit</code> actions? Every other action in typical scaffold controllers has a <code>respond_to</code> block in order to output <code>html</code> and <code>xml</code> formats. Why is the <code>edit</code> action an exception?</p> <p>I'm using the latest version of Ruby on Rails (2.1.1).</p>
[ { "answer_id": 115211, "author": "Pete", "author_id": 13472, "author_profile": "https://Stackoverflow.com/users/13472", "pm_score": 5, "selected": true, "text": "GET /my_models/[:id].xml (Show) \n" }, { "answer_id": 116792, "author": "Ryan McGeary", "author_id": 8985, ...
2008/09/22
[ "https://Stackoverflow.com/questions/115121", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20467/" ]
115,159
<p>I have been using ASP.NET for years, but I can never remember when using the # and = are appropriate.</p> <p>For example:</p> <pre><code>&lt;%= Grid.ClientID %&gt; </code></pre> <p>or</p> <pre><code>&lt;%# Eval("FullName")%&gt; </code></pre> <p>Can someone explain when each should be used so I can keep it straight in my mind? Is # only used in controls that support databinding?</p>
[ { "answer_id": 115212, "author": "Keith", "author_id": 905, "author_profile": "https://Stackoverflow.com/users/905", "pm_score": 5, "selected": false, "text": "<%@" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115159", "https://Stackoverflow.com", "https://Stackoverflow.com/users/417/" ]
115,167
<p>I've been developing a site over the past few weeks using CodeIgniter as the framework. I've been thinking of the best way to accomplish something, which in a lot of other frameworks in other languages is relatively simple: sortable tables. CodeIgniter switches off query strings by default, because your URLs contain method parameters. So a URL might look like:</p> <pre><code>/controller/method/param1/param2 </code></pre> <p>You might think that you could just add in <code>sortBy</code> and <code>sortOrder</code> as two additional parameters to the controller method. I don't particularly want to do that, mainly because I want to have a re-usable controller. When you use query string parameters, PHP can easily tell you whether there is a parameter called <code>sortBy</code>. However, when you're using URL based parameters, it will vary with each controller.</p> <p>I was wondering what my options were. As far as I can see they are something like:</p> <ul> <li>Pass in my <code>sortBy</code> and <code>sortOrder</code> parameters, just suck it up, and develop some less-than-reusable component for it.</li> <li>Have an additional controller, which will store the <code>sortBy</code> and <code>sortOrder</code> in the session (although it would have to know where you came from, and send you back to the original page).</li> <li>Have some kind of AJAX function, which would call the controller above; then reload the page.</li> <li>Hack CodeIgniter to turn query strings back on. Actually, if this is the only option, any links to how to do this would be appreciated.</li> </ul> <p>I just can't quite believe such a simple task would present such a problem! Am I missing something? Does anyone have any recommendations?</p> <p>While I love jQuery, and I'm already using it on the site, so TableSorter is a good option. However, I would like to do server-side sorting as there are some pages with potentially large numbers of results, including pagination.</p>
[ { "answer_id": 119265, "author": "JayTee", "author_id": 20153, "author_profile": "https://Stackoverflow.com/users/20153", "pm_score": 1, "selected": false, "text": "$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\\-,';\n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115167", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
115,210
<p>I'm processing some data files that are supposed to be valid UTF-8 but aren't, which causes the parser (not under my control) to fail. I'd like to add a stage of pre-validating the data for UTF-8 well-formedness, but I've not yet found a utility to help do this.</p> <p>There's a <a href="http://www.w3.org/2005/01/yacker/uploads/utf8-validator" rel="noreferrer">web service</a> at W3C which appears to be dead, and I've found a Windows-only validation <a href="http://web.archive.org/web/20081101142036/http://bolek.techno.cz:80/UTF8-Validator/" rel="noreferrer">tool</a> that reports invalid UTF-8 files but doesn't report which lines/characters to fix.</p> <p>I'd be happy with either a tool I can drop in and use (ideally cross-platform), or a ruby/perl script I can make part of my data loading process. </p>
[ { "answer_id": 115241, "author": "tzot", "author_id": 6899, "author_profile": "https://Stackoverflow.com/users/6899", "pm_score": 3, "selected": false, "text": ">>> a=\"γεια\"\n>>> a\n'\\xce\\xb3\\xce\\xb5\\xce\\xb9\\xce\\xb1'\n>>> b='\\xce\\xb3\\xce\\xb5\\xce\\xb9\\xff\\xb1' # note seco...
2008/09/22
[ "https://Stackoverflow.com/questions/115210", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6716/" ]
115,222
<p>I have a file I need to move that's already under perforce. Once moved it needs some editing - update the package, etc - appropriate to its new location. Should I submit the move changespec and then reopen it for edit, or can I do this in one go? If so, what is the appropriate sequence of events?</p>
[ { "answer_id": 115290, "author": "Jough Dempsey", "author_id": 20497, "author_profile": "https://Stackoverflow.com/users/20497", "pm_score": 0, "selected": false, "text": "<text>" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115222", "https://Stackoverflow.com", "https://Stackoverflow.com/users/4893/" ]
115,237
<p>I am using Visual Studio, developing a native application, I have a programmatical breakpoint (assert) in my code placed using __asm int 3 or __debugbreak. Sometimes when I hit it, I would like to disable it so that successive hits in the same debugging session no longer break into the debugger. How can I do this?</p>
[ { "answer_id": 115238, "author": "Suma", "author_id": 16673, "author_profile": "https://Stackoverflow.com/users/16673", "pm_score": 6, "selected": true, "text": "*(char *)eip,x" }, { "answer_id": 6228529, "author": "Fili", "author_id": 675305, "author_profile": "https...
2008/09/22
[ "https://Stackoverflow.com/questions/115237", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16673/" ]
115,249
<p>I am trying to have a logout page where is displays a messages and then redirects to the login page. This is in ASP.net 2.0.</p> <p>I have this in my <code>Page_Load</code>:</p> <pre><code>ClientScript.RegisterStartupScript(typeof(Page), "pageredirect", JavascriptRedirect() ); </code></pre> <p>This is my redirect function:</p> <pre><code>private string JavascriptRedirect() { StringBuilder sb = new StringBuilder(); sb.Append("&lt;script type=\"text/javascript\" language=\"javascript\"&gt;"); sb.Append("var x = 5;"); sb.Append("var y = 1;"); sb.Append("function startClock(){"); sb.Append("x = x-y;"); sb.Append("t=setTimeout(\"startClock()\", 1000);"); sb.Append("if(x==0){"); sb.Append("window.location='login.aspx';"); sb.Append("clearTimeout(t);"); sb.Append(" }"); sb.Append(" }"); sb.Append("startClock();"); sb.Append("&lt;/script&gt;"); return sb.ToString(); } </code></pre> <p>When I test there is no javascript in my resulting logout page. Anyone have an idea on what is happening. Is <code>Page_Load</code> to late to register this?</p>
[ { "answer_id": 115286, "author": "Johannes Hädrich", "author_id": 18246, "author_profile": "https://Stackoverflow.com/users/18246", "pm_score": 2, "selected": true, "text": "<HEAD>" }, { "answer_id": 115373, "author": "brock.holum", "author_id": 15860, "author_profile...
2008/09/22
[ "https://Stackoverflow.com/questions/115249", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3208/" ]
115,269
<p>There's something very unsatisfactory about this code:</p> <pre><code>/* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command getCommand(String cmd) { cmdName = cmd.subString(0,8).trim(); if(cmdName.equals("START")) { return new StartCommand(cmd); } if(cmdName.equals("END")) { return new EndCommand(cmd); } // ... more commands in more if blocks here // else it's a bad command. return new InvalidCommand(cmd); } } </code></pre> <p>I'm unrepentant about the multiple exit points - the structure is clear. But I'm not happy about the series of near-identical if statements. I've considered making a Map of Strings to Commands:</p> <pre><code>commandMap = new HashMap(); commandMap.put("START",StartCommand.class); // ... etc. </code></pre> <p>... then using Reflection to make instances of the appropriate class looked up from the Map. However while conceptually elegant, this involves a fair amount of Reflection code that whoever inherits this code might not appreciate - although that cost might be offset by the benefits. All the lines hardcoding values into the commandMap smell almost as bad as the if block.</p> <p>Even better would be if the factory's constructor could scan the classpath for subclasses of Command, query them for String representations, and automatically add them them to its repertoire.</p> <p>So - how should I go about refactoring this?</p> <p>I guess some of the frameworks out there give me this kind of thing for free. Let's assume I'm not in a position to migrate this stuff into such a framework.</p>
[ { "answer_id": 115313, "author": "davetron5000", "author_id": 3029, "author_profile": "https://Stackoverflow.com/users/3029", "pm_score": 5, "selected": true, "text": "Class c = commandMap.get(cmdName);\nif (c != null)\n return c.newInstance();\nelse\n throw new IllegalArgumentExce...
2008/09/22
[ "https://Stackoverflow.com/questions/115269", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7512/" ]
115,277
<p>I'm wandering myself what component is the best for displaying fast search results in swing. I want to create something like this, make a text field where user can enter some text, during his entering I'll improve in back end fast search on database, and I want to show data bellow the text box, and he will be able to browse the results and on pres enter result will be displayed in table. So my question is is there any component which already have this logic for displaying? Or is it's not, what is the best way to implement that.</p> <p>This search will be something what ajax gives me on web, same logic same look and feel, if it's possible on desktop application.</p>
[ { "answer_id": 115355, "author": "davetron5000", "author_id": 3029, "author_profile": "https://Stackoverflow.com/users/3029", "pm_score": 2, "selected": false, "text": "JTextField" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115277", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16039/" ]
115,316
<p>I want to use a WSDL SOAP based web service in Python. I have looked at the <a href="http://web.archive.org/web/20181001011217/http://www.diveintopython.net/soap_web_services/" rel="noreferrer">Dive Into Python</a> code but the SOAPpy module does not work under Python 2.5.</p> <p>I have tried using <a href="https://fedorahosted.org/suds" rel="noreferrer">suds</a> which works partly, but breaks with certain types (suds.TypeNotFound: Type not found: 'item').</p> <p>I have also looked at <a href="http://trac.optio.webfactional.com/wiki" rel="noreferrer">Client</a> but this does not appear to support WSDL.</p> <p>And I have looked at <a href="http://pywebsvcs.sourceforge.net/zsi.html" rel="noreferrer">ZSI</a> but it looks very complex. Does anyone have any sample code for it?</p> <p>The WSDL is <a href="https://ws.pingdom.com/soap/PingdomAPI.wsdl" rel="noreferrer">https://ws.pingdom.com/soap/PingdomAPI.wsdl</a> and works fine with the PHP 5 SOAP client.</p>
[ { "answer_id": 27302096, "author": "Teddy Belay", "author_id": 4325298, "author_profile": "https://Stackoverflow.com/users/4325298", "pm_score": 4, "selected": false, "text": "import logging\nfrom suds.client import Client\nfrom suds.wsse import *\nfrom datetime import timedelta,date,dat...
2008/09/22
[ "https://Stackoverflow.com/questions/115316", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2183/" ]
115,319
<p>I'm using C# and connecting to a WebService via an auto-generated C# proxy object. The method I'm calling can be long running, and sometimes times out. I get different errors back, sometimes I get a <code>System.Net.WebException</code> or a <code>System.Web.Services.Protocols.SoapException</code>. These exceptions have properties I can interrogate to find the specific type of error from which I can display a human-friendly version of to the user.</p> <p>But sometimes I just get an <code>InvalidOperationException</code>, and it has the following Message. Is there any way I can interpret what this is without digging through the string for things I recognize, that feels very dirty, and isn't internationalization agnostic, the error message might come back in a different language.</p> <pre><code>Client found response content type of 'text/html; charset=utf-8', but expected 'text/xml'. The request failed with the error message: -- &lt;html&gt; &lt;head&gt; &lt;title&gt;Request timed out.&lt;/title&gt; &lt;style&gt; body {font-family:"Verdana";font-weight:normal;font-size: .7em;color:black;} p {font-family:"Verdana";font-weight:normal;color:black;margin-top: -5px} b {font-family:"Verdana";font-weight:bold;color:black;margin-top: -5px} H1 { font-family:"Verdana";font-weight:normal;font-size:18pt;color:red } H2 { font-family:"Verdana";font-weight:normal;font-size:14pt;color:maroon } pre {font-family:"Lucida Console";font-size: .9em} .marker {font-weight: bold; color: black;text-decoration: none;} .version {color: gray;} .error {margin-bottom: 10px;} .expandable { text-decoration:underline; font-weight:bold; color:navy; cursor:hand; } &lt;/style&gt; &lt;/head&gt; &lt;body bgcolor="white"&gt; &lt;span&gt;&lt;H1&gt;Server Error in '/PerformanceManager' Application.&lt;hr width=100% size=1 color=silver&gt;&lt;/H1&gt; &lt;h2&gt; &lt;i&gt;Request timed out.&lt;/i&gt; &lt;/h2&gt;&lt;/span&gt; &lt;font face="Arial, Helvetica, Geneva, SunSans-Regular, sans-serif "&gt; &lt;b&gt; Description: &lt;/b&gt;An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. &lt;br&gt;&lt;br&gt; &lt;b&gt; Exception Details: &lt;/b&gt;System.Web.HttpException: Request timed out.&lt;br&gt;&lt;br&gt; &lt;b&gt;Source Error:&lt;/b&gt; &lt;br&gt;&lt;br&gt; &lt;table width=100% bgcolor="#ffffcc"&gt; &lt;tr&gt; &lt;td&gt; &lt;code&gt; An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.&lt;/code&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br&gt; &lt;b&gt;Stack Trace:&lt;/b&gt; &lt;br&gt;&lt;br&gt; &lt;table width=100% bgcolor="#ffffcc"&gt; &lt;tr&gt; &lt;td&gt; &lt;code&gt;&lt;pre&gt; [HttpException (0x80004005): Request timed out.] &lt;/pre&gt;&lt;/code&gt; &lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; &lt;br&gt; &lt;hr width=100% size=1 color=silver&gt; &lt;b&gt;Version Information:&lt;/b&gt; Microsoft .NET Framework Version:2.0.50727.312; ASP.NET Version:2.0.50727.833 &lt;/font&gt; &lt;/body&gt; &lt;/html&gt; &lt;!-- [HttpException]: Request timed out. --&gt; --. </code></pre> <p>Edit: I have a try-catch around the method on the web-server. I have debugged it, and the web-server method returns (after a minute or so) without any exception. I also added an unhandled exception handler in the web service and a breakpoint there wasn't hit. As soon as the web-service returns, I get this error in the client instead of the result I expected.</p>
[ { "answer_id": 6207632, "author": "Mhoque", "author_id": 557700, "author_profile": "https://Stackoverflow.com/users/557700", "pm_score": 3, "selected": false, "text": " <httpRuntime requestValidationMode=\"2.0\" />\n" }, { "answer_id": 33893246, "author": "Zameer Ansari", ...
2008/09/22
[ "https://Stackoverflow.com/questions/115319", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11898/" ]
115,328
<p>I have the following class</p> <pre> public class Car { public Name {get; set;} } </pre> <p>and I want to bind this programmatically to a text box.</p> <p>How do I do that?</p> <p>Shooting in the dark:</p> <pre> ... Car car = new Car(); TextEdit editBox = new TextEdit(); editBox.DataBinding.Add("Name", car, "Car - Name"); ... </pre> <p>I get the following error</p> <blockquote> <p>"Cannot bind to the propery 'Name' on the target control.</p> </blockquote> <p>What am I doing wrong and how should I be doing this? I am finding the databinding concept a bit difficult to grasp coming from web-development.</p>
[ { "answer_id": 115346, "author": "Danimal", "author_id": 2757, "author_profile": "https://Stackoverflow.com/users/2757", "pm_score": 4, "selected": false, "text": "editBox.DataBinding.Add(\"Text\", car, \"Name\");\n" }, { "answer_id": 115351, "author": "ageektrapped", "au...
2008/09/22
[ "https://Stackoverflow.com/questions/115328", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15771/" ]
115,369
<p>I feel that my shop has a hole because we don't have a solid process in place for versioning our database schema changes. We do a lot of backups so we're more or less covered, but it's bad practice to rely on your last line of defense in this way. </p> <p>Surprisingly, this seems to be a common thread. Many shops I have spoken to ignore this issue because their databases don't change often, and they basically just try to be meticulous.</p> <p>However, I know how that story goes. It's only a matter of time before things line up just wrong and something goes missing. </p> <p>Are there any best practices for this? What are some strategies that have worked for you? </p>
[ { "answer_id": 115422, "author": "Paul Tomblin", "author_id": 3333, "author_profile": "https://Stackoverflow.com/users/3333", "pm_score": 5, "selected": false, "text": "if [ $VERSION \\< '8.0.108' ] ; then\n psql -U cosuser $dbName << EOF8.0.108\n BEGIN TRANSACTION;\n --\n -- R...
2008/09/22
[ "https://Stackoverflow.com/questions/115369", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16082/" ]
115,389
<p>How do you update your SQL sever database when installing your product's update? Are there any tools that will integrate with windows installer? My typical schema changes are:</p> <ul> <li>Adding/removing columns</li> <li>Adding/removing tables.</li> <li>Adding views.</li> <li>Adding/alter indexs.</li> </ul>
[ { "answer_id": 116254, "author": "Philippe Grondier", "author_id": 11436, "author_profile": "https://Stackoverflow.com/users/11436", "pm_score": 0, "selected": false, "text": "//instruction 1, batch instructions for version#2.162\nUSE myDatabase\nGO\nALTER TABLE myTable\n ADD myColumn...
2008/09/22
[ "https://Stackoverflow.com/questions/115389", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5618/" ]
115,399
<p>My credit card processor requires I send a two-digit year from the credit card expiration date. Here is how I am currently processing:</p> <ol> <li>I put a <code>DropDownList</code> of the 4-digit year on the page.</li> <li>I validate the expiration date in a <code>DateTime</code> field to be sure that the expiration date being passed to the CC processor isn't expired.</li> <li>I send a two-digit year to the CC processor (as required). I do this via a substring of the value from the year DDL.</li> </ol> <p>Is there a method out there to convert a four-digit year to a two-digit year. I am not seeing anything on the <code>DateTime</code> object. Or should I just keep processing it as I am?</p>
[ { "answer_id": 115440, "author": "brock.holum", "author_id": 15860, "author_profile": "https://Stackoverflow.com/users/15860", "pm_score": 8, "selected": true, "text": "DateTime expirationDate = new DateTime(2008, 1, 31); // random date\nstring lastTwoDigitsOfYear = expirationDate.ToStri...
2008/09/22
[ "https://Stackoverflow.com/questions/115399", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2535/" ]
115,418
<p>How to get an instance's member's values?</p> <p>With propertyInfos there is a <code>propertyInfo.GetValue(instance, index)</code>, but no such thing exists in memberInfo.</p> <p>I searched the net, but it seems to stop at getting the member's name and type.</p>
[ { "answer_id": 115429, "author": "Matt Howells", "author_id": 16881, "author_profile": "https://Stackoverflow.com/users/16881", "pm_score": 5, "selected": true, "text": "FieldInfo" }, { "answer_id": 8801597, "author": "Carlo V. Dango", "author_id": 454017, "author_pro...
2008/09/22
[ "https://Stackoverflow.com/questions/115418", "https://Stackoverflow.com", "https://Stackoverflow.com/users/11333/" ]
115,420
<p>When trying to run the Flex Builder 3 profiler on any I don't get the profiler dialog window and then after a few seconds I get "Socket timeout" in the console window. Any ideas why it can't connect?</p> <p>I've got the latest debug version of Flash player and have tried shutting off my firewall.<br> I'm running it on XP from the local drive, ie. not through localhost.</p> <p>Thanks, Alex</p>
[ { "answer_id": 1092530, "author": "Community", "author_id": -1, "author_profile": "https://Stackoverflow.com/users/-1", "pm_score": 0, "selected": false, "text": "Error #2044: Unhandled securityError:. text=Error #2048: Security sandbox violation:\n file:///C|%2Fwork%2Flabsense%2Fbran...
2008/09/22
[ "https://Stackoverflow.com/questions/115420", "https://Stackoverflow.com", "https://Stackoverflow.com/users/15899/" ]
115,425
<p>Aside from trying</p> <pre><code>perldoc &lt;module name&gt; </code></pre> <p>individually for any CPAN module that takes my fancy or going through the file system and looking at the directories I have no idea what modules we have installed. </p> <p>What's the easiest way to just get a big list of every CPAN module installed? From the command line or otherwise.</p>
[ { "answer_id": 115439, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 5, "selected": false, "text": "perldoc perllocal\n" }, { "answer_id": 115564, "author": "amoore", "author_id": 7573, "author_profile": "h...
2008/09/22
[ "https://Stackoverflow.com/questions/115425", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3404/" ]
115,426
<p>I'm looking for an algorithm to detect if two rectangles intersect (one at an arbitrary angle, the other with only vertical/horizontal lines).</p> <p>Testing if a corner of one is in the other ALMOST works. It fails if the rectangles form a cross-like shape.</p> <p>It seems like a good idea to avoid using slopes of the lines, which would require special cases for vertical lines.</p>
[ { "answer_id": 115520, "author": "Nils Pipenbrinck", "author_id": 15955, "author_profile": "https://Stackoverflow.com/users/15955", "pm_score": 8, "selected": true, "text": " edge = v(n) - v(n-1)\n" }, { "answer_id": 13550752, "author": "tristan", "author_id": 1109630, ...
2008/09/22
[ "https://Stackoverflow.com/questions/115426", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20493/" ]
115,428
<p>I am looking to convert a <code>MySQL timestamp</code> to a epoch time in seconds using <code>PHP</code>, and vice versa. </p> <p>What's the cleanest way to do this?</p>
[ { "answer_id": 115510, "author": "Michał Niedźwiedzki", "author_id": 2169, "author_profile": "https://Stackoverflow.com/users/2169", "pm_score": 3, "selected": false, "text": "$unixTimestamp = strtotime($mysqlDate);\n$mysqlDate = date('Y-m-d h:i:s', $unixTimestamp);\n" }, { "answ...
2008/09/22
[ "https://Stackoverflow.com/questions/115428", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
115,431
<p>Suppose I have some XAML like this:</p> <pre><code>&lt;Window.Resources&gt; &lt;v:MyClass x:Key="whatever" Text="foo\nbar" /&gt; &lt;/Window.Resources&gt; </code></pre> <p>Obviously I want a newline character in the MyClass.Text property, but the XAML parser constructs the object with the literal string "foo\nbar".</p> <p>Is there (a) a way to convince the parser to translate escape sequences, or (b) a .NET method to interpret a string in the way that the C# compiler would?</p> <p>I realize that I can go in there looking for <code>\n</code> sequences, but it would be nicer to have a generic way to do this.</p>
[ { "answer_id": 115543, "author": "deepcode.co.uk", "author_id": 20524, "author_profile": "https://Stackoverflow.com/users/20524", "pm_score": 1, "selected": false, "text": "<v:MyClass x:Key=\"whatever\" Text=\"{MyBinder foo\\nbar}\"/>" }, { "answer_id": 115718, "author": "Mat...
2008/09/22
[ "https://Stackoverflow.com/questions/115431", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9591/" ]
115,462
<p>I'm having a little bit of a problem scaling my images to a properly predefined size. I was wondering - since it is purely mathematics, if there's some sort of common logical algorithm that works in every language (PHP, ActionScript, Javascript etc.) to scale images proportionally.</p> <p>I'm using this at the moment: </p> <pre><code>var maxHeight = 300; var maxWidth = 300; var ratio:Number = height / width; if (height &gt; maxHeight) { height = maxHeight; width = Math.round(height / ratio); } else if(width &gt; maxWidth) { width = maxWidth; height = Math.round(width * ratio); } </code></pre> <p>But it doesn't work properly. The images scales proportionately, sure enough, but the size isn't set at 300 (either in width or in height). It kind of makes sense, but I was wondering if there's a fool-proof, easy way to scale images proportionally.</p>
[ { "answer_id": 115492, "author": "Dark Shikari", "author_id": 11206, "author_profile": "https://Stackoverflow.com/users/11206", "pm_score": 7, "selected": true, "text": "ratio = MIN( maxWidth / width, maxHeight/ height );\nwidth = ratio * width;\nheight = ratio * height;\n" }, { ...
2008/09/22
[ "https://Stackoverflow.com/questions/115462", "https://Stackoverflow.com", "https://Stackoverflow.com/users/17362/" ]
115,472
<p>I'm working on a .NET 3.5 website, with three projects under one solution. I'm using jQuery in this project. I'd like to use the Visual Studio JavaScript debugger to step through my JavaScript code. If I set a breakpoint in any of the .js files I get a warning that says:</p> <blockquote> <p>The breakpoint will not currently be hit. No symbols have been loaded for this document.</p> </blockquote> <p>How do I fix this? I'm guessing that Visual Studio is having some trouble parsing through some of the jQuery code. I will try to replace the minimized version of <code>jQuery.js</code> with the expanded version, but I don't think that will fix it.</p>
[ { "answer_id": 466131, "author": "Ian Robinson", "author_id": 326, "author_profile": "https://Stackoverflow.com/users/326", "pm_score": 5, "selected": true, "text": "debugger;" }, { "answer_id": 1278156, "author": "ExceptionRaiser", "author_id": 156528, "author_profil...
2008/09/22
[ "https://Stackoverflow.com/questions/115472", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13800/" ]
115,478
<p>The following code is in the <code>/Courses/Detail</code> action:</p> <pre><code> [AcceptVerbs("GET")] public ActionResult Detail(int id) { ViewData["Title"] = "A View Title"; return View(tmdc.GetCourseById(id)); } </code></pre> <p>The <code>tmdc.GetCourseById(id)</code> method returns an instance of type <code>Course</code> for the View. In the View I am using </p> <pre><code>&lt;%= HTML.TextBox("Title")%&gt; </code></pre> <p>to display the value of the <code>Title</code> property for the <code>Course</code> object. Instead the text box is displaying the string <code>A View Title</code>. Is this normal/expected behavior? What would be the best way to handle this?</p> <p><b>Update</b><br /> As a workaround, I've changed <code>ViewData["Title"]</code> to <code>ViewData["VIEW_TITLE"]</code> but would like a cleaner way to handle this collision or to know if this is an expected result.</p>
[ { "answer_id": 466131, "author": "Ian Robinson", "author_id": 326, "author_profile": "https://Stackoverflow.com/users/326", "pm_score": 5, "selected": true, "text": "debugger;" }, { "answer_id": 1278156, "author": "ExceptionRaiser", "author_id": 156528, "author_profil...
2008/09/22
[ "https://Stackoverflow.com/questions/115478", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19251/" ]
115,488
<p>I am having difficulty reliably creating / removing event sources during the installation of my .Net Windows Service.</p> <p>Here is the code from my ProjectInstaller class:</p> <pre><code>// Create Process Installer ServiceProcessInstaller spi = new ServiceProcessInstaller(); spi.Account = ServiceAccount.LocalSystem; // Create Service ServiceInstaller si = new ServiceInstaller(); si.ServiceName = Facade.GetServiceName(); si.Description = "Processes ..."; si.DisplayName = "Auto Checkout"; si.StartType = ServiceStartMode.Automatic; // Remove Event Source if already there if (EventLog.SourceExists("AutoCheckout")) EventLog.DeleteEventSource("AutoCheckout"); // Create Event Source and Event Log EventLogInstaller log = new EventLogInstaller(); log.Source = "AutoCheckout"; log.Log = "AutoCheckoutLog"; Installers.AddRange(new Installer[] { spi, si, log }); </code></pre> <p>The facade methods referenced just return the strings for the name of the log, service, etc.</p> <p>This code works most of the time, but recently after installing I started getting my log entries showing up in the Application Log instead of the custom log. And the following errors are in the log as well:</p> <blockquote> <p>The description for Event ID ( 0 ) in Source ( AutoCheckout ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. </p> </blockquote> <p>For some reason it either isn't properly removing the source during the uninstall or it isn't creating it during the install.</p> <p>Any help with best practices here is appreciated.</p> <p>Thanks!</p> <p>In addition, here is a sample of how I am writing exceptions to the log:</p> <pre><code>// Write to Log EventLog.WriteEntry(Facade.GetEventLogSource(), errorDetails, EventLogEntryType.Error, 99); </code></pre> <p><strong>Regarding stephbu's answer:</strong> The recommended path is an installer script and installutil, or a Windows Setup routine.</p> <p>I am using a Setup Project, which performs the installation of the service and sets up the log. Whether I use the installutil.exe or the windows setup project I believe they both call the same ProjectInstaller class I show above.</p> <p>I see how the state of my test machine could be causing the error if the log isn't truly removed until rebooting. I will experiment more to see if that solves the issue.</p> <p><strong>Edit:</strong> I'm interested in a sure fire way to register the source and the log name during the installation of the service. So if the service had previously been installed, it would remove the source, or reuse the source during subsequent installations.</p> <p>I haven't yet had an opportunity to learn WiX to try that route.</p>
[ { "answer_id": 1287334, "author": "helb", "author_id": 157690, "author_profile": "https://Stackoverflow.com/users/157690", "pm_score": 5, "selected": false, "text": "ServiceInstaller" }, { "answer_id": 3674774, "author": "Tod Flak", "author_id": 380605, "author_profil...
2008/09/22
[ "https://Stackoverflow.com/questions/115488", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13368/" ]
115,496
<p>How to customize the color of the symbol inserted in the "glasses mode" in Emacs? I have not found the option for this. Can anyone suggest anything?</p>
[ { "answer_id": 115940, "author": "Allen", "author_id": 6043, "author_profile": "https://Stackoverflow.com/users/6043", "pm_score": 4, "selected": true, "text": "glasses-face" }, { "answer_id": 115947, "author": "dmckee --- ex-moderator kitten", "author_id": 2509, "aut...
2008/09/22
[ "https://Stackoverflow.com/questions/115496", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20514/" ]
115,500
<p>In Java you can give the number zero as a single parameter for the Socket or DatagramSocket constructor. Java binds that Socket to a free port then. Is it possible to limit the port lookup to a specific range?</p>
[ { "answer_id": 116113, "author": "Jason Cohen", "author_id": 4926, "author_profile": "https://Stackoverflow.com/users/4926", "pm_score": 2, "selected": false, "text": "public static Socket getListeningSocket() {\n for ( int port = MIN_PORT ; port <= MAX_PORT ; port++ )\n {\n ...
2008/09/22
[ "https://Stackoverflow.com/questions/115500", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16515/" ]
115,503
<p>I recently asked a question about Oracle Encryption. Along the way to finding a solution for myself I decided to move the encryption (well, obfuscation) to the application side for certain tasks. </p> <p>My problem is that the database is already encrypting data a certain way and I need Java code to duplicate that functionality, so that text encrypted by one system can be decrypted by the other and vice versa.</p> <p>I want the encryption to be compatible with what the DB was already doing but couldn't find the documentation that describes exactly what Oracle is doing. How do I replicate this in Java?</p> <pre><code>dbms_obfuscation_toolkit.DESEncrypt( input_string =&gt; v_string, key_string =&gt; key_string, encrypted_string =&gt; encrypted_string ); RETURN UTL_RAW.CAST_TO_RAW(encrypted_string); </code></pre> <p>No matter what I try, it seems as if the Java DES encryption is different than Oracle's.</p>
[ { "answer_id": 115540, "author": "Mr. Shiny and New 安宇", "author_id": 7867, "author_profile": "https://Stackoverflow.com/users/7867", "pm_score": 3, "selected": true, "text": "KeySpec ks = new DESKeySpec(new byte[] {'s','e','c','r','e','t','!','!'});\nSecretKeyFactory skf = SecretKeyFact...
2008/09/22
[ "https://Stackoverflow.com/questions/115503", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7867/" ]
115,508
<p>I am connecting to a Windows XP machine via Microsoft's Remote Desktop Connection Client, version 2.0.0 Beta 3, running on a Mac. On the Windows machine there is a Java console running, where I want to send a Ctrl-Break so I can see the Java threads running.</p> <p>According to the RDC help, Alt/Option-F3 is break, but Ctrl-Opt-F3 and various other combinations do not have an effect.</p> <p>Any ideas on how to send a Ctrl-Break?</p>
[ { "answer_id": 8670518, "author": "andrew", "author_id": 1121554, "author_profile": "https://Stackoverflow.com/users/1121554", "pm_score": 2, "selected": false, "text": "fn + Esc\n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115508", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
115,526
<p>I'm running an c# .net app in an iframe of an asp page on an older site. Accessing the Asp page's session information is somewhat difficult, so I'd like to make my .net app simply verify that it's being called from an approved page, or else immediately halt.</p> <p>Is there a way for a page to find out the url of it's parent document?</p>
[ { "answer_id": 115533, "author": "Dan", "author_id": 17121, "author_profile": "https://Stackoverflow.com/users/17121", "pm_score": 5, "selected": true, "text": "top.location.href\n" }, { "answer_id": 116157, "author": "Raleigh Buckner", "author_id": 1153, "author_prof...
2008/09/22
[ "https://Stackoverflow.com/questions/115526", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12382/" ]
115,548
<p>This code in JS gives me a popup saying "i think null is a number", which I find slightly disturbing. What am I missing?</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>if (isNaN(null)) { alert("null is not a number"); } else { alert("i think null is a number"); }</code></pre> </div> </div> </p> <p>I'm using Firefox 3. Is that a browser bug?</p> <p>Other tests:</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>console.log(null == NaN); // false console.log(isNaN("text")); // true console.log(NaN == "text"); // false</code></pre> </div> </div> </p> <p>So, the problem seems not to be an exact comparison with NaN?</p> <p><i><b>Edit:</b> Now the question has been answered, I have cleaned up my post to have a better version for the archive. However, this renders some comments and even some answers a little incomprehensible. Don't blame their authors. Among the things I changed was:</p> <ul> <li>Removed a note saying that I had screwed up the headline in the first place by reverting its meaning</li> <li>Earlier answers showed that I didn't state clearly enough why I thought the behaviour was weird, so I added the examples that check a string and do a manual comparison. </i></li> </ul>
[ { "answer_id": 115696, "author": "Glenn Moss", "author_id": 5726, "author_profile": "https://Stackoverflow.com/users/5726", "pm_score": 8, "selected": true, "text": "x" }, { "answer_id": 118084, "author": "treat your mods well", "author_id": 20772, "author_profile": "...
2008/09/22
[ "https://Stackoverflow.com/questions/115548", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2077/" ]
115,557
<p>We are struggling to configure our web app to be able to connect with web services via Spring WS. We have tried to use the example from the documentation of client-side Spring-WS, but we end up with a WebServiceTransportException. The XML config looks like this:</p> <pre><code>&lt;bean id="webServiceTemplate" class="org.springframework.ws.client.core.WebServiceTemplate"&gt; &lt;constructor-arg ref="messageFactory"/&gt; &lt;property name="messageSender"&gt; &lt;bean class="org.springframework.ws.transport.http.CommonsHttpMessageSender"&gt; &lt;property name="credentials"&gt; &lt;bean class="org.apache.commons.httpclient.UsernamePasswordCredentials"&gt; &lt;constructor-arg value="john"/&gt; &lt;constructor-arg value="secret"/&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>We have been able to configure the application programmatically, but this configuration was not possible to "transfer" to a Spring XML config because some setters did not use the format Spring expects. (HttpState.setCredentials(...) takes two parameters). The config was lifted from some other Spring-WS client code in the company.</p> <p>This is the configuration that works:</p> <pre><code> public List&lt;String&gt; getAll() { List&lt;String&gt; carTypes = new ArrayList&lt;String&gt;(); try { Source source = new ResourceSource(request); JDOMResult result = new JDOMResult(); SaajSoapMessageFactory soapMessageFactory = new SaajSoapMessageFactory(MessageFactory.newInstance()); WebServiceTemplate template = new WebServiceTemplate(soapMessageFactory); HttpClientParams clientParams = new HttpClientParams(); clientParams.setSoTimeout(60000); clientParams.setConnectionManagerTimeout(60000); clientParams.setAuthenticationPreemptive(true); HttpClient client = new HttpClient(clientParams); client.getState().setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("username", "password")); CommonsHttpMessageSender messageSender = new CommonsHttpMessageSender(client); template.setMessageSender(messageSender); template.sendSourceAndReceiveToResult(SERVICE_URI, source, result); // Handle the XML } catch (IOException e) { throw new RuntimeException(e); } catch (SOAPException e) { throw new RuntimeException(e); } return carTypes; } </code></pre> <p>Does anyone know how to solve my problem? Every tutorial I have see out there lists the first configuration. It seems that when I set the credentials on the messageSender object, they are just ignored...</p>
[ { "answer_id": 150178, "author": "Symbioxys", "author_id": 1841427, "author_profile": "https://Stackoverflow.com/users/1841427", "pm_score": 1, "selected": false, "text": "<constructor-arg value=\"john\"/>\n<constructor-arg value=\"secret\"/>\n" }, { "answer_id": 1915645, "au...
2008/09/22
[ "https://Stackoverflow.com/questions/115557", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20529/" ]
115,573
<p>I'm sure we all have received the wonderfully vague "Object reference not set to instance of an Object" exception at some time or another. Identifying the object that is the problem is often a tedious task of setting breakpoints and inspecting all members in each statement. </p> <p>Does anyone have any tricks to easily and efficiently identify the object that causes the exception, either via programmatical means or otherwise?</p> <p>--edit</p> <p>It seems I was vague like the exception =). The point is to _not have to debug the app to find the errant object. The compiler/runtime does know that the object has been allocated/declared, and that the object has not yet been instantiated. Is there a way to extract / identify those details in a caught exception</p> <p>@ W. Craig Trader</p> <p>Your explanation that it is a result of a design problem is probably the best answer I could get. I am fairly compulsive with defensive coding and have managed to get rid of most of these errors after fixing my habits over time. The remaining ones just <strong><em>tweak</em></strong> me to no end, and lead me to posting this question to the community. </p> <p>Thanks for everyone's suggestions.</p>
[ { "answer_id": 115619, "author": "Chris Marasti-Georg", "author_id": 96, "author_profile": "https://Stackoverflow.com/users/96", "pm_score": 1, "selected": false, "text": "ArgumentNullException" }, { "answer_id": 115732, "author": "Craig Trader", "author_id": 12895, "...
2008/09/22
[ "https://Stackoverflow.com/questions/115573", "https://Stackoverflow.com", "https://Stackoverflow.com/users/16391/" ]
115,643
<p>PowerShell is definitely in the category of dynamic languages, but would it be considered strongly typed? </p>
[ { "answer_id": 115676, "author": "David Mohundro", "author_id": 4570, "author_profile": "https://Stackoverflow.com/users/4570", "pm_score": 3, "selected": false, "text": "[1] » [int]$x = 5\n[2] » $x\n5\n[3] » $x = 'haha'\nCannot convert value \"haha\" to type \"System.Int32\". Error: \"I...
2008/09/22
[ "https://Stackoverflow.com/questions/115643", "https://Stackoverflow.com", "https://Stackoverflow.com/users/3289/" ]
115,658
<p>In my C# application I am using the Microsoft Jet OLEDB data provider to read a CSV file. The connection string looks like this:</p> <pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\Data;Extended Properties="text;HDR=Yes;FMT=Delimited </code></pre> <p>I open an ADO.NET OleDbConnection using that connection string and select all the rows from the CSV file with the command:</p> <pre><code>select * from Data.csv </code></pre> <p>When I open an OleDbDataReader and examine the data types of the columns it returns, I find that something in the stack has tried to guess at the data types based on the first row of data in the file. For example, suppose the CSV file contains:</p> <pre><code>House,Street,Town 123,Fake Street,Springfield 12a,Evergreen Terrace,Springfield </code></pre> <p>Calling the OleDbDataReader.GetDataTypeName method for the House column will reveal that the column has been given the data type "DBTYPE_I4", so all values read from it are interpreted as integers. My problem is that House should be a string - when I try to read the House value from the second row, the OleDbDataReader returns null.</p> <p>How can I tell either the Jet database provider or the OleDbDataReader to interpret a column as strings instead of numbers?</p>
[ { "answer_id": 116111, "author": "Rory MacLeod", "author_id": 1016, "author_profile": "https://Stackoverflow.com/users/1016", "pm_score": 4, "selected": false, "text": "[Data.csv]\nColNameHeader=True\nCol1=House Text\nCol2=Street Text\nCol3=Town Text\n" }, { "answer_id": 7658003,...
2008/09/22
[ "https://Stackoverflow.com/questions/115658", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1016/" ]
115,665
<p>I'm using the <code>cacheCounter</code> in <code>CakePHP</code>, which increments a counter for related fields.</p> <p>Example, I have a Person table a Source table. Person.source_id maps to a row in the Source table. Each person has one Source, and each Source has none or many Person rows.</p> <p><code>cacheCounter</code> is working great when I change the value of a source on a person. It increments <code>Source.Person_Count</code>. Cool.</p> <p>But when it increments, it adds it to the destination source for a person, but doesn't remove it from the old value. I tried <code>updateCacheControl()</code> in <code>afterSave</code>, but that didn't do anything.</p> <p>So then I wrote some code in my model for <code>afterSave</code> that would subtract the source source_id, but it always did this even when I wasn't even changing the <code>source_id</code>. (So the count went negative).</p> <p>My question: Is there a way to tell if a field was changed in the model in <code>CakePHP</code>?</p>
[ { "answer_id": 123485, "author": "neilcrookes", "author_id": 9968, "author_profile": "https://Stackoverflow.com/users/9968", "pm_score": 0, "selected": false, "text": "echo $form->input('field_to_monitor');\necho $form->hidden('field_to_monitor_prev', array('value'=>$form->value('field_t...
2008/09/22
[ "https://Stackoverflow.com/questions/115665", "https://Stackoverflow.com", "https://Stackoverflow.com/users/43/" ]
115,681
<p>I have to restore a database that has been inadvertently DROPped in MySQL 5.0. From checking the backup files, I only seem to have .FRM files to hold the database data.</p> <p>Can anyone advise whether this is all I need to perform a database restore/import from the backup, or are there other files I should have to hand to complete this?</p>
[ { "answer_id": 11069206, "author": "Ash", "author_id": 23548, "author_profile": "https://Stackoverflow.com/users/23548", "pm_score": 4, "selected": false, "text": "_ib_logfile0\n_ib_logfile1\n_ibdata1\n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115681", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7703/" ]
115,685
<p>I once wrote this line in a Java class. This compiled fine in Eclipse but not on the command line. </p> <p>This is on</p> <ul> <li>Eclipse 3.3</li> <li>JDK 1.5</li> <li>Windows XP Professional</li> </ul> <p>Any clues?</p> <p>Error given on the command line is:</p> <pre><code>Icons.java:16: code too large public static final byte[] compileIcon = { 71, 73, 70, 56, 57, 97, 50, ^ </code></pre> <p>The code line in question is:</p> <pre><code>public static final byte[] compileIcon = { 71, 73, 70, 56, 57, 97, 50, 0, 50, 0, -9, 0, 0, -1, -1, -1, -24, -72, -72, -24, -64, -64, -8, -16, -24, -8, -24, -24, -16, -24, -32, -1, -8, -8, 48, 72, -72, -24, -80, -80, 72, 96, -40, -24, -24, -8, 56, 88, -56, -24, -40, -48, -24, -48, -64, 56, 80, -64, 64, 88, -48, -56, -64, -64, -16, -24, -24, -32, -40, -40, -32, -88, -96, -72, -72, -72, -48, -56, -56, -24, -32, -32, -8, -8, -1, -24, -40, -56, -64, -72, -72, -16, -32, -40, 48, 80, -72, -40, -96, -104, -40, -96, -96, -56, -104, -104, 120, 88, -104, -40, -64, -80, -32, -88, -88, -32, -56, -72, -72, -80, -80, -32, -80, -88, 104, -96, -1, -40, -40, -40, -64, -104, -104, -32, -56, -64, -112, 104, 112, -48, -104, -112, -128, -112, -24, -72, -80, -88, -8, -8, -8, -64, -112, -120, 72, 104, -40, 120, 96, -96, -112, -96, -24, -112, -120, -72, -40, -88, -88, -48, -64, -72, -32, -72, -80, -48, -72, -88, -88, -72, -24, 64, 88, -56, -120, 96, 104, 88, -128, -72, 48, 56, 56, 104, 104, 120, 112, -120, -16, -128, 104, -88, -40, -48, -48, 88, -120, -24, 104, 88, -104, -40, -56, -72, -128, 112, -88, -128, 96, -88, -104, -88, -24, -96, -120, 120, -88, -128, -80, -56, -56, -64, 96, 120, -8, -96, -128, -88, -80, -96, -104, -32, -72, -72, 96, 104, 112, 96, -104, -8, -72, -112, -112, -64, -72, -80, 64, 64, 72, -128, -120, -96, -128, 88, 88, -56, -72, -80, 88, 96, 120, -72, -128, 112, 72, 112, -40, 96, 120, -56, 88, -112, -16, 64, 104, -48, -64, -80, -88, -88, -120, -80, 88, 88, 96, -56, -96, -120, -40, -56, -64, 96, 104, 120, -120, -80, -24, -104, -88, -40, -48, -72, -80, -64, -56, -16, -88, -112, -128, -32, -48, -56, -24, -16, -8, -64, -120, 120, -96, -96, -88, 80, -128, -24, -56, -72, -88, -96, 120, 88, -72, -112, 120, -64, -104, 120, -48, -56, -64, -120, -104, -32, -104, 120, -80, -96, -112, -120, 56, 88, -64, -128, 96, 64, 88, 120, -40, -80, -104, -120, -104, -128, 104, 96, -104, -24, -72, -120, -128, 56, 96, -56, -128, 112, 104, -48, -88, -112, 96, 96, 104, -104, -88, -72, -40, -88, -96, -72, -88, -96, -120, 120, 104, -80, -88, -96, 72, 72, 80, -120, 88, 96, 120, -120, -24, 96, -104, -16, 104, 80, 48, -56, -80, -96, -56, -88, -104, -104, 120, -88, -88, 120, 104, -72, -120, -120, -24, -32, -40, 112, 88, -104, 120, 96, -104, -32, -32, -32, -96, 96, 96, 80, 80, 88, 64, 88, 120, 72, 120, -40, 72, 88, 112, -88, -96, -104, -56, -80, -88, -72, -88, -104, -56, -64, -72, -80, -120, 104, -80, -120, -80, -112, 112, -88, 120, 112, 112, 112, -96, -24, -120, -120, -64, -120, 120, -80, 64, 96, -128, 96, 64, 64, 96, -128, -32, 80, 112, -24, 112, -120, -24, 104, -96, -8, 96, 120, -16, -88, 120, 120, -72, -56, -16, -128, -128, -128, -104, -120, -72, -64, -96, -120, -32, -64, -64, -40, -48, -56, -64, -88, -96, -64, -104, -72, -96, -88, -24, -104, -96, -40, -96, -128, 96, -128, -128, -96, 104, 88, 80, 112, -88, -8, -64, -104, -80, -96, -120, 112, 96, 120, -32, 56, 80, -72, -104, -88, -32, 104, -128, -24, -56, -88, -120, -80, -72, -8, -96, -128, -128, -64, -128, 96, -72, -96, -120, 72, 104, -32, -96, 96, 64, -72, -96, -112, -32, -40, -48, -64, -88, -112, -88, -128, 96, -88, -128, -88, -64, -64, -32, -128, -96, -32, -88, -104, -112, 32, 32, 64, -120, 104, -88, 120, -120, -16, -104, 120, -72, -24, -48, -56, -96, -96, -96, -64, 96, 96, 96, 64, 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 44, 0, 0, 0, 0, 50, 0, 50, 0, 0, 8, -1, 0, 1, 8, 28, 72, -80, -96, -63, -125, 8, 19, 42, 92, -120, 112, 0, 3, 6, 12, 23, 6, -104, 72, -79, -94, -59, -117, 19, 39, -124, 64, -128, -128, 3, -121, 9, 19, 48, -118, -92, 24, 81, 33, -118, 8, 40, 7, -88, 84, -55, -64, 12, 6, 6, 45, 74, -54, 52, 8, 73, -60, 24, 22, 25, 92, 73, 40, 64, -96, -64, 74, -121, 24, 94, -58, -100, 25, -79, -59, 47, 17, 3, 52, -120, 88, -125, 105, 73, 6, 42, -102, -68, 96, -16, -71, 18, 3, -118, 6, 13, 14, -114, -36, 26, -64, 69, 7, 18, 28, -61, -110, -32, -32, -62, -54, -94, 72, -61, -48, -88, -40, 72, 34, -60, 4, 21, 23, -119, 14, -92, 80, -58, 6, -108, 10, 18, 44, 68, -8, 57, -96, -128, 16, 98, 70, -24, -48, 97, -45, 6, 4, 6, 16, 67, -27, 18, 52, -79, -52, -89, -46, 49, -105, -74, -32, 109, -45, -85, -63, -49, 2, 13, 88, -51, -62, 5, 40, 80, 31, 91, 103, 20, 11, -116, 32, -124, -81, -54, 2, 40, -58, -40, -103, -59, -122, 13, 43, 51, 12, 122, 106, 96, -48, 0, -105, 40, 29, 106, 32, 17, 20, -64, -69, -73, -17, -33, -68, 25, 113, 13, 80, -125, 44, -102, 72, 108, -84, -88, 80, 49, -127, -61, -94, 28, -97, -108, -4, -98, -103, 102, 9, -127, -21, -40, -81, 23, -32, 35, -126, 39, -10, 2, 32, -116, 29, -1, 27, -74, 37, -40, 29, 60, 90, -60, -120, -90, 0, -122, -118, -23, -107, 54, -36, -72, -15, 2, 66, -61, -23, -39, 24, -8, -36, -7, -108, -27, -128, 44, -59, -112, -16, -64, 67, 3, -39, 21, 72, 0, 6, 34, 120, -31, -123, 124, 124, 52, 16, 84, 3, -119, -88, 82, -62, 28, -2, 21, 4, -36, -123, -83, -92, -96, 97, 13, 20, 117, 112, 2, -121, 24, 77, -128, 6, 48, -64, 72, -93, -62, 31, 104, -56, 48, 68, 16, 65, 112, 49, 29, 67, 82, 8, 24, 72, 118, 18, 84, 48, 66, 6, 63, 72, 96, 96, 1, 26, -128, 64, -97, 8, 50, 24, 114, -64, -112, -22, -51, -28, 7, 24, 77, 116, -15, 75, 1, 123, 53, 2, -63, 15, 22, 88, 0, 1, 5, 44, 72, 32, -127, 74, -78, -47, -122, -62, 27, -90, -24, 49, -28, 1, 69, -106, -108, 76, 21, -99, 8, -127, -119, 29, -81, 60, 41, -63, 15, 16, -116, 80, 65, -114, 22, -44, 40, 72, 6, 111, 60, 4, 77, 3, 34, -124, 1, -60, -105, 7, 40, 96, -31, -123, -68, 49, -111, 66, 30, 32, 102, -92, 66, 30, 86, 60, -47, -63, 12, 30, 42, 58, 67, 13, 51, 120, -32, 1, 35, 30, 112, 112, -62, 39, -114, -80, 24, -124, 116, 47, 30, 116, 6, 15, -120, 24, -104, 93, 3, -105, 44, -79, 12, 11, -103, -116, 112, 35, 20, 52, -96, 64, 3, 32, 91, -40, -1, 114, 5, -97, 126, -106, 36, 5, 24, -106, -67, 103, 26, 3, 32, -68, -14, 10, 20, 44, 88, -78, -124, 37, 91, -124, -47, -33, -105, 112, -56, -28, 7, -103, -70, -86, 116, -57, 29, 52, 80, 37, -101, 8, 54, 24, 99, -121, 17, 82, -108, -80, 0, -83, 7, 93, 56, 70, 14, 41, -96, -78, -107, 11, -117, -48, 97, -42, 12, 127, 32, 64, 66, 91, 19, -96, -88, -94, 35, -16, 110, 10, -88, 65, 103, 76, -62, 67, 19, 114, -120, -102, 93, 49, 107, -108, 65, -121, 29, -121, -36, 65, -116, 16, 24, -32, 121, -125, 33, -70, 108, -96, 112, -97, 37, 5, -127, 100, 23, -128, -4, 68, 65, 5, 123, -103, 102, -63, 24, 101, -20, 49, -51, 33, -121, -40, 80, 65, 9, 122, 40, -84, 112, -78, 17, 73, 81, 69, -110, -110, -28, -38, -105, 9, 84, -30, 69, 21, -106, 60, 106, 32, 68, 25, -127, -96, -96, -25, 6, 14, 56, -96, 112, -83, 90, 81, 116, 2, -72, 57, 16, 66, 8, 88, 28, 49, 26, 66, 8, 51, 60, -15, -60, 9, 51, -128, -75, -82, 91, 19, 116, 96, -87, 12, 31, 84, 93, -75, 18, 91, 13, 100, -126, -67, 125, 72, 50, 72, 45, 63, 89, -112, 1, 5, 20, -104, 96, 65, 1, 38, -4, 48, 49, 4, -82, 60, 84, 48, 13, -90, 92, -111, -13, -36, 60, 39, -44, 66, 40, 96, -12, -47, -59, 32, 81, -20, -1, -15, 19, 4, 18, 68, 80, 64, 5, 72, -80, 0, -127, 9, 17, 72, -112, 9, 20, -106, -48, -48, -86, -79, 56, -49, 77, -14, 66, -76, -100, -68, 119, 20, 59, 44, -15, 19, -53, 20, 0, 30, 103, -101, 110, -66, 97, -122, 25, 52, 44, 33, -125, -74, 11, -92, -98, 115, -35, 90, -55, 1, 52, 33, 83, 76, 33, -118, 10, 97, 73, -70, 81, 7, 29, 44, -35, 1, -46, 29, 76, -22, 2, 7, 30, -84, 50, -60, 7, 48, 60, 114, -11, 112, 0, -124, -95, 67, 21, -110, 96, -66, -61, 14, 12, -84, 36, -27, 8, -99, -101, 80, -128, 5, 72, -36, -104, -55, 23, -92, 83, -95, -116, 19, 14, -92, 46, 62, -21, 8, 21, 1, 68, 9, -93, -124, -78, 3, 51, 59, -68, -84, 82, -30, 72, 84, 64, 1, 18, 121, 85, 0, -123, 32, -126, -80, -112, 6, -56, 11, -32, 32, -2, -28, 10, -71, -64, 5, -80, 48, 7, 74, 56, -63, 16, 58, -40, 65, 45, -28, -16, 5, -108, 56, 16, 37, -112, -80, 17, 5, 70, -16, 6, 87, 124, -127, 5, -98, 0, -126, 3, 30, -128, -125, 14, -30, 64, 1, 2, 12, -95, 8, 67, 8, 0, -118, 108, -126, 8, 31, -16, 1, 40, 100, -96, -120, 20, 76, 33, 18, 121, -104, 64, 88, 102, 24, 2, -78, 48, 66, 5, -101, -96, 26, 12, 118, -72, 67, 100, 12, 103, 34, 4, 89, 65, 18, -1, 72, -127, -125, 2, 30, 80, 7, -107, -24, -37, 22, 26, -15, -66, 2, 20, -96, 17, 12, 64, 65, 52, -30, -74, -128, 7, 88, -47, -118, -28, 99, -120, 2, 122, -112, -124, 36, -100, 34, 1, 14, -48, -126, 26, 74, -128, -121, 80, 68, 33, 10, -127, -80, -127, 6, 98, -122, 1, 42, 120, 34, 11, 27, -72, -94, 21, 1, 56, 19, 50, 116, -47, -117, -89, 32, -59, 3, 28, 112, 5, 39, -108, 0, -119, 81, 16, -123, 17, 108, 96, 6, 42, -8, 65, 91, 15, 72, -128, 28, -77, -120, 16, -116, -64, -30, 25, 113, -120, 100, 36, -101, -15, 8, 24, -84, 80, 6, 46, -116, 93, 36, -124, -9, 1, 34, 120, -46, -109, 71, -8, 33, 73, 16, 66, -122, 21, -12, -32, -108, 61, 40, 5, 47, 18, 48, -121, 62, -2, 113, 18, 58, 112, -62, 6, 18, 64, -53, 90, 50, 82, 49, 10, 40, -62, 41, 11, -63, 75, 94, -68, 32, 117, 106, -16, -93, 30, 18, 89, -53, 4, -60, 64, 52, 10, 81, -128, 47, 86, -64, 76, 102, -106, 34, 23, 47, -48, -126, 22, 28, 80, 76, 90, -34, 82, 32, 6, -56, -90, 54, 69, 25, 0, 38, -64, -126, 11, 71, 8, -89, 56, -107, -96, 8, 31, -104, -45, 7, 68, -32, 2, 55, -127, 72, -108, 11, -112, -95, 8, 49, -120, -89, 60, 71, -15, -126, 122, 38, -32, -102, -56, 60, -120, 2, 110, 80, 51, -124, 126, -58, -94, 8, -62, -88, -25, 49, -13, 41, 23, 5, -112, -31, 6, 8, 93, 65, 64, -15, -39, -56, 117, 98, -124, 9, 51, -72, -59, 45, 56, -95, 78, -121, 6, -128, -96, 5, -39, 39, 67, 49, -54, -47, -114, 122, -44, 32, 1, 1, 0, 59 }; </code></pre>
[ { "answer_id": 116184, "author": "Kip", "author_id": 18511, "author_profile": "https://Stackoverflow.com/users/18511", "pm_score": 3, "selected": true, "text": "class MyClass\n{\n private String[] s = { \"a\", \"b\", \"c\"}\n\n public MyClass()\n {\n }\n" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115685", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9425/" ]
115,692
<p>For example I have such query:</p> <pre><code>Query q = sess.createQuery("from Cat cat"); List cats = q.list(); </code></pre> <p>If I try to make something like this it shows the following warning </p> <pre><code>Type safety: The expression of type List needs unchecked conversion to conform to List&lt;Cat&gt; List&lt;Cat&gt; cats = q.list(); </code></pre> <p>Is there a way to avoid it?</p>
[ { "answer_id": 115719, "author": "Dave L.", "author_id": 3093, "author_profile": "https://Stackoverflow.com/users/3093", "pm_score": 2, "selected": false, "text": "@SuppressWarnings(\"unchecked\")" }, { "answer_id": 115952, "author": "Joe Dean", "author_id": 5917, "au...
2008/09/22
[ "https://Stackoverflow.com/questions/115692", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20128/" ]
115,694
<p>Anyone know how to turn off code folding in visual studio 2008? Some of my colleagues love it, but I personally always want to see all the code, and never want code folded out of sight. I'd like a setting that means my copy of Visual Studio never folds <code>#regions</code>or function bodies. </p>
[ { "answer_id": 16943723, "author": "xks", "author_id": 1012881, "author_profile": "https://Stackoverflow.com/users/1012881", "pm_score": 0, "selected": false, "text": "\n Private Sub DocumentEvents_DocumentOpened(ByVal Document As EnvDTE.Document) Handles DocumentEvents.DocumentOpened...
2008/09/22
[ "https://Stackoverflow.com/questions/115694", "https://Stackoverflow.com", "https://Stackoverflow.com/users/6722/" ]
115,703
<p>I have some template code that I would prefer to have stored in a CPP file instead of inline in the header. I know this can be done as long as you know which template types will be used. For example:</p> <p><strong>.h file</strong></p> <pre><code>class foo { public: template &lt;typename T&gt; void do(const T&amp; t); }; </code></pre> <p><strong>.cpp file</strong></p> <pre><code>template &lt;typename T&gt; void foo::do(const T&amp; t) { // Do something with t } template void foo::do&lt;int&gt;(const int&amp;); template void foo::do&lt;std::string&gt;(const std::string&amp;); </code></pre> <p>Note the last two lines - the foo::do template function is only used with ints and std::strings, so those definitions mean the app will link.</p> <p>My question is - is this a nasty hack or will this work with other compilers/linkers? I am only using this code with VS2008 at the moment but will be wanting to port to other environments.</p>
[ { "answer_id": 115792, "author": "Ben Collins", "author_id": 3279, "author_profile": "https://Stackoverflow.com/users/3279", "pm_score": 2, "selected": false, "text": "export" }, { "answer_id": 13952386, "author": "namespace sid", "author_id": 708995, "author_profile"...
2008/09/22
[ "https://Stackoverflow.com/questions/115703", "https://Stackoverflow.com", "https://Stackoverflow.com/users/9236/" ]
115,720
<p>Is there a command in classic ASP I can use to tell the browser not to pull the page from it's cache, or, to not cache, or clear the cache of my page?</p>
[ { "answer_id": 115734, "author": "Espo", "author_id": 2257, "author_profile": "https://Stackoverflow.com/users/2257", "pm_score": 0, "selected": false, "text": "Response.Expires = -1\n" }, { "answer_id": 115756, "author": "Forgotten Semicolon", "author_id": 1960, "aut...
2008/09/22
[ "https://Stackoverflow.com/questions/115720", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5836/" ]
115,764
<p>I have some Python code that creates a Calendar object based on parsed VEvent objects from and iCalendar file.</p> <p>The calendar object just has a method that adds events as they get parsed.</p> <p>Now I want to create a factory function that creates a calendar from a file object, path, or URL.</p> <p>I've been using the <a href="http://codespeak.net/icalendar/" rel="nofollow noreferrer">iCalendar python module</a>, which implements a factory function as a class method directly on the Class that it returns an instance of:</p> <pre><code>cal = icalendar.Calendar.from_string(data) </code></pre> <p>From what little I know about Java, this is a common pattern in Java code, though I seem to find more references to a factory method being on a different class than the class you actually want to instantiate instances from.</p> <p>The question is, is this also considered Pythonic ? Or is it considered more pythonic to just create a module-level method as the factory function ?</p>
[ { "answer_id": 115853, "author": "S.Lott", "author_id": 10661, "author_profile": "https://Stackoverflow.com/users/10661", "pm_score": 4, "selected": false, "text": "from_string" }, { "answer_id": 115933, "author": "Thomas Wouters", "author_id": 17624, "author_profile"...
2008/09/22
[ "https://Stackoverflow.com/questions/115764", "https://Stackoverflow.com", "https://Stackoverflow.com/users/2900/" ]
115,773
<p>I'm using python and CherryPy to create a simple internal website that about 2 people use. I use the built in webserver with CherryPy.quickstart and never messed with the config files. I recently changed machines so I installed the latest Python and cherrypy and when I run the site I can access it from localhost:8080 but not through the IP or the windows machine name. It could be a machine configuration difference or a newer version of CherryPy or Python. Any ideas how I can bind to the correct IP address?</p> <p>Edit: to make it clear, I currently don't have a config file at all.</p>
[ { "answer_id": 115826, "author": "nosklo", "author_id": 17160, "author_profile": "https://Stackoverflow.com/users/17160", "pm_score": 5, "selected": true, "text": "cherrypy.server.socket_host = 'www.machinename.com'\ncherrypy.engine.start()\ncherrypy.engine.block()\n" }, { "answe...
2008/09/22
[ "https://Stackoverflow.com/questions/115773", "https://Stackoverflow.com", "https://Stackoverflow.com/users/852/" ]
115,809
<p>Many beginning programmers write code like this:</p> <pre><code>sub copy_file ($$) { my $from = shift; my $to = shift; `cp $from $to`; } </code></pre> <p>Is this bad, and why? Should backticks ever be used? If so, how?</p>
[ { "answer_id": 115810, "author": "raldi", "author_id": 7598, "author_profile": "https://Stackoverflow.com/users/7598", "pm_score": 3, "selected": false, "text": "my $cmd = \"./do_something.sh foo bar\";\nmy $output = `$cmd`;\n\nif ($?) {\n die \"Error running [$cmd]\";\n}\n" }, { ...
2008/09/22
[ "https://Stackoverflow.com/questions/115809", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7598/" ]
115,813
<p>I have been trying to produce a statically linked "single binary" version of my game for windows. I want to link with sdl, sdl_image and sdl_mixer which in turn pull in a few support libraries. Unfortunately I haven't found a way to get them all to compile and link using cygwin/mingw/gcc. As far as I can tell all existing public versions are only shared libraries / dlls.</p> <p>Please note that I'm not talking about licencing here. The source will be open thus the GPL/LGPLness of sdl is not relevant.</p>
[ { "answer_id": 525124, "author": "Alex Lyman", "author_id": 5897, "author_profile": "https://Stackoverflow.com/users/5897", "pm_score": 6, "selected": true, "text": "sdl-config --libs" }, { "answer_id": 1416421, "author": "singpolyma", "author_id": 8611, "author_profi...
2008/09/22
[ "https://Stackoverflow.com/questions/115813", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20555/" ]
115,819
<p>My machine is seriously underpowered, and I think I need to start conserving every spare cycle. I know that my Gnome environment seems to underperform compared to my coworkers' KDE setups. But if I'm going to make that big of a switch, I might as well consider running something even lighter.</p> <p>Is it possible to survive on a lightweight window manager and still run modern apps (Firefox, Eclipse, OpenOffice)? What's a good candidate window manager for me to try, and what do I need to know?</p>
[ { "answer_id": 20819825, "author": "gavenkoa", "author_id": 173149, "author_profile": "https://Stackoverflow.com/users/173149", "pm_score": 1, "selected": false, "text": "Xlib" } ]
2008/09/22
[ "https://Stackoverflow.com/questions/115819", "https://Stackoverflow.com", "https://Stackoverflow.com/users/18103/" ]
115,835
<p>I am looking into an image processing problem for semi-real time detection of certain scenarios. My goal is to have the live video arrive as Motion JPEG frames in my Java code <em>somehow</em>. </p> <p>I am familiar with the <a href="http://java.sun.com/javase/technologies/desktop/media/jmf/" rel="noreferrer">Java Media Framework</a> and, sadly, I think we can consider that an effectively dead API. I am also familiar with <a href="http://www.axis.com/" rel="noreferrer">Axis boxes</a> and, while I really like their solution, I would appreciate any critical feedback on my specific points of interest. </p> <p>This is how I define "best" for the purpose of this discussion:</p> <ul> <li>Latency - if I'm controlling the camera using this video stream, I would like to keep my round-trip latency at less than 100 milliseconds if possible. That's measured as the time between my control input to the time when I see the visible change. EDIT some time later: another thing to keep in mind is that camera control is likely to be a combination of manual and automatic (event triggers). We need to see those pictures right away, even if the high quality feed is archived separately.</li> <li>Cost - free / open source is better than not free.</li> <li>Adjustable codec parameters - I need to be able to tune the codec for certain situations. Sometimes a high-speed low-resolution stream is actually easier to process.</li> <li>"Integration" with Java - how much trouble is it to hook this solution to my code? Am I sending packets over a socket? Hitting URLs? Installing Direct3D / JNI combinations?</li> <li>Windows / Linux / both? - I would prefer an operating system agnostic solution because I have to deliver to several flavors of OS but there may be a solution that is optimal for one but not the other.</li> </ul> <p>NOTE: I am aware of other image / video capture codecs and that is not the focus of this question. I am specifically <em>not</em> interested in streaming APIs (e.g., MPEG4) due to the loss of frame accuracy. However, if there is a solution to my question that delivers another frame-accurate data stream, please chime in.</p> <p>Follow-up to this question: at this point, I am strongly inclined to buy appliances such as the <a href="http://www.axis.com/products/video/video_server/index.htm" rel="noreferrer">Axis video encoders</a> rather than trying to capture the video in software or on the PC directly. However, if someone has alternatives, I'd love to hear them.</p>
[ { "answer_id": 9046373, "author": "gtiwari333", "author_id": 607637, "author_profile": "https://Stackoverflow.com/users/607637", "pm_score": 3, "selected": false, "text": "import com.googlecode.javacv.OpenCVFrameGrabber;\n\nimport com.googlecode.javacv.cpp.opencv_core.IplImage;\nimport s...
2008/09/22
[ "https://Stackoverflow.com/questions/115835", "https://Stackoverflow.com", "https://Stackoverflow.com/users/5812/" ]
115,836
<p>A friend of mine brought up this questiont he other day, he's recently bought a garmin heart rate moniter device which keeps track of his heart rate and allows him to upload his heart rate stats for a day to his computer.</p> <p>The only problem is there are no linux drivers for the garmin USB device, he's managed to interpret some of the data, such as the model number and his user details and has identified that there are some binary datatables essentially which we assume represent a series of recordings of his heart rate and the time the recording was taken.</p> <p>Where does one start when reverse engineering data when you know nothing about the structure? </p>
[ { "answer_id": 115920, "author": "freespace", "author_id": 8297, "author_profile": "https://Stackoverflow.com/users/8297", "pm_score": 0, "selected": false, "text": "strings" }, { "answer_id": 2389469, "author": "TMN", "author_id": 69471, "author_profile": "https://St...
2008/09/22
[ "https://Stackoverflow.com/questions/115836", "https://Stackoverflow.com", "https://Stackoverflow.com/users/20400/" ]
115,844
<p>From <a href="http://pypi.python.org/pypi/PyPubSub/" rel="noreferrer">PyPubSub</a>:</p> <blockquote> <p>Pypubsub provides a simple way for your Python application to decouple its components: parts of your application can publish messages (with or without data) and other parts can subscribe/receive them. This allows message "senders" and message "listeners" to be unaware of each other:</p> <ul> <li>one doesn't need to import the other</li> <li>a sender doesn't need to know <ul> <li>"who" gets the messages, </li> <li>what the listeners will do with the data, </li> <li>or even if any listener will get the message data.</li> </ul></li> <li>similarly, listeners don't need to worry about where messages come from.</li> </ul> <p>This is a great tool for implementing a Model-View-Controller architecture or any similar architecture that promotes decoupling of its components.</p> </blockquote> <p>There seem to be quite a few Python modules for publishing/subscribing floating around the web, from PyPubSub, to <a href="http://pydispatcher.sourceforge.net/" rel="noreferrer">PyDispatcher</a> to simple "home-cooked" classes.</p> <p>Are there specific advantages and disadvantages when comparing different different modules? Which sets of modules have been benchmarked and compared?</p> <p>Thanks in advance</p>
[ { "answer_id": 16918220, "author": "Jabba", "author_id": 232485, "author_profile": "https://Stackoverflow.com/users/232485", "pm_score": 2, "selected": false, "text": "from time import sleep\nimport smokesignal\n\n@smokesignal.on('debug')\ndef verbose(val):\n print \"#\", val\n\n\ndef...
2008/09/22
[ "https://Stackoverflow.com/questions/115844", "https://Stackoverflow.com", "https://Stackoverflow.com/users/8206/" ]
115,850
<p>I'd like to implement a way to display a list of stored addresses sorted by proximity to a given address.</p> <p>Addresses in the list will be stored in a database table. Separate parts have separate fields (we have fields for postal code, city name, etc.) so it is not just a giant <code>varchar</code>. These are user-entered and due to the nature of the system may not always be complete (some may be missing postal code and others may have little more than city and state).</p> <p>Though this is for an intranet application I have no problems using outside resources including accessing internet web services and such. I'd actually prefer that over rolling my own unless it would be trivial to do myself. If Google or Yahoo! already provides a free service, I'm more than willing to check it out. The keyword is it must be free, as I'm not at liberty to introduce any additional cost onto this project for this feature as it is already a bonus "perk" so to speak.</p> <p>I'm thinking of this much like many brick &amp; mortar shops do their "Find a Location" feature. Showing it in a simple table sorted appropriately and displaying distance (in, say, miles) is great. Showing a map mash-up is even cooler, but I can definitely live with just getting the distance back and me handling all of the subsequent display and sorting.</p> <p>The problem with simple distance algorithms is the nature of the data. Since all or part of the address can be undefined, I don't have anything convenient like lat/long coords. Also, even if I make postal codes required, 90% of the addresses will probably have the same five postal codes.</p> <p>While it need not be blisteringly fast, anything that takes more than seven seconds to show up on the page due to latency might be too long for the average user to wait, as we know. If such a hypothetical service supports sending a batch of addresses at once instead of querying one at a time, that'd be great. Still, I should not think the list of addresses would exceed 50 total, if that many.</p>
[ { "answer_id": 115957, "author": "Rahul", "author_id": 16308, "author_profile": "https://Stackoverflow.com/users/16308", "pm_score": 2, "selected": false, "text": "public static double distance(double lat1, double lon1, double lat2, double lon2, char unit)\n{\n double theta = lon1 - lon...
2008/09/22
[ "https://Stackoverflow.com/questions/115850", "https://Stackoverflow.com", "https://Stackoverflow.com/users/7290/" ]
115,862
<p>I'm not sure about what's the difference between opening a JS script with </p> <pre><code>&lt;SCRIPT language='JavaScript'&gt; </code></pre> <p>or with:</p> <pre><code>&lt;SCRIPT type="text/JavaScript"&gt; </code></pre> <p>Should JavaScript always be quoted (either with " " or with ' ') or that's not really important?</p> <p>Thank you for any clarification on this topic!</p>
[ { "answer_id": 115871, "author": "Joel Coehoorn", "author_id": 3043, "author_profile": "https://Stackoverflow.com/users/3043", "pm_score": -1, "selected": false, "text": "<script language=\"javascript\" type=\"text/javascript\">\n" }, { "answer_id": 115911, "author": "Quentin...
2008/09/22
[ "https://Stackoverflow.com/questions/115862", "https://Stackoverflow.com", "https://Stackoverflow.com/users/19159/" ]
115,866
<p>Convert mysql timestamp to epoch time in python - is there an easy way to do this?</p>
[ { "answer_id": 115903, "author": "David Singer", "author_id": 4618, "author_profile": "https://Stackoverflow.com/users/4618", "pm_score": 5, "selected": false, "text": "select unix_timestamp(fieldname) from tablename;\n" }, { "answer_id": 118236, "author": "Tony Meyer", "...
2008/09/22
[ "https://Stackoverflow.com/questions/115866", "https://Stackoverflow.com", "https://Stackoverflow.com/users/-1/" ]
115,868
<p>I'd like to know how to grab the Window title of the current active window (i.e. the one that has focus) using C#. </p>
[ { "answer_id": 115891, "author": "ine", "author_id": 4965, "author_profile": "https://Stackoverflow.com/users/4965", "pm_score": 2, "selected": false, "text": "GetForegroundWindow()" }, { "answer_id": 115905, "author": "Jorge Ferreira", "author_id": 6508, "author_prof...
2008/09/22
[ "https://Stackoverflow.com/questions/115868", "https://Stackoverflow.com", "https://Stackoverflow.com/users/1039/" ]
115,873
<p>Our organization has a lot of its essential data in a mainframe Adabas database. We have ODBC access to this data and from C# have queried/updated it successfully using ODBC/Natural "stored procedures".</p> <p>What we'd like to be able to do now is to query a mainframe table from within SQL Server 2005 stored procs, dump the results into a table variable, massage it, and join the result with native SQL data as a result set.</p> <p>The execution of the Natural proc from SQL works fine when we're just selecting it; however, when we insert the result into a table variable SQL seems to be starting a distributed transaction that in turn seems to be wreaking havoc with our connections.</p> <p>Given that we're not performing updates, is it possible to turn off this DTC-escalation behavior? </p> <p>Any tips on getting DTC set up properly to talk to DataDirect's (formerly Neon Systems) Shadow ODBC driver?</p>
[ { "answer_id": 366535, "author": "gbn", "author_id": 27535, "author_profile": "https://Stackoverflow.com/users/27535", "pm_score": 2, "selected": false, "text": "SET REMOTE_PROC_TRANSACTIONS OFF" }, { "answer_id": 2705986, "author": "Registered User", "author_id": 38332, ...
2008/09/22
[ "https://Stackoverflow.com/questions/115873", "https://Stackoverflow.com", "https://Stackoverflow.com/users/12260/" ]
115,882
<p>A product that I am working on collects several thousand readings a day and stores them as 64k binary files on a NTFS partition (Windows XP). After a year in production there is over 300000 files in a single directory and the number keeps growing. This has made accessing the parent/ancestor directories from windows explorer very time consuming. </p> <p>I have tried turning off the indexing service but that made no difference. I have also contemplated moving the file content into a database/zip files/tarballs but it is beneficial for us to access the files individually; basically, the files are still needed for research purposes and the researchers are not willing to deal with anything else. </p> <p>Is there a way to optimize NTFS or Windows so that it can work with all these small files? </p>
[ { "answer_id": 115946, "author": "mdb", "author_id": 8562, "author_profile": "https://Stackoverflow.com/users/8562", "pm_score": 3, "selected": false, "text": "ABC\\\n DEF\\\n ABCDEFGHI.db\n EFG\\\n ABCEFGHIJ.db\n" }, { "answer_id": 115986, "author": "fina...
2008/09/22
[ "https://Stackoverflow.com/questions/115882", "https://Stackoverflow.com", "https://Stackoverflow.com/users/13054/" ]