instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>HI,</p> <p>I m doing the folling stuff in the jsp code I need to do it using Struts or using JSTL tag can any body have relevant idea please share..</p> <p>The following is my JSP code</p> <pre><code>&lt;% Object category = request.getAttribute("categoryDetails"); ...
<p>According to <a href="http://net-snmp.sourceforge.net/wiki/index.php/Writing_your_own_MIBs" rel="nofollow noreferrer">this</a> net-snmp howto, there is a tool called <a href="http://www.ibr.cs.tu-bs.de/projects/libsmi/smilint.html" rel="nofollow noreferrer">smilint</a> from the <a href="http://www.ibr.cs.tu-bs.de/pr...
<p>I've been using <a href="http://www.mibexplorer.com/download/download.html" rel="nofollow">MIB Explorer Lite</a> which has a syntax checker whenever you load a MIB. There's a free trial which I think lasts about 30 days.</p>
49,409
<p>I am running some queries to track down a problem with our backup logs and would like to display datetime fields in 24-hour military time. Is there a simple way to do this? I've tried googling and could find nothing.</p>
<pre><code>select to_char(sysdate,'DD/MM/YYYY HH24:MI:SS') from dual; </code></pre> <p>Give the time in 24 hour format.</p> <p>More options are described <a href="http://www.oradev.com/oracle_date_format.jsp" rel="noreferrer">here</a>.</p>
<p>It's not oracle that determines the display of the date, it's the tool you're using to run queries. What are you using to display results? Then we can point you to the correct settings hopefully.</p>
12,848
<p>I have a source base that, depending on defined flags at build time, creates two different apps. I can build both of these apps using a Makefile by specifying two different targets, one that compiles with a flag and one that compiles without, and having an aggregate target that builds both.</p> <p>How do I do the e...
<p>Create one solution with two project files in the same folder. Set two different configurations in your solution, one of them building one of the projects, the other one building the other project.</p> <p>Alternatively, you can have one project which always builds to intermediate binary and then have a postbuild st...
<p>Release vs Debug? You can create your own custom configurations as well. But building a completely different app based on the configuration seems like a bad idea.</p> <p>Normal visual studio can have multiple projects in one solution, and I think there's a way to shoe-horn this into Express edition (perhaps by op...
24,745
<p>I´m currently working on a custom delta printer running Marlin 1.0.2 firmware. To control it I´m using the Repetier Host software with the onboard Cura software to slice my objects. The printing works fine but it takes the nozzle nearly 5 minutes to move from the homing position at 250&nbsp;mm to the starting positi...
<p>I had the same problem, and I solved it by changing the <em>Z-Axis Feed Rate</em> to a much higher value (1000 mm/min.) in Repetier Host via <em>Config -> Printer Settings -> Printer</em>.</p>
<p>Try changing the travel speed in you r slicer, if that doesn't work , try changing out the motors for newer ones.</p>
588
<p>How do you reference a bitmap on the stage in flash using actionscript 3?</p> <p>I have a bitmap on the stage in flash and at the end of the movie I would like to swap it out for the next in the sequence before the movie loops. in my library i have 3 images, exported for actionscript, with the class name img1/img2/...
<p>To reference something on the stage, you need to give the stage instance a name - not give the symbol in the library a class name.</p> <p>Click on the item on the stage and look at the properties panel. There should be a text entry box just above the entry boxes for the item's dimensions. Enter a name there.</p> <...
<p>I would probably do something like this in your document class</p> <pre><code>for(var i:int=0; i&lt;numChildren; i++){ trace(getChildAt(i),"This is the child at position "+i); } </code></pre> <p>I do this because I still code in the flash IDE and its debugger is so very painful to get working most of the time ...
6,497
<p>While I'm developing my MS Access application, I open it with shift click. When an Error occurs, that is not trapped (by ON ERROR ...), a message box pops up informing me about the error. This is a good thing.</p> <p>When a user open my application, he does't shift click, and an appropriate Start Form opens. Howeve...
<p>It turns out, this is a side effect of setting the AllowSpecialKeys property to False. This can be done programmatically, but I did it in the menu under Tools > StartUp.</p> <p>Since this property allows the user to open the code editor, it kind of makes sense, but the relationship of the phenomen described to this...
<p>You can create your own error handler and add it to all procs, subs and functions. You have this very nice <a href="http://www.mztools.com" rel="nofollow noreferrer">MZ Tools</a> VBA add-on that allows you many thing such as adding line numbers to your code, "preprogramming" your error label, etc. </p> <p>If you ar...
46,372
<p>I've drawn an ellipse in the XZ plane, and set my perspective slightly up on the Y-axis and back on the Z, looking at the center of ellipse from a 45-degree angle, using gluPerspective() to set my viewing frustrum.</p> <p><a href="http://www.flickr.com/photos/rampion/2863703051/" rel="nofollow noreferrer" title="el...
<p>It looks like you're using 1.0 as the aspect when you call gluPerspective(). You should use width/height. For example, if your viewport is 640x480, you would use 1.33333 as the aspect argument.</p>
<p>It looks like the aspect parameter on your gluPerspective call need tweaking. See <a href="http://www.opengl.org/documentation/specs/man_pages/hardcopy/GL/html/glu/perspective.html" rel="nofollow noreferrer">The Man Page</a>. If your window were physically square, the aspect ratio would be 1 and your problem would...
10,471
<p>So I assume I'm not the only one. I'm wondering if there are others out there who have compiled a personal code library. Something that you take from job to job that has examples of best practices, things you are proud of, or just common methods you see yourself using over and over. </p> <p>I just recently started ...
<p>Because I primarily do web development, I've abstracted out some common features that I end up doing frequently on sites for clients. </p> <ul> <li><p><strong>Ajax Emailer</strong>. Nearly every site I work on has some type of contact form. I wrote a utility that allows me to drop some HTML on a page, having JavaSc...
<p>I have several utility MATLAB functions that I have taken with me as I move from job to job, particularly ones that enforce W3C standards on the plots I make to ensure that text and background colors have a good <a href="http://www.w3.org/TR/2005/WD-WCAG20-20051123/appendixA.html" rel="nofollow noreferrer">luminosit...
23,341
<p>I want to serialize a Dictionary that has a custom <code>IEqualityComparer</code>.</p> <p>I've tried using <code>DataContractSerializer</code> but I can't get the <code>Comparer</code> to be serialized.</p> <p>I can't use <code>BinaryFormatter</code> because of <a href="https://connect.microsoft.com/VisualStudio/f...
<p>pop-cmd.py:</p> <pre><code>#!/usr/bin/env python import os, shlex, sys from subprocess import call filename = sys.argv[1] lines = open(filename).readlines() if lines: command = lines[0].rstrip() open(filename, "w").writelines(lines[1:]) if command: sys.exit(call(shlex.split(command) + sys.argv[2...
<p>You can't write to the beginning of a file, so cutting out line 1 would be a lot of work (rewrite the rest of the file (which isn't actually that much work for the programmer (it's what every other answer post has written for you :) ) ) ).</p> <p>I'd recommend keeping the whole thing in memory and using a classic s...
47,839
<p>In Cygwin a space in a path has to be escaped with a backslash Not true in Windows, put the whole path in a quote</p> <p>Is there a way to convert to this automatically in Ruby?</p> <p>Otherwise, how in Ruby do I detect if I am running with Windows or Cygwin?</p>
<p><a href="http://rant.rubyforge.org/" rel="nofollow noreferrer">http://rant.rubyforge.org/</a></p> <pre><code>sys.escape("foo bar") # gives on Windows: '"foo bar"' # other systems: 'foo\ bar' </code></pre>
<p>I found how to detect the platform at least - the RUBY_PLATFORM constant defines that.</p>
29,913
<p>What is the best way to disable the warnings generated via <code>_CRT_SECURE_NO_DEPRECATE</code> that allows them to be reinstated with ease and will work across Visual Studio versions?</p>
<p>If you don't want to pollute your source code (after all this warning presents only with Microsoft compiler), add <code>_CRT_SECURE_NO_WARNINGS</code> symbol to your project settings via "Project"->"Properties"->"Configuration properties"->"C/C++"->"Preprocessor"->"Preprocessor definitions".</p> <p>Also you can def...
<p>Another late answer... Here's how Microsoft uses it in their <code>wchar.h</code>. Notice they also disable <a href="http://msdn.microsoft.com/en-us/library/ms182089%28v=vs.100%29.aspx" rel="nofollow">Warning C6386</a>:</p> <pre><code>__inline _CRT_INSECURE_DEPRECATE_MEMORY(wmemcpy_s) wchar_t * __CRTDECL wmemcpy(_O...
14,541
<p>Are there any third party enterprisey data grid controls out there, alla JIDE Data Grid? Is there a website like torry.net that lists third party java controls? Google doesn't turn up much for and I thought there would be a lot of both considering how popular java seems to be.</p> <p>TIA</p>
<p>Most Java frameworks offer that kind of component or widget. You can look into SWT (from eclipse), they is very good stuff in there: <a href="http://www.eclipse.org/swt/" rel="nofollow noreferrer">http://www.eclipse.org/swt/</a>. You could also look into Jambi (Qt in Java) from <a href="http://trolltech.com/products...
<p>I usually look on component sales sites like <a href="http://www.componentsource.com/features/grids/java-components/index.html" rel="nofollow noreferrer">http://www.componentsource.com/features/grids/java-components/index.html</a></p> <p>Jonathan Wax jwaxster@gmail.com</p>
29,588
<p>A long time ago I saw this trick in Ruby. Instead of doing (for example)</p> <pre><code>if array1.empty? and array2.empty? and array3.empty? </code></pre> <p>You could call all of the objects at once and append the operation at the end, kind of like</p> <pre><code>if %w(array1 array2 array3).each { |a| a.empty? }...
<p><code>if [array1, array2, array3].all? { |a| a.empty? }</code></p> <p>I think that's what you're looking for</p>
<p>On a side note, Symbol#to_proc can have performance issues, so use it in cases when readability is worth it.</p>
49,401
<p>I've written a Custom User Control which returns some user specific data. To load the Custom User Control I use the following line of code:</p> <pre><code>UserControl myUC = (UserControl).Load("~/customUserControl.ascx"); </code></pre> <p>But how can I access <code>string user</code> inside the User Control <code...
<p>Let's call your usercontrol "Bob"</p> <p>If you Inherit from UserControl in Bob, then I guess it's safe to do this:</p> <pre><code>Bob b = (Bob).Load("~/customUserControl.ascx"); </code></pre> <p>For the user part, I can't really follow what you want to do, is the "user" in the class were you create the "Bob" use...
<p>You will need to cast the loaded control to the actual type and use its public property:</p> <pre><code>MyUserControl myUCTyped = (MyUserControl)myUC; myUCTyped.ThePublicProperty = "some value"; </code></pre>
43,645
<p>I have a project and it needs to access a large amount of proprietary data in ASP.NET. This was done on the Linux/PHP by loading the data in shared memory. I was wondering if trying to use Memory Mapped Files would be the way to go, or if there is a better way with better .NET support. I was thinking of using the...
<p>I know this is a bit late, but the .NET 4.0 framework now supports memory-mapped files out of the box:</p> <p><a href="http://blogs.msdn.com/salvapatuel/archive/2009/06/08/working-with-memory-mapped-files-in-net-4.aspx" rel="noreferrer">http://blogs.msdn.com/salvapatuel/archive/2009/06/08/working-with-memory-mapped...
<p>You might want to just throw it in the Cache[] object. You can set a cache expiration based on the real file. Then whenever you modify the actual file the contents will be null for the object in the cache and you can reload it. This may not be appropriate if you're dealing with a large number of bytes.</p> <pre>...
46,574
<p>I'm writing an ASP.NET application. I have a textbox on a webform, and I want to force whatever the user types to upper case. I'd like to do this on the front end. You should also note that there is a validation control on this textbox, so I want to make sure the solution doesn't interfere with the ASP.NET validatio...
<p>Why not use a combination of the CSS and backend? Use:</p> <pre><code>style='text-transform:uppercase' </code></pre> <p>on the TextBox, and in your codebehind use:</p> <pre><code>Textbox.Value.ToUpper(); </code></pre> <p>You can also easily change your regex on the validator to use lowercase and uppercase lette...
<p>Minimum 8 characters at least 1 Alphabet and 1 Number &lt;asp:TextBox ID=&quot;txtPolicy1&quot; runat=&quot;server&quot;&gt;&lt;/asp:TextBox&gt;<br /> &lt;asp:RegularExpressionValidator ID=&quot;Regex1&quot; runat=&quot;server&quot; ControlToValidate=&quot;txtPolicy1&quot; ValidationExpression=&quot;^(?=.<em>[A-Za-z...
24,743
<p>Does anyone know how to programmaticly find out where the java classloader actually loads the class from? </p> <p>I often work on large projects where the classpath gets very long and manual searching is not really an option. I recently had a <a href="https://stackoverflow.com/questions/226280/eclipse-class-versi...
<p>Here's an example:</p> <pre><code>package foo; public class Test { public static void main(String[] args) { ClassLoader loader = Test.class.getClassLoader(); System.out.println(loader.getResource("foo/Test.class")); } } </code></pre> <p>This printed out:</p> <pre><code>file:/C:/Users/...
<p>Assuming that you're working with a class named <code>MyClass</code>, the following should work:</p> <pre><code>MyClass.class.getClassLoader(); </code></pre> <p>Whether or not you can get the on-disk location of the .class file is dependent on the classloader itself. For example, if you're using something like BC...
28,153
<p>Have you managed to get Aptana Studio debugging to work? I tried following this, but I don't see <code>Windows -&gt; Preferences -&gt; Aptana -&gt; Editors -&gt; PHP -&gt; PHP Interpreters</code> in my menu (I have <code>PHP plugin</code> installed) and any attempt to set up the servers menu gives me "socket error" ...
<p>I've been using ZendDebugger with Eclipse (on OS X) for a while now and it works great!</p> <p>Here's the recipe that's worked well for me.</p> <ol> <li>install Eclipse PDT via "All in one" package at: <a href="http://www.zend.com/en/community/pdt" rel="nofollow noreferrer">http://www.zend.com/en/community/pdt</a>...
<p>I realize that this is a old thread but I was having the same problem with Aptana Studio 3 and FireFox. If anyone is having this problem make sure that FireFox has FireBug <strong>V1.8.X</strong> installed, any other version might give you the same problem...</p> <p>Hope this helps</p>
15,551
<p>How exactly can I create a new directory using Emacs? What commands do I use? (If possible, please provide an example)</p>
<ul> <li><p>to create the directory <code>dir/to/create</code>, type:</p> <pre><code>M-x make-directory RET dir/to/create RET </code></pre></li> <li><p>to create directories <code>dir/parent1/node</code> and <code>dir/parent2/node</code>, type:</p> <pre><code>M-! mkdir -p dir/parent{1,2}/node RET </code></pre> <p>It...
<p>I came across this question while searching for how to automatically create directories in Emacs. The best answer I found was in <a href="https://stackoverflow.com/questions/6830671/how-to-make-emacs-create-intermediate-dirs-when-saving-a-file">another thread</a> from a few years later. The answer from <a href="http...
18,809
<p>I have a Virtual Machine in Virtual PC 2007.</p> <p>To start it from the desktop, I have the following command in a batch file:</p> <pre><code>"c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc "MY-PC" -launch </code></pre> <p>But that leaves a dos prompt on the host machine until the virtual machine shut...
<p>START has a peculiarity involving double quotes around the first parameter. If the first parameter has double quotes it uses that as the optional TITLE for the new window. </p> <p>I believe what you want is:</p> <pre><code>start "" "c:\program files\Microsoft Virtual PC\Virtual PC.exe" -pc MY-PC -launch </code></...
<p>have you tried:</p> <pre><code>start "c:\program files\Microsoft Virtual PC\Virtual PC.exe" "-pc MY-PC -launch" </code></pre> <p>?</p>
18,613
<p>What Python libraries do folks use for querying Amazon product data? (Amazon Associates Web Service - used to be called E-Commerce API, or something along those lines).</p> <p>Based on my research, <a href="http://pyaws.sourceforge.net/" rel="noreferrer">PyAWS</a> seems okay, but still pretty raw (and hasn't been u...
<p>I'm using <a href="https://github.com/aurorasoftware/bottlenose">Bottlenose</a>, Dan Loewenherz's "super awesome Python wrapper for the Amazon Product Advertising API". It doesn't parse the XML, so I'm using <a href="http://codespeak.net/lxml/objectify.html">lxml.objectify</a>:</p> <pre><code>ACCESS_KEY_ID = "..." ...
<p>pyaws is the best in my opinion. The most available version is 0.2.0, but there is also a version 0.3.0 that is somewhat harder to find. The best maintained version of it that I have found though, which is based on 0.3.0, is on <a href="http://bitbucket.org/johnpaulett/pyaws/overview/" rel="nofollow noreferrer">bi...
7,130
<p>The following method does not work because the inner block declares a variable of the same name as one in the outer block. Apparently variables belong to the method or class in which they are declared, not to the block in which they are declared, so I therefore can't write a short little temporary block for debuggin...
<p>I believe the rationale is that most of the time, that isn't intentional, it is a programming or logic flaw.</p> <p>in an example as trivial as yours, its obvious, but in a large block of code, accidentally redeclaring a variable may not be obvious.</p> <p>ETA: it might also be related to exception handling in jav...
<p>another reason: if this kind of variable declaration were allowed, people would want (need?) a way to access outer block variables. may be something like "outer" keyword would be added:</p> <pre><code>void methodName() { int i = 7; for (int j = 0; j &lt; 10; j++) { int i = outer.i * 2; if(i ...
17,047
<p>Is there a <code>string.Empty</code> in JavaScript, or is it just a case of checking for <code>&quot;&quot;</code>?</p>
<h3>Empty string, undefined, null, ...</h3> <p>To check for a <a href="https://developer.mozilla.org/en-US/docs/Glossary/Truthy" rel="noreferrer">truthy value</a>:</p> <pre><code>if (strValue) { // strValue was non-empty string, true, 42, Infinity, [], ... } </code></pre> <p>To check for a <a href="https://develope...
<pre><code>var x =" "; var patt = /^\s*$/g; isBlank = patt.test(x); alert(isBlank); // Is it blank or not?? x = x.replace(/\s*/g, ""); // Another way of replacing blanks with "" if (x===""){ alert("ya it is blank") } </code></pre>
18,612
<p>I want ajax application to process a simple form with textinput and submit button only , and without validation , i want to add this with a php script . I ask this because i don't know how to program with ajax or javascript .</p>
<p>Honestly, you're not going to get anywhere without learning javascript. You should really look into learn it, it's not that complex of a language either. Ajax isn't actually a language, it's a function, a feature so to speak. Once you get the hang of using it, it's not difficult either, and frameworks like JQuery an...
<p>You can use the <a href="http://exscale.se/archives/2008/01/20/ajax-submit-form-jquery-plugin/" rel="nofollow noreferrer">ajaxSubmit</a> plugin for jQuery.</p> <p>After you include jquery and the plugin in the html you just add</p> <pre><code>$(document).ready(function () { $('form').ajaxSubmit('#result'); });...
35,614
<p>Currently, I am splitting all my tests by package (projects). So if I have 12 projects, I will create 1 more project for Unit Test with 12 classes that will test all my package. </p> <p>Do you do the same way or do you have 1 testing class by class? How do you organize all your test?</p>
<p>Like Pokus my tests are in the same assembly as the classes to test so I can test internals and privates. </p> <p>In C# you have Debug and Release builds, I add another called UnitTest with a compiler directive UNITTEST. I can then add the directive(#if UNITTEST) at the top of the test class, so that when I compi...
<p>We do one-to-one test assemblies (C#). For each assembly in a solution, we have a corresponding test project. Each project has a test for each class in the corresponding project.</p> <p>For example:</p> <p>Company.Product.Feature<br /> &nbsp;&nbsp;ClassnameAlpha<br /> &nbsp;&nbsp;ClassnameBeta<br /> &nbsp;&nbsp;...
38,741
<p>I'm required to write documentation for my current project that lists all .c files and for each one lists every .h file which is directly or indirectly included by that file.</p> <p>This is a large project, and although we have Makefiles which theoretically have this information, those Makefiles are sometimes incor...
<p>What I do in my Makefile is</p> <pre><code>SRCS=$(wildcard *.c) depend: $(SRCS) gcc -M $(CFLAGS) $(SRCS) &gt;depend include depend </code></pre> <p>This means that if any of the source files are updated, the depend rule will run, and use gcc -M to update the file called depend. This is then included in the m...
<p>In MSVC (2005 and 2008 at least, possibly other versions as well but not VC6) you can get the compiler to tell you all the files that were included during compilation. The output is quite verbose, but complete and fairly easy to parse with human eyes.</p> <p>In Project Settings, go to the C/C++>Advanced tab, and t...
25,086
<p>The background should be transparent, but the text should not.</p>
<p>By making an "Enso style" application you mean the Enso launcher?</p> <p>Here is a screenshot of it: <a href="http://enscreenshots.softonic.com/s2en/68000/68880/3_ensolauncher03.jpg" rel="nofollow noreferrer">alt text http://enscreenshots.softonic.com/s2en/68000/68880/3_ensolauncher03.jpg</a></p> <p>I would sugges...
<p>You can set the background color, and transparency key properties to the same color and that will make the background transparent. The rest of the control items will stay non-transparent, as long as they are different colors.</p>
13,636
<p>PHP 4.4 and PHP 5.2.3 under Apache 2.2.4 on ubuntu.</p> <p>I am running Moodle 1.5.3 and have recently had a problem when updating a course. The $_POST variable is empty but only if a lot of text was entered into the textarea on the form. If only a short text is entered it works fine.</p> <p>I have increased the p...
<p>I don't know enough to really provide a useful answer so the following is more a well-educated guess (at least I hope so).</p> <p>First, you should debug the entire request, either by access_log or for example through <a href="http://www.getfirebug.com/" rel="nofollow noreferrer">firebug</a>. (Good to have Firebug ...
<p>It sounds like an Apache or Apache/PHP integration problem. If $_POST is empty it would hint that the http server is not giving the POST information to PHP. If I were you I'd investigate the Apache configuration.</p>
28,381
<p>I have a VS2005 solution which contains a variety of projects (C++ DLLs, C++ static libraries, C# assemblies, C++ windows executables) that are combined in various ways to produce several executables. For some reason, every time I open the solution, VS2005 wants to check out one of the projects for editing. The pr...
<p>As Charles and Graeme have hinted at, Visual Studio constantly make changes to user option files and such on the backed even if you don't make changes to the project directly.</p> <p>I'm not sure what information is being stored but I do know that it happens. Common remedies is to not include the *.suo files. I al...
<p>Have you put a .suo or .ncb file into source control perhaps?</p>
12,754
<p>If I have a Django form such as:</p> <pre><code>class ContactForm(forms.Form): subject = forms.CharField(max_length=100) message = forms.CharField() sender = forms.EmailField() </code></pre> <p>And I call the as_table() method of an instance of this form, Django will render the fields as the same order...
<p><strong>[NOTE: this answer is now pretty completely outdated - please see the discussion below it, and more recent answers].</strong></p> <p>If <code>f</code> is a form, its fields are <code>f.fields</code>, which is a <code>django.utils.datastructures.SortedDict</code> (it presents the items in the order they are...
<p>It has to do with the meta class that is used in defining the form class. I think it keeps an internal list of the fields and if you insert into the middle of the list it might work. It has been a while since I looked at that code.</p>
45,664
<p>Rather than rewriting the entire contents of an xml file when a single element is updated, is there a better alternative to updating the file?</p>
<p>I would recommend using VTD-XML <a href="http://vtd-xml.sourceforge.net/" rel="noreferrer">http://vtd-xml.sourceforge.net/</a></p> <p>From their FAQ ( <a href="http://vtd-xml.sourceforge.net/faq.html" rel="noreferrer">http://vtd-xml.sourceforge.net/faq.html</a> ):</p> <blockquote> <p>Why should I use VTD-XML for...
<p><strong>Process Large XML Files with XQuery Works with Gigabyte Size XML Files</strong> <a href="http://www.xquery.com" rel="nofollow noreferrer">http://www.xquery.com</a></p> <p>XQuery is a query language that was designed as a native XML query language. Because most types of data can be represented as XML, XQuery...
8,783
<p>I've been raised to believe that if multiple threads can access a variable, then all reads from and writes to that variable must be protected by synchronization code, such as a "lock" statement, because the processor might switch to another thread halfway through a write.</p> <p>However, I was looking through Syste...
<p>For the definitive answer go to the spec. :)</p> <p>Partition I, Section 12.6.6 of the CLI spec states: "A conforming CLI shall guarantee that read and write access to properly aligned memory locations no larger than the native word size is atomic when all the write accesses to a location are the same size."</p> <...
<p>Ack, nevermind... as pointed out, this is indeed incorrect. It doesn't prevent a second thread from entering the "initialize" code section. Bah.</p> <blockquote> <p>You could also decorate s_Initialized with the volatile keyword and forego the use of lock entirely.</p> </blockquote>
3,104
<p>No extracted data output to data2.txt? What goes wrong to the code?</p> <p><strong>MyFile.txt</strong></p> <pre><code>ex1,fx2,xx1 mm1,nn2,gg3 EX1,hh2,ff7 </code></pre> <p>This is my desired output in data2.txt:</p> <pre><code>ex1,fx2,xx1 EX1,hh2,ff7 </code></pre> <p><br></p> <pre><code>#! /DATA/PLUG/pvelasco/S...
<p>This regex makes no sense:</p> <pre><code>m/EX$HF|ex$HF/ </code></pre> <p>Is $HF supposed to be a variable? What are you trying to match? </p> <p>Also, the second line in <em>every</em> Perl script you write should be:</p> <pre><code>use strict; </code></pre> <p>It will make Perl catch such mistakes and tell yo...
<p>When I run your code, but name the input file <code>My1.txt</code> instead of <code>MyFile.txt</code> I get the desired output - except with empty lines, which you can remove by removing the <code>, "\n"</code> from the print statement.</p>
25,952
<p>In SQL you can use </p> <p>SELECT * FROM INFORMATION_SCHEMA.TABLES </p> <p>etc to get information about the database structure. I need to know how to achieve the same thing for an Access database.</p>
<p>The equivalent operation can be accomplished using </p> <p>OleDbConnection.GetOleDbSchemaTable() method.</p> <p>see <a href="http://support.microsoft.com/kb/309488" rel="noreferrer">http://support.microsoft.com/kb/309488</a> for more information</p>
<p>In OLEDB it can be accessed as DBSCHEMA_TABLES. Following C++ code demonstrates the retrieval of the tables information from an OLEDB provider:</p> <pre><code>#include &lt;atldb.h&gt; ... // Standard way of obtaining table node info. CAccessorRowset&lt;CDynamicAccessor, CBulkRowset&gt; pRS; ...
14,359
<p>They both seem to be sending data to the server inside the body, so what makes them different?</p>
<p><strong>HTTP PUT:</strong></p> <p>PUT puts a file or resource at a specific URI, and exactly at that URI. If there's already a file or resource at that URI, PUT replaces that file or resource. If there is no file or resource there, PUT creates one. PUT is <a href="https://www.rfc-editor.org/rfc/rfc9110.html#name-id...
<p>Both PUT and POST are Rest Methods .</p> <p>PUT - If we make the same request twice using PUT using same parameters both times, the second request will not have any effect. This is why PUT is generally used for the Update scenario,calling Update more than once with the same parameters doesn't do anything more than ...
13,287
<p>A client of mine has asked me to integrate a 3rd party API into their Rails app. The only problem is that the API uses SOAP. Ruby has basically dropped SOAP in favor of REST. They provide a Java adapter that apparently works with the Java-Ruby bridge, but we'd like to keep it all in Ruby, if possible. I looked i...
<p>I built <a href="http://savonrb.com" rel="noreferrer">Savon</a> to make interacting with SOAP webservices via Ruby as easy as possible.<br> I'd recommend you check it out.</p>
<p>I was having the same issue, switched to Savon and then just tested it on an open WSDL (I used <a href="http://www.webservicex.net/geoipservice.asmx?WSDL" rel="nofollow">http://www.webservicex.net/geoipservice.asmx?WSDL</a>) and so far so good!</p> <p><a href="https://github.com/savonrb/savon" rel="nofollow">https:...
6,150
<p>I re-read my question and realized I made a confusing one, so I am rewording a LOT.</p> <p>So the software I use is Craftware. When it comes to the first layer I have it set to .25mm, with the following layers being whatever I specify otherwise. And because of this there shouldn't be a difference with the first lay...
<p>You likely need to re-calibrate the Z-height of your nozzle. The reason that a lot less plastic is coming out of the nozzle at 0.1mm is that the actual gap is likely smaller than 0.1mm. This makes the print bed act essentially like a partial "lid" on the nozzle which occludes the outflow of molten plastic. </p> <p>...
<p>You have asked several questions here. </p> <p>"why is first layer set to 0.25" -- check the gcode file, opening it in a text editor, to see what layer values are specified. </p> <p>"looks like under-extrude" -- please show a picture. If it's purely that the print failing to adhere, you may need to adjust the Z...
852
<p>My goal here is to create a very simple template language. At the moment, I'm working on replacing a variable with a value, like this:</p> <p>This input:</p> <blockquote> The Web </blockquote> <p>Should produce this output:</p> <blockquote> <p>The Web This Is A Test Variable</p> </blockquote> <p>I've got i...
<p>The first thing that may improve things is to move the re.compile outside the function. The compilation is cached, but there is a speed hit in checking this to see if its compiled.</p> <p>Another possibility is to use a single regex as below:</p> <pre><code>MatchedQuotes = re.compile(r"(['\"])(.*)\1", re.LOCALE) ...
<p>Why not use XML and XSLT instead of creating your own template language? What you want to do is pretty easy in XSLT.</p>
17,653
<p>I am wondering if it is possible to use LINQ to pivot data from the following layout:</p> <pre><code>CustID | OrderDate | Qty 1 | 1/1/2008 | 100 2 | 1/2/2008 | 200 1 | 2/2/2008 | 350 2 | 2/28/2008 | 221 1 | 3/12/2008 | 250 2 | 3/15/2008 | 2150 </code></pre> <p>into something like t...
<p>Something like this?</p> <pre><code>List&lt;CustData&gt; myList = GetCustData(); var query = myList .GroupBy(c =&gt; c.CustId) .Select(g =&gt; new { CustId = g.Key, Jan = g.Where(c =&gt; c.OrderDate.Month == 1).Sum(c =&gt; c.Qty), Feb = g.Where(c =&gt; c.OrderDate.Month == 2).Sum(c ...
<p>Group your data on month, and then project it into a new datatable with columns for each month. The new table would be your pivot table.</p>
20,206
<p>On a cross platform c/c++ project (Win32, Linux, OSX), I need to use the *printf functions to print some variables of type size_t. In some environments size_t's are 8 bytes and on others they are 4. On glibc I have %zd, and on Win32 I can use <a href="http://msdn.microsoft.com/en-us/library/tcxf1dw6.aspx" rel="nor...
<p>The <code>PRIuPTR</code> macro (from &lt;inttypes.h&gt;) defines a decimal format for <code>uintptr_t</code>, which should always be large enough that you can cast a <code>size_t</code> to it without truncating, e.g.</p> <pre><code>fprintf(stream, "Your size_t var has value %" PRIuPTR ".", (uintptr_t) your_var); </...
<p><code>size_t</code> is an <em>unsigned</em> type of at least 16 bits. Widths of 32 and 64 are often seen.</p> <pre><code>printf("%zu\n", some_size_t_object); // Standard since C99 </code></pre> <p>Above is the best way going forward, yet if code needs to also port to pre-C99 platforms, covert the value to some wi...
21,048
<p>I want to do something like this:</p> <pre><code>List&lt;Animal&gt; animals = new ArrayList&lt;Animal&gt;(); for( Class c: list_of_all_classes_available_to_my_app() ) if (c is Animal) animals.add( new c() ); </code></pre> <p>So, I want to look at all of the classes in my application's universe, and when ...
<p>I use <a href="https://github.com/ronmamo/reflections" rel="noreferrer">org.reflections</a>:</p> <pre><code>Reflections reflections = new Reflections("com.mycompany"); Set&lt;Class&lt;? extends MyInterface&gt;&gt; classes = reflections.getSubTypesOf(MyInterface.class); </code></pre> <p>Another example:</p> <p...
<p>This is a tough problem and you will need to find out this information using static analysis, its not available easily at runtime. Basically get the classpath of your app and scan through the available classes and read the bytecode information of a class which class it inherits from. Note that a class Dog may not d...
25,186
<p>I have the following project solution:</p> <ul> <li><p>There is a ASP.NET MVC Web Application where I have a SQL database (mdf file) in the App_Data directory.</p></li> <li><p>There is a class library where I have some migrations from <a href="http://code.google.com/p/migratordotnet/" rel="nofollow noreferrer">migr...
<p>One icon for user account, another icon is for group account. </p>
<p>Connect permission has been revoked and Connect permission has been denied are both correct. The only way I've found to cause the red arrow is for the user to NOT have connect access to the database. </p> <p>Source SQL Server QOTD - 2 July 2014 (Andy Warren)</p>
49,868
<p>I'm trying to convert an Excel document into a table in SQL 2005. I found the link below and am wondering if it looks like a solution. If so, what would the @excel_full_file_name syntax be and where would the path be relative to? </p> <p><a href="http://www.siccolo.com/Articles/SQLScripts/how-to-create-sql-to-con...
<p>You can use the BULK INSERT T-SQL command if you just want a pure sql solution. You have to save the file as csv/text first.</p> <pre><code>BULK INSERT YourDestinationTable FROM 'D:\YourFile.csv' WITH ( FIELDTERMINATOR = ',', ROWTERMINATOR = '\n' ) GO </c...
<p><a href="http://cheeso.members.winisp.net/srcview.aspx?dir=MSOffice&amp;file=CopyData-SqlToExcel-TwoOledbConnections.cs" rel="nofollow noreferrer">This example</a> copies data from SQL to Excel. But it is just a matter of swapping the OleDb providers to get it to work in the opposite direction. </p>
43,987
<p>I am asked to work on a piece of code which relies heavily on pthreads. So many calls are made to this library that I know nothing of. I have learnt the basics of pthread and have tried out a few examples like creating joining etc. but dont know the depths of it. </p> <p>I have learnt much of it using <a href="http...
<p><a href="https://hpc-tutorials.llnl.gov/posix/" rel="nofollow noreferrer">https://hpc-tutorials.llnl.gov/posix/</a></p> <p><a href="http://en.wikipedia.org/wiki/POSIX_Threads" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/POSIX_Threads</a></p> <p>[EDIT] First link was broken, now is fixed.</p>
<p>As Ankit S states above, Advanced Programming in the Unix Environment is a good source. Also, volume 2 of Unix Network Programming (also by Stevens) has a big section on posix semaphores and similar topics.</p>
29,482
<p>I'm using VS2008 Team Suite, ASP.NET MVC Beta, with TestDriven.Net installed. When I created my project from the template, it created a "Tests" project as well and put some controller tests for the AccountController in a folder inside this project. I've added other controllers and associated tests. Howerver, when ...
<p>It isn't going to very fast if you have a lot of <strong>a</strong> or <strong>b</strong> nodes but this validates against what you've described.</p> <pre><code>&lt;xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"&gt; &lt;xs:element name="test"&gt; &lt;xs:complexType&gt; &lt;xs:sequence&gt; ...
<p>If you paste the sample XML, we can help you better. However, <a href="https://stackoverflow.com/questions/288236/xsd-code-generator">Microsoft has an XSD code generator</a> that generates an XSD based on an XML file that you pass in as an argument.</p>
46,171
<p>My WinForms app uses a number of <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.backgroundworker.aspx" rel="noreferrer">BackgroundWorker</a> objects to retrieve information from a database. I'm using BackgroundWorker because it allows the UI to remain unblocked during long-running database qu...
<p>If the operation raises an exception that your code does not handle, the <code>BackgroundWorker</code> catches the exception and passes it into the <code>RunWorkerCompleted</code> event handler, where it is exposed as the Error property of <code>System.ComponentModel.RunWorkerCompletedEventArgs</code>. If you are ru...
<p>As it was already noted:</p> <blockquote> <p>If the operation raises an exception that your code does not handle, the BackgroundWorker catches the exception and passes it into the RunWorkerCompleted event handler, where it is exposed as the Error property of System.ComponentModel.RunWorkerCompletedE...
32,288
<p>I'm a C programmer trying to understand C++. Many tutorials demonstrate object instantiation using a snippet such as:</p> <pre><code>Dog* sparky = new Dog(); </code></pre> <p>which implies that later on you'll do:</p> <pre><code>delete sparky; </code></pre> <p>which makes sense. Now, in the case when dynamic m...
<p>On the contrary, you should always prefer stack allocations, to the extent that as a rule of thumb, you should never have new/delete in your user code.</p> <p>As you say, when the variable is declared on the stack, its destructor is automatically called when it goes out of scope, which is your main tool for trackin...
<p>I had the same problem in Visual Studio. You have to use:</p> <p>yourClass->classMethod();</p> <p>rather than:</p> <p>yourClass.classMethod();</p>
43,220
<p>I have the following legacy code:</p> <pre><code>public class MyLegacyClass { private static final String jndiName = "java:comp/env/jdbc/LegacyDataSource" public static SomeLegacyClass doSomeLegacyStuff(SomeOtherLegacyClass legacyObj) { // do stuff using jndiName } } </code></pre> <p>This c...
<p>Just to make @Robin's suggestion of a strategy pattern more concrete: (Notice that the public API of your original question remains unchanged.)</p> <pre><code>public class MyLegacyClass { private static Strategy strategy = new JNDIStrategy(); public static SomeLegacyClass doSomeLegacyStuff(SomeOtherLegacyCla...
<p>I think that the best solution here is bind that JNDI to a local </p> <p>The legacy Code is using the jndiName like that:</p> <pre><code>DataSource datasource = (DataSource)initialContext.lookup(DATASOURCE_CONTEXT); </code></pre> <p>So, The solution here is bind a local (or whatever you have for you test data) in...
31,115
<p>I am working on a cocoa software and in order to keep the GUI responsive during a massive data import (Core Data) I need to run the import outside the main thread.</p> <p>Is it safe to access those objects even if I created them in the main thread without using locks <strong>if</strong> I don't explicitly access th...
<p>With Core Data, you should have a separate managed object context to use for your import thread, connected to the same coordinator and persistent store. You cannot simply throw objects created in a context used by the main thread into another thread and expect them to work. Furthermore, you cannot do your own lock...
<p>The whole point of using locks is to ensure that two threads don't try to access the same resource. If you can guarantee that through some other mechanism, go for it.</p>
9,274
<p>I'm embedding MSBuild directly into a more complex build tool. The relevant code looks roughly like this:</p> <pre><code>// assume 'using Microsoft.Build.BuildEngine;' Engine e = Engine(); BuildPropertyGroup props = new BuildPropertyGroup(); props.SetProperty( "Configuration", Config.BuildConfig ); e.BuildProjectFi...
<p>This question has come up a few times on the MSDN boards, and unfortunately I haven't seen any other way, apart from terminating the thread. Sadly, in this case, terminating the thread isn't really drastic with it being the only real option.</p> <p>On a random side note, I am not sure to what extent you are using ...
<p>I had done something similar by running msbuild from command. This starts a process which you could terminate.</p> <p>From my experience, it is far easier and flexible to manipulate the project files using xml tools and then execute msbuild than it is to programmatically configure your projects the way you have de...
40,188
<p>I have a table (volunteers_2009) that has all the volunteers stored within, then I have a table (venues) that list all the different venues a volunteer could work (volunteers are assigned to one venue each, and that is stored within volunteers_2009.venue_id, which equals venues.id)</p> <p>The venues table also has ...
<p>google.com, update.microsoft.com, and other services which handle astonishingly high aggregate bandwidth do much of their magic via DNS.</p> <p>BGP Anycast routing is used to announce the IP address of their DNS servers from multiple points around the world. Each DNS server is configured to resolve google.com to IP...
<p>This is normal internet traffic handling. Google literally has entire data centers all over the planet that respond to www.google.com</p>
25,897
<p>Is there any way to trap an error and exit gracefully from Perl? I am working on a script which might fail due to a SIG event from the OS or other applications running on my server. I wish to trap this event, display the error and exit after closing all files and other attributes I have open during the execution of ...
<p>Use the %SIG hash to install signal handlers. Example:</p> <p>$SIG{INT} = 'SigIntHandler';</p> <p>Where SigIntHandler is a sub that you write to be called when an interrupt is caught.</p>
<p>See <a href="http://www.perl.com/doc/manual/html/lib/sigtrap.html" rel="nofollow noreferrer">perldoc sigtrap</a>.</p>
34,953
<p>I'm planning to write an operating system and I don't know very much about operating systems. Are there any good resources or books to read in order for me to learn? What are your recommendations?</p>
<p>We used Andrew Tannenbaum's <a href="https://rads.stackoverflow.com/amzn/click/com/0136006639" rel="nofollow noreferrer" rel="nofollow noreferrer">Modern Operating Systems</a> at the university I attended. I highly recommend it for it's clear explanations of the tradeoffs inherent in many of the design decisions th...
<p>Apart from books, there are many sites that learn OS Development<br> <a href="http://www.brokenthorn.com/Resources/OSDevIndex.html" rel="nofollow">BrokenThorn Entertainment</a> is on of this website that learn OS dev from base </p>
31,692
<p>In our app, we currently live with the legacy of a decision to store all engineering data in our database in SI.</p> <p>I worry that we may run the risk of not having sufficient precision and accuracy in our database or in .NET numeric types. I am also worried that we may see artifacts of floating-point maths (alth...
<p>Keep <em>significant figures</em> in mind -- the accuracy of the measurement. If the PSI is known to only whole pounds, then after conversion to Pa there are 15 decimals, there is still only one significant figure.</p> <p>Precision is different from accuracy, and performing floating point operations on engineering...
<p>Well, it depends on how exact you want to be. Remember than when talking about engineering, it isn't enough to just store the number 3.20, because 3.2 isn't the same as 3.20 when it comes to engineering. 3.20 implies higher accuracy than 3.2, which could be <em>3.15 &lt;= x &lt; 3.25</em>.</p>
44,706
<p>I remember hearing <a href="http://en.wikipedia.org/wiki/Joel_Spolsky" rel="noreferrer">Joel Spolsky</a> mention in <a href="https://stackoverflow.fogbugz.com/default.asp?W4" rel="noreferrer">podcast 014</a> that he'd barely ever used a foreign key (if I remember correctly). However, to me they seem pretty vital to ...
<p>Reasons to use Foreign Keys:</p> <ul> <li>you won't get Orphaned Rows</li> <li>you can get nice "on delete cascade" behavior, automatically cleaning up tables</li> <li>knowing about the relationships between tables in the database helps the Optimizer plan your queries for most efficient execution, since it is able ...
<p>I always thought it was lazy not to use them. I was taught it should always be done. But then, I didnt listen to Joel's discussion. He may have had a good reason, I don't know.</p>
10,884
<p>I've just done a test with bitfields, and the results are surprising me. </p> <pre><code>class test1 { public: bool test_a:1; bool test_b:1; bool test_c:1; bool test_d:1; bool test_e:1; bool test_f:1; bool test_g:1; bool test_h:1; }; class test2 { public: int test_a:1; int t...
<p>your compiler has arranged all of the members of test3 on integer size boundaries. Once a block has been used for a given type (integer bit-field, or boolean bit-field), the compiler does not allocate any further bit fields of a different type until the next boundary.</p> <p>I doubt it is a bug. It probably has som...
<p>From "Samuel P. Harbison, Guy L. Steele] C A Reference":</p> <p><strong>The problem:</strong></p> <p>"Compilers are free to impose constraints on the maximum size of a bit field, and specify certain addressing boundaries that bit field cannot cross."</p> <p><strong>Manipulations which can be done within standard:...
39,721
<p>I'm using the following syntax to loop through a list collection:</p> <pre><code>For Each PropertyActor As JCPropertyActor In MyProperty.PropertyActors i = IndexOf(PropertyActor) Next </code></pre> <p>How do I get the index of the current object within the loop? I'm using IndexOf(PropertyActor) but this seems...
<p>An index doesn't have any meaning to an IEnumerable, which is what the foreach construct uses. That's important because <code>foreach</code> may not enumerate in index order, if your particular collection type implements IEnumerable in an odd way. If you have an object that can be accessed by index <em>and</em> yo...
<p>Add an index variable that you increase yourself for each iteration?</p>
25,237
<p>While I'm googling/reading for this answer I thought I would also ask here. </p> <p>I have a class that is a wrapper for a SDK. The class accepts an ILoader object and uses the ILoader object to create an ISBAObject which is cast into an ISmallBusinessInstance object. I am simply trying to mock this behavior usin...
<p>You need to use sbainst.Object, as sbinst isn't an instance of ISbaObjects - it's just the mock part.</p>
<p>Updated, correct code</p> <pre><code>[TestMethod] public void Test_Customer_GetByID() { var mock = new Mock&lt;ILoader&gt;(); var sbainst = new Mock&lt;ISbaObjects&gt;(); mock.Expect(x =&gt; x.GetSbaObjects("")).Returns(sbainst.Object); } </code></pre>
19,871
<p>I cannot figure out a way to disable a container AND its children in Swing. Is Swing really missing this basic feature?</p> <p>If I do setEnabled(false) on a container, its children are still enabled.</p> <p>My GUI structure is pretty complex, and doing a traversion of all elements below the container is not an op...
<p>To add to <a href="https://stackoverflow.com/questions/305527#305551">mmyers's answer</a>, disabling children is not an easy task (see this <a href="http://forums.java.net/jive/thread.jspa?threadID=13758" rel="nofollow noreferrer">thread</a>)</p> <blockquote> <p>The problem is near-to unsolvable in the general ca...
<p>This is what I came up with.</p> <pre><code>Component[] comps = myPanel.getComponents(); for (Component comp:comps){ comp.setEnabled(false); } </code></pre>
39,299
<p>My application correctly handles different kind of character sets, but only internally - when it comes to displaying text in standard WinForms labels und textboxes, it seems to have problems with chinese characters.</p> <p>The problem seems to be the font used (Tahoma), because when I copy&amp;paste the text, or vi...
<p><a href="http://en.wikipedia.org/wiki/Uniscribe" rel="nofollow noreferrer">UniScribe</a>, which was introduced in Windows 2000, is supposed to handle this transparently, meaning that it will automatically use a different font (such as Mincho) for characters that aren't present in the font you've selected. This is wh...
<p>All fonts don't have data for all the glyphs that can be expressed in unicode. You´ll have to locate a suitable font which has the subset you want.</p> <p>edit: Just to clarify, there <em>are</em> fonts which cover the full unicode range, but the one you´re using now isn´t one of them.</p>
12,916
<p>Googling has turned up little to nothing.</p> <p>I need to develop some heavy stuff in m4 and I'd love to do it in my favorite environment with all the bells and whistles thereof.</p> <p>There are packages for running m4 on just about every platform, such as <a href="http://gnuwin32.sourceforge.net/packages/m4.htm...
<p>I'm not aware of any specific editing support for m4. However, if you have some time to spare (!) and the BNF for m4, then you could use Xtext (<a href="http://wiki.eclipse.org/Xtext" rel="nofollow noreferrer">http://wiki.eclipse.org/Xtext</a>) to create a syntax-coloring and -completing editor, with an outline view...
<p>If you are familiar with (and like) vim, you could try out <a href="http://eclim.org/" rel="nofollow noreferrer">Eclim</a> and then setup syntax highlighting for m4.</p>
40,626
<p>I've had a lot of trouble trying to come up with the best way to properly follow TDD principles while developing UI in JavaScript. What's the best way to go about this?</p> <p>Is it best to separate the visual from the functional? Do you develop the visual elements first, and then write tests and then code for fu...
<p>I've done some TDD with Javascript in the past, and what I had to do was make the distinction between Unit and Integration tests. Selenium will test your overall site, with the output from the server, its post backs, ajax calls, all of that. But for unit testing, none of that is important.</p> <p>What you want is j...
<p>This is the primary reason I switched to the Google Web Toolkit ... I develop and test in Java and have a reasonable expectation that the compiled JavaScript will function properly on a variety of browsers. Since TDD is primarily a unit testing function, most of the project can be developed and tested before compil...
12,165
<p>What is the least expensive 3D printer available today? I am looking for something suitable for general use in a home office.</p>
<p><strong>Depends on your definition of "available" and your definition of "suitable for general use."</strong> </p> <p>The cheapest 3D printers are mostly Kickstarter promises that take a year or more to ship, if they ever do. For example, the Peachy 3D printer Kickstarter just imploded and failed. There have been m...
<p>You can get an A8 3D printer on Gearbest at 149$, It's a version of an i3, with easy assemble and pre configured, and it have a suprising good quality.</p> <p>I thinks is the best price/quality that you can find at the moment. It prints with a good quality by default and you can upgrade it if you need it without sp...
295
<p>I want to include a js file depending on the value of the current Locale. I have tried to access it from JSP as follows: </p> <pre><code>&lt;%@ page import="java.util.Locale" %&gt; &lt;% if( ((Locale) pageContext.getAttribute("org.apache.struts.action.LOCALE",PageContext.REQUEST_SCOPE)).getLanguage().equals("de")...
<p>At the moment I am using this :</p> <pre><code>&lt;c:set var="localeCode" value="${pageContext.response.locale}" /&gt; </code></pre> <p>This can later be access by using <code>${localeCode}</code> </p> <ol> <li><strong>Scriplet mode</strong>, discouraged! See <a href="http://www.coderanch.com/how-to/java/WhyNotUs...
<p>Ken G. pointed to the answer.</p> <pre><code>pageContext.getAttribute("org.apache.struts.action.LOCALE",PageContext.SESSION_SCOPE) </code></pre> <p>should be used instead</p> <pre><code>pageContext.getAttribute("org.apache.struts.action.LOCALE",PageContext.REQUEST_SCOPE) </code></pre>
43,264
<p>How can I list the contents of a zipped folder in C#? For example how to know how many items are contained within a zipped folder, and what is their name?</p>
<p><a href="http://www.codeplex.com/DotNetZip" rel="noreferrer">DotNetZip</a> - Zip file manipulation in .NET languages</p> <p>DotNetZip is a small, easy-to-use class library for manipulating .zip files. It can enable .NET applications written in VB.NET, C#, any .NET language, to easily create, read, and update zip fi...
<p>The best way is to use the .NET built in J# zip functionality, as shown in MSDN: <a href="http://msdn.microsoft.com/en-us/magazine/cc164129.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc164129.aspx</a>. In this link there is a complete working example of an application reading and writi...
39,626
<p>I am having a lot of trouble finding good information on how to call a standard SOAP/WSDL web service with Android. All I've been able to find are either very convoluted documents and references to "kSoap2" and then some bit about parsing it all manually with <a href="http://en.wikipedia.org/wiki/Simple_API_for_XML"...
<p>Android does not provide any sort of SOAP library. You can either write your own, or use something like <a href="http://ksoap2.sourceforge.net/" rel="noreferrer">kSOAP 2</a>. As you note, others have been able to compile and use kSOAP2 in their own projects, but I haven't had to.</p> <p>Google has shown, to date, l...
<p>Add Soap Libaray(<code>ksoap2-android-assembly-3.2.0-jar-with-dependencies.jar</code>):</p> <p>public static String Fn_Confirm_CollectMoney_Approval(</p> <pre><code> HashMap &lt; String, String &gt; str1, HashMap &lt; String, String &gt; str2, HashMap &lt; String, String &gt; str3) { O...
38,084
<p>I have a registry value which is stored as a binary value (REG_BINARY) holding information about a filepath. The value is read out into an byte array. But how can I transform it into a readable string?</p> <p>I have read about system.text.encoding.ASCII.GetString(value) but this does not work. As far as I got to kn...
<p>Well, it's not <em>arbitrary</em> binary data - it's text data in <em>some</em> kind of encoding. You need to find out what the encoding is.</p> <p>I wouldn't be surprised if <code>Encoding.Unicode.GetString(value)</code> worked - but if that doesn't, please post a sample (in hex) and I'll see what I can do. What d...
<p>Use</p> <pre><code>Function Microsoft.Win32.RegistryKey.GetValue(name as String) as Object </code></pre> <p>Also look at <code>System.Text.Encoding</code> and <code>System.Text.Encoding.Unicode</code></p>
45,466
<p>I can easily set breakpoints in embedded JS functions, but I don't see any way of accessing external JS scripts via Firebug unless I happen to enter them during a debug session. Is there a way to do this without having to 'explore' my way into the script?</p> <p>@Jason: This is a good point, but in my case I do not...
<p>Place <code>debugger;</code> in your external script file on the line you want to break on.</p>
<p>After you place a break point in them, you can also call them by name in the firebug console, and see the output of (or step through) any intermediate functions. This can help when the main entry point calls many other helper functions, and you are really just concerned with how these helpers are working.</p> <p>T...
5,259
<p>I am looking for a way to generate 2D horizontal templates for manually carving an object. My thought was to produce an STL of the model, generate the G-code, and then transform that into slices. Appreciate any suggestions for where to start. I'm not afraid of getting my hands dirty with python, R, matlab, whatever....
<h1>Carving decorative patterns?</h1> <p>If your templates needs to be used like one does a stencil, that's doable... but paper-thin is not as you can't make that with an FDM printer.</p> <p>But if you allow 0.2 or even better, 0.5 mm thickness, it is as simple as making a vector graphic, importing it into a suitable C...
<p>I would approach following way. I saw interesting example of using <em>Autodesk Fusion 360</em> to generate moves (G-Code) for carving in vertical slices. Fusion generated moves like for CNC tool in &quot;parallel mode&quot;. You can see details in the video <a href="https://www.youtube.com/watch?v=CkRDLPbVNo4" rel=...
1,831
<p>I wrote a program out, which was all in one file, and the methods were forward declared in a header. The program initially worked perfectly when it was in one file. But when I separated the program, I kept getting random occurrences for the destructor of one of the classes which was declared in the header file. <...
<p>You must define the constructor in A (all of them) to increment the count.</p> <p>Note unless you define them the compiler automatically generate the following four methods:</p> <ul> <li>Default Constructor (if no other constructor is defined)</li> <li>Default Destructor</li> <li>Copy Constructor</li> <li>Assignme...
<p>Can you elaborate what you mean by the "value seems to be off"? Do you get too many constructions? Not enough destructions? If you get too many constructions and not enough destructions, it would not have anything to do with the statics.</p> <p>Also, what do you mean by a static variable? Do you mean a static membe...
42,746
<p>The ones that stick out and make life usefull.</p>
<p>Here is one for a testClass with Nunit support.</p> <pre><code> Imports Nunit.FrameWork Namespace $NAMESPACE$ ''' ''' A TestClass ''' ''' _ Public Class $CLASSNAME$ #Region " Setup and TearDown " ''' ''' Sets up the Tests ''' ''' _ ...
<p>MSTest testclass. I like my testclass basic. Not like the one that is created by VS.</p> <pre><code>Imports Microsoft.VisualStudio.TestTools.UnitTesting &lt;TestClass()&gt; _ Public Class $ClassName$ $END$ End Class </code></pre> <p><code>$Classname</code> is "Current file name without extension" macro.</p>
4,714
<p>I'm trying to compile over 100 java classes from different packages from a clean directory (no incremental compiles) using the following ant tasks:</p> <pre><code>&lt;target name="-main-src-depend"&gt; &lt;depend srcdir="${src.dir}" destdir="${bin.dir}" cache="${cache.dir}" ...
<blockquote> <p>It will be nice to know; what can cause or causes a StackOverflowError during compilation of Java code?</p> </blockquote> <p>It is probable that evaluating the long expression in your java file consumes lots of memory and because this is being done in conjunction with the compilation of other cla...
<p>That's quite odd, 100 classes really isn't that many. What is the compiler doing when the stack overflows? Is there a useful stack trace generated? What happens if you run <code>javac</code> directly on the command line instead of thorugh ant?</p> <p>One possible workaround is to simply increase the size of the sta...
3,762
<p>I currently have a .net SOAP web service with a timeout on the request that I set using</p> <pre><code>Server.ScriptTimeout = TIME_OUT; </code></pre> <p>I then have java client calling said web service. However when the timeout is reached I get this exception:</p> <pre><code>Exception in thread "Thread-9" com.sun...
<p>This is a <a href="https://jax-ws.dev.java.net/issues/show_bug.cgi?id=566" rel="nofollow noreferrer">known issue</a> with Sun's JAX-WS stack.</p> <p>For reference, the HTTP 500 code actually means that the server had an Internal Server Error. I'm not sure why .NET sends that rather than HTTP 503 Service Unavailabl...
<p>You can make your webservice <a href="http://msdn.microsoft.com/en-us/library/aa480516.aspx" rel="nofollow noreferrer">asynchronous</a>. Then start a timer with your timeout in the BeginMyMethod, and throw custom exception in your EndMyMethod method. It will be wrapped in SOAP exception and sent to the client as suc...
44,333
<p>I have a fair number of Python scripts that contain reusable code that are used and referenced by other Python scripts. However, these scripts tend to be scattered across different directories and I find it to be somewhat tedious to have to include (most often multiple) calls to sys.path.append on my top-level scrip...
<p>The simple answer is to put your reusable code in your site-packages directory, which is in your sys.path.</p> <p>You can also extend the search path by adding .pth files somewhere in your path. See <a href="https://docs.python.org/2/install/#modifying-python-s-search-path" rel="nofollow noreferrer">https://docs.py...
<p>My solution was to package up one utility that would import the module: my_util is in site packages</p> <pre><code>import my_util foo = myutil.import_script('..//shared1//reusable_foo') if foo == None: sys.exit(1) def import_script(script_path, log_status = True): """ imports a module and returns the...
36,626
<p>This is a nasty one for me... I'm a PHP guy working in Java on a JSP project. I know how to do what I'm attempting through too much code and a complete lack of finesse. </p> <p>I'd prefer to do it right. Here is the situation:</p> <p>I'm writing a small display to show customers what days they can water their ...
<p>You could do essentially the same code with Hashtables (or some other Map):</p> <pre><code>Hashtable&lt;String, Hashtable&lt;String, String&gt;&gt; schedule = new Hashtable&lt;String, Hashtable&lt;String, String&gt;&gt;(); schedule.put("A", new Hashtable&lt;String, String&gt;()); schedule.put("B", new Hashtable...
<p>There is no pretty solution. Java just doesn't do things like this well. Mike's solution is pretty much the way to do it if you want strings as the indices (keys). Another option if the hash-of-hashes setup is too ugly is to append the strings together (shamelessly stolen from Mike and modified):</p> <pre><code>...
3,394
<p>Before anyone recommends that I do a google search on this, I have. I just need a bit more clarity around what codepages and encodings.</p> <p>If I use UTF8 encoding, and use an italian code page and then a french code page, does this mean ill get different characters even though the bytes havent changed?</p>
<p>Joel has a nice summary of this:<br> <a href="http://www.joelonsoftware.com/articles/Unicode.html" rel="nofollow noreferrer">http://www.joelonsoftware.com/articles/Unicode.html</a></p> <p>And no. if I understand your question correctly it doesn't mean that. When you're converting UTF-8 to a specific code page, it i...
<p>UTF-8 includes all characters from your French and Italian code page, but the language specific code pages does not include all of each others characters.</p> <p>So you can take input from each language and convert it to UTF-8 for storage, but you can not be certain that you will get the right characters if you tak...
32,192
<p>There has been some talk of Website performance monitoring tools and services on stackoverflow, however, they seem fairly expensive for what they actually do. Are there any good opensource libraries for automating checking/monitoring the availability of a website?</p>
<p>If you just want to know if your server is serving out content or not, take a look at <a href="http://www.montastic.com/" rel="nofollow noreferrer">Montastic</a>. I use it, and am pleased. Plus its free!</p> <p>It will ping your site periodically, and if it doesn't get a 200 status, it lets you know.</p>
<p>I have always used <a href="http://www.zabbix.com/" rel="nofollow noreferrer">Zabbix</a> especially for critical web sites. It uses MySql for the database and it has a PHP frontend. Of course it is open source and it is very flexible. It uses servers to stick data in the database and agents collect the data and s...
7,839
<p>I'm maintaining <a href="http://perl-begin.org/" rel="nofollow noreferrer">the Perl Beginners' Site</a> and used a modified template from Open Source Web Designs. Now, the problem is that I still have an undesired artifact: a gray line on the left side of the main frame, to the left of the navigation menu. Here's <a...
<p>It's the <code>background-image</code> on the body showing through. Quick fix (edit style.css or add elsewhere):</p> <pre><code>#page-container { background-color: white; } </code></pre>
<p>Thanks to all the people who answered. The problem was indeed the transparency of the #page-container and the background image of the body. I fixed them both in the stylesheet. </p>
10,021
<p>How to obtain Vista Edition programmatically, that is Home Basic, Home Premium, Business or Ultimate ?</p>
<p>MSDN gives extensive answer:</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms724429%28VS.85%29.aspx" rel="nofollow noreferrer">Getting the System Version</a></p>
<p>Brilliant! This is just what I need as well. Thanks aku.</p> <p>edg: Environment.OSVersion contains a version string but this doesn't generally give enough information to differentiate editions (also applies to XP Home/XP Pro). Also, there's the risk that this string will be localised so matching on it woudn't nece...
8,007
<p>This fails with 'X.m is not a function'...</p> <pre><code>var Y = function () { this.m = function () { alert('this is m'); }; }; var X = new function () { }; X.prototype = new Y(); X.m(); </code></pre> <p>It would certainly work if I skipped the new keyword in the X definition and then instantiat...
<p>No you cannot set the prototype and have that change effect previously existing instances. You can however, modify the prototype object to have the desired effect. But not the way you have attempted. This is because your instance X is an object, not a class. (This is because you used the "new" operator before th...
<p>You're trying to use .prototype on an <code>object</code> when you should be using it on a <code>function</code>.</p> <p><code>alert(typeof Y); alert(typeof X);</code></p> <p>You're actually creating a property on X called prototype, rather than using the "magic" protoype (try <code>X.prototype.m()</code> to see w...
40,351
<p>My application has several threads: 1) Main Thread 2) 2 Sub-Main Threads (each with Message Loop, as shown below), used by TFQM 3) n Worker Threads (simple loop, containing Sleep())</p> <p>My problem is, when I close my application, the Worker Threads manage to exit properly, but 1 of the 2 Sub-Main Threads hangs (...
<p>If I may point to few problems in your code ...</p> <p>1) You're not checking output of AllocateHwnd. Yes, most probably it will never fail, but still ...</p> <p>2) AllocateHwnd belogs OUT of try..finally! If it fails, DeallocateHwnd should not be called.</p> <p>3) AllocateHwnd is not threadsafe. If you call it f...
<p>I've had the same problem, and I found out I <strong>shouldn't</strong> create a hidden window just to recieve messages. Threads already have a message system. </p> <p>I think that you're creating your windows handle and store it in fHandle, but GetMessage checks your thread's message loop. Therefore the message Po...
28,426
<p>Suppose I have a couple of spring beans: </p> <pre><code>&lt;beans&gt; &lt;bean name="A" ... /&gt; &lt;bean name="B" ... /&gt; &lt;/beans&gt; </code></pre> <p>"B" exposes a remote service that doesn't need "A". Assume that "A" takes a non-negligble time to load. What this means is that during a restart cycle...
<p>Don't refer to bean "A" directly. Instead, refer to a bean which is a FACTORY for bean "A"; in this way, the Factory bean can be created without taking the initialization hit for instantiating "A". You'll need to refactor your classes which refer to an "A" to retrieve an "A" first, of course.</p> <p>Or, you could...
<p>I do not understand, why "A takes a non-negligble time to load", but maybe you could to a lazy initialize yourself by refactoring A. Do not use InitializingBean or handle an ApplicationEvent. Just initialize on the first Request to be handled. This will slow down the first request!</p> <p>The other possibility is t...
24,667
<p>I have the need to copy the entire contents of a directory on a FTP location onto a shared networked location. FTP Task has you specify the exact file name (not a directory) and File System Task does not allow accessing a FTP location.</p> <p><strong>EDIT</strong>: I ended up writing a script task.</p>
<p>I've had some similar issues with the FTP task before. In my case, the file names changed based on the date and some other criteria. I ended up using a Script Task to perform the FTP operation.</p> <p>It looks like this is what you ended up doing as well. I'd be curious if anyone else can come up with a better way ...
<p>When I need to do this sort of thing I use a batch file to call FTP on the command line and use the mget command. Then I call the batch from the DTS/DTSX package.</p>
6,358
<p>What's the general consensus on supporting Windows 2000 for software distribution? Are people supporting Windows XP SP2+ for new software development or is this too restrictive still?</p>
<p>"OK" is a subjective judgement. You'll need to take a look at your client base and see what they're using.</p> <p>Having said that, I dropped support for Win2K over a year ago with no negative impact.</p>
<p>A lot of computers at my company use Win2k, so we couldn't really drop support. It all depends on the client base.</p>
3,290
<p>An image set as the background of a DIV is displayed in IE, but not in Firefox.</p> <p>CSS example:</p> <pre><code>div.something { background:transparent url(../images/table_column.jpg) repeat scroll 0 0; } </code></pre> <p>(The issue is described in many places but haven't seen any conclusive explanation or fix....
<p>Sorry this got huge, but it covers two possibilities that consistently happen to me.</p> <h2>Possibility 1</h2> <p>You may find the path to the CSS file isn't correct. For example:</p> <p>Say I have the following file structure:</p> <pre><code>public/ css/ global.css images/ background.jp...
<p>This worked for me:</p> <p>1) Click on the background image table.<br/> 2) Right click on the status bar at the bottom of the page.<br/> 3) Click Inline styles.<br/> 4) Click the Background styles tab.<br/> 5) If you see 'Transparent' in the colour title, that is the problem.<br/> 6) Click the colour box and...
48,528
<p>I have a makefile template to compile a single DLL (for a plugin system). The makefile of the user looks like this:</p> <pre><code>EXTRA_SRCS=file1 file2 include makefile.in </code></pre> <p>In the <code>makefile.in</code> I have:</p> <pre><code>plugin.dll: plugin.os $(patsubst %,%.os,$(EXTRA_SRCS)) </code></pre>...
<p>Use the "wildcard" function:</p> <pre><code>$(wildcard *.h) </code></pre> <p>EDIT: in order to match a specific list, do</p> <pre><code>$(wildcard $(HEADER_FILES)) </code></pre> <p>There is no need to use $(filter ...), the wildcard function automatically filters files which don't exist.</p>
<p>Does the simple</p> <pre><code>$(filter $(wildcard *.h),$(HEADER_FILES)) </code></pre> <p>do what you want?</p>
31,111
<p>I have a website that plays mp3s in a flash player. If a user clicks 'play' the flash player automatically downloads an mp3 and starts playing it. </p> <p>Is there an easy way to track how many times a particular song clip (or any binary file) has been downloaded?</p> <hr> <blockquote> <p>Is the play link a lin...
<p>The funny thing is I wrote a php media gallery for all my musics 2 days ago. I had a similar problem. I'm using <a href="http://musicplayer.sourceforge.net/" rel="nofollow noreferrer">http://musicplayer.sourceforge.net/</a> for the player. And the playlist is built via php. All music requests go to a script called ...
<p>Is there a database for your music library? If there is any server code that runs when downloading the mp3 then you can add extra code there to increment the play count. You could also have javascript make a second request to increment the play count, but this could lead to people/robots falsely incrementing counts....
2,261
<p>We are using Zabbix for services monitoring.</p> <p>There are some essential monitoring configured. I want to have timeline of version strings of my service along with this monitorings. That would give me opportunity to see that upgrading to this version altered overall error-count.</p> <p>Is it possible? </p>
<p>Yes, it's possible.</p> <p>You can pass arbitrary data from your Zabbix agent to the Zabbix server by using "UserParameter" fields in zabbix_server.conf, i.e. agent configuration file. </p> <p>General syntax is:</p> <blockquote> <p>UserParameter=section[id], command</p> </blockquote> <p>For example, let's assu...
<p>Update to Igor's answer:</p> <p>UserParameter is declared client-side in <code>zabbix_agentd.conf</code> or <code>zabbix_agent.conf</code> (depending on whether you're using the daemon or inetd version), not <code>zabbix_server.conf</code>.</p>
15,020
<p>I know that you can do this in SQL Server 2005, but I'm at a loss for 2000.</p>
<p>Not to my knowledge.</p> <p>To get around this, I manage my stored procedures in a Visual Studio database project. Every stored procedure is in its own file and has a drop command at the top of the file. When I update the stored through Visual Studio, the database's created date is updated in the database because...
<p>From all the research I've done on this in the past, I unfortunately have to say no. SQL Server 2000 simply does not store this information, and I've never seen any solution for retrieving it.</p> <p>There are a few alternative methods, but they all involve user intervention. Besides keeping stored procedure script...
19,818
<ul> <li>I autoformat a GridView in ASP.NET.</li> <li><p>It looks nice but the headers all run together like this:</p> <p><strong>idfirstNamelastNameage</strong></p></li> <li><p>I set CellPadding="5" but it does nothing.</p></li> </ul> <p>How can I set the cell padding of the headers and all cells?</p> <p>A D D E N ...
<p>You should set a cssclass and use css to control it. The only property of a table you cant fully control cross browser with css is cellspacing.</p> <pre><code>.myTableClass tr th { padding: 5px; } </code></pre>
<p>Check the generated HTML and find the table it has created. Check the ID of the table. With the id, add following lines to your CSS. This worked for me when all else failed..</p> <pre><code>#YourTableIdFoo th , #YourTableIdFoo td { padding-right: 1em; } </code></pre>
40,931
<p>In a static view, how can I view an old version of a file?</p> <p>Given an empty file (called <code>empty</code> in this example) I can subvert <code>diff</code> to show me the old version:</p> <pre> % cleartool diff -ser empty File@@/main/28 </pre> <p>This feels like a pretty ugly hack. Have I missed a more ...
<blockquote> <p>I'm trying to look at a bunch of old versions</p> </blockquote> <p>I am not sure if you are speaking about &quot;a bunch of old versions&quot; of <em>one file</em>, &quot;a bunch of old versions&quot; from <em>several</em> files.</p> <p>To visualize several old versions of one file, the simplest mean is...
<p>ct shell cat File@@version</p>
21,304
<p>I have a method which prints out the order of a set of images. I need to submit this to a new php page.</p> <p>I have a form which currently prints out the order to the same page.</p> <pre><code>&lt;form action="mainpage.php" method="post"&gt; &lt;div style="clear:both;padding-bottom:10px"&gt; &lt;input type=...
<p>You can submit the form with (note that this isn't tested):</p> <pre><code>document.formname.submit(); </code></pre> <p>If you need to change the action (the page to submit to) first:</p> <pre><code>document.formname.action = 'some_other_url'; </code></pre> <p>If you need to submit the form asynchronously you ne...
<p>with plain POST (no ajax) you need to store the result of your process (image order id retrieval) in an form field:</p> <pre><code>&lt;input type="hidden" name="imagesorder" value=""/&gt; </code></pre> <p>in your function, you can set the value to this field after the orderString is populated:</p> <pre><code>docu...
46,857
<p>I can think of plenty of good reasons to using it; however, what are the downsides to it?</p> <p>(Apart from buying another server)</p> <p>What are some advantages to using a daily build instead of it?</p>
<p>(It's worth noting that by "continuous integration" I mean <strong>automated</strong> integration with an <strong>automated</strong> build process and <strong>automatically</strong> runs tests and <strong>automatically</strong> detects failure of each piece.</p> <p>It's also worth noting that "continuous integratio...
<p>The only good reason not to do continuous integration comes when you've gotten your project working to the point where your integration tests hadn't identified any defect in a good long while and they're taking too much time to run every time you do a build. In other words: you've done enough continuous integratio...
26,388
<p>Looking for a better Windows XP command-line interface. The Visual Studio Command Prompt isn't near as nice as the Linux/OSX terminals. </p> <p>Thoughts?</p> <p><strong>edit:</strong></p> <p>Answers: Console on Sourceforge, and the Windows Powershell. Thanks, I'll go dig them up and evaluate them. The Cygwin pack...
<p>Take a look at Console2 <a href="http://sourceforge.net/projects/console/" rel="noreferrer">http://sourceforge.net/projects/console/</a></p> <p>It's features:</p> <p>"multiple tabs, text editor-like text selection, different background types, alpha and color-key transparency, configurable font, different window st...
<p>I see you put "powershell" as one of your tags. Maybe you could help direct our answers by explaining what you don't like about PowerShell as a replacement for cmd.exe?</p>
23,502
<p>I work on a complex application where different teams work on their own modules with a degree of overlap. A while back we got a Mediawiki instance set up, partly at my prompting. I have a hard job getting people to actually use it, let alone contribute.</p> <p>I can see a lot of benefit in sharing information. It m...
<p>Some tips:</p> <p>Any time someone sends information by email that really should be in a wiki, make a page for that topic and add what they put in the email. Then reply "Thanks for that info, I've put it into the wiki here so that it's easier to find in the future." </p> <p>Likewise, if you have information you n...
<p>Find "sticky" items (sub-3 pg. docs / diagrams / etc) something that the team seems to be creating again and again &amp; post it on the wiki. Make sure everyone has access to the wiki and knows its there - set up a notification mechanism if possible. With some luck, the next time they have to access, rather than dig...
3,668
<p>I want to put in a date and serial number that would be difficult to erase or change. Is it better to print in the number or engrave it in with a laser engraver.</p> <p>Material will be anti-bacterial PLA.</p> <p>It will be on free masks donated to schools, I want to make sure we can identify them when they show up ...
<p>For this specific application, it may be better to think in terms of a <strong>Lot Number</strong> for each batch instead of individual serial numbers. This will still let you trace back an item for where it was originally allocated, and greatly simplify your processing.</p> <p>Under this plan, you create the STL fi...
<p>Have you considered using a barcode rather than text. It would be easier to print clearly as there are no curves, and would be machine readable.</p>
2,058
<p>How do I group search results returned by Lucene by fields (similar to SQL Server's)?</p>
<p>Lucene 3.4 now supports faceted search. At indexing you specify something supplementary and at search time you search by query and by groups.</p> <p>for next 3 docs, that you index with these groups</p> <pre><code>doc1: monday, 1pm, 3min doc2: monday, 1pm, 4min doc3: monday, 2pm, 3min </code></pre> <p>...
<p>It's not clear whether you want a true SQL-like "GROUP BY" behavior, or merely an "ORDER BY" behavior. There's nothing like aggregation functions in Lucene, so "GROUP BY" would have to implemented in your application, on top of Lucene.</p> <p>However, sorting by fields is fairly easy. Make sure the desired field is...
44,587
<p>I am primarily a fluent .NET developer (as can be seen from the amount of posts and threads I make about .NET), but I thought it would be good to learn RoR.</p> <p>In doing so, I have a few questions about the architecture of the language (Ruby) and the framework (RoR):</p> <p>1) In .NET, every object is derived f...
<p>Dave Thomas (Pragmatic Programmers) has an excellent <a href="http://www.pragprog.com/screencasts/v-dtrubyom/the-ruby-object-model-and-metaprogramming" rel="nofollow noreferrer">screencast series</a> on the Ruby object model/metaprogramming. We watched this in a local Ruby user's group. The series isn't free, but ...
<ol> <li>If we compare .NET to Rails then yes, there is this kind of hierarchy there. And in general, you can achieve this kind of hierarchy in any Ruby application via using modules.</li> <li>I guess it's because of Ruby's dynamic nature. </li> </ol>
49,070
<p>I have a problem with a memory leak in a .NET CF application. </p> <p>Using <a href="http://blogs.msdn.com/stevenpr/archive/2006/04/17/577636.aspx" rel="nofollow noreferrer">RPM</a> I identified that dynamically creating controls are not garbage collected as expected. Running the same piece of code in .NET Window...
<p>Some additional information here that explains this behaviour.</p> <p><a href="http://forums.microsoft.com/msdn/ShowPost.aspx?PostID=4002811&amp;SiteID=1&amp;mode=1" rel="nofollow noreferrer">According to Ilya Tumanov</a>:</p> <blockquote> <p><strong>Everything UI related on NETCF is intentionally removed from...
<p>Are you sure you have a memory leak? The .NET Compact Framework garbage collector works slightly differently to the one in the full .NET framework. From <a href="http://blogs.msdn.com/stevenpr/archive/2004/07/26/197254.aspx" rel="nofollow noreferrer">Steven Pratschner's blog</a>:</p> <blockquote> <p>A collection ...
24,505
<p>I was asked to manage and develop a project. The client does not really care if I hire people who would do it or I do it myself. Thus, I've decided to be more manager than developer. </p> <p>Are there any (free / low cost) web projects that could help me to communicate with each "sub-developer" outta there on Inter...
<p>As many open source projects found, <a href="http://trac.edgewall.org/" rel="nofollow noreferrer">trac</a> is a good fit - lightweight project management with integrated <a href="http://svn.tigris.org/" rel="nofollow noreferrer">subversion</a> interface:</p> <blockquote> <p>Trac is an enhanced wiki and issue trackin...
<p>It is possible that you can do this with the free version of <a href="http://www.aceproject.com/" rel="nofollow noreferrer">AceProject</a>.</p>
47,861