instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is there any risk of damaging stepper motors if I set too big travel speed? What is maximum safe travel speed?</p> <p>My printer is a German RepRap Neo.</p> <p>I currently use 120&nbsp;mm/s. Is it safe to increase this value to 200&nbsp;mm/s? What would my printer do if I set very big travel speed?</p>
<p>Short answer <strong>no</strong></p> <p>We use stepper drivers to limit the current, the travel speed is at capped by the amount of current supplied by the stepper drivers. This prevents the stepper motors from damaging themselves. You can set 200mm/s in the slicer, but you have no guarantee that that will be reach...
<p>A high speed is unlikely to be reached unless you also set a high acceleration, and acceleration is generally more likely to cause a problem (unless you reach the pulse rate limit of the drivers).</p> <p>High acceleration will increase vibration, and critically requires higher torque from the motors. At some point,...
1,199
<p>I've read all the posts about prefixing the numbers with ', and setting IMEX=1 in the connection string; nothing seems to do the trick for me. </p> <p>Here's the setup: Excel column with mixed data - 99% numbers (some start with 0) 1% text.</p> <p>PROGRAMATICALLY mporting into SQL Server 2005 table / column type -...
<p>The ISAM driver only samples the first 8 rows, but you can change that behaviour through a registry change:</p> <p><a href="http://sqlserversd.wordpress.com/2008/09/14/ssis-excel-values-import-as-nulls/" rel="nofollow noreferrer">http://sqlserversd.wordpress.com/2008/09/14/ssis-excel-values-import-as-nulls/</a></p>...
<p>We usually save the file as a .csv file or .txt file and then the issue doesn't occur.</p>
47,339
<p>I have a few models that need to have custom find conditions placed on them. For example, if I have a Contact model, every time Contact.find is called, I want to restrict the contacts returned that only belong to the Account in use.</p> <p>I found this via Google (which I've customized a little):</p> <pre><code>d...
<p>You don't tell us which version of rails you are using [edit - it is on rails 2.1 thus following advice is fully operational], but I would recommand you use the following form instead of overloading find yourself : </p> <pre><code>account.contacts.find(...) </code></pre> <p>this will automatically wrap the find i...
<p>to give a specific answer to your problem, I'd suggest moving the above mentioned method into a module to be included by the models in question; so you'd have </p> <pre><code>class Contact include NarrowFind ... end </code></pre> <p>PS. watch out for sql escaping of the account_id, you should probably use the ...
10,589
<p>I mainly use the MySQL GUI tools. This allows me to easily see the results in a table as well as to quick edits and bookmark frequently run queries. This suits my needs far better than the command line.</p> <p>I remember when I used to do this on Oracle DBs years ago I could put variables in the query itself, so th...
<p>Ok, a different solution, since it appears Bill is right (read the comments on my other answer).</p> <p>In the Params tab in the bottom right, you can right click the "Local Params" folder and add a new parameter. Give it a name, eg: "myTest". Initially it is given a value of NULL. Double click on NULL and type in ...
<p>I'm not sure if there's a way to get the GUI tools to prompt you for a value, but you can certainly use variables in MySQL.</p> <pre><code>SET @myVar='john_smith14'; SELECT email FROM users WHERE login = @myVar; </code></pre> <p>That might even suit you better, since you don't have to keep typing in the variable v...
40,970
<p>In Gmail, I have a bunch of labeled messages.</p> <p>I'd like to use an IMAP client to get those messages, but I'm not sure what the search incantation is.</p> <pre><code>c = imaplib.IMAP4_SSL('imap.gmail.com') c.list() ('OK', [..., '(\\HasNoChildren) "/" "GM"', ...]) c.search(???) </code></pre> <p>I'm not findin...
<p><code>imaplib</code> is intentionally a thin wrapper around the IMAP protocol, I assume to allow for a greater degree of user flexibility and a greater ability to adapt to changes in the IMAP specification. As a result, it doesn't really offer any structure for your search queries and requires you to be familiar wit...
<p>I've been pretty surprised that imaplib doesn't do a lot of the response parsing. And it seems that responses were crafted to be hard to parse.</p> <p>FWIW, to answer my own question: c.search(None, 'GM')</p> <p>(I have no idea what the '(\HasNoChildren) "/"' part is about.)</p>
21,589
<p>What I would like to do is create a clean virtual machine image as the output of a build of an application.</p> <p>So a new virtual machine would be created (from a template is fine, with the OS installed, and some base software installed) --- a new web site would be created in IIS, and the web app build output cop...
<p>To find out which files on your system have been encrypted with EFS, you can simply run this command:</p> <pre><code>CIPHER.EXE /U /N </code></pre>
<p>Clippy noticed that you have sensitive information in your files and automatically encrypted them.</p> <p>Are you sure it's for EFS? I've had things prompt me to backup my keys before, but I didn't know exactly what they were to. I was assuming it was like a DRM protected file or something. It was a while ago so i ...
3,280
<p>After compiling a simple C++ project using Visual Studio 2008 on vista, everything runs fine on the original vista machine and other vista computers. However, moving it over to an XP box results in an error message: "The application failed to start because the application configuration is incorrect".</p> <p>What do...
<p>You need to install the Visual Studios 2008 runtime on the target computer:</p> <blockquote> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e03-4391-8a4d-074b9f2bc1bf&amp;displaylang=en" rel="nofollow noreferrer">http://www.microsoft.com/downloads/details.aspx?FamilyID=9b2da534-3e0...
<p>It is much the simplest to link to the runtime statically.</p> <p>c++ -> Code Generation -> Runtime Library and select "multi-threaded /MT"</p> <p>However, this does make your executable a couple hundred KByte larger. This might be a problem if you are installing a large number of small programs, since each will ...
11,297
<p>I have an application that runs transactions spanning over multiple databases on the same server. Naturally this involves the Microsoft Distributed Transaction Coordinator and everything works like it is supposed to.<br/></p> <p>Howver, when I remotely connect to the network where the server is hosted via VPN and r...
<p>Do you administer the VPN connection? There might be restricted ports on the VPN. Likewise, do you administer your servers? Your servers might only allow connections from IP addresses on the inside and not on the segment used for VPN service. If you are the administrator, perhaps saying which VPN software you are us...
<p>I'm having the same problem using a Windows 7 x64 client and a Server 2003R2 server. I have been able to make it work (on the same vpn, same server) using XP, Vista x86, and Windows 7 x86. I have a support call with Microsoft open and they are looking into it. I'm curious - what operating system are you guys using...
48,306
<p>As the question states, i am a C#/Java programmer who is interested in (re)learning C++. As you know C#/Java have a somewhat strict project file structure (especially Java). I find this structure to be very helpful and was wondering if it is a) good practice to do a similar structure in a C++, b) if so, what is the ...
<p>I find the structure of java projects quite nice. I do it like this (root is the root directory)</p> <p><em>root/include/foo/bar/baz.hpp</em> becomes</p> <pre><code>namespace foo { namespace bar { // declare/define the stuff (classes, functions) here } } // foo::bar </code></pre> <p>in code. </p> <p>I keep ...
<blockquote> <p>a) (is it) good practice to do a similar structure in a C++,</p> </blockquote> <p>One way to find out would be to download a few open source projects and look at their file structure.</p> <p>In my experience, the build tool used really ends up dictating the file structure. If it's a bit of a pain t...
47,028
<p>Why is NodeList undefined in IE6/7?</p> <pre><code>&lt;form action="/" method="post" id="testform"&gt; &lt;input type="checkbox" name="foobar[]" value="1" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="2" id="" /&gt; &lt;input type="checkbox" name="foobar[]" value="3" id="" /&gt; &lt;/...
<p>"<a href="http://en.wikipedia.org/wiki/Duck_typing" rel="noreferrer">Duck Typing</a>" should always work:</p> <pre><code>... if (typeof el.length == 'number' &amp;&amp; typeof el.item == 'function' &amp;&amp; typeof el.nextNode == 'function' &amp;&amp; typeof el.reset == 'function') { alert("I'm a...
<p>I would just use something that always evaluates to a certain type. Then you just do a true/false type check to see if you got a valid object. In your case, I would get a reference to the select item like you are now, and then use its getOptions() method to get an HTMLCollection that represents the options. This ...
18,243
<p>How can we find the junit tests in our suite that take the longest amount of time to run? The default output of the junitreport ant task is helpful, but our suite has thousands of tests organized into many smaller suites, so it gets tedious, and the worst offenders are always changing.</p> <p>We use luntbuild but ...
<p>JUnitReport works on the xml files produced by the JUnit task. You could write a task that would read the test durations out of the same xml files (TEST-*.xml). But you can also take a shortcut and just read the summary file created by JUnitReport (TESTS-TestSuites.xml) which has all the information in the single fi...
<p>If you launch your tests on your build server using cruise control, it is one of the top level options to sort by run time.</p>
35,076
<p>I need to spawn a child process that is a console application, and capture its output.</p> <p>I wrote up the following code for a method:</p> <pre><code>string retMessage = String.Empty; ProcessStartInfo startInfo = new ProcessStartInfo(); Process p = new Process(); startInfo.CreateNoWindow = true; startInfo.Redi...
<p>Here's code that I've verified to work. I use it for spawning MSBuild and listening to its output:</p> <pre><code>process.StartInfo.UseShellExecute = false; process.StartInfo.RedirectStandardOutput = true; process.OutputDataReceived += (sender, args) =&gt; Console.WriteLine("received output: {0}", args.Data); proce...
<p>Here's a method that I use to run a process and gets its output and errors :</p> <pre><code>public static string ShellExecute(this string path, string command, TextWriter writer, params string[] arguments) { using (var process = Process.Start(new ProcessStartInfo { WorkingDirectory = path, FileName = co...
36,296
<p>I've looked at both the <a href="http://www.parashift.com/c++-faq-lite/ctors.html#faq-10.20" rel="nofollow noreferrer">Named Parameter Idiom</a> and the <a href="http://www.boost.org/doc/libs/1_36_0/libs/parameter/doc/html/index.html" rel="nofollow noreferrer">Boost::Parameter library</a>. What advantages does each ...
<p>Implementing the Named Parameter Idiom is really easy, almost about as easy as using Boost::Parameter, so it kind of boils down to one main point.</p> <p>-Do you already have boost dependencies? If you don't, Boost::parameter isn't special enough to merit adding the dependency.</p> <p>Personally I've never seen Bo...
<p>Never heard of either, but reviewing the links, named parameter is WAY easier and more obvious to understand. I'd pick it in a heartbeat over the boost implementation.</p>
24,916
<blockquote> <p>Where a new system concept or new technology is used, one has to build a system to throw away, for even the best planning is not so omniscient as to get it right the first time. Hence <strong>plan to throw one away; you will, anyhow.</strong></p> <p>-- Fred Brooks, <a href="http://en.wikipedi...
<p>If you're doing test-driven development, you can refactor your way out of almost any trouble. I've changed major design decisions without much trouble, and rescued decade-old codebases.</p> <p>The only exception is when you've discovered that your architecture is completely wrong from beginning to end. For example,...
<p>As a development manager in this organisation, I'm "not allowed" to write production code. </p> <p>I (ab)use that rule to knock out quick, dirty proof-of-concept code that addresses one or other sticking point, then I check it in to source control and point a "proper" dev at it and say "Here's how it's done, now do...
10,420
<p>I'd like to use a <code>LinqDataSource</code> control on a page and limit the amount of records returned. I know if I use code behind I could do something like this:</p> <pre><code>IEnumerable&lt;int&gt; values = Enumerable.Range(0, 10); IEnumerable&lt;int&gt; take3 = values.Take(3); </code></pre> <p>Does anyone ...
<p>I had this same issue. The way I got round this was to use the Selecting event on the LinqDataSource and return the result manually.</p> <p>e.g.</p> <pre><code>protected void lnqRecentOrder_Selecting(object sender, LinqDataSourceSelectEventArgs e) { DataClassesDataContext dx = new DataClassesDataContext(); ...
<p>I know that if you use a paging repeater or gridview with the linqdatasource it will automatically optimize the number of results returned, but I'm also pretty sure in the datasource wizard you can go to advanced options and limit it to </p> <pre><code>SELECT TOP 3 FROM </code></pre> <p>which should allow you to ...
2,621
<p>How do I park a Bluetooth connection? I'm trying to communicate with dozens of Bluetooth devices, and the time to re-establish a connection is unacceptable. I've read that you can park connections, but not found anything that answers how to do this.</p>
<p>I know that you can park a connection if it's on the MS Bluetooth stack. There is a nice API you can use called 32feet.Net. It lets you set the socket options. Here's a quick link to the <a href="http://community.inthehand.com/library/InTheHand.Net.Bluetooth.BluetoothSocketOptionNameMembers.html" rel="nofollow noref...
<p>Parking mode is one of connected state mode, explained in the core Bluetooth spec, right from early 1.1 or so. Please follow up with various sniff modes as well, including the newer ones such as sniff sub rating. Other than park modes, you have hold modes as well.</p>
9,012
<p>I've created a learning application using <a href="http://jimneath.org/2008/09/09/bort-base-rails-application/" rel="noreferrer">Bort</a>, which is a base app that includes Restful Authentication and RSpec. I've got it up and running and added a new object that requires users to be logged in before they can do anyt...
<p>I have a very similar setup, and below is the code I'm currently using to test this stuff. In each of the <code>describe</code>s I put in:</p> <pre><code>it_should_behave_like "login-required object" def attempt_access; do_post; end </code></pre> <p>If all you need is a login, or</p> <pre><code>it_should_behave_l...
<p>To mock a user being logged in, I hack into the controller to set <code>@current_user</code> manually:</p> <pre><code>module AuthHelper protected def login_as(model, id_or_attributes = {}) attributes = id_or_attributes.is_a?(Fixnum) ? {:id =&gt; id} : id_or_attributes @current_user = stub_model(model, ...
9,045
<p><strong>Note that I am not asking which to choose (MVC or MVP), but rather if one of the two should be used for a web application.</strong></p> <p>I realize that it might be too much work to convert an older application from its current design to a MVC or MVP pattern. However, what about for a new app? It appears t...
<p>MVP / MVC works well in web applications because the HTTP verb + URL combination is a very good way to determine which action to take. There are reasons not to use it, such as if your team has a lot of experience with another framework, but I would generally recommend an MVP / MVC framework. Your application will be...
<p>I would prefer the MVC Pattern, just because the loose coupling. There is a clear seperation between model, view and controller and through the isolation it`s better suited for Test-Driven Development or just Unit-Testing.</p>
22,018
<p>In visual studio, I have an asp.net 3.5 project that is using MS Enterprise Library 4.0 application blocks. </p> <p>When I have my web config file open, my Error list fills up with 99 messages with things like </p> <pre><code>Could not find schema information for the element 'dataConfiguration'. Could not find s...
<p>I've created a new scheme based on my current app.config to get the messages to disappear. I just used the button in Visual Studio that says "Create Schema" and an xsd schema was created for me.</p> <p>Save the schema in an apropriate place and see the "Properties" tab of the app.config file where there is a proper...
<p>Navigate to this : <a href="http://nlog-project.org/2010/06/30/intellisense-for-nlog-configuration-files.html" rel="nofollow">NLog xsd files</a></p> <p>Download the appropriate xsd for your project and save it along the NLog.config</p> <p>The first one did the trick for me.</p>
21,706
<p>I was mapping a relation using something like the following </p> <pre><code>&lt;map name="Foo" cascade="all-delete-orphan" lazy="false"&gt; &lt;key column="FooId"/&gt; &lt;index column="FooType" type="Domain.Enum.FooType, Domain"/&gt; &lt;element column ="FooStatus" type="Domain.Enum.FooStatus, Domain"/&gt; &...
<p>ANSWER From Fluent NHibernate Google group were I asked the same question</p> <p>The short answer is no, you cannot do this with the fluent interface at the moment. My initial implementation of AsMap() was rather naive and does not support your scenario. I will raise it as an issue and get back to you once a fix...
<p>Forget to add </p> <pre><code>namespace Domain { public virtual IDictionary&lt;FooType, FooStatus&gt; MyFoo { set; get; } } </code></pre>
30,163
<p>What command checks if a directory exists or not within a Bash shell script?</p>
<p>To check if a directory exists:</p> <pre><code>if [ -d &quot;$DIRECTORY&quot; ]; then echo &quot;$DIRECTORY does exist.&quot; fi </code></pre> <p>To check if a directory does not exist:</p> <pre><code>if [ ! -d &quot;$DIRECTORY&quot; ]; then echo &quot;$DIRECTORY does not exist.&quot; fi </code></pre> <hr /> <p>...
<p>From script file <em>myScript.sh</em>:</p> <pre><code>if [ -d /home/ec2-user/apache-tomcat-8.5.5/webapps/Gene\ Directory ]; then echo "Directory exists!" echo "Great" fi </code></pre> <p><em>Or</em></p> <pre><code>if [ -d '/home/ec2-user/apache-tomcat-8.5.5/webapps/Gene Directory' ]; then echo "Directory...
8,459
<p>I'm running Eclipse Europa (3.3). I leave the "Build Automatically" setting, under the Project menu, on all the time. Once in awhile my code isn't compiling, and I puzzle over it and then pull down the Project menu ... lo and behold, it's not set anymore. What gives? Is this a bug, or is there something else I'm...
<p>I don't have eclipse right here to test and make sure but here is an idea.</p> <p>Is any of the project or even workspace file in SVN ? if they are and they were uploaded with auto build disabled that might explain it</p> <p>You update and overwrite your settings. This doesn't become apparent until you restart ecl...
<p>When installing Google Plugin for Eclipse, 'Google App Engine for Android' is also installed. </p> <p>For me, I uninstalled 'Google App Engine for Android', which I didn't need, and solved this problem. </p>
14,112
<p>I'm working on a music writing application and would like to add the functionality to import Finale music files. Right now, the only thing I know is that they are enigma binary files. </p> <p>Does anyone have any suggestions on where I could start so that I could be able to parse through these types of files?</p>...
<p>Finale files are not just binary files, but compressed, encrypted binary files. ETF files are text files and do have some documentation in older versions of the Finale plug-in developer kit. But ETF export was removed from Finale several versions ago.</p> <p>As was previously suggested, your best bet is to import M...
<p>I would look into the MusicXml format, <a href="http://www.recordare.com/xml.html" rel="nofollow noreferrer">http://www.recordare.com/xml.html</a>.</p> <p>Finale should have the ability to export to MusicXml. (I think it is with a plug-in shipped with newer versions of Finale). From there, it should be relatively s...
12,406
<p>I have a database table with a large number of rows and one numeric column, and I want to represent this data in memory. I could just use one big integer array and this would be very fast, but the number of rows could be too large for this.</p> <p>Most of the rows (more than 99%) have a value of zero. Is there an...
<p>I would expect that the map/dictionary/hashtable of the non-zero values should be a fast and economical solution.</p> <p>In Java, using the Hashtable class would introduce locking because it is supposed to be thread-safe. Perhaps something similar has slowed down your implementation.</p> <p><strong>--- update: usi...
<p>Create integer array for non-zero values and bit array holding indicators if particular row contains non-zero value.</p> <p>You can find then necessary element in first array summing up bits in second array starting from 0 up to row index position.</p>
42,527
<p>I would like to write my own OS, and would like to temporarily jump over the complicated task of writing the kernel and come back to it later by using the Linux kernel in the mean time. However, I would like to provide the OS as closed source for now. What license is the Linux kernel under and is it possible to us...
<p>You can of course write whatever closed-source OS over the Linux kernel that you like provided you are compatible with the licensing of components you link against.</p> <p>Of course that's likely to include the gnu C library (or some other C library). You may also need some command line utilities which will probabl...
<p>It is GPL. Short answer -- no.</p>
14,261
<p>Does anyone know of some good tutorials that explain how to use the JQuery Slider.</p> <p>I've found a few, but none of them really present what I need in clear terms. What I really need to figure out how to do is make the slider go from 1.0 - 5.0 (including all tenths) and when it changes set a hidden control bas...
<p>The <a href="http://docs.jquery.com/UI/Slider/slider#options" rel="nofollow noreferrer">documentation on the jQuery site</a> is pretty good.</p> <pre><code>$('#mySlider').slider({ min : 1, max : 5, stepping: .1, // or, steps: 40 change : function (e, ui) { $('#myHiddenInput').val(ui.value)...
<p>I have written an article on using the jQuery UI Slider at my website, check out the link:</p> <p><a href="http://www.ryancoughlin.com/2008/11/04/using-the-jquery-ui-slider/" rel="nofollow noreferrer">http://www.ryancoughlin.com/2008/11/04/using-the-jquery-ui-slider/</a></p> <p>Thanks and let me know if you have a...
38,026
<p>Does anyone have a regular expression for matching function calls in C programs ?</p>
<p>After a bit more searching I decided to let the compiler do the hard work.</p> <p>Get the compiler to produce a <a href="http://en.wikipedia.org/wiki/Register_Transfer_Language#RTL_in_GCC" rel="nofollow noreferrer">Register Transfer Language (RTL)</a> file using the -dr options of gcc.</p> <p>The produced RTL file...
<p>I doubt you can find a regex that matches all (and only) the function calls in some source code. But maybe you could use a tool like <a href="http://www.scitools.com/products/understand/" rel="nofollow noreferrer">Understand</a>, or your IDE, to browse your code.</p>
6,051
<p>I noticed that EStackOverflow, as defined in SysUtils.pas is marked as deprecated in Delphi 2009. I checked and it was also marked as deprecated in 2007. I have a Delphi 7 install disk here, but I thought I would ask if anyone knows when it was deprecated.</p> <p>Additionally, does anyone know why, and what repla...
<p>I don't have D5 here to say, but I barely remember the <strong>deprecated</strong> directive appeared only on D6.</p> <p>As for StackOverflow exception, I think it's deprecated because is only for Delphi runtime environment to raise it. </p> <p>EDIT: Based on the aggregate of all the answers, EStackOverflow was d...
<blockquote> <p>Is this just to discourage me from throwing an EStackOverflow in my own code?</p> </blockquote> <p>More importantly, I think this means you should not design code to depend on it being thrown in future versions.</p>
35,903
<p>Scrum is quite popular dev.process these days and often Project Manager suddenly gets new title (Scrum Master). However it should be not just a new title, but new habits and new paradigm. What are the bad habits of your Scrum master?</p>
<p>Not keeping scrums on track - letting them descend into technical discussions and a much longer meeting.</p>
<p>When I was involved in a Scrum, the Scrum master quickly developed the habit of just letting us do our own thing, and the Scrum fell back into our normal development routine.</p>
20,353
<p>I have a Div with five float divs inside:</p> <pre><code>var div=document.createElement("div"); div.className="cssDivNino"; var divFolio=document.createElement("div"); divFolio.className="cssFolio"; div.appendChild(divFolio); var divCurp=document.createElement("div"); divCurp.className="cssCurp"; div.appendChild(...
<p>A few notes:</p> <ol> <li><p>You will save yourself a lot of trouble by just using a <code>&lt;table&gt;</code> for this data, which is tabular. </p></li> <li><p>Building this stuff via the DOM is insanely slow compared to letting the browser just render raw HTML. Just something to be aware of.</p></li> </ol> <p...
<p>I agree with Tpiptych but for arguments sake if I wanted to accomplish this I'd end up using different styles sheets for the defect browser (in this case IE6). </p> <p>Be aware, that you may not be able to get 100% of the same look and you may need to design a slightly different look for IE6. </p> <p>Even after I ...
49,997
<p>My university refused to allow us to access out mail via POP or IMAP etc so I want to write a GTK based C app that sits in my notifcation area and does the job of a mail client notifier. Because I can't use anything like POP or IMAP, what would be a good way to do it? I guess I could scrape the HTML and look for a ...
<p>I know you said C/GTK but it's a piece of cake in Python/GTK with urllib2, libcookie, and BeautifulSoup. That way you don't have to deal with raw sockets, and parsing the HTML yourself. Hell if you edit your question with a link to the source I could hack this up for you in no time. But if you're doing this as a soc...
<p>Well yes, if the only way to access your email is through webmail then any tool you create will have to use the webmail markup to work out new messages.</p> <p>Personally I'd try and find out why POP/IMAP isn't allowed. As far as I'm concerned that's a really strange policy.</p>
45,431
<p>I recently started using Linux as my primary OS. What are the tools that I will need to set up a complete programming environment in Linux for C and C++?</p>
<p>Standard stuff:</p> <ul> <li>The compiler tools, gcc, gdb, etc.</li> <li>Some sort of editor/IDE (emacs, vim, eclipse)</li> <li>Profiling tools</li> <li>Source Control (SubVersion, git, etc)</li> <li>Language specific tools, like easy_install for python (you said C/C++, but the same goes for everything)</li> <li>A ...
<p>I took an old windows laptop with a dead hard drive and replaced the hard drive then installed Ubuntu (linux / debian all in one handy release) on it. I had to burn the ubuntu installation files onto a cd first on another working computer.</p> <p>Here's where I got my linux from (complete with desktop gui, very eas...
27,450
<p>I'm using C# on Framework 3.5. I'm looking to quickly sort a Generic <code>List&lt;T&gt;</code>. For the sake of this example, let's say I have a List of a <code>Person</code> type with a property of lastname. How would I sort this List using a lambda expression?</p> <pre><code>List&lt;Person&gt; people = Popula...
<p>If you mean an in-place sort (i.e. the list is updated):</p> <pre><code>people.Sort((x, y) =&gt; string.Compare(x.LastName, y.LastName)); </code></pre> <p>If you mean a new list:</p> <pre><code>var newList = people.OrderBy(x=&gt;x.LastName).ToList(); // ToList optional </code></pre>
<p>In .NET 7 preview you can use the <a href="https://devblogs.microsoft.com/dotnet/announcing-dotnet-7-preview-7/#usage" rel="nofollow noreferrer">simplified ordering</a> of <code>System.Linq</code>. It also has some performance improvements.</p> <pre><code>var sorted = people.Order(); </code></pre> <p>Also, be aware ...
22,802
<p>Our development team work with Borland C++ Builder 6 and CodeGear C++ Builder 2007 (as well as Visual Studio). I hear a lot of comments that the Builder 2007 IDE crashes a lot more than BCB6 does. Does anyone out there have any experience of the C++ Builder 2009 IDE yet, particularly with a decent size application, ...
<p>My experiences with BCB2009 so far have been mostly positive. the IDE seems stable and installs etc are much faster.</p> <p>However, I haven't yet moved a major project over to 2009, but I can almost guarantee you it will be non-trivial because of the Unicode changes. You will need to switch to new versions of any...
<p>I haven't used C++ Builder 2009 but maybe this will help you.</p> <p>According to Chris Pattinson (QA manager at CodeGear), they made over 4000 fixes in both Delphi and C++ Builder 2009 (See this blog: <a href="http://blogs.codegear.com/chrispattinson/2008/09/19/38897" rel="nofollow noreferrer">http://blogs.codegea...
14,863
<p>I'm a student currently dabbling in a .Net n-tier app that uses Nhibernate+WCF+WPF.</p> <p>One of the things that is done quite terribly is object graph serialisation, In fact it isn't done at all, currently associations are ignored and we are using DTOs everywhere.</p> <p>As far as I can tell one method to procee...
<p>You ask a very good question that unfortunately does not have a very clean answer. Even if you were able to get lazy loading to work over WCF (which we were able to do) you still would have issues using the proxy interceptor. Trust me on this one, you want POCO objects on the client tier!</p> <p>What you really n...
<p>If you are really determined to transport the object graph across the network and preserve lazy loading functionality. Take a look at some code I produced over here <a href="http://slagd.com/?page_id=6" rel="nofollow noreferrer">http://slagd.com/?page_id=6</a> . Basically it creates a fake session on the other sid...
49,778
<p>I am currently writing a little bootstrap code for a service that can be run in the console. It essentially boils down to calling the OnStart() method instead of using the ServiceBase to start and stop the service (because it doesn't run the application if it isn't installed as a service and makes debugging a nightm...
<p>Like Ash, I write all actual processing code in a separate class library assembly, which was then referenced by the windows service executable, as well as a console app.</p> <p>However, there are occasions when it is useful to know if the class library is running in the context of the service executable or the cons...
<p>This is a bit of a self-plug, but I've got a little app that will load up your service types in your app via reflection and execute them that way. I include the source code, so you could change it slightly to display standard output.</p> <p>No code changes needed to use this solution. I have a Debugger.IsAttached...
24,409
<p>Having some issues loading files from media hosting into swf shell (a swf loading swfs as assets). Mp3s and images work fine but a swf never loads. Code is like:</p> <p>swfpath = "<a href="http://555.55.555.555/vir_dir/swf/N000001.swf" rel="nofollow noreferrer">http://555.55.555.555/vir_dir/swf/N000001.swf</a>" mov...
<p>In the event of any cross-domain request, Flash will look for the crossdomain.xml file at the root of the domain. For example, if you are requesting an XML file from: <code>http://mysubdomain.mydomain.com/fu/bar/</code> </p> <p>Flash will check if a crossdomain.xml file exist at: <code>http://mysubdomin.mydomain.c...
<p>You need to have a crossdomain.xml file set up on the server serving the loaded SWF.</p> <p>Check out the first couple of links on google:</p> <p><a href="http://www.google.com/search?client=safari&amp;rls=en-us&amp;q=crossdomain.xml&amp;ie=UTF-8&amp;oe=UTF-8" rel="nofollow noreferrer">http://www.google.com/search...
25,945
<p>Does anyone know what will be in .NET 4.0?</p> <p>I found <a href="https://mef.svn.codeplex.com/svn/src/ComponentModel/System/Tuple.cs" rel="nofollow noreferrer">tuples on codeplex</a>:</p> <pre><code>.... // NOTE : this is a TEMPORARY and a very minimalistic implementation of Tuple'2, // as defined in http://dev...
<p><a href="http://blogs.msdn.com/pfxteam/archive/2008/10/10/8994927.aspx" rel="nofollow noreferrer">Parallel Extensions</a></p> <p><a href="http://blogs.msdn.com/wenlong/archive/2008/09/07/net-4-0-wf-wcf-and-oslo.aspx" rel="nofollow noreferrer">WCF/WF improvements</a></p> <p>I expect BigInteger will be back, too. I'...
<p>I have seen the usage of <em>dynamic</em> keyword in C# 4.0 from <a href="http://jaoo.blip.tv/file/1317881/" rel="nofollow noreferrer">Anders Hejlsberg's JAOO talk</a>. It allows calling methods in a late-bindish way which will really help in COM interop scenarios.</p> <p>Usage:</p> <pre><code>// Instead of this: ...
29,324
<p>I have an embedded webserver that has a total of 2 Megs of space on it. Normally you gzip files for the clients benefit, but this would save us space on the server. I read that you can just gzip the js file and save it on the server. I tested that on IIS and I didn't have any luck at all. What exactly do I need ...
<p>As others have mentioned mod_deflate does that for you, but I guess you need to do it manually since it is an embedded environment.</p> <p>First of all you should leave the name of the file foo.js after you gzip it. </p> <p>You should not change anything in your html files. Since the file is still foo.js </p> <p...
<p>Using gzip compression on a webserver usually means compressing the output from it to conserve your bandwidth - not quite what you have in mind.</p> <p><a href="http://www.microsoft.com/technet/prodtechnol/WindowsServer2003/Library/IIS/25d2170b-09c0-45fd-8da4-898cf9a7d568.mspx?mfr=true" rel="nofollow noreferrer">Lo...
26,101
<p>I do a lot of work in the grid and HPC space and one of the biggest challenges we have with a system distributed across hundreds (or in some case thousands) of servers is analysing the log files. </p> <p>Currently log files are written locally to the disk on each blade but we could also consider publishing logging...
<p>First, synchronize all clocks in the system using NTP.</p> <p>Second, if you are collecting the logs in a single location (like the UDP appender you mention) make sure the logs have enough information to actually help. I would include at least the server that generated the log, the time it happened, and the messag...
<p>Are you using Apache? If so you could have a look at <a href="http://www.schlossnagle.org/~george/mod_log_spread/" rel="nofollow noreferrer">mod_log_spread</a> Though you may have too big an infrastructure to make it maintainable. The other option is to look at "broadcasting" or "multicasting" your log messages and ...
5,573
<p>MS Access appears to support nulls in code, but I can't for the life of me figure out how to enter a null directly in a table. This is maddening because once a field has had a figure entered in it, it can never be deleted/set to null. Normally, allowing zero length strings would take care of this, but Access treat...
<p>Does setting the "Allow zero length string" option in the table definition help? It may force an empty string to be interpreted as NULL.</p>
<p>Just delete all characters in the column and access will insert a null value for you if the coumn allows it.</p>
43,753
<p>I am writing a custom session handler in PHP and trying to make the methods defined in session_set_save_handler private.</p> <pre><code>session_set_save_handler( array('Session','open'), array('Session','close'), array('Session','read'), array('Session','write'), array('Session','destroy'), ...
<p>They have to be public. Your class is instantiated and called in exactly the manner you would in your own code.</p> <p>So, unless you can figure out how to publically call a private method on ANY class, then no =P</p>
<p>Pass an instantiated object as the first parameter of your callback array.</p> <pre><code>$session = new Session(); session_set_save_handler( array($session,'open'), array($session,'close'), array($session,'read'), array($session,'write'), array($session,'destroy'), array($session,'gc') ); <...
30,877
<p>On some systems it is UTF-8, on others latin-1. How do you set this? Is it something in php.ini?</p> <p>(I know you can set the encoding/charset for a given page by setting HTTP headers, but this is not what I am looking for.)</p> <p>Alex</p>
<p>If you're using a PowerPC Mac, look into gcc inline assembler. Otherwise, look into nasm. I can't give any decent references to PPC ASM (they're few and far between), but I suggest the following things to learn x86 asm:</p> <ul> <li>The book <a href="https://rads.stackoverflow.com/amzn/click/com/0764574817" rel=...
<p>There's no reason why you shouldn't; there is nothing you can do in assembly language that you can't do in a higher level language like C.</p> <p>As far as tools go, you might want to install <a href="http://macports.org" rel="nofollow noreferrer">MacPorts</a> and get the GNU assembler. That may or may not be the e...
16,634
<p>I am currently using Hibernate Tools 3.1; I customized naming convention and DAO templates. The database (SQL Server 2005) in early development phase and I'm in charge of rebuilding the mappings, entities, DAOs, configuration, whatever. Each time I have to reverse-engineer the tables and so I lose every customizatio...
<p>I'd strongly recommend against continual reverse engineering. Reverse engineering is a great one time thing, but changes need to be managed as changes to both the hbm and the database.</p> <p>We use migrations to manage db changes, and we include the associated changes in the hbm. If Hibernate has it (I believe it ...
<p>This is two and a half years late, but I'll offer a dissenting opinion. You should be able to make any customizations you need to the mapping files through the hibernate.reveng.xml file or a custom ReverseEngineeringStrategy. For the classes themselves, you should always generate to base classes and extend them with...
10,624
<p>What are some good templating engines for web designers? I definitely have my preferences as to what I'd prefer to work with as a programmer. But web designers seem to have a different way of thinking about things and thus may prefer a different system.</p> <p>So:</p> <ul> <li>Web designers: what templating eng...
<p>Look at <a href="http://www.makotemplates.org/" rel="noreferrer">Mako</a>.</p> <p>Here's how I cope with web designers.</p> <ol> <li>Ask them to mock up the page. In HTML.</li> <li>Use the HTML as the basis for the template, replacing the mocked-up content with <code>${...}</code> replacements.</li> <li>Fold in l...
<p>Mi vote goes to <a href="http://www.clearsilver.net/" rel="nofollow noreferrer">Clearsilver</a>, it is the template engine used in Trac before 0.11, it's also used in pages like Google Groups or Orkut. The main benefits of this template engine is that it's very fast and language-independent.</p>
26,368
<p>If an application† crashes,</p> <p><a href="https://i.stack.imgur.com/o8DiZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/o8DiZ.png" alt="enter image description here"></a></p> <p>I hit "Debug" and Visual Studio is my currently registered Just-In-Time (JIT) debugger:</p> <p><a href="https://i...
<p>Looking at the screenshot it appears that Visual Studio is currently debugging in Run mode - you need to break execution of the process before it makes sense to look at things like the call stack, etc...</p> <p>To break execution of the process you either need to hit a breakpoint, or you can break execution of the ...
<p>I guess you are already in the Debug mode. The "Run" button is disabled. Just go to Debug -> windows -> Disassembly to view disassembly.</p>
47,102
<p>I came across this recently, up until now I have been happily overriding the equality operator (<strong>==</strong>) and/or <strong>Equals</strong> method in order to see if two references types actually contained the same <strong>data</strong> (i.e. two different instances that look the same).</p> <p>I have been us...
<p>It looks like you're coding in C#, which has a method called Equals that your class should implement, should you want to compare two objects using some other metric than "are these two pointers (because object handles are just that, pointers) to the same memory address?".</p> <p>I grabbed some sample code from <a h...
<p>I believe getting something as simple as checking objects for equality correct is a bit tricky with .NET's design.</p> <p><strong>For Struct</strong></p> <p>1) Implement <code>IEquatable&lt;T&gt;</code>. It improves performance noticeably.</p> <p>2) Since you're having your own <code>Equals</code> now, override <...
12,972
<p>Is it possible to have a fixture change between test methods? If so, how can I do this? </p> <p>My syntax for this problem : </p> <p>In the cakephp framework i am building tests for a behavior that is configured by adding fields to the table. This is intended to work in the same way that adding the "created" and ...
<p>Last time I checked, you could use the <a href="http://developers.sugarcrm.com/tutorials/Customizing_Sugar/4/" rel="nofollow noreferrer">module builder</a> to extend the interface. From 5.0 (or maybe 4.x) on, Sugar added all those APIs, which should enable you to extend SugarCRM without hacking it in and losing it w...
<p>Basically, the Account name should be a related field in your new invoices module (base the module creation on something like QUOTES that has similar fields. Once you create the module (so simple you can almost guess your way through it in the ADMIN section) and the fields you like (using Studio) just add the RELATE...
5,857
<p>Here's my binding source object: </p> <pre><code>Public Class MyListObject Private _mylist As New ObservableCollection(Of String) Private _selectedName As String Public Sub New(ByVal nameList As List(Of String), ByVal defaultName As String) For Each name In nameList _mylist.Add(na...
<p>We had a similar issue last week. It has to do with how <code>SelectedValue</code> updates its internals. What we found was if you set <code>SelectedValue</code> it would not see the change we had to instead set <code>SelectedItem</code> which would properly update every thing. My conclusion is that <code>Selected...
<p>The Binding Mode needs to be OneWayToSource or TwoWay since the source is what you want updated. Mode OneWay is Source to Target and therefore makes the Source ReadOnly which results in never updating the Source.</p>
30,729
<p>I've been using Destop.open() to launch a .pdf viewer on Windows machines, both Vista and XP, and most of them work just fine. However, on one XP machine the call does not work, simply returning without throwing any exceptions, and the viewer does not launch. On that machine the file association is properly set up...
<p>This is a known problem with early versions of XP SP2, the ShellExecute function stopped accepting URIs; bring the XP machines patches up to date.</p> <p>To view the exceptions make sure the Java Console is turned on:</p> <pre><code>Control Panel-&gt;Java Control Panel-&gt;Advanced-&gt;Java Console. </code></pre>
<p>I still have this problem with one of my customers, I'll check what version of windows (As far as I remember He uses windows 7, 64-bits). The file association with pdf is OK (checked that). And he uses the latest java version (checked the updates of java), so still an actual problem as far as I Am concerned.....</p>...
11,005
<p>I am starting a new web application project. I want to use python as I am using it at my bread-and-butter-job.</p> <p>However I don't want to reinvent the wheel. Some things I have thought about:</p> <ul> <li><p>AJAX would be nice if it’s not too much of a hazzle. </p></li> <li><p>It is best if the licensing allow...
<p><a href="http://www.jquery.com/" rel="nofollow noreferrer">jQuery</a>? Though its <a href="http://ui.jquery.com/" rel="nofollow noreferrer">UI</a> components are perhaps not up to the very best (but lots of work appears to be done in that area), jQuery itself seems to be on track to become the de facto JS standard l...
<p>I heartily suggest <a href="http://www.djangoproject.com/" rel="nofollow noreferrer">Django</a> + <a href="http://www.prototypejs.org/" rel="nofollow noreferrer">Prototype</a>. I think they cover most of the bases you are looking at and they are very straight-forward to get started with. Also you could use them on...
25,141
<p>Which gets called first - the base constructor or "other stuff here"?</p> <pre><code>public class MyExceptionClass : Exception { public MyExceptionClass(string message, string extrainfo) : base(message) { //other stuff here } } </code></pre>
<p>The base constructor will be called first.</p> <p>try it:</p> <pre><code>public class MyBase { public MyBase() { Console.WriteLine("MyBase"); } } public class MyDerived : MyBase { public MyDerived():base() { Console.WriteLine("MyDerived"); } } </code></pre>
<p>The base constructor will be called first, otherwise, in cases where your "other stuff" must make use of member variables initialized by your base constructor, you'll get compile time errors because your class members will not have been initialized yet. </p>
16,987
<p>When I code like this: </p> <pre><code>ServerSocketChannel ssc = ServerSocketChannel.open(); InetSocketAddress sa = new InetSocketAddress("localhost",8888); ssc.socket().bind(sa); ssc.configureBlocking(false); ssc.socket().accept(); </code></pre> <p>the <code>ServerSocket.accept()</code> method throws <code>j...
<p>Because that's what javadoc for serversocket.accept() says?</p> <p>IllegalBlockingModeException - if this socket has an associated channel, and the channel is in non-blocking mode.</p>
<p>Because that's what javadoc for serversocket.accept() says?</p> <p>IllegalBlockingModeException - if this socket has an associated channel, and the channel is in non-blocking mode.</p>
42,617
<p>Are there any plugins/tools available to go through the classpath of an eclipse project (or workspace) and highlight any unused jars?</p>
<p><a href="http://classpathhelper.sourceforge.net/" rel="noreferrer">ClassPathHelper</a> is a good start.</p> <p>It automatically identifies orphan jars and much more.</p> <p>The only limitation is with dependencies that are not defined in classes, e.g. in dependency injection framework configuration files. </p> <p...
<p>I know this is an old one, but if anyone else stumbles upon this, Eclipse does this by itself.</p> <p>Navigate to Project properties->Java Code Style->Clean Up Select the Eclipse [Built-in] and it does the following:</p> <ul> <li>Change non static accesses to static members using declaring type</li> <li>Change ind...
30,894
<p>I have a little utility that converts .dbc files to .csv files, trouble is, somewhere in the conversion some data is lost/destroyed/whatever. I input a.dbc into converter, it produces a.csv. I delete a.dbc,and then run a.csv back through the converter, and I come back with a "slightly" different .dbc file then I had...
<p>Sounds like this is nothing more than a buggy utility.</p> <p>If you convert the same .dbc file to a .csv file twice in a row, do you get the exact same .csv file? If you run the .csv through twice do you get the same .dbc file out both times? That would at least tell you which side of the conversion the bugs are...
<p>Do you have access to FoxPro to export the file as a CSV directly from FoxPro without using the utility? That would allow you to compare the CSV file created from FoxPro versus your utility to try and narrow down where the problem is.</p>
17,226
<p>I'm trying to create a bookmarklet for posting del.icio.us bookmarks to a separate account.</p> <p>I tested it from the command line like:</p> <pre><code>wget -O - --no-check-certificate \ "https://seconduser:thepassword@api.del.icio.us/v1/posts/add?url=http://seet.dk&amp;description=test" </code></pre> <p>This w...
<p>Can you sniff the traffic to find what's actually being sent? Is it sending any auth data at all and it's incorrect or being presented in a form the server doesn't like, or is it never being sent by firefox at all?</p>
<p>Does calling the method twice work?</p> <p>Seems to me that your authentication is being approved after the content arrives, so then a second attempt now works because you have the correct cookies.</p>
2,654
<p>When I'm working with DataBound controls in ASP.NET 2.0 such as a Repeater, I know the fastest way to retrieve a property of a bound object (instead of using Reflection with the Eval() function) is to cast the DataItem object to the type it is and then use that object natively, like the following:</p> <pre><code>&l...
<p>I believe you can add something like:</p> <pre><code>&lt;%@ Import Namespace="RootNamespace.SubNamespace1" %&gt; </code></pre> <p>At the top of the page.</p>
<p>What you're looking for is the <a href="http://msdn.microsoft.com/en-us/library/eb44kack(v=VS.80).aspx" rel="nofollow noreferrer" title="MSDN">@Import page directive</a>.</p>
4,138
<p>I want to test my Entities that are built using Entity Framework. My concern is that using Entity Framework means directly working with data source. So any ideas how to unit testing Entity Framework based components?</p>
<p>For Enity Framework 4, this looks promising: <a href="http://msdn.microsoft.com/en-us/ff714955.aspx" rel="noreferrer">Testability and Entity Framework 4.0</a></p>
<p>How about using a mocking framework? It seems to me that a mocking framework can help you isolaye your business logic from the database.</p>
42,301
<p>I'm trying to gear down a servo even further. I notice that the majority of the gears are made of nylon, and I want to create new gears that come close to the resolution and strength of the existing gears. I have a Replicator 2, but the resolution does not seem to come close to what I need. Any suggestions on how I ...
<p>I looked at the current Marlin code and the P24 command should work as you expect it unless the pin you are trying to use in listed as the "SENSITIVE_PINS" list:</p> <pre><code>#define SENSITIVE_PINS { 0, 1, \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PI...
<p>Might be because servo pins are not connected to 5V. use Jumper as shown</p> <p><a href="https://i.stack.imgur.com/ycegg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ycegg.png" alt="enter image description here"></a></p>
486
<p>My gut feel is that document based web services are preferred in practice - is this other peoples experience? Are they easier to support? (I noted that SharePoint uses Any for the "document type" in its WSDL interface, I guess that makes it Document based). </p> <p>Also - are people offering both WSDL and Rest type...
<p>Document versus RPC is only a question if you are using SOAP Web Services which require a service description (<a href="http://en.wikipedia.org/wiki/Web_Services_Description_Language" rel="noreferrer">WSDL</a>). RESTful web services do not not use WSDL because the service can't be described by it, and the feeling is...
<p>BiranLy's answer is excellent. I would just like to add that document-vs-RPC can come down to implementation issues as well. We have found Microsoft to be Document-preferring, while our Java-based libraries were RPC-based. Whatever you choose, make sure you know what other potential clients will assume as well.</p>
2,745
<p>I have a .NET assembly that (for reasons outside my control) <em>must</em> be in the GAC. However, the same assembly is used by another program, which has a its own copy of an older version of the same assembly. It must use its own copy and not whatever is in the GAC. Proper versioning is probably more hassle than i...
<p>Make sure the GAC Assembly and local Assembly have different version numbers (not a bad idea to let your build number, at least, auto-increment by wild-carding your AssemblyVersion in AssemblyInfo: [assembly: AssemblyVersion("1.0.0.*")] ). Then, redirect your assembly binding using your app's config: </p> <ul> <li>...
<p>I change the name of the assembly in the GAC, put an &quot;_&quot; as the first character.</p>
33,575
<p>I read an excel sheet into a datagrid.From there , I have managed to read the grid's rows into a DataTable object.The DataTable object has data because when I make equal a grid's datasource to that table object , the grid is populated.</p> <p>My Problem : I want to use the table object and manipulate its values usi...
<p>Change your temp table from #table to ##table in both places.</p> <p>Using ## means a global temp table that stays around. You'll need to Drop it after you have completed your task.</p> <p>Command = " Drop Table ##table"</p>
<p>Pardon me, if I have not understood what you exactly want.<br> If you want to perform SQL query on excel sheet, you could do it directly.</p> <p>Alternatively, you can use SQL Server to query excel (OPENROWSET or a function which I dont remember right away). Using this, you can join a sql server table with excel sh...
25,102
<p>I'm trying to come up with a clean way of sorting a set of strings based on a "sorting template". I apologize if my wording is confusing, but I can't think of a better way to describe it (maybe someone can come up with a better way to describe it after reading what I'm trying to do?).</p> <p>Consider the following ...
<p>You could use a <code>Dictionary&lt;string, int&gt;</code> to store and retrieve your sorting template tokens. However, this basically does the same as your enum (only perhaps in a slightly more readable manner), because <code>Enum.Parse</code> here could be confusing.</p> <pre><code>var ordering = Dictionary&lt;st...
<p>You could rename your commands like</p> <pre><code>[1FA, 2TY, 3AK, 4PO, 5PR, 6ZZ, 7QW, 8BC] </code></pre> <p>and strip out the first character when you were ready to use it. I think that's called a <a href="http://en.wikipedia.org/wiki/Kludge" rel="nofollow noreferrer">kludge</a>.</p> <p>I can't help thinking you...
49,679
<p>I encountered a problem when running some old code that was handed down to me. It works 99% of the time, but once in a while, I notice it throwing a "Violation reading location" exception. I have a variable number of threads potentially executing this code throughout the lifetime of the process. The low occurrence f...
<p>Given an address of "4", Likely the "this" pointer is null or the iterator is bad. You should be able to see this in the debugger. If this is null, then the problem isn't in that function but who ever is calling that function. If the iterator is bad, then it's the race condition you alluded to. Most iterators ca...
<p>Are you ever calling <code>operator[]</code> with an argument that's not in the range <code>0..9</code>? If so, then you are inadvertently modifying the map, which is likely causing badness to happen in other threads. If you call <code>operator[]</code> with an argument not already in the map, it inserts that key ...
28,704
<p>The CherryPy web server can supposedly be deployed in the Google App Engine.</p> <p>Who has done it, and what was the experience like?</p> <p>What special effort was required (configuration, etc.)?</p> <p>Would you recommend it to others?</p>
<p>The <a href="http://web.archive.org/web/20120722170650/http://boodebr.org/main/python/cherrypy-under-google-appserver" rel="nofollow noreferrer">article</a> is a good example but its slightly out of date now as the <a href="https://bitbucket.org/cherrypy/cherrypy/issue/803/patch-for-running-under-google-app-engine" ...
<p>There is a good article on how to do this <del><a href="http://boodebr.org/main/python/cherrypy-under-google-appserver" rel="nofollow noreferrer">over here</a></del> <a href="http://web.archive.org/web/20120722170650/http://boodebr.org/main/python/cherrypy-under-google-appserver" rel="nofollow noreferrer">now here</...
49,699
<p>My DataView is acting funny and it is sorting things alphabetically and I need it to sort things numerically. I have looked all across the web for this one and found many ideas on how to sort it with ICompare, but nothing really solid.</p> <p>So my questions are </p> <ol> <li>How do I implement ICompare on a Data...
<p>For the first issue - IIRC you can't sort a DataView with a comparer. If you just need to sort numerically a field you must be sure that the column type is numeric and not string. Some code would help to elucidate this.</p> <p>For the second issue also you can't do that directly in the DataView. If you really need ...
<p>It's ugly, but: </p> <pre><code> DataView dv = GetDataViewSomewhere(); //Naturally sort by COLUMN_TO_SORT_ON try { List&lt;string&gt; rowList = new List&lt;string&gt;(); foreach (DataRowView drv in dv) rowList.Add((string)drv["COLUMN_TO_...
11,539
<p>I am trying to add a link into the pop-up text bubble of a marker in Google Maps through the API. I have successfully run the below code:</p> <pre><code>echo '&lt;marker lat="43.91892" lng="-78.89231" html="Albertus Magnus College&amp;lt;br&amp;gt;Link to Admissions" label="Albertus Magnus College" /&gt;'; </code>...
<p>This is the answer:</p> <pre><code>$window2a_url = '&amp;lt;a href=&amp;apos;http://www.albertus.edu/admission/index.shtml&amp;apos;&amp;gt;Admissions'; echo '&lt;marker lat="41.331304" lng="-72.921438" html=" Albertus Magnus College&amp;lt;br&amp;gt;'; echo $window2a_url; echo '" label="Albertus Magnus College" /&...
<p>what the other chap said.</p> <p>try:</p> <pre><code>echo '&lt;marker lat="43.91892" lng="-78.89231" html="Albertus Magnus College&amp;lt;br&amp;gt;&amp;lt;a href=\'http://www.albertus.edu/admission/index.shtml\'&amp;gt;Admissions&amp;lt;\/a&amp;gt;" label="Albertus Magnus College" /&gt;'; </code></pre>
45,085
<p>Are there any import and export tools that would let us move projects into and out of team system <strong>with full history and log</strong>? Our current SCM is SVN.</p> <p>PS - Sorry, I know it's a repost, but I didn't get an answer before... :)</p>
<p>Unfortunately, you probably didn't get an answer because there isn't a good one on offer...</p> <p>I've looked into this a couple of times before, initially for the first TFS Betas. (At the time we were eager to move away from VSS while waiting for TFS to be ready... the compromise we ended up with then was to use...
<p>Just thinking out loud here, but does SVN support a way to "play back" its history? If there is a way to generate a complete set of SVN commands from an existing repository, then you could feed those commands to <a href="http://www.codeplex.com/SvnBridge" rel="nofollow noreferrer">SvnBridge</a>, which would actually...
13,318
<p>I'm not sure of all of them, but what are the commands to do things like update Ruby, download a new gem, or update an existing gem? What other important things are there?</p> <p>Since it might matter, I'm running Windows.</p>
<h1>Useful command: Rake</h1> <p>In addition to the commands listed by Joseph Pecoraro, the 'rake' command is also pretty standard when working with Ruby. Rake makes it easy to automate (simple) tasks; like building a RubyGem or running your unit tests.</p> <p>With rake, the only important command to remember is 'rak...
<blockquote> <p>@John Topley: Thanks. Is there a similar command to update Ruby itself?</p> </blockquote> <p>Not really. You don't say which operating system you're using. I use Mac OS X and tend to <a href="http://hivelogic.com/articles/2008/02/ruby-rails-leopard" rel="nofollow noreferrer">build Ruby from source<...
5,704
<p>I'm trying to make a program in Visual C# that has my one created class, and at application launch it creates an array of my class object, and this array of my object can be used all over the program. So any function, or a control's event can access the array of objects and their member variables. I created my class...
<p>Your problem is that you are defining it within the main function, hence it will only exist inside the main function. you need to define it inside the class, not inside the function</p> <pre> public partial class Form1:Form { MyClass[] MyArrayObject; // declare it here and it will be available everywhere public F...
<p>Only static objects are available in all contexts. While your design lacks... er, just lacks in general, the way you could do this is to add a second, static class that maintains the array of your MyClass:</p> <pre><code>public static class MyClassManager { private MyClass[] _myclasses; public MyClass[] MyClas...
39,871
<p>I am creating a Python script where it does a bunch of tasks and one of those tasks is to launch and open an instance of Excel. What is the ideal way of accomplishing that in my script?</p>
<p>While the <code>Popen</code> answers are reasonable for the general case, I would recommend <code>win32api</code> for this specific case, if you want to do something useful with it:</p> <p>It goes something like this:</p> <pre><code>from win32com.client import Dispatch xl = Dispatch('Excel.Application') wb = xl.Wo...
<p>os.system("open file.xls")</p>
30,772
<p>I recently read that using flexible array members in C was poor software engineering practice. However, that statement was not backed by any argument. Is this an accepted fact?</p> <p>(<a href="https://en.wikipedia.org/wiki/Flexible_array_member" rel="noreferrer">Flexible array members</a> are a C feature introduce...
<p>It is an accepted "fact" that using goto is poor software engineering practice. That doesn't make it true. There are times when goto is useful, particularly when handling cleanup and when porting from assembler. </p> <p>Flexible array members strike me as having one main use, off the top of my head, which is mappin...
<p>As a side note, for C89 compatibility, such structure should be allocated like :</p> <pre><code>struct header *my_header = malloc(offsetof(struct header, data) + n * sizeof my_header-&gt;data); </code></pre> <p>Or with macros :</p> <pre><code>#define FLEXIBLE_SIZE SIZE_MAX /* or whatever maximum length for an a...
30,669
<p>I'm putting a crontab job for updating with apt-get once a day (running Debian Lenny, there are updates almost daily). But almost all examples i've seen of this cron job invoke the -d flag. </p> <p>This elicits 4 questions:</p> <ul> <li>Why should I only download the packages and not install them?</li> <li>Doesn't...
<p>You're operating on a faulty assumption--neither apt-get (nor aptitude) are meant to be run automatically, nor is the Debian packaging system really designed for it. That's why the tools make it difficult.</p> <p>What happens when a software upgrade breaks because you forgot to update a configuration file? This has...
<p>I run a Ubuntu server and have the following run as root once a week.</p> <pre><code>/usr/bin/apt-get update &amp;&amp; /usr/bin/apt-get -s -u upgrade </code></pre> <p>The '-s' option tells apt-get to "simulate" updating the packages but not to actually do anything.<br> The net effect is I get an email (via cron) ...
35,900
<p>When I serialize;</p> <pre><code>public class SpeedDial { public string Value { get; set; } public string TextTR { get; set; } public string TextEN { get; set; } public string IconId { get; set; } } </code></pre> <p>It results:</p> <pre><code>&lt;SpeedDial&gt; &lt;Value&gt;110&lt;/Value&gt; ...
<p>Three approaches leap to mind:</p> <p>1: create a property to use for the serialization, and hide the others with <code>[XmlIgnore]</code> 2: implement <code>IXmlSerializable</code> and do it yourself 3: create a separate DTO just for the serialization</p> <p>Here's an example that re-factors the "text" portion in...
<pre><code>public class SpeedDial { public string Value { get; set; } public TextClass text; public string IconId { get; set; } } public class TextClass { public string TR { get; set; } public string EN { get; set; } } </code></pre>
36,983
<p>It appears that our implementation of using Quartz - JDBCJobStore along with Spring, Hibernate and Websphere is throwing unmanaged threads. </p> <p>I have done some reading and found a tech article from IBM stating that the usage of Quartz with Spring will cause that. They make the suggestion of using CommnonJ to...
<p>We have a working solution for this (two actually).</p> <p>1) Alter the quartz source code to use a WorkManager daemon thread for the main scheduler thread. It works, but requires changing quarts. We didn't use this though since we didn't want maintain a hacked version of quartz. (That reminds me, I was going to...
<p>You can check the below JIRA link raised on quartz regarding this. </p> <p><a href="http://jira.opensymphony.com/browse/QUARTZ-708" rel="nofollow noreferrer">http://jira.opensymphony.com/browse/QUARTZ-708</a></p> <p>This has the required WebSphereThreadPool implementation which can be used with the changes in quar...
21,189
<p>An initial draft of requirements specification has been completed and now it is time to take stock of requirements, <a href="https://stackoverflow.com/questions/186716/when-reviewing-requirements-specification-what-deadly-sins-need-to-be-addressed">review the specification</a>. Part of this process is to make sure t...
<p><strong>Continued, frequent, frank, and two-way communication with the customer</strong> strikes me as the main 'technique' as far as I'm concerned.</p>
<p>I agree with Galwegian. The technique described is far more efficient than the "wait for customer to yell at us" approach. </p>
24,494
<p>I have no trouble building 1.35.0, as well as 1.36.0 on the timesys arm-gcc toolchain, both statically (link-static) as well as dynamically (.so, default option).</p> <p>However, when I try to link a simple sample filesystem app:</p> <pre><code>#include &lt;boost/filesystem.hpp> #include &lt;iostream> namespace f...
<p>borrowed from <a href="http://www.perlmonks.org/?node_id=95456" rel="noreferrer">here</a></p> <pre><code>%mon2num = qw( jan 1 feb 2 mar 3 apr 4 may 5 jun 6 jul 7 aug 8 sep 9 oct 10 nov 11 dec 12 ); </code></pre> <p>and to retrieve</p> <pre><code>$mon2num{"jan"} </code></pre>
<p>Definitely a hash, as suggested by others.</p>
29,907
<p>In the context of unit testing, what is a "unit"? </p>
<p>I usually define it as a <strong>single code execution path</strong> through a single method. That comes from the rule of thumb that the number of unit tests required to test a method is equal to or greater than the method's <a href="http://en.wikipedia.org/wiki/Cyclomatic_complexity" rel="nofollow noreferrer">cycl...
<p>Can be different things. A Class, a Module, a File, ... Choose your desired granularity of testing.</p>
29,686
<p>I have a table of Users that includes a bitmask of roles that the user belongs to. I'd like to select users that belong to one or more of the roles in a bitmask value. For example:</p> <pre>select * from [User] where UserRolesBitmask | 22 = 22</pre> <p>This selects all users that have the roles '2', '4' or '16'...
<p>I think this will work, but I haven't tested it.Substitute the name of your DataContext object. YMMV. </p> <pre><code>from u in DataContext.Users where UserRolesBitmask | 22 == 22 select u </code></pre>
<p>If that doesn't work you could always use <code>ExecuteCommand</code>:</p> <pre><code>DataContext.ExecuteCommand("select * from [User] where UserRolesBitmask | {0} = {0}", 22); </code></pre>
15,862
<p>I've got a small web form with 2 radio buttons, call them PickFromList and EnterValue. When PickFromList is checked I want to show a GridView that I've configured to bind to an ObjectDataSource. When EnterValue is checked I want the GridView to disappear.</p> <p>This form is laid out using a table and want to hid...
<p>Why dont you just show/hide the TRs with javascript? That way you won't have this problem and you'll have a much more responsive UI.</p> <p>With jQuery:</p> <p>$('.classOnShowRadioButton').click(function(){ $('.trToShow').show(); $('.trToHide').hide(); });</p> <p>then obviously do the reverse for the othe...
<p>hmm.. not quite sure but something which has got me a few times is have the AutoWireEvents set to false, its at the top in the &lt;% page /%> section. sorry if it's no help, but something annoying and insignificant like that is prob the problem.</p>
31,257
<p>Assuming a MySQL datastore, when would you NOT want to use memcached in a Ruby on Rails app?</p>
<p>Memcache is a strong distributed cache, but isn't any faster than local caching for some content. Caching should allow you to avoid bottlenecks, which is usually database requests and network requests. If you can cache your full page locally as HTML because it doesn't change very often (isn't very dynamic), then y...
<p>When you want to have fine-grained control about things expiring. From my tests, memcached only seems to have a timing resolution of about a second.</p> <p>EG: if you tell something to expire in 1 second, it could stay around for between 1 and just over 2 seconds.</p>
18,588
<p>Some files in our repository are individual to each developer. For example some developers use a local database, which is configured in a properties file in the project. So each developer has different settings. When one developer commits, he always has to take care to not commit his individually configured files.</...
<p>Our properties files are under a "properties" directory. Each developer has their own "username.properties" files which they can override properties in the environment-specific files such as "dev.properties", or "test.properties". This takes advantage of ANT's immutable properties (include personal first, THEN env...
<p>Don't keep them under version control, and use your tool's ignore ability to keep them from being accidentally checked in. Instead, version a script that generates them, which can use version-controlled data and local, non-version-controlled data. This keeps them up to date, while having any appropriate local modi...
14,157
<p>Since Terminal appeared I've saved as ~/mySrvr.term a modified stock .term file which opens to execute an ssh to a remote server and to modify the appearance. I have NOT been able to save "use option key as meta" for emacs-ery; there's no slot for it in the term file and I'm reluctant to wrestle with a keyboard dict...
<p>If you're on Leopard open up preferences in Terminal.app. There is a tab called Settings which is actually settings for different styles of terminal windows. Make a copy of one of Apple's defaults and change it to your liking and make sure to select the option-as-meta radio button there.</p> <p>I don't even bothe...
<p>Not sure if this helps, but when I go Shell -> Export Settings and save the file as a .terminal file, there are a few lines that save my option-as-meta preference:</p> <pre><code>&lt;key&gt;useOptionAsMetaKey&lt;/key&gt; &lt;true/&gt; </code></pre> <p>These lines are for a .terminal preference file, not for a .ter...
38,265
<p>I'm writing an inner loop that needs to place <code>struct</code>s in contiguous storage. I don't know how many of these <code>struct</code>s there will be ahead of time. My problem is that STL's <code>vector</code> initializes its values to 0, so no matter what I do, I incur the cost of the initialization plus th...
<p><code>std::vector</code> must initialize the values in the array somehow, which means some constructor (or copy-constructor) must be called. The behavior of <code>vector</code> (or any container class) is undefined if you were to access the uninitialized section of the array as if it were initialized.</p> <p>The be...
<p>Do the structs themselves need to be in contiguous memory, or can you get away with having a vector of struct*?</p> <p>Vectors make a copy of whatever you add to them, so using vectors of pointers rather than objects is one way to improve performance.</p>
12,216
<p>The version of <strong>Subclipse (1.2.4)</strong> currently available through Aptana's automatic <em>Plugins Manager</em> does not work with the newest version of Subversion.</p> <p>I see on the Subclipse website however that they have 1.4.2 out for Eclipse. So I added a <a href="http://subclipse.tigris.org/update_...
<p>Subclipse does not require Mylyn, but the update site includes a plugin that integrates Mylyn and Subclipse. This is intended for people that use Mylyn. In your case, you would want to just de-select Mylyn in the update dialog.</p> <p>Subclipse also requires Subversion 1.5 and the corresponding version of the Jav...
<p>I used the update url and I installed the JavaHL adapter, the Subclipse project itself <b>and</b> the SVNKit adapter BETA.</p> <p>After this it worked fine for me, this is for linux platform hope it works for you.</p>
2,249
<p>When I've worked a bit with my source code, I did my usual thing commit and then I pushed to a remote repository. But then I noticed I forgot to organize my imports in the source code. So I do the amend command to replace the previous commit:</p> <pre><code>&gt; git commit --amend </code></pre> <p>Unfortunately th...
<p>I actually once pushed with <code>--force</code> and <code>.git</code> repository and got scolded by Linus <strong>BIG TIME</strong>. In general this will create a lot of problems for other people. A simple answer is "Don't do it".</p> <p>I see others gave the recipe for doing so anyway, so I won't repeat them her...
<p>Here, How I fixed an edit in a previous commit:</p> <ol> <li><p>Save your work so far.</p> </li> <li><p>Stash your changes away for now if made: <code>git stash</code> Now your working copy is clean at the state of your last commit.</p> </li> <li><p>Make the edits and fixes.</p> </li> <li><p>Commit the changes in <s...
31,540
<p>I was hoping someone could help me out with a problem I'm having using the java search function in Eclipse on a particular project.</p> <p>When using the java search on one particular project, I get an error message saying <code>Class file name must end with .class</code> (see stack trace below). This does not seem...
<p>Two more general-purpose mechanisms for fixing some of Eclipse's idiosyncrasies:</p> <ul> <li>Close and open the project</li> <li>Delete the project (but not from disk!) and reimport it as an existing project</li> </ul> <p>Failing that, <a href="https://bugs.eclipse.org/bugs/buglist.cgi?query_format=specific&amp;o...
<p>Closing the projects didn't do the trick for me. I started eclipse with the -clean flag and that worked for some reason.</p>
2,852
<p>I am printing some minion chess pieces for my teacher at school and on every model I have found something called "ghosting", or at least I heard that is what it is called. For example there is a strap on the model for the pants. And going left and right there is very shallow "straps" or something happening. </p> <p...
<p><strong>Ghosting is an artefact in the print due to the vibrations in the printer that are induced by rapid changes of direction</strong>. It is important not to confuse them with inherent vibrations in the printer due for example to the belts being loose or the bearings not being in perfect order.</p> <p>The good...
<p>To expand on the #3 solution: reducing the elasticity of the system, if you have your filament mounted on the top of your printer, placing the filament elsewhere on a separate spool holder can also reduce ghosting. Tightening the belts and moving my filament got rid of ghosting for me on my MP Maker Select.</p>
806
<p>Hi Guys can you please help me with this error? What is it?</p> <blockquote> <p>Server Error in '/' Application.</p> <hr> <p>The request failed with HTTP status 400: Bad Request. Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trac...
<p>I think I've had this error when I've tried to run a .NET 2.0 web app with IIS set to .NET 1.1 for that virtual directory.</p>
<p>Just a guess: This can be a problem with IIS or ASP.NET installation. Try to restart/reinstall IIS.</p>
48,455
<p>Greetings,</p> <p>I want to write a small cross-platform utility program with GUI in it. What language/GUI-library should I stick to? Is it possible whatsoever?</p> <p>This is gonna be a small program, so I don't want to make people download JVM or .NET Framework. Is it possible to develop it natively?</p> <p>Upd...
<p>If you know C or C++ the first cross platform GUI framework I can think of are:</p> <ul> <li><a href="http://qt-project.org/" rel="nofollow noreferrer">QT</a> (C++, proprietary but free with the LGPL licensing)</li> <li><a href="http://www.wxwidgets.org/" rel="nofollow noreferrer">wxWidgets</a> (C++, the most compl...
<p>If it "HAS" to be Desktop use Qt. Nothing beats it right now. </p> <p>However personally I gave up on desktop and any UI based project I do is normally Browser/Server based. You can easily write a little custom server that listens to some port so the program can run locally with no need for your users to install Ap...
16,808
<p>Developer looking for best method to identify a deadlock on a specific transaction inside a specific thread. We are getting deadlock errors but these are very general in FB 2.0</p> <p>Deadlocks happening and they are leading to breakdowns in the DB connection between client and the DB. </p> <ul> <li>We send live...
<p>I don't know of a specific way to identify the particular thread or statement. I've had to deal with FB deadlocks many times. You probably have two theads that are trying to update the same row in some table but they are doing it in separate transactions.</p> <p>The best solution I've found is to design things so t...
<p>My suggestion would be to write a 3-tier application, serialize all access to database (inserting) to a single thread (other threads would just stack up data on the queue) and use Firebird embedded (which is much faster because it eliminates TCP/IP overhead). </p> <p>Beside avoiding deadlocks, this approach would a...
8,843
<p>How can you express X of Y are true, in boolean logic? a rule like 2 of the following must be true (A, B, C, D, E, F) is it a form of multiplcation or set operations?<br> the end result is all the permutations like AB OR AC OR AD, if you said 3 of following it is like ABC, ABD, ABE, etc.. so it is like (A,B,C)^2?</...
<p>In boolean logic (<strong>v</strong> is OR, <strong>'</strong> following the predicate is NOT):</p> <pre><code>A B C'D'E'F' v A B'C'D'E'F v A'B C'D'E'F' v : : : : : : &lt;absolute bucketload of boolean expressions&gt; : : : : : : A'B'C'D'E F </code></pre> <p>With permutations, there's a great many subexpressions ...
<p>Assuming "A or more"</p> <p>you can do a bit better by building a tree</p> <pre><code>2 : a&amp;(b|c|d|e|f) | b&amp;(c|d|e|f) | c&amp;(d|e|f) | d&amp;(e|f) | e*f 3 : a&amp;(b&amp;(c|d|e|f) | c&amp;(d|e|f) | d&amp;(e|f) | e*f) | b&amp;(c&amp;(d|e|f) | d&amp;(e|f) | e*f) | c&amp;(d&amp;(e|f) | e*f) | d&amp;e&amp;f <...
35,810
<p>I have the following string in the smarty (php templating system) variable $test:</p> <pre><code>&lt;img height="113" width="150" alt="Sunset" src="/test.jpg"/&gt; </code></pre> <p>I want to add "em" to the height and width like this:</p> <pre><code>{$test|replace:'" w':'em" w'|replace:'" a':'em" a'} </code></pre...
<p>my regex isn't the greatest, or i'd give you a better matcher, but maybe using what you have through the regex replace would work.</p> <pre><code>{$test|regex_replace:'/".w/':'em" w'|regex_replace:'/".a/':'em" a'} </code></pre> <p>other matchers to try</p> <pre><code>'/\".w/' '/".*w/' '/\".*w/' </code></pre> <p>...
<p>With <a href="http://www.aggiorno.com/smart-search-replace.aspx?so" rel="nofollow noreferrer">Aggiorno</a>'s Smart Search and Replace you can do it like this:</p> <p>Search Pattern: </p> <pre><code>&lt;img height="$h" width="$w" $attributes/&gt; </code></pre> <p>Replace Pattern:</p> <pre><code>&lt;img height="$[...
38,884
<p>Forgive me for probably using the wrong term for this "application mode".</p> <p>Our application has a problem during start in that it doesn't show a task bar icon until the main window is up, even though there are loading progress windows, logon-windows, etc. on screen before that.</p> <p>We change the code to fi...
<p>Not sure exactly how to do this in delphi, but if you can call out to the user32.dll, and call the function:</p> <pre><code>if (GetSystemMetrics(SM_REMOTESESSION) != 0) { // We are in a remote session } </code></pre> <p>This should tell you if you are running in a Citrix or Terminal Services environment. SM_REM...
<p>This works for me:</p> <pre><code>return System.Windows.Forms.SystemInformation.TerminalServerSession; </code></pre>
39,191
<p>Here's the jist of the problem: Given a list of sets, such as:</p> <pre><code>[ (1,2,3), (5,2,6), (7,8,9), (6,12,13), (21,8,34), (19,20) ] </code></pre> <p>Return a list of groups of the sets, such that sets that have a shared element are in the same group.</p> <pre><code>[ [ (1,2,3), (5,2,6), (6,12,13) ], [ (7,8...
<p>The problem is exactly the computation of the connected components of an hypergraph: the integers are the vertices, and the sets are the hyperedges. A usual way of computing the connected components is by flooding them one after the other:</p> <ul> <li>for all i = 1 to N, do:</li> <li>if i has been tagged by some j...
<p>This is likely pretty inefficient, but it should work, at least: Start with a key, select all the groups containing that key, select all the keys of those groups, select all the groups containing those keys, etc., and as soon as a step adds no new keys or groups, you have a list of all the groups of one sub-graph. ...
21,572
<p>I've created two functions to load expanded views of a month in the archive section of my blog when it's link is clicked:</p> <pre><code>// Load open view of a month in the Archive section function loadMonth(date) { // Remove other open month removeMonth(); // Hide opening month's link // Define variabl...
<p>You should be fine with:</p> <pre><code>openMonth.id = "openMonth"; </code></pre> <p><code>getElementById()</code> can only work if the element is part of the DOM, but since you already use <code>insertBefore()</code> this is merely a side note.</p> <p>There is a common source of confusion involved here: An attri...
<p>Another idea - you're reusing the 'openMonth' id for different elements, maybe that's a problem even if you remove the previous element first.</p> <p>You could try to use a class instead of id, or you could holding a global variable with the 'current month element'.</p>
44,618
<p>I have a legacy C++ module that offers encryption/decryption using the openssl library (DES encryption). I'm trying to translate that code into java, and I don't want to rely on a DLL, JNI, etc... C++ code looks like:</p> <pre><code>des_string_to_key(reinterpret_cast&lt;const char *&gt;(key1), &amp;initkey); des_st...
<p>I'm not an OpenSSL expert, but I'd guess the C++ code is using DES in CBC mode thus needing an IV (that's what the initKey probably is, and that's why you think you need two keys). If I'm right, you need to change your Java code to use DES in CBC mode too, then the Java code too will require an encryption key and an...
<p>The algorithms should match; if you're getting different results it may have to do with the way you're handling the keys and the text. Also keep in mind that Java characters are 2 bytes long, which C++ chars are 1 byte, so that may have something to do with it.</p>
11,788
<p>Wikipedia says Ruby is a functional language, but I'm not convinced. Why or why not?</p>
<p>I most definitely think you can use functional style in Ruby.</p> <p>One of the most critical aspects to be able to program in a functional style is if the language supports higher order functions... which Ruby does.</p> <p>That said, it's easy to program in Ruby in a non-functional style as well. Another key asp...
<p>Please, have a look at the beginning of the book: <a href="http://www.scribd.com/doc/230611/A-Great-Ruby-eBook" rel="nofollow noreferrer">"A-Great-Ruby-eBook"</a>. It discusses the very specific topic you are asking. You can do different types of programming in Ruby. If you want to program like functionally, you can...
19,323
<p>We would like to enumerate all strings in a resource file in .NET (resx file). We want this to generate a javascript object containing all these key-value pairs. We do this now for satellite assemblies with code like this (this is VB.NET, but any example code is fine):</p> <pre><code>Dim rm As ResourceManager rm = ...
<p>Use <a href="http://msdn.microsoft.com/en-us/library/system.resources.resxresourcereader.aspx" rel="nofollow noreferrer">System.Resources.ResXResourceReader</a> (it's in System.Windows.Forms.dll)</p>
<p><a href="http://tonesdotnetblog.wordpress.com/2010/02/14/string-enumerations-and-resource-files-in-c/" rel="nofollow noreferrer">http://tonesdotnetblog.wordpress.com/2010/02/14/string-enumerations-and-resource-files-in-c/</a> has an alternative solution that involves putting attributes on enumerations that enable re...
35,131
<p>I'm not a designer, so I'm looking for some free WPF themes.</p> <p>Any suggestions?</p>
<p>The only one that I have found (for sale) is <a href="http://www.nukeation.com/reuxables.aspx" rel="nofollow noreferrer">reuxables</a>. A little pricey, if you ask me, but you do get 9 themes/61 variations.</p> <h3>UPDATE 1:</h3> <p>A WPF Contrib project ... which does have 1 <a href="http://www.codeplex.com/wpfcont...
<p>Viblend <a href="http://www.viblend.com/Products/NET/WPF/Controls/WPFProducts.aspx" rel="nofollow">WPF themes</a> are free.</p>
32,504