instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have a site that is using x509 client certificates (2 way SSL) to authenticate users and an LDAP directory that contains authorization information. I would like to use one of the certificate attributes to query the directory ( SSL_CLIENT_S_DN_CN to be exact ). I see how to use mod_ssl to use the user's client cer...
<p>A module exists for apache 2.2.x: <a href="http://www.urec.fr/rubrique34.html" rel="nofollow noreferrer">modXLDAPAuth</a></p>
<p>this might help: <a href="http://httpd.apache.org/docs/2.2/mod/mod_ldap.html#settingcerts" rel="nofollow noreferrer">settingcerts</a> + <a href="http://httpd.apache.org/docs/2.2/mod/mod_authnz_ldap.html#authldapurl" rel="nofollow noreferrer">mod_authnz_ldap</a> (authldapurl)</p>
24,213
<p>What's the "right" way to do the following as a boolean expression?</p> <pre><code>for i in `ls $1/resources`; do if [ $i != "database.db" ] then if [ $i != "tiles" ] then if [ $i != "map.pdf" ] then if [ $i != "map.png" ] then ...
<p>The other solutions have a couple of common mistakes: <a href="http://www.pixelbeat.org/programming/shell_script_mistakes.html" rel="nofollow noreferrer">http://www.pixelbeat.org/programming/shell_script_mistakes.html</a></p> <ol> <li><p><code>for i in $(ls ...)</code> is redundant/problematic just do: <code>for i ...
<pre><code>for i in `ls $1/resources`; do if [ $i != "database.db" ] &amp;&amp; [ $i != "tiles" ] &amp;&amp; [ $i != "map.pdf" ] &amp;&amp; [ $i != "map.png" ]; then svn export -q $1/resources/$i ../MyProject/Resources/$i </code></pre>
7,123
<p>I'm trying to create a server control, which inherits from TextBox, that will automatically have a <a href="http://www.asp.net/AJAX/AjaxControlToolkit/Samples/Calendar/Calendar.aspx" rel="nofollow noreferrer">CalendarExtender</a> attached to it. Is it possible to do this, or does my new control need to inherit from ...
<p>I accomplished this in a project a while back. To do it I created a CompositeControl that contains both the TextBox and the CalendarExtender.</p> <p>In the <code>CreateChildControls</code> method of the CompositeControl I use code similar to this:</p> <pre><code>TextBox textbox = new TextBox(); textbox.ID = this.I...
<p>When you are trying to not allow users to type anything in the textbox, but only be filled by the calendar extender and then you try to get the selected date from the textbox control it may be empty string if you have set the textbox property to ReadOnly="True".</p> <p>Its because read only controls are NOT posted ...
10,934
<p>At my last place of employment, I used BTS quite a bit. However, I've noticed that managers often want to use it for the wrong things, and developers are hesitant to adopt it.</p> <p>So, I'm just wondering, how's BTS being used? Please post experiences, not theories. Thanks!</p>
<p>I've worked as a consultant for one the largest oil/energy companies in Europe and they basically use BizTalk for all their messaging/integration stuff. Examples are: Invoices (electronic invoices) sent from and to partners in different formats, sync jobs between AD and third party software that maintains it's own u...
<p>Personally have developed for: </p> <p>Procurement: handling buying request for a hospital to different manufacturing companies. These companies would have varying xml requests sent out to different companies, where each manufacture will have it's own style. All purchases then were also made into a html/xslt report...
16,562
<p>Goal: Efficiently show/hide rows based on the data in the row.</p> <ol> <li>Create a helper column that determines whether or not a row should be hidden.</li> <li>Have the formula in the helper column return an error or a number.</li> <li>Hide the helper column and write code to execute the hiding/showing.</li> </...
<p>there is a different way and that is to use th auto filter feature - after all VBA has an A in it - use the features of the application wherever possible so this bit of code is pretty short and sweet - assumes that the data is a contiguous block in columns a and b and assumes no other error handling in play. the res...
<p>If you do not wish to show the user what's happening, would it not be better to perform the calculation in VBA itself, rather than in a hidden column? Granted, that would seem to lock you into option 2, which I suspect is the slower option ... most of my VBA experience is in older versions of Excel, so I've not had ...
36,656
<p>I don't understand what's wrong with my G-code. I have set the printing temperature to 195 °C but when I try to print, the target temperature is always 0 °C and printing never starts.</p> <p><a href="https://i.stack.imgur.com/hkB6E.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hkB6E.jpg" alt="en...
<p>I got the same problem today and after a lot of troubleshooting (following the answers here) I found out that the <strong>issue was the connection to the hotbed</strong>. After I clean out the connection to the hotbed the printer started working as usual. The debugging logic was that <strong>the printer heats up the...
<p>Double check the physical connection to the heating element and the thermistor that go in the hot end. Those wires and crimps aren't great. I had one fail on me out of the box with my A8. Re-crimping did the trick.</p>
1,219
<p>I have an input String say <code>Please go to http://stackoverflow.com</code>. The url part of the String is detected and an anchor <code>&lt;a href=""&gt;&lt;/a&gt;</code> is automatically added by many browser/IDE/applications. So it becomes <code>Please go to &lt;a href='http://stackoverflow.com'&gt;http://stacko...
<h2>Use java.net.URL for that!!</h2> <p>Hey, why don't use the core class in java for this "java.net.URL" and let it validate the URL. </p> <p>While the following code violates the golden principle "Use exception for exceptional conditions only" it does not make sense to me to try to reinvent the wheel for something ...
<p>To detect an URL you just need this:</p> <pre><code>if (yourtextview.getText().toString().contains("www") || yourtextview.getText().toString().contains("http://"){ your code here if contains URL;} </code></pre>
36,271
<p>Inversion of Control (IoC) can be quite confusing when it is first encountered.</p> <ol> <li>What is it?</li> <li>Which problem does it solve?</li> <li>When is it appropriate to use and when not?</li> </ol>
<p>The <strong><code>Inversion-of-Control</code> (IoC)</strong> pattern, is about providing <em>any kind</em> of <code>callback</code> (which controls reaction), instead of acting ourself directly (in other words, inversion and/or redirecting control to external handler/controller). The <strong><code>Dependency-Injecti...
<p>Inversion of control is an indicator for a shift of responsibility in the program.</p> <p>There is an inversion of control every time when a dependency is granted ability to directly act on the caller's space.</p> <p>The smallest IoC is passing a variable by reference, lets look at non-IoC code first:</p> <pre><code...
2,521
<p>I have a Windows forms project and a Web Service project in my solution, and I'm trying to call the web service and return a customer object as the result. The problem is that when I try to receive the return object, I get an error that it can't convert it. For example, here is the signature for my webservice:</p> ...
<p>This is actually pretty common. What's happening is that the Web Service has defined in it the definitions of all the types used in the web service. When you add a reference to that web service, it auto-generates a proxy type in a sub namespace of your namespace. That is what is being returned by your web service...
<p>The web service reference in a VB.NET or C# project can reference <em>any</em> type of web service and is not limited to those provided by ASP.NET. That is why Visual Studio creates proxy classes for each object which can be retrieved from the web service.</p>
23,457
<p>When a user logs in to my site I want a css styled button to appear (this could be anything really, i.e. some special news text item etc), how can you do this via masterpages in asp.net? Or is there some other way you do this?</p>
<p>You haven't provided a whole lot of information about your setup simon, but assuming you're using a .NET Membership Provider, then you can use a login view to have a section of your page render differently for logged in Vs. not</p> <pre><code> &lt;asp:LoginView&gt; &lt;AnonymousTemplate&gt; N...
<p>This MSDN article describes how you can find and manipulate master page content from a content page. </p> <p><a href="http://msdn.microsoft.com/en-us/library/xxwa0ff0(VS.85).aspx" rel="nofollow noreferrer">MSDN</a></p>
30,105
<p>This is a nut I'm cracking these days</p> <p>Application I'm working on has some advanced processing towards SQL. One of the operations selects various metadata on the objects in the current context from different tables, based on the item names in the collection. For this, a range of "select...from...where...in()"...
<p>One potential workaround is to use the ability to query XML and simply send all the data for your 'in' as an xml column and then join on that. </p> <p>The same approach could be used to populate your temp table, but then again, why not just use it directly.</p> <p>Here's a short sample that should illustrate:</p> ...
<p>For the bulk update problem: take a look at data adapter with a data table in it. You can set a parameter that allows you to insert/update the items in the table in batches, and you can choose the nr of items in a batch <a href="http://msdn.microsoft.com/en-us/library/kbbwt18a(VS.80).aspx" rel="nofollow noreferrer">...
20,087
<p>Is there any online service available to validate Web Service WSDL file?</p>
<p>If you're using Eclipse, just have your WSDL in a .wsdl file, eclipse will validate it automatically.</p> <p>From the <a href="http://wiki.eclipse.org/WSDL_Validator" rel="noreferrer">Doc</a></p> <blockquote> <p>The WSDL validator handles validation according to the 4 step process defined above. Steps 1 and ...
<p>you might want to look at the online version of <a href="http://www.w3.org/2001/03/webdata/xsv" rel="nofollow noreferrer">xsv</a></p>
18,332
<p>I guess the real question is: </p> <p>If I don't care about dirty reads, will adding the <strong>with (NOLOCK)</strong> hint to a SELECT statement affect the performance of:</p> <ol> <li>the current SELECT statement </li> <li>other transactions against the given table</li> </ol> <p>Example:</p> <pre><code>Sele...
<p>1) <strong>Yes</strong>, a select with <code>NOLOCK</code> will complete faster than a normal select.</p> <p>2) <strong>Yes</strong>, a select with <code>NOLOCK</code> will allow other queries against the effected table to complete faster than a normal select.</p> <p><strong>Why would this be?</strong> </p> <p><c...
<ul> <li><p>The answer is <strong>Yes</strong> if the query is run multiple times at once, because each transaction won't need to wait for the others to complete. However, If the query is run once on its own then the answer is No.</p></li> <li><p><strong>Yes</strong>. There's a significant probability that careful use ...
25,794
<p>What's the easiest way to convert a percentage to a color ranging from Green (100%) to Red (0%), with Yellow for 50%?</p> <p>I'm using plain 32bit RGB - so each component is an integer between 0 and 255. I'm doing this in C#, but I guess for a problem like this the language doesn't really matter that much.</p> <p>...
<p>I made this function in JavaScript. It returns the color is a css string. It takes the percentage as a variable, with a range from 0 to 100. The algorithm could be made in any language:</p> <pre><code>function setColor(p){ var red = p&lt;50 ? 255 : Math.round(256 - (p-50)*5.12); var green = p&gt;50 ? 255 : ...
<p>Because it's R-G-B, the colors go from integer values of -1 (white), to -16777216 for black. with red green and yellow somewhere in the middle that. Yellow is actually -256, while red is -65536 and green is -16744448. So yellow actually isn't between red and green in the RGB notation. I know that in terms of wav...
4,466
<p>Our solution has a lot of todo comments, but unfortunately it seems the only way to sort them is by file. Sorting by project would give me a much better overview of what I'm actually responsible for. Just wondering if there's any way to do this or any add-ins that provide better functionality.</p>
<p><a href="http://www.jetbrains.com/resharper/index.html" rel="noreferrer">Resharper 4.0</a> does this for you. They have a "To-do Explorer". Uses comments to find TODO, Note and Bug comments.</p> <p><strong>Edit:</strong> Here is a link to the <a href="http://www.jetbrains.com/resharper/features/navigation_search....
<p>I ended up just using trusty find-in-files for <strong><code>todo:</code></strong> which can be limited to the current project or a user defined folder set. Your wallet may vary.</p>
44,399
<p>What open source licenses are more corporate-friendly, i.e., they can be used in commercial products without the need to open source the commercial product?</p>
<p>I recommend the Apache License (specifically, version 2). It is not a “copy left” license and it addresses several matters that are important to established companies and their lawyers.</p> <p>“Copy left” is the philosophy of the free software foundation requiring anything incorporating the licensed opens source c...
<p>MIT, Apache and BSD tend to be the most corporate friendly. The least corporate friendly that I have ran across are usually Q Public, GPL and Mozilla...</p>
4,814
<p>We have a SQL Server table containing Company Name, Address, and Contact name (among others).</p> <p>We regularly receive data files from outside sources that require us to match up against this table. Unfortunately, the data is slightly different since it is coming from a completely different system. For example...
<p>Here's something I wrote for a nearly identical stack (we needed to standardize the manufacturer names for hardware and there were all sorts of variations). This is client side though (VB.Net to be exact) -- and use the Levenshtein distance algorithm (modified for better results):</p> <pre><code> Public Shared ...
<p>There's quite a few ways to tackle this that may not be obvious. The best is finding unique identifiers that you can use for matching outside of the fields with mis spellings, etc.</p> <p>Some thoughts</p> <ol> <li>The obvious, Social security number, drivers license, etc</li> <li>Email address</li> <li>Cleansed p...
15,438
<p>If you have a table with a compound primary key that is composed of a foreign key and other table columns, how do you get ASP.NET Dynamic Data to allow the non-foreign primary key table columns to be editable?</p>
<p>LINQ to SQL does not support changing the primary key of an entity even without using Dynamic Data.</p>
<p>A primary key represents the identity of an entity. It is assumed that primary key fields are never changed. Your question suggests that you might be using primary keys incorrectly.</p>
13,197
<p>I drew a fairly simple model in Google SketchUp. I exported it as an STL. I imported it into Cura and exported as gcode. Then I printed the model.</p> <p>All of the bottom layers of the model cover the entire space instead of leaving the two open gaps that should exist. I don't know why it's happening. Do I have so...
<p>I suspect, as I am wont to do, that your problem lies in the STL created by SketchUp. It's an unfortunate aspect of that program that it creates non-manifold models which creates troubles such as this. </p> <p>Consider to load your STL file into a program suitable for showing flaws (and repairing them) to determine...
<p>You have a problem with your STL file. Check the orientation of the faces of your 3D model, if that is not the problem, search for a software to fix your stl file. Just a tip, give Fusion360 a try, it is the best!</p>
758
<p>Should I try to actually upgrade my existing app, or just rewrite it mostly from scratch, saving what pieces (templates, etc) I can?</p>
<p>Although this depends on what you're doing, most applications should be able to just upgrade and then fix everything that breaks. In my experience, the main things that I've had to fix after an upgrade are</p> <ol> <li><p>Changes to some of the funky stuff with models, such as the syntax for following foreign keys...
<p>Only simplest sites are easy to upgrade.</p> <p>Expect real pain if your site happen to be for <em>non-ASCII</em> part of the world (read: anywhere outside USA and UK). The most painful change in Django was switching from bytestrings to unicode objects internally - now you have to find all places where you use byte...
15,632
<p>I got a program that writes some data to a file using a method like the one below.</p> <pre><code> public void ExportToFile(string filename) { using(FileStream fstream = new FileStream(filename,FileMode.Create)) using (TextWriter writer = new StreamWriter(fstream)) { // try catch block for w...
<p><strong>UPDATE:</strong></p> <p>Modified the code based on <a href="https://stackoverflow.com/a/4397002/11702">this answer</a> to get rid of obsolete methods.</p> <p>You can use the Security namespace to check this:</p> <pre><code>public void ExportToFile(string filename) { var permissionSet = new PermissionS...
<p>Wow...there is a lot of low-level security code in this thread -- most of which did not work for me, either -- although I learned a lot in the process. One thing that I learned is that most of this code is not geared to applications seeking per user access rights -- it is for Administrators wanting to alter rights p...
15,865
<p>I'm trying to find an zip compression and encryption component with <a href="http://www.networkworld.com/careers/2004/0315manonline.html" rel="noreferrer">encryption suitable for use by the US Federal Government</a>, so I can't use Zip 2.0 encryption, it has to be AES or the like. I've already found <a href="http:/...
<p>How much would you be willing to pay for AES in DotNetZip? ;)</p> <p>DotNetZip supports AES Encryption, with 128 or 256-bit keys. </p> <p><a href="http://www.codeplex.com/DotNetZip" rel="noreferrer">http://www.codeplex.com/DotNetZip</a></p> <p>Example code:</p> <pre><code> using (ZipFile zip = new ZipFile()) ...
<p>Check out this awesome article on the <a href="http://msdn.microsoft.com/en-us/magazine/cc163290.aspx" rel="nofollow noreferrer">Stream Pipeline</a>. It not only defines a cool way to link streams to each other in a multithreaded fashion, the example used is compression followed by encryption.</p>
44,253
<p>I've used <a href="http://ondras.zarovi.cz/sql/" rel="nofollow noreferrer">WWW SQL Designer</a> several times to design databases for applications. I'm now in charge of working on an application with a lot of tables (100+ mysql tables) and I would love to be able to look at the relations between tables in a manner s...
<p><a href="http://code.google.com/p/database-diagram/" rel="nofollow noreferrer">http://code.google.com/p/database-diagram/</a></p> <p>This takes a SQL structure (SQL dump) and shows a diagram :)</p>
<p>You could use VISIO to import the database, it will diagram it for you.</p>
14,339
<p>I'm running some java processes on Windows 2003 server R2 I'm using Apache log4j-1.2.8. All my processes called via one jar file with different parameter example</p> <pre><code> java -jar process.jar one java -jar process.jar two java -jar process.jar three </code></pre> <p>And I config log4j.propert...
<p>Is your log4j.properties file in the classpath when executed by the scheduler? I had a similar problem in the past, and it was due to the configuration file not being in the classpath.</p> <p>You can include it in your process.jar file, or specify its location like this:</p> <blockquote> <p>java -Dlog4j.config...
<p><strong>Many thanks, I will try again for your solution.</strong></p> <p>and Now My schedule executed my processes via bgprocess.bat </p> <p><strong>bgprocess.bat</strong></p> <pre><code>@echo off set CLASSPATH=.;%CLASSPATH% set path=C:\j2sdk1.4.2\bin;%path% javaw -jar process.jar %1 </code></pre> <p><strong>pr...
20,847
<p>I want to implement forms authentication on an ASP.NET website, the site should seek the user on the database to get some data and then authenticate against LDAP (Active Directory) to validate the user/password combo.</p> <p>After that I need to keep a instance of class that represents the user to use it in various...
<p>I would use Windows Authentication as the main authentication provider, but roll my own simple database persistence for user information.</p> <p>Your session method would work, you can adjust session timeout in IIS and match it to the authentication cookie timeout.</p> <p>Also, you can do something like this in a ...
<p>I set the session and auth cookie timeout values to the same value. I use sliding windows for my auth cookie. I also make it a habit to never assume that values I get out of the session are non-null before attempting to use them. I often abstract all of the session functionality out into a proxy class that contai...
25,333
<p>This is related to a question I asked the other day on <a href="https://stackoverflow.com/questions/366629/how-do-i-send-an-email-message-from-my-c-application">how to send email</a>. </p> <p>My new, related question is this... what if the user of my application is behind a firewall or some other reason why the l...
<p>I think that if you are looking to test the SMTP it's that you are looking for a way to validate your configuration and network availability without actually sending an email. Any way that's what I needed since there were no dummy email that would of made sense.</p> <p>With the suggestion of my fellow developer I c...
<p>I also had this need.</p> <p><a href="https://github.com/tallesl/SMTPConnectionTester" rel="nofollow">Here's the library I made</a> (it send a <code>HELO</code> and checks for a 200, 220 or 250):</p> <pre><code>using SMTPConnectionTest; if (SMTPConnection.Ok("myhost", 25)) { // Ready to go } if (SMTPConnectio...
48,729
<p>We're all familiar with the pre- and post-increment operators, e.g.</p> <pre><code>c++; // c = c + 1 ++c; // ditto </code></pre> <p>and the "combined operators" which extend this principle:</p> <pre><code>c += 5; // c = c + 5 s .= ", world"; // s = s . ", world"; e.g. PHP </code></pre> <p>I've often ...
<p>A basic objection to the example as-given is that it'd create ambiguity:</p> <pre><code>a=-5; //'a = -5' or 'a =- 5'? b=*p; //'b = *p' or 'b =* p'? c=.5; //'c = .5' or 'c =. 5'? </code></pre> <p><strong>Edit:</strong> But no, I'm not aware of any languages that use them. Presumably this is because they we...
<p>None that I know about, and I don't think that there will be, as it's a meta-meta-command.</p> <p>To explain, the original operators (for numbers) came from C where they mapped directly to machine code operations. This allowed the programmer to do optimization, since the early compiler didn't.<br> So,</p> <pre><c...
20,816
<p>I know this specific question has been <a href="https://stackoverflow.com/questions/185235/jquery-tabs-getting-newly-selected-index">asked before</a>, but I am not getting any results using the <code>bind()</code> event on the <code>jQuery UI Tabs</code> plugin. </p> <p>I just need the <code>index</code> of the new...
<p>If you need to get the tab index from outside the context of a tabs event, use this:</p> <pre><code>function getSelectedTabIndex() { return $("#TabList").tabs('option', 'selected'); } </code></pre> <p>Update: From version 1.9 'selected' is changed to 'active'</p> <pre><code>$("#TabList").tabs('option', 'acti...
<p>take a hidden variable like <code>'&lt;input type="hidden" id="sel_tab" name="sel_tab" value="" /&gt;'</code> and on each tab's onclick event write code like ...</p> <pre><code>&lt;li&gt;&lt;a href="#tabs-0" onclick="document.getElementById('sel_tab').value=0;" &gt;TAB -1&lt;/a&gt;&lt;/li&gt; &lt;li&gt;&lt;a href="...
38,457
<pre><code>A.Event1 := nil; A.Event2 := nil; try ... finally A.Event1 := MyEvent1; A.Event2 := MyEvent2; end; </code></pre> <p>Can something go wrong with it?</p> <p><strong>EDIT:</strong></p> <p>I've accepted Barry's answer because it answered exactly what I asked, but Vegar's answer is also correct depending...
<p>It entirely depends on what happens in the bit of code marked '...'. If it e.g. starts up a background thread and tries to invoke Event1 or Event2 after execution has continued into the finally block, you may get unexpected results.</p> <p>If the code is entirely single-threaded, then yes, neither Event1 nor Event2...
<p>As Barry said, the only real concern is with multithreaded concerns - other than that is perfectly normal. As VCL events setters just assign the event, nothing need to be worried.</p>
41,883
<p>Are there any good MVC frameworks for native Windows Mobile code?</p> <p>Barring that could someone link to an open source Windows Mobile or CE project that uses the MVC pattern?</p>
<p>Perhaps you could try Qt. It provides some classes for mvc programming. Here is link for MVC in Qt. <a href="http://doc.trolltech.com/4.4/model-view-programming.html" rel="nofollow noreferrer">http://doc.trolltech.com/4.4/model-view-programming.html</a></p>
<p>Inspired by akam129, this is a <a href="http://doc.trolltech.com/qq/qq10-mvc.html" rel="nofollow noreferrer">link</a> from Qt Quarterly on MVC. </p> <p>Overview: The controls in Qt are using MVC internally, and it is possible to do MVC programming at application level by using signal-slot mechanism</p>
20,815
<p>In my vb.net program, I am using a webbrowser to show the user an HTML preview. I was previously hitting a server to grab the HTML, then returning on an asynchronous thread and raising an event to populate the WebBrowser.DocumentText with the HTML string I was returning.</p> <p>Now I set it up to grab all of the i...
<p>Try the following:</p> <pre class="lang-cs prettyprint-override"><code>browser.Navigate(&quot;about:blank&quot;); HtmlDocument doc = browser.Document; doc.Write(String.Empty); browser.DocumentText = _emailHTML; </code></pre> <p>I've found that the <code>WebBrowser</code> control usually needs to be initialized to <c...
<p>please refer to this answer <a href="https://stackoverflow.com/questions/4737823/c-filenotfoundexception-on-webbrowser/4738244#4738244">c# filenotfoundexception on webbrowser?</a></p>
21,021
<p>I have a folder in NTFS that contains tens of thousands of files. I've deleted all files in that folder, save 1. I ran contig.exe to defragment that folder so now it's in 1 fragment only. However, the size of that folder is still 8MB in size. This implies that there's a lot of gap in the index. Why is that? If I del...
<p>I guess this is one way in which NTFS is just like almost every other FS - none of them seem to like shrinking directories.</p> <p>So you should apply a high-tech method that involves using that advanced language, "BAT" :)</p> <p>collapse.bat</p> <pre><code>REM Invoke as "collapse dirname" ren dirname dirname.old...
<p>There is <i>slack</i> in the index, but not a <i>gap</i>. I make the distinction to imply that there is technically wasted space, but it's not like NTFS has to parse the 8MB in order to enumerate/query/whatever the index. It knows where the root of its tree is, and it just happens to have a lot of extra allocation...
37,154
<p>What kinds of considerations are there for migrating an application from <strong>NHibernate</strong> 1.2 to 2.0? What are breaking changes vs. recommended changes? </p> <p>Are there mapping issues?</p>
<p><a href="http://forum.hibernate.org/viewtopic.php?t=985289" rel="noreferrer">Breaking changes in NHibernate 2.0</a></p> <p><strong>If you have good test coverage it's busywork.</strong></p> <p>Edit: We upgraded this morning. There is nothing major. You have to Flush() the session after you delete. The Expressio...
<p>I found the answer here:</p> <p><a href="http://blog.domaindotnet.com/2008/08/24/nhibernate-20-gold-released-must-wait-for-linq-to-nhibernate/" rel="nofollow noreferrer">http://blog.domaindotnet.com/2008/08/24/nhibernate-20-gold-released-must-wait-for-linq-to-nhibernate/</a></p> <h1>gold release 2.0.0.GA</h1> <h2...
4,688
<p>I have my Wordpress install and MediaWiki <a href="https://stackoverflow.com/questions/33745" title="Thanks ceejayoz">sharing the same login information</a>. Unfortunately, users need to log into both separately, but at least they use the same credentials. </p> <p>What I would like to do is cause a successful log...
<p>The primary problem you are going to run into is that you'll have two login forms, and two logout methods. What you need to do is pick one of the login forms as the default, and redirect the other one over to it.</p> <p>I've been able to <a href="http://www.howtogeek.com" rel="nofollow noreferrer">successfully inte...
<p>You could consider some kind of single-sign-on software. I am unaware of any that are free and I've only ever used <a href="http://ca.com/us/internet-access-control.aspx" rel="nofollow noreferrer">SiteMinder</a> which is neither free nor good. <a href="http://www.atlassian.com/software/crowd/default.jsp" rel="nofoll...
5,800
<p>I'm using a table adapter in Visual Studio to make a query to a stored procedure in my SQL Server 2005 database. When I make the call via my website application it returns nothing. When I make the same call via SQL Server Manager it returns the expected data.</p> <p>I put a breakpoint on the call to the adapter's...
<p>Use Sql Profiler to see how the sql sent to sql server actually looks like. This has helped me many times.</p>
<p>Visual Studio can be funny with query parameters. Make sure each variable has the correct length and type. For example, I use several date parameters in a query. Everytime I edit the query, Visual Studio automatically detects the date parameters and limits the variable to a length of 7. I pass the date in as "9/...
43,758
<p>Is there a risk of legal trouble if you include GPL or LGPL licensed icons in a closed source software? </p> <p>Would it force it to become open source just to include the icon?</p> <p>Does it matter if the icon is compiled as a resource?</p> <p>Are the creative common licensed icons safe to use if you follow t...
<p>For GPL, yes. Any GPL Code/Content that's compiled into your Application or the Package will make it GPL. (Edit: What could be safe is if the Icon is a separate file and is used. That could be a grey area, as you are not using GPL Code to access it. But any attempt to embed it will force your program to GPL, it's on...
<p>It's a tricky area, at a minimum you should probably arrange for the icons to be loaded at run time so that they can be replaced with other versions, this is at least the spirit of the GPL. </p> <p>An article discusses this at <a href="http://www.linux.com/feature/119212" rel="nofollow noreferrer">http://www.linux....
7,035
<p>If you're writing a library, or an app, where do the unit test files go? </p> <p>It's nice to separate the test files from the main app code, but it's awkward to put them into a "tests" subdirectory inside of the app root directory, because it makes it harder to import the modules that you'll be testing. </p> <p...
<p>For a file <code>module.py</code>, the unit test should normally be called <code>test_module.py</code>, following Pythonic naming conventions.</p> <p>There are several commonly accepted places to put <code>test_module.py</code>:</p> <ol> <li>In the same directory as <code>module.py</code>.</li> <li>In <code>../tes...
<p>I've recently started to program in Python, so I've not really had chance to find out best practice yet. But, I've written a module that goes and finds all the tests and runs them.</p> <p>So, I have:</p> <pre> app/ appfile.py test/ appfileTest.py </pre> <p>I'll have to see how it goes as I progress to larger pr...
8,627
<p>I'm looking for a tool that will be able to build a parser (in C#) if I give it a BNF grammar (eg. <a href="http://savage.net.au/SQL/sql-2003-2.bnf" rel="noreferrer">http://savage.net.au/SQL/sql-2003-2.bnf</a>)</p> <p>Does such a generator exist?</p>
<p>Normally BNF grammars are too ambiguous. ANTLR will be probably good for what you are looking for.</p>
<p>Also take a look at Irony:</p> <p><a href="http://irony.codeplex.com/" rel="nofollow">http://irony.codeplex.com/</a></p> <p>seems very promising</p>
18,539
<p>Does anyone know how the built in dictionary type for python is implemented? My understanding is that it is some sort of hash table, but I haven't been able to find any sort of definitive answer.</p>
<p>Here is everything about Python dicts that I was able to put together (probably more than anyone would like to know; but the answer is comprehensive).</p> <ul> <li><p>Python dictionaries are implemented as <strong>hash tables</strong>.</p> </li> <li><p>Hash tables must allow for <strong>hash collisions</strong> i.e....
<p>Python Dictionaries use <a href="http://en.wikipedia.org/wiki/Hash_table#Open_addressing" rel="noreferrer">Open addressing</a> (<a href="http://books.google.co.in/books?id=gJrmszNHQV4C&amp;lpg=PP1&amp;hl=sv&amp;pg=PA298#v=onepage&amp;q&amp;f=false" rel="noreferrer">reference inside Beautiful code</a>)</p> <p><stron...
42,409
<p>A problem I ran into a while back I never found a good solution for...</p> <p>Say you have a working copy checked out from subversion at revision 7500, and the disk holding the current repository dies. You've got a backup of the repository at, say, revision 7450. It's easy to restore the repository backup, but any ...
<p>You could check out a rev.7450 copy somewhere, then export your 7500 copy (to remove the .svn folders). Drag the exported copy (which is the latest copy) over the 7450 copy. All the new files should simply overwrite the older ones, leaving the .svn folders the same. </p> <p>Subversion will assume you just made a bu...
<p>If you are positive you've got the latest version in your directory, then do this:</p> <ol> <li>Delete the item from the repository</li> <li>Delete the SVN references from your copy</li> <li>Check your code in as a new copy.</li> <li>Check out the code you just checked in</li> </ol>
8,047
<p>I have had a few problems with log files growing too big on my SQL Servers (2000). Microsoft doesn't recommend using auto shrink for log files, but since it is a feature it must be useful in some scenarios. Does anyone know when is proper to use the auto shrink property?</p>
<p>Your problem is not that you need to autoshrink periodically but that you need to backup the log files periodically. (We back ours up every 15 minutes.) Backing up the database itself is not sufficient, you must do the log as well. If you do not back up the transaction log, it will grow until it takes up all the spa...
<p>I used to use it when we had a demo version of a huge database that took up a lot of space on the laptop, so we used it to keep the size down.</p> <p>The key is to use it only when the data is basically throw away.</p> <p>You should truncate the logs periodically as a part of your backup strategy.</p>
49,435
<p>I'd like to have a custom object attached to the application so I can preserve state in it between different html pages in adobe air. Is this possible?</p> <hr> <p>I was asking for a fullblown solution to store a custom js object in memory and persist it between pages loaded from the application sandbox, but this ...
<p>Perhaps you could try attaching the object on the user's machine. There is a tutorial online that seems like it could help:</p> <p><a href="http://corlan.org/2008/09/02/storing-data-locally-in-air/" rel="nofollow noreferrer">http://corlan.org/2008/09/02/storing-data-locally-in-air/</a></p> <p>Example from the site...
<p>What sort of object ?-)</p> <p>If it only holds values that are meaningful in a string, you could store it as a cookie or perhaps in a serverside session ...</p>
23,476
<p>I would like MATLAB to tell me if I have an input file (.m file) that contains some variables with their numbers (i.e., <code>a = 5</code>, <code>b = 6</code>, <code>c = 7</code>) so that I can then use that .m file in another program (main .m file) that uses these variables to calculate <code>S = a + b + c</code>. ...
<p>This is typically not good practice in MATLAB. The file containing the input variables would, in your example, be a script. As would your main file. MATLAB does not error when running one script from another, as suggested by ScottieT812, but under certain circumstances strange errors can arise. (Run time compiling h...
<p>I ran into the exact problem <a href="https://stackoverflow.com/questions/185461/reading-input-m-file-in-a-main-m-file#185660">KennyMorton</a> mentioned when trying to create runtime compiled versions of MATLAB software for my work. The software uses m-files extensively for passing arguments between functions. Add...
22,429
<p>Does anyone know if dbunit has the power to export specific data from multiple tables at once based on a sql statement, as can be done by using dbunit's QueryDataSet class to export data from a single table based on a sql statement, <a href="http://www.dbunit.org/faq.html#extract" rel="nofollow noreferrer">as can be...
<p><a href="http://jailer.sourceforge.net/" rel="noreferrer">http://jailer.sourceforge.net/</a></p>
<p>Yes it can. All you need is to call addTable(...) method to collect data to QueryDataSet and just export it by FlatXmlDataSet.write(...)</p> <pre><code>QueryDataSet partialDataSet = new QueryDataSet(connection); partialDataSet.addTable(tableName1, "select * from " + tableName1); partialDataSet.addTable(tableName2, ...
23,163
<p>I thought I understood Java generics pretty well, but then I came across the following in java.lang.Enum:</p> <pre><code>class Enum&lt;E extends Enum&lt;E&gt;&gt; </code></pre> <p>Could someone explain how to interpret this type parameter? Bonus points for providing other examples of where a similar type parameter...
<p>It means that the type argument for enum has to derive from an enum which itself has the same type argument. How can this happen? By making the type argument the new type itself. So if I've got an enum called StatusCode, it would be equivalent to:</p> <pre><code>public class StatusCode extends Enum&lt;StatusCode&gt...
<p>According to wikipedia, this pattern is called <a href="https://en.wikipedia.org/wiki/Curiously_recurring_template_pattern" rel="nofollow noreferrer">Curiously recurring template pattern</a>. Basically, by using the CRTP pattern, we can easily refer to subclass type without type casting, which means by using the pa...
25,934
<p>There's a <a href="http://groups.google.com/group/comp.lang.c++.moderated/browse_thread/thread/8e0235d58c8635c2" rel="noreferrer" title="assertions: does it matter that they are disabled in production?">discussion</a> going on over at comp.lang.c++.moderated about whether or not assertions, which in C++ only exist i...
<p>Assertions are comments that do not become outdated. They document which theoretical states are intended, and which states should not occur. If code is changed so states allowed change, the developer is soon informed and needs to update the assertion.</p>
<p>An assertion is error, pure and simple and therefore should be handled like one.</p> <p>Since an error should be handled in release mode then you don't really need assertions.</p> <p>The main benefit I see for assertions is a conditional break - they are much easier to setup than drilling through VC's windows to s...
3,832
<p>My main application for my 3D printer (Zortrax M200 Plus) is making 28 mm scale miniatures for role-playing games. Basically people and animals at 1:60 scale, which means that things like arms, legs, or weapons are only a few millimeters thick. If I use the automatically generated supports of the Z-Suite software, t...
<p>I see that you've already tried <a href="http://www.meshmixer.com/download.html" rel="nofollow noreferrer" title="Meshmixer - Free Download">Meshmixer</a> and didn't find it helpful, but I wanted to call out <a href="https://www.prusaprinters.org/how-to-create-custom-overhang-supports-in-meshmixer/" rel="nofollow no...
<p>I had good experience with the support interfaces from CURA. But reduce the thickness of the support interface to be just enough, that a smooth support interface top can be printed and set the top distance so that the model itself can be printed smooth and you can remove the interface easy enough. (I got good result...
897
<p>I have built a 3D printer from parts. It is using a standard 12V power supply, an Arduino Mega 2560 replica and a RAMPS 1.4 board. The hotend cooling fan is connected to the 12V-AUX pin (the one right next to the x axis stepper driver) on the RAMPS board so that it continuously receives power as long as the machine ...
<p>Now that you have done some measurements, you could make some conclusions.</p> <blockquote> <p>The voltage over the fan is reported to be constant, but the current starts at 110-115 mA and reduces to 90 mA over time.</p> </blockquote> <p>With limited knowledge of electronics you can conclude that the resistanc...
<p>I propose examining the current voltage of the motor and the arm. The fluctuation of voltage causes the noise.</p>
962
<p>Is it possible to deploy a native Delphi application with ClickOnce without a stub C# exe that would be used to launch the Delphi application?</p> <p>The same question applies to VB6, C++ and other native Windows applications.</p>
<p>Personally, I build my own mechanism to kick off self update process when my application timestamp is out of sync with the server. Not too difficult, but it's not a simple task.</p> <p>By the way, for Delphi you can use some thirdparty help:</p> <p><a href="http://www.tmssoftware.com/site/wupdate.asp" rel="nofollo...
<p>I'm not 100% sure if this can be accomplished without the stub, but this article may provide some insight:</p> <p><a href="http://blogs.msdn.com/g/archive/2008/06/06/sample-demonstrating-clickonce-deployment-of-com-component-implemented-in-managed-assembly-without-using-gac-or-registry-and-without-requiring-admin-r...
7,489
<p>I'm looking for a way to poll different servers and check that SQL server is up and running. I'm writing my code in C#. I don't particularly care about individual databases, just that SQL server is running and responsive.</p> <p>Any ideas?</p>
<p>Well, the brute force solution is to attempt to initiate a connection with the database on each server. That will tell you whether it's running, though you could have timeout issues.</p> <p>The more elegant (but more difficult... isn't that always the way?) solution would be to use WMI to connect to the remote mach...
<p>I would certainly go with Vincent's answer. Just make absolutely certain you are closing and disposing the tcp connections properly etc. WMI seems a bit of overkill to me if that is all you're after.</p>
4,297
<p>If I am storing the Subversion user names and passwords for repository access in a text file in the <code>conf</code> folder, what is the maximum length of the passwords I can use? That is to say, how long can the secrets in the following file be?</p> <pre><code>[users] harry = harryssecret sally = sallyssecret </c...
<p>If you are using <code>svnserve</code>, it seems to be no limit defined (at least I couldn't find any mention of it). From <a href="http://svnbook.red-bean.com/" rel="nofollow noreferrer">svn book</a>:</p> <blockquote> <p>The svnserve server, by default, knows only how to send a CRAM-MD5 authentication challenge....
<p>There's no limit in the config file (aside from memory constraints, of course!).</p> <p>Whether the client limits the input or not will depend on which client you're using, of course, but I'd hope that all of them would allow fairly long passwords.</p>
44,652
<p>I need to edit an xml file using javascript. Now I'm involved in a project of online testing. </p> <p>The question.xml file is already in the project folder.</p> <p>In that i want to add or edit the questions(only using javascript). I'm able to bring the particular content through ajax, but I am not able to edit ...
<p>Javascript can't write to a file. The best you'll be able to do is get Javascript to read and edit the XML then post that data to a server-side script to write to file.</p>
<p>Nickf is correct. The reason Javascript can't write to a file is because it is a <a href="http://en.wikipedia.org/wiki/Client-side_scripting" rel="nofollow noreferrer">Client-Side</a> language. Javascript will never have permission to write a file because it has to operate inside the browser sandbox. </p> <p>You ...
44,116
<p>A Y-combinator is a computer science concept from the &ldquo;functional&rdquo; side of things. Most programmers don't know much at all about combinators, if they've even heard about them.</p> <ul> <li>What is a Y-combinator?</li> <li>How do combinators work?</li> <li>What are they good for?</li> <li>Are they useful...
<p>If you're ready for a long read, <a href="http://mvanier.livejournal.com/2897.html" rel="noreferrer">Mike Vanier has a <em>great</em> explanation</a>. Long story short, it allows you to implement recursion in a language that doesn't necessarily support it natively.</p>
<p>I think the best way to answer this is to pick a language, like JavaScript:</p> <pre><code>function factorial(num) { // If the number is less than 0, reject it. if (num &lt; 0) { return -1; } // If the number is 0, its factorial is 1. else if (num == 0) { return 1; } // O...
11,904
<p>I'm getting ready to implement a source control system (subversion) but I'm facing some doubts on how to structure my folders.</p> <p>I use Delphi for all my development and compile the projects from within the IDE.</p> <p>My current projects folder structure is as follows:</p> <pre> -E:\Work\1. Shared --Forms (s...
<p>Having setup literally hundreds of projects over the years, and having specialized in software configuration management and release engineering, I would recommend that you first focus on how you want to build/release your project(s).</p> <p>If you only use an IDE to build (compile and package) your project(s), then...
<p>why the 5.x? (under projectA)</p> <p>I don't think it is useful to introduce the versions in the tree - that is what subversion, etc is for. </p>
37,931
<p>I'm using Grails to send a large number of HTML emails. I use the SimpleTemplateEngine to create my email bodies in this fashion:</p> <pre><code>def ccIdToEmailMap = [:] def emailTemplateFile = Utilities.retrieveFile("email${File.separator}emailTemplate.gtpl") def engine = new SimpleTemplateEngine() def clientCont...
<p>Sounds like a synchronization issue. As a first step, you should create the template outside of the loop. Since there is no need to recreate the template every time.</p> <pre><code> def ccIdToEmailMap = [:] def emailTemplateFile = Utilities.retrieveFile("email${File.separator}emailTemplate.gtpl") def eng...
<p>Sounds like a synchronization issue. As a first step, you should create the template outside of the loop. Since there is no need to recreate the template every time.</p> <pre><code> def ccIdToEmailMap = [:] def emailTemplateFile = Utilities.retrieveFile("email${File.separator}emailTemplate.gtpl") def eng...
48,356
<p>We've recently completed phase 1 of a ASP.Net website in English and French. We went with using resource files to store language specific strings, but because the site used ASP.Net AJAX and javascript heavily we rigged up a solution to pass the right files through the ASP.Net pipeline where we could catch "tokens" a...
<p>In my main project (a RAD framework using PHP with gettext for translations) we're doing already alot of prepare operations on javascript files like merging and minifying them. Within this preperations we parse for gettext-markers and replace them with the language specific text.</p> <p>The result get save as javas...
<p>To deal with il8n in our applications we dynamically create a JavaScript file (based on the locale we are interested in), that contains keys and translations, e.g.</p> <pre><code>LOCALISATIONS = { 'util.date.day.long': ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'], 'util.dat...
23,227
<p>In the Java code I'm working with we have an interface to define our Data Access Objects(DAO). Most of the methods take a parameter of a Data Transfer Object (DTO). The problem occurs when an implementation of the DAO needs to refer to a specific type of DTO. The method then needs to do a (to me completely unnecessa...
<p>You could use generics:</p> <pre><code>DAO&lt;SpecificDTO&gt; dao = new SpecificDAO(); dao.save(new SpecificDTO()); etc. </code></pre> <p>Your DAO class would look like:</p> <pre><code>interface DAO&lt;T extends DTO&gt; { void save(T); } class SpecificDAO implements DAO&lt;SpecificDTO&gt; { void save(Spe...
<p>Refactoring to generics is no small amount of pain (even though it's most likely worth it).</p> <p>This will be especially horrendous if code uses your DTO interface like so:</p> <pre><code>DTO user = userDAO.getById(45); ((UserDTO)user).setEmail(newEmail) userDAO.update(user); </code></pre> <p>I've seen this d...
25,807
<p>I have a DirectShow graph to render MPEG2/4 movies from a network stream. When I assemble the graph by connecting the pins manually it doesn't render. But when I call Render on the GraphBuilder it renders fine. </p> <p>Obviously there is some setup step that I'm not performing on some filter in the graph that Graph...
<p>You can watch the graph you created using GraphEdit, a tool from the DirectShow SDK. In GraphEdit, select File->Connect to remote Graph...</p> <p>In order to find your graph in the list, you have to register it in the running object table:</p> <pre><code>void AddToRot( IUnknown *pUnkGraph, DWORD *pdwRegister ) { ...
<p>Older versions of DirectX, I belive 9a, but not 9b had a "debug mode" for dshow. It would output logs of debug info into the debug console. </p> <p>So download an older version, set it to debug. then open up debugview or load graphedt.exe in visual studio to see the debug info.</p>
4,748
<p>Many applications have grids that display data from a database table one page at a time. Many of them also let the user pick the number of records per page, sort by any column, and navigate back and forth through the results.</p> <p>What's a good algorithm to implement this pattern without bringing the entire table...
<p>On MS SQL Server 2005 and above, <a href="http://msdn.microsoft.com/en-us/library/ms186734.aspx" rel="noreferrer">ROW_NUMBER()</a> seems to work:</p> <p><a href="http://blogs.x2line.com/al/archive/2005/11/18/1323.aspx" rel="noreferrer">T-SQL: Paging with ROW_NUMBER()</a></p> <pre><code>DECLARE @PageNum AS INT; DEC...
<p>There is a discussion about this <a href="https://web.archive.org/web/20211020131201/https://www.4guysfromrolla.com/webtech/042606-1.shtml" rel="nofollow noreferrer">Here</a></p> <p>The technique gets page number 100,000 from a 150,000 line database in 78ms</p> <blockquote> <p>Using optimizer knowledge and SET R...
3,141
<p>Lately I'm having some issues with white PLA.</p> <p>It sticks nicely to the print bed, but the very last layer of the print comes out really ugly.</p> <p>I'm not a native english speaker, I don't know what is the proper term to describe what I see, so I'm attaching two pictures instead:</p> <p><a href="https://i...
<p>This appears to be the result of your hot end (nozzle) temperature being slightly too high. </p> <p>I'd recommend lowering your nozzle temperature by a few degrees and retrying the print. If the quality improves you're good. If it doesn't improve significantly try lowering a few degrees more. </p> <p>If you lower ...
<p>This looks like the air trapped inside the print is expanding, causing wavy surfaces. This can be solved by lowering nozzle temperatures, and turning on the fan.</p>
559
<p>Would it suppose any difference regarding overhead to write an import loading all the types within one package (<code>import java.*</code>); than just a specific type (i.e. <code>import java.lang.ClassLoader</code>)? Would the second one be a more advisable way to use than the other one?</p>
<p>There is not a performance or overhead cost to doing import .* vs importing specific types. However, I consider it to be a best practice to never use import .* My primary reason for this is I just like to keep things straightward, clean and with as little ambiguity as possible, and I think with a .* import you los...
<p>It's more of a good coding practice as anyone reading your code will immediately know what classes are used by a particular class by just looking at the import block at the top of the file whereas one would have to dig to find out if you used wildcards.</p>
22,698
<p>I want to show first element that is hidden by jquery. my html code is:</p> <pre><code>&lt;ol&gt; &lt;li&gt;1&lt;/li&gt; &lt;li style="display:none"&gt;2&lt;/li&gt; &lt;li style="display:none"&gt;3&lt;/li&gt; &lt;li style="display:none"&gt;4&lt;/li&gt; &lt;li style="display:none"&gt;5&lt;/li&gt;...
<p>Just add a :first selector after you get :hidden set so you get the first element from set found by :hidden selector</p> <pre><code>$("a.add").click(function(){ $(":hidden:first").slideToggle("fast"); }); </code></pre>
<p>Thank You "aether": I found below solutions after your answer:</p> <pre><code>$(":hidden:eq(0)",$(this).parent().parent()) </code></pre> <p>OR</p> <pre><code>$(":hidden:lt(1)",$(this).parent().parent()) </code></pre>
47,825
<p>I'm trying to setup Spring using Hibernate and JPA, but when trying to persist an object, nothing seems to be added to the database.</p> <p>Am using the following:</p> <pre><code>&lt;bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"&gt; &lt;property name="url" value="${jdbc.url}"/&gt; &l...
<p>Thanks to eric and Juan Manuel's answers, I was able to figure out that the transaction wasn't committed.</p> <p>Adding @Transactional to the storeAccount method did the trick!</p>
<p>Probably you're keeping the transaction active and it is not calling "commit" until other methods running supporting the active transaction end (all "voting" for commit and none for rollback.)</p> <p>If you're sure that the entity you're going to persist is ok you could probably do this:</p> <pre><code>@Transactio...
49,042
<p>How do I convert a DateTime structure to its equivalent <a href="http://www.ietf.org/rfc/rfc3339.txt" rel="noreferrer">RFC 3339</a> formatted string representation and/or parse this string representation back to a <a href="http://msdn.microsoft.com/en-us/library/system.datetime.aspx" rel="noreferrer">DateTime</a> st...
<p>This is an implementation in C# of how to parse and convert a DateTime to and from its RFC-3339 representation. The only restriction it has is that the DateTime is in Coordinated Universal Time (UTC).</p> <pre><code>using System; using System.Globalization; namespace DateTimeConsoleApplication { /// &lt;summar...
<p>In .NET (assuming UTC):</p> <pre><code> datetime.ToString("YYYY-MM-DD'T'HH:mm:ssZ") </code></pre> <p><code>DateTime.Parse()</code> can be used to convert back into a <code>DateTime</code> structure.</p>
3,772
<p>I have a code igniter project, and I wanted to try debugging it using Zend Studio. WHen I start debugging, I immediately run ino</p> <p>"The URI you submitted has disallowed characters."</p> <p>Does anyone have any idea?</p>
<p>(Assuming you are using the latest version of CodeIgniter (CI) which is 1.7.0)</p> <p>CI is pretty strict about what characters it allows in URLs. You can modify the regex that is used to filter URLs.</p> <p>In system/config/config.php on line 126 is </p> <pre><code>$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\...
<p>in Expression engine you'll find this in /admin/expressionengine/config/config.php</p> <pre><code>$config['permitted_uri_chars'] = 'a-z 0-9~%.:_\\-'; </code></pre> <p>change to </p> <pre><code>$config['permitted_uri_chars'] = ''; </code></pre> <p>but read the line comment before you do this.</p> <p>Or don't us...
45,342
<p>I'm currently working on an asp.net-mvc content management system. It would be incredibly useful to be able to deploy nested applications e.g. /shop to have a separate app inside. Or even another instance of the cms.</p> <p>I've found some information around talking about limiting the inheritance of the web.config ...
<p>To be honest you biggest hurdle is going to be creating the routes and making sure they don't interfere with routes already in the system. After you get that working the rest is easy as pie.</p> <p>The first thing you will need is an HttpModule that will be inserted in to the web.config under the . This module wi...
<p>I've gone down this road before (with /blog), but found it to be doable but complicated and difficult to maintain. Instead I ended up using subdomains:</p> <ul> <li>www.example.com </li> <li>shop.example.com</li> <li>blog.example.com</li> </ul> <p>These are much easier to maintain because you can just have them wo...
35,524
<p>I have a subversion repository with the standard layout, i.e. trunk/ and branches/ (and tags/). When working on a bigger change, a feature branch is used, regularly synced with trunk, and later reintegrated back into trunk (using 1.5 now). Pretty standard stuff.</p> <p>What I am wondering is whether such a feature ...
<p>If you are really worried about deleting them, lest they be forgotten, then simply create a folder under branches called 'inactive' and <code>svn move</code> your older, inactive branches into that folder. This might be the best of both worlds for you.</p>
<p>My team deletes them to keep the clutter down. It's not like the go away after all; they can be retrieved if desired. You are right that it can be difficult to find them again: you need to know a revision number where the branch existed so you tell your client to look at that revision in order to see your files.</...
19,661
<p>I have a C linux application (A) that spawns another process (P) when it is started. When I want to debug P I start A as usual and I connect with ddd/gdb to P.</p> <p>Problems appear when I want to debug the entry-point (start of main) of P. If I follow the usual approach when I connect the debugger to P is already...
<p>You should use this option:</p> <pre><code>set follow-fork-mode</code> <i>mode</i></pre> <p>Where <em>mode</em> is one of <code>parent</code>, <code>child</code> or <code>ask</code>.</p> <p>To follow the parent (this is the default) use:</p> <pre><code>set follow-fork-mode parent </code></pre> <p>To follow the ...
<p>You should be able to do this by making use of gdb's remote debugging features, specifically <code>gdbserver</code>. In effect, launch (P) using <code>gdbserver</code>. These links have more detailed info:</p> <ul> <li><a href="http://davis.lbl.gov/Manuals/GDB/gdb_17.html" rel="nofollow noreferrer">Using gdbserver<...
49,390
<p>i'm using the <a href="http://msdn.microsoft.com/en-us/library/bb775248(VS.85).aspx" rel="nofollow noreferrer">Win32 progress dialog</a>. The damnest thing is that when i call:</p> <pre><code>progressDialog.StopProgressDialog(); </code></pre> <p>it doesn't disappear. It stays on screen until the user moves her mou...
<p>To really hide the dialog, I've added the following to my C++ wrapper class:</p> <pre><code>void CProgressDlg::Stop() { if ((m_isVisible)&amp;&amp;(m_bValid)) { HWND hDlgWnd = NULL; //Sometimes the progress dialog sticks around after stopping it, //until the mouse pointer is moved ov...
<p>Check the return value of the StopProgressDialog Method, maybe that will give you more information about what is going on:</p> <blockquote> <p>HRESULT StopProgressDialog(VOID);</p> <p><em>Returns S_OK if successful, or an error value otherwise.</em></p> </blockquote>
49,542
<pre><code>File fil = new File("Tall.txt"); FileReader inputFil = new FileReader(fil); BufferedReader in = new BufferedReader(inputFil); int [] tall = new int [100]; String s =in.readLine(); while(s!=null) { int i = 0; tall[i] = Integer.parseInt(s); //this is line 19 System.out.println(tall[i]); s = ...
<p>You might want to do something like this (if you're in java 5 &amp; up)</p> <pre><code>Scanner scanner = new Scanner(new File("tall.txt")); int [] tall = new int [100]; int i = 0; while(scanner.hasNextInt()){ tall[i++] = scanner.nextInt(); } </code></pre>
<pre><code>File file = new File("E:/Responsibility.txt"); Scanner scanner = new Scanner(file); List&lt;Integer&gt; integers = new ArrayList&lt;&gt;(); while (scanner.hasNext()) { if (scanner.hasNextInt()) { integers.add(scanner.nextInt()); } else { scanner.next(); ...
39,049
<p>I'm using ccl/openmcl on Mac OS X. (latest versions of both). When the lisp prompt is displayed, using the cursor keys to navigate the current line results in escape codes, rather than movement, eg:</p> <p><code>Welcome to Clozure Common Lisp Version 1.2-r9226-RC1 (DarwinX8664)!<br> ? (^[[D</code></p> <p>Here I'v...
<p>If Clozure CL doesn't provide native readline/editline/whatever support or is configured not to use it, you can run it with rlwrap, for example:</p> <pre><code>rlwrap openmcl </code></pre> <p>rlwrap can be obtained via <a href="http://www.macports.org/" rel="nofollow noreferrer">MacPorts</a> or directly from <a hr...
<p>i know that i'm not answering the question with this, but you should not spend much time directly using a lisp repl.</p> <p>using emacs and <a href="http://common-lisp.net/project/slime/" rel="nofollow noreferrer">slime</a> is a much more convenient way of interacting with a lisp. you have an inspector and a debugg...
22,672
<p>I'm looking at working on a project which uses C#.NET (sitting on a windows box) as the primary language and PostgreSQL as the backend database (backend is sitting on a linux box). I've heard that ODBC.NET allows for easy integration of these two components. </p> <p>Has anyone had experience actually setting C# a...
<p>I'm working with C# and Postgres using <b>Npgsql2</b> component, and they work fast, I recommend you.</p> <p>You can download from <a href="https://github.com/npgsql/Npgsql/releases" rel="noreferrer">https://github.com/npgsql/Npgsql/releases</a></p> <p><b>Note:</b> If you want an application that works with any da...
<p>Npgsql is excellent driver, but only issue Ive found so far is that Numeric value does not fit in a System.Decimal, so only option is correct each query or DB schema </p> <p><a href="https://github.com/npgsql/Npgsql.EntityFrameworkCore.PostgreSQL/issues/438#issuecomment-486586272" rel="nofollow noreferrer">https:/...
6,918
<p>If I have a string with a valid math expression such as:</p> <pre><code>String s = "1 + 2 * 7"; </code></pre> <p>Is there a built in library/function in .NET that will parse and evaluate that expression for me and return the result? In this case 15.</p>
<p>You could add a reference to Microsoft Script Control Library (COM) and use code like this to evaluate an expression. (Also works for JScript.)</p> <pre><code>Dim sc As New MSScriptControl.ScriptControl() sc.Language = "VBScript" Dim expression As String = "1 + 2 * 7" Dim result As Double = sc.Eval(expression) </c...
<p>Flee Fast Lightweight Expression Evaluator</p> <p><a href="https://flee.codeplex.com" rel="nofollow">https://flee.codeplex.com</a></p> <p>Language Reference</p> <ul> <li>ArithmeticOperators Example: a*2 + b ^ 2 - 100 % 5</li> <li>ComparisonOperators Example: a &lt;> 100</li> <li>AndOrXorNotOperators Example (...
46,273
<p>Some systems such as Symbian insist people to use heap instead of stack when allocating<br> big objects(such as pathnames, which may be more than 512 bytes). Is there any specific reason for this?</p>
<p>Embedded devices often have a fixed-sized stack. Since a subroutine call in C only needs to push a few words onto the stack, a few hundred byte may suffice (if you avoid recursive function calls).</p>
<p>The stack for embedded devices usually resides in a very small amount of high-speed memory. If you allocate large objects on the stack on such a device, you might be facing a <strong>stack overflow</strong>.</p>
47,410
<p>I'm trying out PHPTAL and I want to render a table with zebra stripes. I'm looping through a simple php assoc array ($_SERVER).</p> <p>Note that I don't want to use jQuery or anything like that, I'm trying to learn PHPTAL usage!</p> <p>Currently I have it working like this (too verbose for my liking):</p> <pre><c...
<p>You could create expression modifier by writing <code>phptal_tales_evenodd()</code> function (see <code>phptal_tales()</code> in manual):</p> <pre><code>&lt;td tal:attributes="class evenodd:repeat/item/odd"&gt; </code></pre>
<p>Well, it seems like I have my own answer, though I still think this is rather ugly:</p> <pre><code>&lt;tr tal:repeat="item server"&gt; &lt;td tal:content="repeat/item/key" tal:attributes="class php: repeat.item.odd ? 'odd' : 'even'"&gt;item key&lt;/td&gt; &lt;td tal:content="item" tal:attributes="class php: rep...
40,853
<p>More than once I've lost work by accidentally killing a temporary buffer in Emacs. Can I set up Emacs to give me a warning when I kill a buffer not associated with a file?</p>
<p>Make a function that will ask you whether you're sure when the buffer has been edited and is not associated with a file. Then add that function to the list <code>kill-buffer-query-functions</code>.</p> <p>Looking at the documentation for <a href="http://www.gnu.org/software/emacs/manual/html_node/elisp/Buffer-File...
<pre><code>(defun maybe-kill-buffer () (if (and (not buffer-file-name) (buffer-modified-p)) ;; buffer is not visiting a file (y-or-n-p (format "Buffer %s has been edited. Kill it anyway? " (buffer-name))) t)) (add-to-list 'kill-buffer-query-functions 'maybe-kill-bu...
11,248
<p>I have a model and two views set up like this:</p> <pre><code>Model ---&gt; OSortFilterProxyModel ---&gt; OListView Model ------------------------------&gt; OTableView </code></pre> <p>When the user selects something in one of the views, I want the other view to mirror that selection. So I thought I'd use a QSelec...
<p>What is probably happening is that the views do have two different models. One is your original model, the other is the sort filter model.</p> <p>I'm not sure if this would work, and it depends on what Qt considers "activated", but you could connect a function to each of the view's activated slots. These will pas...
<p>Not quite sure how your model subclass is implemented - but the selection depends on persistent model indexes being correct. Can you provide some source code? Are you using the same selection model on both?</p>
16,533
<p>How to invoke the default browser with an URL from C#?</p>
<pre><code>System.Diagnostics.Process.Start("http://www.google.com"); </code></pre> <p>More details here - <a href="http://msdn.microsoft.com/en-us/library/aa326951.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa326951.aspx</a></p>
<p>I used System.Diagnostics.Process.Start in the past, but if Firefox or another browser is set as the default this method always throws a terrible exception to users. At last, I come across System.Windows.Forms.Help.ShowHelp</p> <p><code> Help.ShowHelp(null, "<a href="http://www.google.com" rel="nofollow noreferrer"...
28,788
<p>I'm looking for a cross-browser way of wrapping long portions of text that have no breaking spaces (e.g. long URLs) inside of divs with pre-determined widths.</p> <p>Here are some solutions I've found around the web and why they <strong>don't</strong> work for me:</p> <ul> <li><strong>overflow : hidden / auto / sc...
<p>I've typically handled this using a combination of <code>word-wrap</code> and the <code>&lt;wbr&gt;</code> idea. note there are a few <a href="http://www.quirksmode.org/oddsandends/wbr.html" rel="nofollow noreferrer">variants</a>. as you can see, <code>&amp;#8203;</code> is probably your best bet for compatibility.<...
<p>Using a regular expression in PHP should be faster to breakup long words. I have created a function that handles htmlspecialchars and breaks up words with &amp;shy; Here is the function for anyone who is interested. Just pass the string, and the max word length (leave as 0 if you dont want to break up words with ...
41,794
<p>Is it possible to format certain text in a WinForm Label instead of breaking the text into multiple labels? Please disregard the HTML tags within the label's text; it's only used to get my point out.</p> <p>For example:</p> <pre><code>Dim myLabel As New Label myLabel.Text = "This is &lt;b&gt;bold&lt;/b&gt; text. ...
<p>That's not possible with a WinForms label as it is. The label has to have exactly one font, with exactly one size and one face. You have a couple of options:</p> <ol> <li>Use separate labels</li> <li>Create a new Control-derived class that does its own drawing via GDI+ and use that instead of Label; this is probabl...
<p>Yeah. You can implements, using HTML Render. For you see, click on the link: <a href="https://htmlrenderer.codeplex.com/" rel="nofollow">https://htmlrenderer.codeplex.com/</a> I hope this is useful.</p>
3,246
<p>Can ZK easily be integrated in a struts web application?</p>
<p>maybe you can find it interesting:</p> <p><a href="http://www.zkoss.org/smalltalks/zk-sample/zk-sample.html" rel="nofollow noreferrer">http://www.zkoss.org/smalltalks/zk-sample/zk-sample.html</a></p> <p>moreover, you can browse a bit the zk forum you can find on <a href="http://www.zkoss.org/" rel="nofollow norefe...
<p>more concretely: <a href="http://docs.zkoss.org/wiki/ZK/How-Tos/Integrate-Other-Frameworks#Struts_.2B_Tiles_.2B_JSP_.28.2B_Spring.29" rel="nofollow noreferrer">http://docs.zkoss.org/wiki/ZK/How-Tos/Integrate-Other-Frameworks#Struts_.2B_Tiles_.2B_JSP_.28.2B_Spring.29</a></p>
19,091
<p>I'm working with Eclipse Version 3.2.1 Build M20060921-0945 on a MS-Windows 2000 SP4 using a JDK 1.5.0-12.<br> I takes my locale that is es-AR and sets all menu and context in Spanish which I don't like. So I had included in eclipse.ini file one parameter <em>"-nl en"</em>.<br> Since that, <em>"References..."</em> f...
<p>Delete all the files in you eclipse data, eg:<br> <code>&lt;WORKSPACE&gt;/.metadata/.plugins/org.eclipse.jdt.core</code><br> This should force eclipse to rebuild its index</p>
<p>Trash your install. </p> <p>Then reinstall it.</p>
33,222
<p>Is there a good tutorial on working with (programming) threads in Visual Studio 2005? Not <a href="http://en.wikipedia.org/wiki/Microsoft_Foundation_Class_Library" rel="nofollow noreferrer">MFC</a> related, just native C++ (no .NET).</p>
<p>Instead of using Win32 threads directly, I'd consider using a thread wrapper such as <a href="http://www.boost.org/doc/libs/1_37_0/doc/html/thread.html" rel="noreferrer">Boost threads</a>. These are cross platform so porting your application later will be easier. </p>
<p>Try one of these articles on <a href="http://en.wikipedia.org/wiki/The_Code_Project" rel="nofollow noreferrer">The Code Project</a>:</p> <ul> <li><p><em><a href="http://www.codeproject.com/KB/threads/threadobject.aspx" rel="nofollow noreferrer">Creating a C++ Thread Class</a></em></p></li> <li><p><em><a href="http:...
35,236
<p>I've committed changes in numerous files to a SVN repository from Eclipse.</p> <p>I then go to website directory on the linux box where I want to update these changes from the repository to the directory there.</p> <p>I want to say "svn update project100" which will update the directories under "project100" with a...
<p>Try:</p> <pre><code>svn status --show-updates </code></pre> <p>or (the same but shorter):</p> <pre><code>svn status -u </code></pre>
<p>You can use 'svn diff' to see the difference between your working copy and the repository.</p>
22,105
<p>I like Nant very much. I do a lot of scripting with NAnt. It is a great little tool.</p> <p>Since NAnt is pre 1.0, when problems occur, I often think if that it is a problem with NAnt itself, but this is not always the case.</p> <p>One funny example: After running the oracle scripts I parsed the log output to make...
<p>NAnt is an open source project that has been around a long while and is quite stable. While they have their reasons for not calling it version "1", does the version number really matter that much in this case? It's just a label.</p> <p>I'd contact the team and find out what needs to be done before they label it as ...
<p>Open Source projects tend to use more "modest" versions than commercial products which tend to be more marketing driven. A good example of the difference is the Java versioning scheme which went from 1.0 to 1.4 and then by the time it got to version 1.5 it flipped to using version 5 (though 1.5 is the internal name)...
34,796
<p>My app uses a WebRequest at certain points to get pages from itself.</p> <p>This shouldn't be a problem. It actually works fine on the server, which is a "shared" hosting package with Medium trust. Locally, I use a custom security policy based on Medium trust, which includes the following &#8212; copied straight ...
<p>Does it work if you put 127.0.0.1 instead of localhost?</p>
<p>This might not be the solution but when I saw your post I remembered this issue that I ran into about a year ago:</p> <blockquote> <p><a href="http://support.microsoft.com/default.aspx/kb/896861" rel="nofollow noreferrer">http://support.microsoft.com/default.aspx/kb/896861</a></p> <p>You receive error 401.1 ...
19,133
<p>What would be a simple implementation of a method to convert a String like "Hello there everyone" to "helloThereEveryone". In JavaME support for String and StringBuffer utility operations are quite limited.</p>
<p>Quick primitive implementation. I have no idea of restrictions of J2ME, so I hope it fits or it gives some ideas...</p> <pre><code>String str = "Hello, there, everyone?"; StringBuffer result = new StringBuffer(str.length()); String strl = str.toLowerCase(); boolean bMustCapitalize = false; for (int i = 0; i &lt; s...
<p>I would do it like this: </p> <pre><code>private String toCamelCase(String s) { StringBuffer sb = new StringBuffer(); String[] x = s.replaceAll("[^A-Za-z]", " ").replaceAll("\\s+", " ") .trim().split(" "); for (int i = 0; i &lt; x.length; i++) { if (i == 0) { x[i] = x...
31,018
<p>Are you aware of any serious performance problems with checking if a file exists before you open it and send it? The context for this is a web application that serves up files dynamically via an ASP page. I was told that there is no check for whether or not the file exists because the database stores this informatio...
<p>Even if you check it exists just before you try to serve it, it could be deleted between the check and you serving it.</p> <p>The problem here is that you send back nothing if you can't serve the file. Trying to serve a non-existent file should throw an exception (or whatever the equivalent is on your platform) - y...
<p>I really don't know if it is a cheap or expensive task, but, considering that not checking for the existence of the file could result in an unpleasant response to the client I would say it's not expensive.</p> <p>I do have some web apps where I check for file existence and is working just fine.</p>
25,122
<p>I've been using a local git repository interacting with my group's CVS repository for several months, now. I've made an almost neurotic number of branches, most of which have thankfully merged back into my trunk. But naming is starting to become an issue. If I have a task easily named with a simple label, but I a...
<p>Here are some branch naming conventions that I use and the reasons for them</p> <p><strong>Branch naming conventions</strong></p> <ol> <li>Use grouping tokens (words) at the beginning of your branch names.</li> <li>Define and use short lead tokens to differentiate branches in a way that is meaningful to your workf...
<p>Following up on <a href="https://stackoverflow.com/a/280157/5411817">farktronix's suggestion</a>, we have been using Jira ticket numbers for similar in mercurial, and I'm planning to continue using them for git branches. But I think the ticket number itself is probably unique enough. While it might be helpful to hav...
34,487
<p>I have been trying to find a really fast way to parse yyyy-mm-dd [hh:mm:ss] into a Date object. Here are the 3 ways I have tried doing it and the times it takes each method to parse 50,000 date time strings.</p> <p>Does anyone know any faster ways of doing this or tips to speed up the methods?</p> <pre><code>castM...
<p>I've been using the following snipplet to parse UTC date strings:</p> <pre><code>private function parseUTCDate( str : String ) : Date { var matches : Array = str.match(/(\d\d\d\d)-(\d\d)-(\d\d) (\d\d):(\d\d):(\d\d)Z/); var d : Date = new Date(); d.setUTCFullYear(int(matches[1]), int(matches[2]) - 1, i...
<p>Here is my implementation. Give this a try.</p> <pre><code>public static function dateToUtcTime(date:Date):String { var tmp:Array = new Array(); var char:String; var output:String = ''; // create format YYMMDDhhmmssZ // ensure 2 digits are used for each format entry, so 0x00 suffuxed at each byte tmp....
2,534
<p>When viewing a webpage, I would like to copy a selection of text with its html formatting in one piece. Meaning if some text is in bold and blue, I want the tool to create a style or class in the html which makes the text blue. Everything is contained in the produced html.</p> <p>I have downloaded a similar plugin ...
<p>I think you may be able to accomplish this by using the Firebug for Firefox extension. I often use it to export the content of a web page for use rebuilding a similar object. Is this still too technical? Firebug is a powerful, viable option that it is worth learning, I think.</p>
<p>I think the copy operation does this already. If I copy this page and paste it in a WYSIWYG editor such as TinyMCE (included in Wordpress), I get the formatting. For example the text of this page is (as pasted):</p> <pre><code>&lt;h2&gt;&lt;a href="http://stackoverflow.com/questions/365603/firefox-plugin-to-copy-te...
47,732
<p>I'm trying to print with Laybrick and for the most part it is going. The problem lies with the top layer and gaps appearing. I've tried increasing the number of top layers but the gaps still appear. Any ideas what else I can try? </p> <p>I'm using Simplify3d. <a href="https://i.stack.imgur.com/Y05dR.jpg" rel="no...
<p>When using Simplify3D, you may try referring to their awesome troubleshooting guide: <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#holes-and-gaps-in-the-top-layers" rel="nofollow">https://www.simplify3d.com/support/print-quality-troubleshooting/#holes-and-gaps-in-the-top-layers</a> 3 rea...
<p>When using Simplify3D, you may try referring to their awesome troubleshooting guide: <a href="https://www.simplify3d.com/support/print-quality-troubleshooting/#holes-and-gaps-in-the-top-layers" rel="nofollow">https://www.simplify3d.com/support/print-quality-troubleshooting/#holes-and-gaps-in-the-top-layers</a> 3 rea...
393
<p>I have an SSRS report where the date should be grouped by project category the project code in the category is repeating in side the group how do I suppress the value</p> <p>Please help me to get an idea.</p> <p>Thanks,brijit</p>
<p>You can also hide fields by putting an expression in the Hidden property like this:</p> <pre><code>=Fields!ProductCode.Value = Previous(Fields!ProductCode.Value) </code></pre> <p>So if the value in the previous record is the same as this one, it will hide the field. You must sort the dataset correctly for this to ...
<p>I think it may be an issue concerning the way you are grouping the dates. Do you have the grouped with time on them as well but suppressing the hours in your output?</p> <p>For example:</p> <p>12-5-2010 12:00:00</p> <p>12-5-2010 13:00:00</p> <p>if you strip the times off in how you see them but not how you grou...
44,466
<p>I want to prevent the user from maximizing the Windows Form to full screen so I have disabled the Maximize button. However, I want to be able to have the user 'restore' the Form. When they click the Restore button I want it to show a different, smaller, minified, form, which will show them a maximize button which wi...
<p>I looked at a similar problem to this at work and the only solutions I could find involved setting undocumented window styles, which I was not inclined to do. </p> <p>Therefore the best solution to your problem I would think would be to hide the current minimize/maximize/restore buttons and add your own using some ...
<p>I had a similar situation recently, and from a UI design perspective, found a good example in Windows Media Player. It leaves the Minimise, Maximise and Restore buttons as they are, and has a separate button on the bottom right for "Switch to Compact Mode". And in the mini/compact mode, the same button toggles to "S...
48,725
<p>I am using <a href="http://msdn.microsoft.com/en-us/library/system.net.networkinformation.networkinterface.getallnetworkinterfaces.aspx" rel="nofollow noreferrer">NetworkInterface.GetAllNetworkInterfaces()</a> to get all the interfaces on a PC. However, this appears to only return "active" interfaces. How can I find...
<p>Ok, this is a hacky solution I got to detect named VPNs. It will throw an error if it cannot connect to the VPN for whatever reason (including the network connection is down, the VPN does not exist, etc.). </p> <p>Specific error codes to test for include :</p> <blockquote> <p>Remote Access error 800 - Unable to ...
<p>OK - Last ditch effort :)</p> <p>How about the <a href="http://msdn.microsoft.com/en-us/library/aa394220(VS.85).aspx" rel="nofollow noreferrer">Win32_NetworkConnection</a> class - I'm pretty sure this will handle VPN connections</p>
45,502
<p>Does anyone know if anyone makes a watermarked textbox control for the compact framework?</p> <p>I already loked at the following and didn't see one.</p> <p><a href="http://www.componentone.com/SuperProducts/StudioMobile/" rel="nofollow noreferrer">Component One Mobile</a></p> <p><a href="http://www.pocketpccontr...
<p>Daniel Moth has a pretty good blog post about how to do this here: </p> <p><a href="http://www.danielmoth.com/Blog/2006/07/textbox-with-cue-banner-support-for.html" rel="noreferrer">TextBox with cue banner support for Windows Mobile</a></p> <p>Best of all it is simple and free!</p>
<p>I've never seen one. <a href="http://www.codeproject.com/KB/miscctrl/WaterMark.aspx" rel="nofollow noreferrer">This project</a> shows how to do it yourself - not sure if it would work on CF, but I didn't see any obvious non-CF supported stuff in the example.</p>
21,073
<p>I'm currently working on a WebSphere 6.1 Web Project.</p> <p>In my java code, how can i get the current running application port?</p>
<p>The servlet API gives you the local port in HttpServletRequest.</p> <pre><code>protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { PrintWriter writer = response.getWriter(); writer.write("" + request.getLocalPort()); writer.close(...
<p>If you use RAD you can run administrative console from IDE and then discover all the ports used by WAS </p> <p><a href="http://pic.dhe.ibm.com/infocenter/radhelp/v9/index.jsp?topic=%2Fcom.ibm.sca.tools.doc%2Fsamples%2Ftopics%2Fwas_ports.html" rel="nofollow noreferrer">http://pic.dhe.ibm.com/infocenter/radhelp/v9/in...
33,175
<p>I am trying to implement the following functionality:</p> <pre><code>class WeightResolver { WeightMonitor _source; bool _cancelled; Weight _threshold; public Cancel() { _cancelled = true; } public Weight Resolve(){ _cancelled = false; while(_source.CurrentWeight &lt; threshold ) { ...
<p>This might not work for you, but based on the information you've provided, I'd suggest looking at thread.Join(XXX) where XXX is the number of milliseconds to wait. It'll greatly simplify your code.</p> <p><a href="http://msdn.microsoft.com/en-us/library/6b1kkss0.aspx" rel="nofollow noreferrer">http://msdn.microsoft...
<p>Is this while loop ever giving up the CPU?</p> <pre><code>while(_source.CurrentWeight &lt; threshold ) </code></pre> <p>If not, then your inactivity timer won't get a chance to run. You might want to use ManualResetEvents (instead of the loop... have whatever sets _source.CurrentWeight set the event) or throw in ...
28,547
<p>I'm doing some shennanigans with jQuery to put little plus/minus icons next to my expanders. Its similar to the windows file trees, or firebugs code expanders.</p> <p>It works, but its not specific enough. </p> <p>Hopefully this makes sense...</p> <pre><code>$('div.toggle').hide();//hide all divs that are part ...
<pre><code>$(this).contents('img.expander') </code></pre> <p>This is what you want. It will select all of the nodes that are children of your list. In your case, all of your images are nested inside of the list element, so this will filter out only what you want.</p>
<p>Have you tried the .siblings() method?</p> <pre><code>$(this).siblings('img.expander').attr('src','img/content/info-close.gif'); </code></pre>
34,322
<p>First of all, I will admit I am a novice to web services, although I'm familiar with HTML and basic web stuff. I created a quick-and-dirty web service using Python that calls a stored procedure in a MySQL database, that simply returns a BIGINT value. I want to return this value in the web service, and I want to ge...
<p>When I tried to write Python web service last year, I ended up using <a href="http://pywebsvcs.sourceforge.net/" rel="noreferrer">ZSI-2.0</a> (which is something like heir of SOAPpy) and a <a href="http://pywebsvcs.sourceforge.net/holger.pdf" rel="noreferrer">paper available on its web</a>.</p> <p>Basically I wrote...
<blockquote> <p>I want to generate a WSDL that I can give to the web folks, ....</p> </blockquote> <p>You can try <a href="http://soaplib.github.com/soaplib/2_0/" rel="nofollow noreferrer">soaplib</a>. It has on-demand WSDL generation.</p>
34,380