instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I want to paste something I have cut from my desktop into a file open in Vi.</p> <p>But if I paste the tabs embed on top of each other across the page.</p> <p>I think it is some sort of visual mode change but can't find the command.</p>
<h2>If you're using plain vi:</h2> <p>You probably have <code>autoindent</code> on. To turn it off while pasting:</p> <pre><code>&lt;Esc&gt; :set noai &lt;paste all you want&gt; &lt;Esc&gt; :set ai </code></pre> <p>I have in my <code>.exrc</code> the following shortcuts:</p> <pre><code>map ^P :set noai^M map ^N :set ...
<p>I found that if I copy tabbed lines first into a text editor and then recopy them from there to vim, then the tabs are correct.</p>
8,323
<p>I'm looking to spend a bit of my lunch break each day teaching myself some C#. I have access to some books on the subject via my employer-paid Books24x7 subscription, but I have no way of running code while I'm at work.</p> <p>My work PC is rather locked down (no admin privileges, read-only "Program Files" - though...
<p>If you have the .Net Framework installed on your computer, then you should already have a compiler.</p> <p>It will be in <code>C:\Windows\Microsoft.NET\Framework\[VERSION]\</code></p> <p>It's called <code>csc.exe</code>.</p> <p>This should work without any administrator priviledges.</p>
<h2>There's <a href="http://ideone.com/" rel="nofollow noreferrer">ideone.com</a>.</h2> <p>It can compile and server-side run several languages that usually require the language to be installed on the client's PC. For me, I can write and run any C# applications without having Visual Studio or the latest .NET Framework...
42,769
<p>I'm trying to configure Windows Powershell to work with Visual Studio. Nothing fancy, just get things set so I can cl &amp; nmake. I think all I need to do is edit the path setting(but I don't know how to set that in WPSH).</p>
<p>After much digging around, I created a directory in My Documents named <strong>WindowsPowerShell</strong>, created a file named <strong>Microsoft.PowerShell_profile.ps1</strong>, and(after a few iterations), inserted the following code in it, and it works.</p> <pre><code>function Get-Batchfile($file) { $theCmd...
<p>You might want to check out <a href="https://stackoverflow.com/questions/138144/whats-in-your-powershell-profileps1file#139997">this post</a> -- it seems to address your question fairly well (it worked for what I wanted, anyway).</p>
24,226
<p>I have several applications that are part of a suite of tools that various developers at our studio use. these applications are mainly command line apps that open a DOS cmd shell. These apps in turn start up a GUI application that tracks output and status (via sockets) of these command line apps.</p> <p>The comma...
<p>I found the programmatic answer that I was looking for. It has to do with stations. Apparently anything running on the desktop will run on a station with a particular name. Anything that isn't on the desktop (i.e. a process started by the task manager when logged off or on a locked workstation) will get started w...
<p>I have successfully used this approach to detect whether the desktop is locked on Windows:</p> <pre><code>bool isDesktopLocked = false; HDESK inputDesktop = OpenInputDesktop(0, FALSE, DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | DESKTOP_ENUMERATE | DESKTOP_SWITCHDESKTOP | DESK...
11,324
<p>what is an efficient way to get a certain time for the next day in Java? Let's say I want the long for tomorrow 03:30:00. Setting Calendar fields and Date formatting are obvious. Better or smarter ideas, thanks for sharing them!</p> <p>Okami</p>
<p>I take the brute force approach</p> <pre><code>// make it now Calendar dateCal = Calendar.getInstance(); // make it tomorrow dateCal.add(Calendar.DAY_OF_YEAR, 1); // Now set it to the time you want dateCal.set(Calendar.HOUR_OF_DAY, hours); dateCal.set(Calendar.MINUTE, minutes); dateCal.set(Calendar.SECOND, seconds)...
<p>I would consider using the predefined api the smart way to do this.</p>
16,854
<p>I'm looking to push my domain model into a WCF Service API and wanted to get some thoughts on lazy loading techniques with this type of setup.</p> <p>Any suggestions when taking this approach?</p> <hr> <p>when I implemented this technique and step into my app, just before the server returns my list it hits the ge...
<p>As for any remoting architecture, you'll want to avoid loading a full object graph "down the wire" in an uncontrolled way (unless you have a trivially small number of objects).</p> <p>The <a href="http://en.wikipedia.org/wiki/Lazy_loading" rel="nofollow noreferrer">Wikipedia article</a> has the standard techniques ...
<p>You could try to use something REST based (e.g. <a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" rel="nofollow noreferrer">ADO.NET Data Services</a>) and wrap it transpariently into your client code.</p>
5,611
<p>What should I keep in mind when converting my projects from C to C++? Is there any reason to use C at all? The only thing in my mind now is to make sure it's friendly to DLLs so I can create a C interface if I need it.</p> <p>Note: I know C++ just fine. Templates, partial specialization, why multiple inheritance is...
<p>At the risk of being obvious, I'd say the main thing to keep in mind is not to fix anything that isn't broken. </p> <p>If you have a working C library, and want it to have a more "C++ ish" interface, then wrapping it in classes might be smarter than converting it. Certainly this satisifies the requirement to provid...
<p>Yes. C code seems to be simpler for smaller projects; LOC-wise and binary-wise.</p>
38,008
<p>We create tables in runtime. They have the same schema layout as tables that exist in our DBML but with an alternate name. We want to set the table names in runtime in our use of Linq to Sql.</p> <p>Using wrapper classes on the Metadata as outlined in <a href="https://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=...
<p>You need to use an <a href="http://msdn.microsoft.com/en-us/library/bb386907.aspx" rel="nofollow noreferrer">external mapping file</a>. Populate the xml with the names of your table at runtime. This over-rides the attribute based mapping.</p>
<p>You need to new up your LINQ expression at run-time via System.Linq.Expressions</p>
47,569
<p>Is there a way to make psycopg and postgres deal with errors without having to reestablish the connection, like MySQLdb? The commented version of the below works with MySQLdb, the comments make it work with Psycopg2:</p> <pre><code>results = {'felicitas': 3, 'volumes': 8, 'acillevs': 1, 'mosaics': 13, 'perat\xe9':...
<p>VMWare server includes the command line tool "vmware-cmd", which can be used to perform virtually any operation that can be performed through the console.</p> <p>In this case you would simply add a "vmware-cmd susepend" to your script before starting your backup, and a "vmware-cmd start" after the backup is compl...
<p>If I recall correctly, VMWare Server has a scripting interface, available via Perl or COM. You might be able to use that to automatically pause the VMs before running the backup.</p> <p>If your backup software was shadow-copy aware, that might work, too.</p>
9,609
<p>For a while, I thought I'd host stuff at home because I can do whatever I want. However, hurricane Ike knocked out my power for a week, and I've finally realized this situation won't work.</p> <p>I have extremely low traffice websites (20 visitors/day), so I don't need tons of CPU or bandwidth. What cheap options...
<p>RapidVPS offers windows hosting. $29,99/month</p> <p><a href="https://www.rapidvps.com/index.php?page=Hosting.Windows.Specs" rel="nofollow noreferrer">https://www.rapidvps.com/index.php?page=Hosting.Windows.Specs</a></p> <p>I am a customer of their linux vps hosting and have had zero problems.</p>
<p>I use <a href="http://www.appliedi.net/" rel="nofollow noreferrer">Applied Innovations</a> for my .NET hosting. They seem to have cheap VPS as well.</p> <p>I've never noticed a downtime,and their billing and support has been reliable.</p>
12,968
<p>I have a HTML file that has code similar to the following.</p> <pre><code>&lt;table&gt; &lt;tr&gt; &lt;td id="MyCell"&gt;Hello World&lt;/td&gt; &lt;/tr&gt; &lt;/table&gt; </code></pre> <p>I am using javascript like the following to get the value</p> <pre><code>document.getElementById(cell2.Element.id...
<p>HTML is white space insensititive which means your DOM is too. Would wrapping your "Hello World" in <b>pre</b> block work at all?</p>
<p>Just checked it and it looks like wrapping with the <strong>pre</strong> tag should do it.</p>
26,287
<p>Do C#/.NET floating point operations differ in precision between debug mode and release mode?</p>
<p>They can indeed be different. According to the CLR ECMA specification:</p> <blockquote> <p>Storage locations for floating-point numbers (statics, array elements, and fields of classes) are of fixed size. The supported storage sizes are float32 and float64. Everywhere else (on the evaluation stack, as ...
<p>In response to Frank Krueger's request above (in comments) for a demonstration of a difference:</p> <p>Compile this code in gcc with no optimizations and -mfpmath=387 (I have no reason to think it wouldn't work on other compilers, but I haven't tried it.) Then compile it with no optimizations and -msse -mfpmath=sse...
11,607
<p>There are a number of run-time differences in compatible code between these two versions of .NET.</p> <p>Here is a list of differences so far:</p> <ul> <li>Graphics.DrawRectangle - differs by 1 pixel</li> <li>Graphics.DrawString - Loses the line wrap if used with a StringFormat with both StringAlignments set to Ce...
<p>Depending on what you are looking for there is a <a href="http://msdn.microsoft.com/en-us/library/2weec7k5.aspx" rel="noreferrer">Differences between .NET Compact Framework and .NET Framework</a> article on MSDN.</p>
<p>I've noticed some differences when I had to port a CF app over to the full .net framework.</p> <ul> <li><p>The default font for labels and treeviews in the CF was larger</p></li> <li><p>When a label is disabled in CF it is just grayed out (the full .net framewark outlines the text with another color)</p></li> </ul>...
44,539
<p>I'm experimenting with the NavBar sample project for iPhone. When I tap on one of the rows in the table in the default view a new view slides in (so far so good). I want to remove the UINavigationBar bar at the top of the new view that slides in. How can I do this? </p> <p>EDIT: I meant "UINavigationBar". Than...
<p>Are you referring to the status bar (where the time and battery status are shown) or the UINavigationBar (where the title and Back buttons are)? </p> <ul> <li><p>To hide the status bar, use <code> [UIApplication sharedApplication].statusBarHidden = YES; </code> in your <code>-applicationDidFinishLaunching:</code> m...
<pre><code>[[UIApplication sharedApplication]setHidesStatusBar:YES]; </code></pre>
29,353
<p>Is there a way to run a project inside a solution that has more one project (read: web applications) and avoid the autostart feature of the integrated asp.net webserver in Visual Studio?</p> <p>I have a big solution that has Windows forms projects, Windows Services projects, Web applications, Windows Libraries etc....
<p>Select the project you don't want to start up automatically in solution explorer and in the properties pane set "Always Start When Debugging" to false</p>
<p>You could just create a new solution with only the project(s) you are working on. </p>
33,904
<p>Hi I'm using <code>System.Net.Mail</code> to send some HTML formatted emails.</p> <p>What is the correct method for inserting css into the email message?</p> <p>I know I can apply formatting to each item, but I'ld rather use style sheets..</p> <p><strong>EDIT</strong> I should have mentioned that this is for an i...
<p>I've always found that strictly using <strong>HTML 3.0 compatible tags and formatting</strong> works best for all email readers and providers.</p> <p>nevertheless here is a <a href="http://www.alistapart.com/articles/cssemail" rel="nofollow noreferrer"><strong>CSS in Email</strong> article</a> that may answer your ...
<p><a href="http://www.campaignmonitor.com/css/" rel="nofollow noreferrer">This reference</a> is the best one I've found to see what works in what when it comes to CSS in emails.</p> <p>To be honest though, CSS support is so, so flaky that you're better off doing as the previous poster says and sticking to basic HTML ...
44,200
<p>X Windows has special processes called Window Managers that manage the layout of windows and decorations like their title bar, control buttons etc. Such processes use an X Windows API to detect events related to windows sizes and positions.</p> <p>Are there any consistent ways for writing such processes for Microso...
<p>Just to extend what Longhorn213 said, here's the code for it:</p> <pre><code>Using mysql as SqlCommand = new SqlCommand(sSql, cnInput) ' do stuff' End Using Using mysql as SqlCommand = new SqlCommand(otherSql, cnInput) ' do other stuff' End Using </code></pre> <p>(edit) Just as an FYI, using automatically wra...
<p>No, the garbage collector will find the old version of mySql and deallocate it in due course.</p> <p>The garbage collector should pick up anything that's been dereferenced as long as it hasn't been moved into the Large Object Heap.</p>
6,389
<p>There's another post on SO relating to .NET -- not us. Pure PHP. Trying to find the best way/process to deploy stable version of our PHP app. I've seen an article on <a href="http://www.simplisticcomplexity.com/2006/8/16/automated-php-deployment-with-capistrano/" rel="nofollow noreferrer">Capistrano</a>, but am c...
<p>I've used a home-grown script for quite some time. It will (based on an application configuration file):</p> <ol> <li>Run <code>svn export</code> on the repository based on a tag.</li> <li>Package the export into a tar or zip file, which includes the tag in the name.</li> <li>Use <code>scp</code> to copy the packag...
<p>I don't know if it works for deploying an app live, but <a href="http://www.phpundercontrol.org/" rel="nofollow noreferrer">phpUnderControl</a> is a continuous integration suite (which I'm just now starting to look into). If it doesn't support doing deployments natively, it can probably be extended to do them.</p>
20,503
<p>I believe several of us have already worked on a project where not only the UI, but also data has to be supported in different languages. Such as - being able to provide and store a translation for what I'm writing here, for instance. </p> <p>What's more, I also believe several of us have some time-triggered events...
<p>Be very very cautious. From what you say about the i18n features you're trying to implement, I wonder if you're over-reaching.</p> <p>Notice that the big boy (e.g. eBay, amazon.com, yahoo, bbc) web applications actually deliver separate apps in each language they want to support. Each of these web applications do c...
<p>I'll describe what has been done in my project (it wasn't my original architecture but I liked it anyways)</p> <p><strong>Providing Translation Support</strong></p> <p>Text which needs to be translated have been divided into three different categories:</p> <ol> <li>Error text: Like errors which happen deep in the...
19,311
<p>I want to make custom control which has couple of <code>&lt;input type='checkbox' /&gt;</code> controls which I render in Render method. Is it possible to retain ViewState (e.g. checked or not) on these Controls? </p> <p>There is a way of doing this by using ASP.NET server CheckBox control, adding them in OnLoad e...
<p>If you want ViewState restored to a dynamic control, you must re-create that control <em>before</em> the load event. That means putting that code in the <code>Init</code> handler.</p>
<p>You can just access the ViewState directly:</p> <pre><code>bool checked = (bool)(ViewState["ThisControlCheckState"] ?? false); if (checked) { write("&lt;input ... &gt;"); } else { write("&lt;input ... &gt;"); } </code></pre> <p>To save the value form the user, you could do something like this in the PostBa...
35,636
<p>I am thinking about creating stored procedures on the fly. </p> <p>ie running CREATE PROCEDURE... when the (web) application is running. </p> <p>What are the risks or problems that it can cause?</p> <ul> <li>I know that the database account needs to have the extra privileges. </li> <li>It does NOT happen everyday...
<p>For a transactional system it's probably quite expensive. If you have a large batch job and want to use a code generator for some reason (quite a common architecture in ETL tools, notably <a href="http://www.oracle.com/solutions/business_intelligence/warehouse-builder.html" rel="nofollow noreferrer">Oracle Warehous...
<p>Firstly, the answer to this question really depends on what exactly this stored procedure is intended to do. If it's just reading data or creating a result set for reporting and you don't mind if it's a little inconsistent, then you're probably fine. If it's doing anything remotely interesting with your data then it...
28,319
<p>It's 5 button clicks to get eclipse to create a deployable war file for my eclipse project, I figure there's probably some eclipse command line option to do the same thing, so I can just write it into a script, but I'm not seeing it.</p>
<p>Use the <a href="http://ant.apache.org/manual/Tasks/war.html" rel="nofollow noreferrer">Ant <code>war</code> task</a>, set up a relevant build file and you can just hit the "external tools" button to execute it. </p>
<p>This Ant script should work for standard Dynamic Web Project structure of project:</p> <p><strong>Create Ant build.xml with replacing of two properties at begining:</strong></p> <pre class="lang-xml prettyprint-override"><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;project name="Deploy From Eclipse to JB...
37,516
<p>I'm working on a project where we mix .NET code and native C++ code via a C++/CLI layer. In this solution I want to use Thread Local Storage via the __declspec(thread) declaration:</p> <pre><code>__declspec(thread) int lastId = 0; </code></pre> <p>However, at the first access of the variable, I get a NullReference...
<p>It seems that __declspec(thread) <a href="http://blogs.msdn.com/jeremykuhne/archive/2006/04/19/578670.aspx" rel="nofollow noreferrer">isn't supported by CLR</a>.</p> <p>Take in mind that .net threads aren't necesarily native threads, <a href="http://blogs.msdn.com/cbrumme/archive/2003/04/15/51351.aspx" rel="nofollo...
<p>Unfortunately not supported. Here's a blog entry with a workaround:</p> <p><a href="http://blogs.msdn.com/jeremykuhne/archive/2006/04/19/578670.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/jeremykuhne/archive/2006/04/19/578670.aspx</a></p>
27,785
<p>I'm working on a PocketPC app in Visual Studio 2005. The solution was building fine, then suddenly broke. The first error is this (assume the project is FooPDA):</p> <p>"Unable to find source file 'C:\FooPDA\obj\Release\FooPDA.exe' for file 'FooPDA.exe', located in '%InstallDir%', the file may be absent or locked...
<p>Seeing %InstallDir% in the error message might be a lead. Do you have a Setup and Deployment project in your solution? Does it get build before your FooPDA project? Seeing it looking in <em>obj</em> is fishy too.</p> <hr> <p><strong>OP Edit</strong>: You were on the right track, so I'll credit you with the ans...
<p>Sometimes this happens to me in class libraries, etc. If the solution does not build properly, it never gets to the point where it generates the .exe file. </p> <p>Can you compile without running the project, or do you get the same error when just trying to compile as well?</p> <p>If you can, I would try fixing an...
37,188
<p>My current project is in Rails. Coming from a Symfony (PHP) and Django (Python) background, they both have excellent admin generators. Seems like this is missing in Rails.</p> <p>For those who aren't familiar with Symfony or Django, they both allow you to specify some metadata around your models to automatically ...
<p><strong>Active Admin</strong> (<a href="http://activeadmin.info/" rel="noreferrer">http://activeadmin.info/</a>) was released in May of 2011, and looks like it's going to become the best Rails 3 option.</p> <p><img src="https://i.stack.imgur.com/mtjrr.png" alt="features"></p>
<p>The most common way to create a CRUD interface is to use Scaffold. </p> <pre><code>./script/generate scaffold_resource MyModel property:type property2:type2 </code></pre> <p>This command would generate a CRUD interface for the model named MyModel (singular) with two properties. Properties is what's called columns ...
8,657
<p>So I was making a class the other day and used Eclipse's method to create the equals method when I realized that it generated the following <strong>working</strong> code:</p> <pre><code>class Test { private int privateInt; [...] public boolean equals(Object obj) { [...] Test t = (Test) obj; if ( t...
<p>It's accessible from different instances of the same class.</p> <p>According to <a href="http://java.sun.com/docs/books/tutorial/java/javaOO/accesscontrol.html" rel="noreferrer">this page</a> (bolding mine):</p> <blockquote> <p>At the member level, you can also use the public modifier or no modifier (package-pri...
<p>The simple answer to this confusion is to remember that private field are visible only and only in the class where they are initialize( and defined)....So when you make an object of the class inside the class, you can always access the private field of that class through the object reference. May be you feel its di...
40,229
<p>When I create a zip Archive via <code>java.util.zip.*</code>, is there a way to split the resulting archive in multiple volumes? </p> <p>Let's say my overall archive has a <code>filesize</code> of <code>24 MB</code> and I want to split it into 3 files on a limit of 10 MB per file.<br> Is there a zip API which has ...
<p>Check: <a href="http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=38&amp;t=004618" rel="nofollow noreferrer">http://saloon.javaranch.com/cgi-bin/ubb/ultimatebb.cgi?ubb=get_topic&amp;f=38&amp;t=004618</a></p> <p><em>I am not aware of any public API that will help you do that. (Although if you...
<p>Below code is my solution to split zip file in directory structure to chunks based on desired size. I found the previous answers useful so, wanted to contribute with similar but little more neat approach. This code is working for me for my specific needs, and I believe there is room for improvement.</p> <pre><code>...
30,241
<p>In <a href="https://stackoverflow.com/questions/346838/can-dataset-filtering-be-done-from-outside-the-dataset">this question,</a> I asked about breaking a dataset into subsets, and got a good response. Now I have the opposite problem. I've got two different datasets, representing objects of two different subclasse...
<p>Create your own TDBLookupComboBox that takes multiple data sources. . . . I've created DB aware controls before (specifically drop down combo boxes). They are pretty easy to do and give you all the control you need.</p>
<p>Create a TDataSource or a TDataSet descendant that is actually a union of other TDataSets. Then on insert you either always insert into one specific TDataSet, or have rules based on the value of a certain field that determines which TDataSet to insert into. . . .</p>
47,123
<p>I have a Google App Engine app - <a href="http://mylovelyapp.appspot.com/" rel="noreferrer">http://mylovelyapp.appspot.com/</a> It has a page - mylovelypage</p> <p>For the moment, the page just does <code>self.response.out.write('OK')</code></p> <p>If I run the following Python at my computer:</p> <pre><code>impo...
<p>appcfg.py, the tool that uploads data to App Engine has to do exactly this to authenticate itself with the App Engine server. The relevant functionality is abstracted into appengine_rpc.py. In a nutshell, the solution is:</p> <ol> <li>Use the <a href="http://code.google.com/apis/accounts/docs/AuthForInstalledApps.h...
<p>I'm not a python expert or a app engine expert. But did you try following the sample appl at <a href="http://code.google.com/appengine/docs/gettingstarted/usingusers.html" rel="nofollow noreferrer">http://code.google.com/appengine/docs/gettingstarted/usingusers.html</a>. I created one at <a href="http://quizengine.a...
12,720
<p>I have an API consisting of ASP.NET webservices callable through GET/POST/SOAP.</p> <p>A new functionality will require me to accept files through this webservice. Basically I'm allowing users to upload files to a file archive through the API, which they'd otherwise do by logging into our browser based administrati...
<p>"would that pose any problems when I need to read the file?" No problems. When you handle the POST request, you have a MIME attachment to the POST, which is the file. It's relatively straightforward to read this file.</p> <p>"would I have any troubles accepting files in the 250MB area?" No. Except that it take...
<p>Not a direct answer but you may also want to look into <a href="http://en.wikipedia.org/wiki/Background_Intelligent_Transfer_Service" rel="nofollow noreferrer">BITS - Background Intelligent Transfer Service [wiki]</a></p> <p>It may or may not be relevant to you / your customers.</p>
27,634
<p>I have a very simple ASP.Net page that acts as a front end for a stored procedure. It just runs the procedure and shows the output using a gridview control: less than 40 lines of total code, including aspx markup. The stored procedure itself is very... volatile. It's used for a number of purposes and the output f...
<p>If you are auto generating the columns which it sounds like you are. The procedure for using the grids formatting is awful.</p> <p>You would need to loop through all the columns of the grid, probably in the databound event and apply a formatting expression to any column you find is a date column.</p> <p>If you ar...
<p>You can use the isDate() function to see if something is a valid date and then use dateformatting options to make it look like you want.</p> <p>Some examples for date formating: <a href="http://datawebcontrols.com/faqs/CustomizingAppearance/FormatDateTimeData.shtml" rel="nofollow noreferrer">http://datawebcontrols....
31,237
<p>I am writing a batch file script using Windows command and want to change each occurrence of some blank space with "," What is the simplest way to do that? </p>
<p>If your users are a list of words on one line in a text file, separated by spaces, eg:</p> <pre><code>one two three four </code></pre> <p>Create a batch file SpaceToComma.bat as follows:</p> <pre><code>@echo off setlocal for /F "tokens=* delims= " %%a in (%1) do @set data=%%a echo %data: =,% endlocal </code></pre...
<p>Well it will depend a lot on how you are getting the data, but you may be able to finagle something with a For-Do construct. Make the field seperator be a space then build the string back in the do with a , between each token. Might I suggest a more robust scripting language? You should have VBScript on just about a...
30,864
<p>My company gave me VS2008 for web development in C#/ASP.NET. I do a lot of Perl programming too and I'd like to start using VS for that so I can have a consistent work environment... but am having real trouble figuring out how to do so.</p> <p>VS has a lot of nice features but seems pretty hostile towards language...
<p>I use VS2008 for .NET stuff, but I'm completely sold on Komodo for Perl editing. The full Komodo IDE is worth the money if this is your job and like/need to use a debugger, but even the free Komodo Edit is a terrific Perl editor.</p>
<p>I heard rumors of there being a .NET implementation of Perl, called IronPerl, but except for that, I don't think there is any sort of plugin for Visual Studio. I would suggest just using one of the many tools out there that are designed for Perl.</p>
44,334
<p>What are the best practices to do transactions in C# .Net 2.0. What are the classes that should be used? What are the pitfalls to look out for etc. All that commit and rollback stuff. I'm just starting a project where I might need to do some transactions while inserting data into the DB. Any responses or links for e...
<p>There are 2 main kinds of transactions; connection transactions and ambient transactions. A connection transaction (such as SqlTransaction) is tied directly to the db connection (such as SqlConnection), which means that you have to keep passing the connection around - OK in some cases, but doesn't allow "create/use/...
<p>It also depends on what you need. For basic SQL transactions you could try doing TSQL transactions by using BEGIN TRANS and COMMIT TRANS in your code. That is the easiest way but it does have complexity and you have to be careful to commit properly (and rollback).</p> <p>I would use something like </p> <pre><cod...
27,769
<p>Seems like the subtraction is triggering some kind of issue and the resulting value is wrong.</p> <pre><code>double tempCommission = targetPremium.doubleValue()*rate.doubleValue()/100d; </code></pre> <p>78.75 = 787.5 * 10.0/100d</p> <pre><code>double netToCompany = targetPremium.doubleValue() - tempCommission; </...
<p>To control the precision of floating point arithmetic, you should use <a href="http://java.sun.com/javase/6/docs/api/java/math/BigDecimal.html" rel="noreferrer">java.math.BigDecimal</a>. Read <a href="https://blogs.oracle.com/CoreJavaTechTips/entry/the_need_for_bigdecimal" rel="noreferrer">The need for BigDecimal</a...
<p>Although you should not use doubles for precise calculations the following trick helped me if you are rounding the results anyway. </p> <pre><code>public static int round(Double i) { return (int) Math.round(i + ((i &gt; 0.0) ? 0.00000001 : -0.00000001)); } </code></pre> <p>Example:</p> <pre><code> Double f...
21,634
<p>As we do not implement the users of our applications as users in SQL server, when the application server connects to a database each application always uses the same credentials to attach to each database.</p> <p>This presents an auditing problem. Using triggers, we want to store every update, insert and delete and...
<p>I use <a href="http://msdn.microsoft.com/en-us/library/ms187768.aspx" rel="nofollow noreferrer">SET CONTEXT_INFO</a> for this. It's just what you need.</p>
<p>We use the Application Name property to control auditing triggers and have not seen any problems using it, and haven't noticed any speed issues (though in our case, we're specifically not auditing for certain applications, so its hard to measure how much time not doing something takes :))</p>
41,873
<p>Under what circumstances - if any - does adding programmers to a team actually speed development of an already late project?</p>
<p>The exact circumstances are obviously very specific to your project ( e.g. development team, management style, process maturity, difficulty of the subject matter, etc.). In order to scope this a bit better so we can speak about it in anything but sweeping oversimplifications, I'm going to restate your question:</p>...
<p>Simply put. It comes down to comparing the time left and productivity you will get from someone excluding the amount of time it takes the additional resources to come up to speed and be productive and subtracting the time invested in teaching them by existing resources. The key factors (in order of significance):</p...
10,215
<p>I have a Creality Ender 3 that printed a spool of Sunlu PLA with no issues, so I bought a second to replace it, just in a different color.</p> <p>The problem is I can’t get it to stick. The bed is level, I’ve tried printing at different temps, even adjusted the fan, but no luck. No matter what, the print still only ...
<h1>Level the bed</h1> <p>Make sure that the bed is level. The nozzle must be equally high over heated surface, otherwise only part of the print will have chance to be smeared and adhere properly.</p> <h1>Clean thoroughly</h1> <p>First thing I do when I notice that increasing bed temperature does not work anymore, is w...
<p>In addition to the suggestion of cleaning the glass with soap (dish soap works very well) and THEN also with any alcohol or brake cleaner or similar no-trace solvent, you can use hairspray or glue stick for larger parts.</p>
1,829
<p>I have a project in a c++ solution. For that project, I have some config files that I would like to manage from within the project and when I build the project, have those config files added to the executable build path in the proper directory structure.</p> <p>Example:</p> <p>test.exe references config/myconfig.t...
<p>You could use pre-build events to create the directories and copy the files.</p>
<p>In Visual Studio's Solution Explorer, you can right-click on the non-code files, select "Properties" and set the "Copy To Output Directory" property.</p> <p>This creates a rule in the build file to (1) include the file, and (2) to copy that file as part of the build process. In other words, it's possible to get th...
39,968
<p>What is the simplest way to get the NT-ID of a user in a C# application? I would probably need to get it only having a name of the user, or maybe an email address.</p>
<p>From within SharePoint, you can get a user's Active Directory information (including display name and email) using SPUtility.ResolveWindowsPrincipal:</p> <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.resolvewindowsprincipal.aspx" rel="nofollow noreferrer">http://msdn.m...
<p>From within SharePoint, you can get a user's Active Directory information (including display name and email) using SPUtility.ResolveWindowsPrincipal:</p> <p><a href="http://msdn.microsoft.com/en-us/library/microsoft.sharepoint.utilities.sputility.resolvewindowsprincipal.aspx" rel="nofollow noreferrer">http://msdn.m...
38,087
<p>For some reason after I installed Boot Camp, my os x terminal started to point to the Boot Camp drive instead of my os x home directory by default! Once in the terminal I know how to switch back an forth and am able to do that, but I was wondering how to make my terminal default back to my os x home folder?</p> <p>...
<p>This is a bit of under-the-hood fiddling, but you could simply enter</p> <pre><code>cd &lt;directory&gt; in /Users/&lt;yourUserName&gt;/.profile </code></pre> <p>and startup a new terminal. You should then be in the directory you want.</p>
<p>You probably want these instructions for how to use the command line:</p> <p><a href="https://superuser.com/questions/154193/setting-a-users-home-directory-on-mac-os-x-server-from-the-command-line">https://superuser.com/questions/154193/setting-a-users-home-directory-on-mac-os-x-server-from-the-command-line</a></p>...
17,521
<p>I'm just starting to get into Django, and of course as of last night one of the two new Python versions went final (2.6 obviously ;)) so I'm wondering if 2.6 plus Django is ready for actual use or do the Django team need more time to finish with tweaks/cleanup? </p> <p>All the google searches I did were inconclusi...
<p>The impression I get is that 2.6 should work fine with Django 1.0. As found here: <a href="http://simonwillison.net/2008/Oct/2/whatus/" rel="nofollow noreferrer">http://simonwillison.net/2008/Oct/2/whatus/</a> </p>
<p>There is an unofficial build for mysqldb 1.2.2 win32 python 2.6 @ <a href="http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe" rel="nofollow noreferrer">http://www.technicalbard.com/files/MySQL-python-1.2.2.win32-py2.6.exe</a></p>
19,688
<p>What type of client is likely to support XP (Extreme Programming) practices?</p>
<p>If your team achieves great results with a proven track-record, then companies desiring a successful result. If the converse is true, only companies who are wandering blindly will be interested.</p> <p>There is the <strong>odd</strong> case where the client will want a certain practices followed. Like a experience...
<p>I think it probably takes less convincing than it used to for customers to accept agile development practices, particularly XP, since they are now much more mainstream. Customers who have had positive experiences with agile teams in the past are more likely to buy into these methods. It's probably easier for a sma...
37,374
<p>I have an Asp.Net 2.0 (VB.Net) app and I'm trying to export a Control (ASCX) to another project. I need to know what other files that the Control needs in order to work. </p> <p>Is there any way - using VS.Net 2005 or an external app - to recursively trace the dependencies of a page or control in a solution?</p> <...
<p>I've used the <a href="http://msdn.microsoft.com/en-us/library/ms229864(VS.80).aspx" rel="nofollow noreferrer">Assembly Binding Log Viewer (Fuslogvw.exe)</a> or maybe ProcMon...</p> <p>One of my coworkers suggested this app called Dependency Auditor. I haven't used it though and am not vouching for it necessarily. ...
<p>I would just move the ascx control to a new project and debug stuff one by one. Then, I would compile that into a dll and use it in the different project.</p>
22,179
<p>My company has developed a long standing product using MFC in Visual C++ as the defacto standard for UI development. Our codebase contains ALOT of legacy/archaic code which must be kept operational. Some of this code is older than me (originally written in the late 70s) and some members of our team are still on Visu...
<p>I'm a developer on an app that has a ton of legacy MFC code, and we have all of your same concerns. A big driver for our strategy was to eliminate as much risk and uncertainty as we could, which meant avoiding The Big Rewrite. As we all know, TBR fails most of the time. So we chose an incremental approach that allow...
<p>I concur with the WPF sentiment. Tag/XML based UI would seem to be a bit more portable than WinForms.</p> <p>I guess too you have to consider your team, if there is not a lot of current C# skills, then that is a factor, but going forward the market for MFC developers is diminishing and C# is growing.</p> <p>Maybe ...
3,209
<p>Does C# have built-in support for parsing strings of page numbers? By page numbers, I mean the format you might enter into a print dialog that's a mixture of comma and dash-delimited.</p> <p>Something like this:</p> <pre><code>1,3,5-10,12 </code></pre> <p>What would be really nice is a solution that gave me back...
<p>Should be simple:</p> <pre><code>foreach( string s in "1,3,5-10,12".Split(',') ) { // try and get the number int num; if( int.TryParse( s, out num ) ) { yield return num; continue; // skip the rest } // otherwise we might have a range // split on the range delimiter ...
<p>Here's a slightly modified version of lassevk's code that handles the string.Split operation inside of the Regex match. It's written as an extension method and you can easily handle the duplicates problem using the Disinct() extension from LINQ.</p> <pre><code> /// &lt;summary&gt; /// Parses a string represe...
6,139
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/2721201/how-to-embed-a-web-browser-control-in-a-cross-platform-application">How to embed a web browser control in a cross-platform application?</a> </p> </blockquote> <p>I'd like to embed a browsing engine (HTM...
<p>WebKit is very lightweight and runs on all platforms. You will have to look at Google Chrome to see how to embed it into a Windows application. I believe it's native to GTK. There are also bindings for wxWidgets / wxPython.</p>
<blockquote> <p>Should I ... write my own abstraction layer on top of the natives ones?</p> </blockquote> <p>Having struggled with this exact issue, I think this is the only safe option at the moment. Something like Webkit on *nix, and Internet Explorer on Windows.</p>
41,681
<p>I have a Java based web-application and a new requirement to allow Users to place variables into text fields that are replaced when a document or other output is produced. How have others gone about this?</p> <p>I was thinking of having a pre-defined set of variables such as :<br> <code>@BOOKING_NUMBER@</code><br> ...
<p>Have a look at java.text.MessageFormat - particularly the format method - as this is designed for exactly what you are looking for.</p> <p>i.e.</p> <pre><code>MessageFormat.format("This is some text for booking {0} that is needed by me, for use with invoice {1}", bookingNumber, invoiceNumber); </code></pre> <p>Yo...
<p>I have used a similiar replacement token system before. I personally like something like.</p> <p>[MYVALUE]</p> <p>As it is easy for the user to type, and then I just use replacements to swap out the tokens for the real data.</p>
30,180
<p>I recently started working on a small game for my own amusement, using Microsoft XNA and C#. My question is in regards to designing a game object and the objects that inherit it. I'm going to define a game object as something that can be rendered on screen. So for this, I decided to make a base class which all other...
<p>Personally I find the sheer number of constructors you have a little offputting, but that's your choice, nothing fundamentally wrong with it :)</p> <p>With regards to the general strategy of deriving game objects from a common base, that's a pretty common way to do things. Standard, even. I've tended to start using...
<p>Depending on how often the constructors would be called, you could consider making all the extra parameters nullable and just passing null to them when they don't have values. Messier creating the objects, fewer constructors</p>
21,731
<p>I've inherited a desktop application which has a custom .NET file chooser that is embedded in a control, but it has some issues.<br> I'd like to replace it with a non-custom File Chooser (like the <code>OpenFileDialog</code>). </p> <p>However, for a variety of reasons it needs to be embedded in the parent control ...
<p>The .Net control is a thin wrapper for the common dialog built into windows, and that <em>is</em> a dialog. So there is no way to embed it as though it were a control.</p>
<p>Depending on your needs, you COULD abuse the web browser control to show local files and folders. It won't match all the functionality of the OpenFileDialog, but it could work.</p> <p>Here's one that I remembered from way-back. <a href="http://www.ssware.com/megapack.htm" rel="nofollow noreferrer">The Shell Mega-...
7,888
<p>I'm new to the world of PHP frameworks and, after some initial investigation, came up with the following list of popular choices:</p> <ul> <li>CakePHP</li> <li>CodeIgniter</li> <li>Symfony</li> <li>Zend</li> </ul> <p>I'm trying not to repeat the "Which is best?" question, which seems to elicit not much more than p...
<p>The thing with frameworks is that they're perfect up to the point you need them to do something they're not made for.</p> <p>I've worked with all of the major PHP framework's you've listed, except Zend and this is what I can quickly tell you:</p> <ul> <li><p>CakePHP enforces OOP, gets you up and running quickly, h...
<p>I stumbled across this (old) question as I am looking for a PHP framework that works well in a shared hosting environment ; speed is important as in shared hosting CPU time is the tightest constraint. </p>
45,557
<p>In an application that I'm writing I have some code like this:</p> <pre><code>NSWorkspace* ws = [NSWorkspace sharedWorkspace]; NSString* myurl = @"http://www.somewebsite.com/method?a=%d"; NSURL* url = [NSURL URLWithString:myurl]; [ws openURL:url]; </code></pre> <p>The main difference being that <em>myurl</em> co...
<p>I'm not sure if this is exactly what you're looking for, but there is a method in NSString that will sanitize a URL:</p> <p><a href="https://developer.apple.com/documentation/foundation/nsstring/1415058-stringbyaddingpercentescapesusin" rel="nofollow noreferrer">stringByAddingPercentEscapesUsingEncoding:</a></p>
<p>Unfortunately you need to be smarter than what is provided by Apple :</p> <pre><code>stringByAddingPercentEscapesUsingEncoding: </code></pre> <p>This will escape all invalid URL characters so that "http://foo.com/hey%20dude/", which is valid, becomes "http://foo.com/hey%2520dud/", which is not what we want. </p> ...
6,791
<p>I have a string that I want to use as a filename, so I want to remove all characters that wouldn't be allowed in filenames, using Python.</p> <p>I'd rather be strict than otherwise, so let's say I want to retain only letters, digits, and a small set of other characters like <code>"_-.() "</code>. What's the most el...
<p>You can look at the <a href="http://www.djangoproject.com" rel="noreferrer">Django framework</a> for how they create a &quot;slug&quot; from arbitrary text. A slug is URL- and filename- friendly.</p> <p>The Django text utils define a function, <a href="https://docs.djangoproject.com/en/4.0/ref/utils/#django.utils.t...
<p><strong>UPDATE</strong></p> <p>All links broken beyond repair in this 6 year old answer.</p> <p>Also, I also wouldn't do it this way anymore, just <code>base64</code> encode or drop unsafe chars. Python 3 example:</p> <pre><code>import re t = re.compile("[a-zA-Z0-9.,_-]") unsafe = "abc∂éåß®∆˚˙©¬ñ√ƒµ©∆∫ø" safe = [...
37,704
<p>At what point in a team's growth must process change drastically? A lone coder can get away with source control and a brain. A team trying to ship large prepackaged software to local and international markets must have a bit more in place. </p> <p>If you've experienced a large transition in 'process': Was the tea...
<p>In my experience this transition occurs at exactly the moment at which you also need management. It is hard to get above 8 developers without some over-arching coordinating function being in place, whether it is a team lead, segregation of tasks or old fashioned management. The reality I have witnessed is that eve...
<p>A lot depends on the people working on the project, the integration points, etc. Even a single coder should have a code management tool and needs to interact with clients or the 'boss'. From experience, I've seen a change once there are more then 2 people and then probably any increase of 50%. If teams are organi...
32,877
<p>What could the best strategy for writing validation layer for mid-enterprise level business application built on Spring 2.5</p> <p>I know that Spring provides facility where we can implement Validator interface and write validation logic in validate method. But this will be restricted to only web requests coming th...
<p>The Spring Validation framework can be used outside of Spring MVC. What WebServices Stack are you using? If you are using Spring-WS (Spring's Web Services stack) they have special instructions on how to set up the validator here:</p> <p><a href="http://static.springframework.org/spring-ws/sites/1.5/reference/html/s...
<p>Recall that the Validator interface defines two methods:</p> <pre><code>boolean supports(Class clazz) void validate(Object target, Errors errors) </code></pre> <p>The <code>Object target</code> is your form object, which is the whole object representing the page to be shown to the user. The Errors instance will c...
8,151
<p>Does the latest version of the enterprise library (<a href="http://msdn.microsoft.com/en-us/library/cc512464.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc512464.aspx</a>) come with the updater application block?</p>
<p>Looks like it doesn't:</p> <p><a href="http://msdn.microsoft.com/en-us/library/cc511823.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc511823.aspx</a></p> <p>It's now in the 'Archived Application Blocks' section of the MSDN docs.</p> <p><a href="http://msdn.microsoft.com/en-us/library/c...
<p>No. Microsoft considers the Updater Application Block to be replaced by ClickOnce in .NET 2.0. The Enterprise Library for .NET 1.1 is no longer updated.</p>
16,898
<p>The way the iPhone uses the touchscreen to enable zooming in and out and scrolling and so forth is very cool, and I was wondering if there is anything available for Windows Mobile that provides a similar user experience.</p>
<p>The zoom in/out is an artifact of the multi-touch hardware. A Pocket PC uses a resistive touch panel, which provides only a single contact point (touching 2 places gives the average of the two, not two points), so WinMo hardware simply won't support it. I've seen a hack that emulated the behavior, but it was just ...
<p>As far as I know Apple patented those gestures. So there 'shouldn't' be anything legal out there.</p> <p>See <a href="http://www.wired.com/gadgets/miscellaneous/news/2008/02/multitouch_patents" rel="nofollow noreferrer">here</a> for example</p>
26,907
<p>I need to convert a name in the format Parisi, Kenneth into the format kparisi.</p> <p>Does anyone know how to do this in Perl?<br></p> <p>Here is some sample data that is abnormal:</p> <p>Zelleb, Charles F.,,IV<br> Eilt, John,, IV<br> Wods, Charles R.,,III<br> Welkt, Craig P.,,Jr.<br></p> <p>These specific name...
<pre> vinko@parrot:~$ cat genlogname.pl </pre> <pre><code>use strict; use warnings; my @list; push @list, "Zelleb, Charles F.,,IV"; push @list, "Eilt, John,, IV"; push @list, "Woods, Charles R.,,III"; push @list, "Welkt, Craig P.,,Jr."; for my $name (@list) { print gen_logname($name)."\n"; } sub gen_logname...
<pre><code> $rowfetch =~ s/['-]//g; #All chars inside the [ ] will be filtered out. $rowfetch =~ m/(\w+), ?(.)/; $rowfetch = lc($2.$1); </code></pre> <p>this is how I ended up using Vinko Vrsalovic's solution... its inside a while loop that goes through a sql query result ... thanks again vinko</p>
49,630
<p>I wanted to change the resolution of a image,this image I am getting from remote location.The image I am getting is too large to fit in iPhone screen is their any way to change that resolution?</p>
<p>If you're using a UIImageView then UIView's contentMode is what you need, you should probably set it to UIViewContentModeScaleAspectFit (or the equivalent in Interface Builder).</p>
<p>Assuming you are using some kind of "View" to display the image (rather than custom drawing) you might see if there is some kind of property which would allow you to set the "Mode" of the view to allow various scaling methods.</p>
17,786
<p>This question is kind of an add-on to this <a href="https://stackoverflow.com/questions/44905/c-switch-statement-limitations-why">question</a></p> <p>In C#, a switch case cannot fall through to other cases, this causes a compilation error. In this case I am just adding some number to the month total for the select...
<p>Often times when you see the noise from a huge switch statement or many if statements that might fall into more than one block, you're trying to suppress a bad design.</p> <p>Instead, what if you implemented the Specification pattern to see if something matched, and then act on it?</p> <pre><code>foreach(MonthSpec...
<p>Write the switch cases in reverse order</p> <pre><code>case 2: case 1: case 0: break; default: </code></pre> <p>Hope that helps!</p>
7,554
<p>I am creating a windows service and want to know best practices for this. In all my windows Program I have a form that asks the user if he wants to report the error and if he answers yes I created a case in FogBugz. What should I do in a windows service. </p>
<p>Since you're not going to have a user interacting with the program, I'd say make configuration variable (in an app.config file) responsible for sending/not sending the data. That way users who don't want to report errors can just change a flag in a config file. I'd personally have it turned on by default and then ...
<p>Since you're not going to have a user interacting with the program, I'd say make configuration variable (in an app.config file) responsible for sending/not sending the data. That way users who don't want to report errors can just change a flag in a config file. I'd personally have it turned on by default and then ...
7,120
<p>As far as I can tell, the best way to do this is do it in the DataTable.RowChanging event. But what if I want to cancel the action? There is no EventArgs.Cancel option...</p>
<p>From the DataTable.RowChanging event handler, you can throw an exception to cancel the change. The exception will be thrown to the piece of code making the change where you can handle it appropriately.</p>
<p>In the case of the <code>DataGridView</code>, if you throw an exception in <code>DataTable.RowChanging</code>, you can handle it in <code>DataGridView.OnError</code>. Setting <code>EventArgs.Cancel</code> to <code>true</code> preserves data entry.</p>
30,447
<p>another request sorry.. Right now I am reading the tokens in one by one and it works, but I want to know when there is a new line..</p> <p>if my file contains</p> <pre><code>Hey Bob Now </code></pre> <p>should give me</p> <pre><code>Hey Bob [NEW LINE] NOW </code></pre> <p>Is there a way to do this without using...
<p>Yes the operator>> when used with string read 'white space' separated words. A 'White space' includes space tab and new line characters.</p> <p>If you want to read a line at a time use std::getline()<br> The line can then be tokenized separately with a string stream.</p> <pre><code>std::string line; while(std::g...
<p>This is another cool and much less verbose way I came across to tokenize strings.</p> <pre><code>vector&lt;string&gt; vec; //we'll put all of the tokens in here string token; istringstream iss("put text here"); while ( getline(iss, token, '\n') ) { vec.push_back(token); } </code></pre>
34,701
<p>I am training in web developement and am learning about <strong>JSP</strong> &amp; <strong>Servlets</strong>. I have some knowledge of <code>HttpSession</code> - I have used it in some of my sample projects.</p> <p>In browsers I have seen the option to "delete cookies". If I delete the cookies it deletes the <code>...
<p>Sessions are server-side files that contain user information, while Cookies are client-side files that contain user information. Sessions have a unique identifier that maps them to specific users. This identifier can be passed in the URL or saved into a session cookie.</p> <p>Most modern sites use the second approa...
<p>Google <em>JSESSIONID</em>. This will explain how the Servlet API initially uses URL re-writing and then, if cookies are enabled, cookies to manage sessions.</p> <p>HTTP is stateless so the client browser must send the id of its session to the server with each request. The server, through whatever means, uses thi...
46,885
<p>Or is it now the other way around?</p> <p>From what I've heard there are some areas in which C# proves to be faster than C++, but I've never had the guts to test it by myself.</p> <p>Thought any of you could explain these differences in detail or point me to the right place for information on this.</p>
<p>There is no strict reason why a bytecode based language like C# or Java that has a JIT cannot be as fast as C++ code. However C++ code used to be significantly faster for a long time, and also today still is in many cases. This is mainly due to the more advanced JIT optimizations being complicated to implement, and ...
<p>Inspired by this, I did a quick test with 60 percent of common instruction needed in most of the programs.</p> <p>Here’s the C# code:</p> <pre><code>for (int i=0; i&lt;1000; i++) { StreamReader str = new StreamReader("file.csv"); StreamWriter stw = new StreamWriter("examp.csv"); string strL = ""; w...
16,750
<p>Is there a good way to remove HTML from a Java string? A simple regex like</p> <pre class="lang-js prettyprint-override"><code>replaceAll(&quot;\\&lt;.*?&gt;&quot;, &quot;&quot;) </code></pre> <p>will work, but some things like <code>&amp;amp;</code> won't be converted correctly and non-HTML between the two angle b...
<p>Use a HTML parser instead of regex. This is dead simple with <a href="http://jsoup.org" rel="noreferrer">Jsoup</a>.</p> <pre><code>public static String html2text(String html) { return Jsoup.parse(html).text(); } </code></pre> <p>Jsoup also <a href="https://jsoup.org/cookbook/cleaning-html/whitelist-sanitizer" re...
<p>you can simply make a method with multiple replaceAll() like</p> <pre><code>String RemoveTag(String html){ html = html.replaceAll("\\&lt;.*?&gt;","") html = html.replaceAll("&amp;nbsp;",""); html = html.replaceAll("&amp;amp;".""); ---------- ---------- return html; } </code></pre> <p>Use this lin...
29,778
<p>I placed a UITextField into a UIAlertView and moved it up so the keyboard wouldn't cover it up with the following code:</p> <pre><code>[dialog setDelegate:self]; [dialog setTitle:@"Enter Name"]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; UITextField * nameField = [[UITextField alloc] ...
<p>For those who may care, here's a working solution:</p> <pre><code>UIAlertView* dialog = [[UIAlertView alloc] init]; [dialog setDelegate:self]; [dialog setTitle:@"Enter Name"]; [dialog setMessage:@" "]; [dialog addButtonWithTitle:@"Cancel"]; [dialog addButtonWithTitle:@"OK"]; nameField = [[UITextField alloc] initWi...
<p>This is actually only 1 more line to the regular UIAlertView code. Hope this helps!</p> <pre><code> UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"test" message:@"This is a alert with a textfield" delegate:self cancelButtonTitle:@"YAY" otherButtonTitles:nil]; alert.alertViewStyle = UIAlertViewStyl...
49,221
<p>Besides the CODEX what resources do you recommend to help a person new to creating plugins help create a WordPress plugin. I have an idea, but need a bit better explanation than what is in the CODEX to get started.</p> <p>UPDATE: Is there a book that I could buy to help me out with this?</p>
<p>Having written the MyBlogLog plugin (the original one, that is) I found that the Wordpress Hooks list (can't remember the link offhand) was incredibly useful, as was the sample code from the Codex and WP Install files. Reading through other developer's plugins is also a good way to learn, as you can see how they imp...
<p>Although technically still information found within the Codex, the Codex contains links to external resources. Apologies for not posting a direct link, but look again, and you should find them.</p>
30,220
<p>I am trying to detect Blackberry user agents in my app, which works fine in my development version. But nothing happens when I redeploy the app in production.</p> <p>application_helper.rb</p> <pre><code> def blackberry_user_agent? request.env["HTTP_USER_AGENT"] &amp;&amp; request.env["HTTP_USER_AGENT"][/(Blac...
<p>Try:</p> <pre><code>request.user_agent </code></pre>
<p>Are you using Apache or nginx in front of your mongrel(s)?</p> <p>Are you logging the user_agent? This is from my nginx.conf:</p> <pre><code>log_format main '$remote_addr - $remote_user [$time_local] $request ' '"$status" $body_bytes_sent "$http_referer" ' '"$http_user_agent" "h...
28,939
<p>Given the following table in SQL Server 2005:</p> <pre><code>ID Col1 Col2 Col3 -- ---- ---- ---- 1 3 34 76 2 32 976 24 3 7 235 3 4 245 1 792 </code></pre> <p>What is the best way to write the query that yields the following result (i.e. one that yie...
<p>There are likely to be many ways to accomplish this. My suggestion is to use Case/When to do it. With 3 columns, it's not too bad. </p> <pre><code>Select Id, Case When Col1 &lt; Col2 And Col1 &lt; Col3 Then Col1 When Col2 &lt; Col1 And Col2 &lt; Col3 Then Col2 Else Col3 ...
<p>I know that question is old, but I was still in the need of the answer and was not happy with other answers so I had to devise my own which is a twist on @paxdiablo´s <a href="https://stackoverflow.com/a/368394/3336667">answer</a>.</p> <hr> <p>I came from land of SAP ASE 16.0, and I only needed a peek at statistic...
48,087
<p>In our Java applications we typically use the maven conventions (docs, src/java, test, etc.). For Perl we follow similar conventions only using a top level 'lib' which is easy to add to Perl's @INC.</p> <p>I'm about to embark on creating a service written in Erlang, what's a good source layout for Erlang applicati...
<p>The Erlang recommended standard directory structure can be <a href="http://erlang.org/doc/design_principles/applications.html#id80846" rel="nofollow noreferrer">found here</a>.</p> <p>In addition you may need a few more directories depending on your project, common ones are (credit to Vance Shipley): </p> <pre> ...
<p>Another critical directory is the priv directory. Here you can store files that can easily be found from your applications.</p> <pre><code>code:priv_dir(Name) -&gt; string() | {error, bad_name} </code></pre> <p>where Name is the name of your application.</p>
14,479
<p>Currently I'm using</p> <pre><code>var x = dict.ContainsKey(key) ? dict[key] : defaultValue </code></pre> <p>I'd like some way to have dictionary[key] return null for nonexistant keys, so I could write something like</p> <pre><code>var x = dict[key] ?? defaultValue; </code></pre> <p>this also winds up being par...
<p>With an extension method:</p> <pre><code>public static class MyHelper { public static V GetValueOrDefault&lt;K, V&gt;(this IDictionary&lt;K, V&gt; dic, K key, V defaultVal = default(V)) { V ret; bool fo...
<p>Isn't simply <code>TryGetValue(key, out value)</code> what you are looking for? Quoting MSDN:</p> <pre><code>When this method returns, contains the value associated with the specified key, if the key is found; otherwise, the default value for the type of the value parameter. This parameter is passed uninitialized. ...
31,697
<p>I'm building a class library that will have some public &amp; private methods. I want to be able to unit test the private methods (mostly while developing, but also it could be useful for future refactoring).</p> <p>What is the correct way to do this?</p>
<p>If you are using .net, you should use the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.internalsvisibletoattribute.aspx" rel="noreferrer">InternalsVisibleToAttribute</a>. </p>
<p><strong>For JAVA language</strong></p> <p>Here, you can over-ride a particular method of the testing class with mock behavior. </p> <p>For the below code:</p> <pre><code>public class ClassToTest { public void methodToTest() { Integer integerInstance = new Integer(0); boolean returnValue= ...
31,199
<p>Sometimes a labeled break or continue can make code a lot more readable. </p> <pre><code>OUTERLOOP: for ( ;/*stuff*/; ) { //...lots of code if ( isEnough() ) break OUTERLOOP; //...more code } </code></pre> <p>I was wondering what the common convention for the labels was. All caps? first cap? </p>
<p>If you have to use them use capitals, this draws attention to them and singles them out from being mistakenly interpreted as "Class" names. Drawing attention to them has the additional benefit of catching someone's eye that will come along and refactor your code and remove them. ;)</p>
<p>The convetion/best practise would still be not to use them at all and to refactor the code so that is more readable using extract as method.</p>
3,629
<p>Are there any successor products on DOS, Windows or Linux?</p>
<p>There are quite a few Clipper compilers available: <a href="http://www.harbour-project.org/" rel="noreferrer">Harbour</a>, <a href="http://www.itk.ru/english/index.shtml" rel="noreferrer">CLIP</a>, and <a href="http://www.xharbour.org/" rel="noreferrer">xHarbour</a>, to name a few of the free ones.</p>
<p><a href="http://www.cavo.com/" rel="nofollow noreferrer">CA Visual Objects</a> (VO) is the official successor, however don't expect to just recompile your Clipper 5.3 app into VO. All of the screen interface code will need to be rewritten for a new UI.</p>
39,920
<p>Some databases support commands such as:</p> <pre><code>SELECT TOP 10 START AT 10 * FROM &lt;TABLE&gt; </code></pre> <p>Essentially I need to pull the first 10 records, then the next 10, then the next 10 etc. Maybe there is another way to do this but in the past I've done it like the above for databases that supp...
<p>Which version of SQL Server?</p> <p>In SQL Server 2000 this is a real pain (though possible using ugly tricks like that posted by stingyjack). </p> <p>In 2005 and later it's a little easier- look at the <a href="http://msdn.microsoft.com/en-us/library/ms186734.aspx" rel="nofollow noreferrer">Row_Number()</a> func...
<pre><code>SELECT Top 10 * FROM Table WHERE &lt;primary key&gt; Not IN ( SELECT Top 10 &lt;primaryKey&gt; FROM Table ORDER BY &lt;primary Key&gt; ASC) ORDER BY &lt;primary Key&gt; ASC </code></pre>
36,141
<p>In WPF you can setup validation based on errors thrown in your Data Layer during Data Binding using the <code>ExceptionValidationRule</code> or <code>DataErrorValidationRule</code>.</p> <p>Suppose you had a bunch of controls set up this way and you had a Save button. When the user clicks the Save button, you need ...
<p>This post was extremely helpful. Thanks to all who contributed. Here is a LINQ version that you will either love or hate.</p> <pre><code>private void CanExecute(object sender, CanExecuteRoutedEventArgs e) { e.CanExecute = IsValid(sender as DependencyObject); } private bool IsValid(DependencyObject obj) { /...
<p>You can iterate over all your controls tree recursively and check the attached property Validation.HasErrorProperty, then focus on the first one you find in it.</p> <p>you can also use many already-written solutions you can check <a href="http://social.msdn.microsoft.com/Forums/en-US/wpf/thread/e7a0ae3b-75f3-4090-8...
15,513
<p>If you had read my other <a href="https://stackoverflow.com/questions/111700/6502-cpu-emulation">question</a>, you'll know I've spent this weekend putting together a 6502 CPU emulator as a programming exercise.</p> <p>The CPU emulator is mostly complete, and seems to be fairly accurate from my limited testing, howe...
<p>I wrote a Z80 emulator many years ago, and to do cycle accurate execution, I divided the clock rate into a number of small blocks and had the core execute that many clock cycles. In my case, I tied it to the frame rate of the game system I was emulating. Each opcode knew how many cycles it took to execute and the co...
<p>Another option is available if audio emulation is implemented, and if audio output is tied to the system/CPU clock. In particular I know that this is the case with the 8-bit Apple ][ computers.</p> <p>Usually sound is generated in buffers of a fixed size (which is a fixed time), so operation (generation of data etc...
13,751
<p>I am looking out for a good open source Reporting tool/framework for windows based application (WPF). </p> <p>The database I am using is sql server 2005.</p> <p>The typical reports format which I am interested is for e.g. Trial balance, balance sheet, etc (typical banking / finance reporting application).</p> <...
<p>Since this may form part of the answer, I thought of putting this in the answer section. I just found this series of article <a href="https://web.archive.org/web/20121214141444/http://janrep.blog.codeplant.net/post/WPF-Multipage-Reports-Part-I.aspx" rel="nofollow noreferrer">WPF multipage reports</a> <strong>(note: ...
<p>As open source, this doesn't exist, at least not yet. It probably doesn't exist commerical offering either. The WPF component market is just getting started.</p>
47,448
<p>I am trying to get the yasnippet and pabbrev packages working together with emacs, but I cannot seem to get any love. How can I get them to play nicely together?</p> <p>The crux of the problem is that pabbrev and yasnippet are binding to the tab keys. Both packages seem to do this fallback when a match isn't foun...
<p>Have a look at <a href="http://www.emacswiki.org/cgi-bin/wiki/tabkey2.el" rel="nofollow noreferrer">tabkey2.el</a>. It looks like it addresses the problem you're having.</p>
<p>I use <a href="http://www.emacswiki.org/emacs/hippie-exp-ext.el" rel="nofollow noreferrer">hippie-expand</a> to manage tab expansion packages.</p> <p>The following code will try each package in order to expand your tab key press:</p> <pre><code>(require 'hippie-exp) (setq hippie-expand-try-functions-list '...
18,270
<p>Everyone I work with is obsessed with the data-centric approach to enterprise development and hates the idea of using custom collections/objects. What is the best way to convince them otherwise?</p>
<p>Do it by example and tread lightly. Anything stronger will just alienate you from the rest of the team.</p> <p>Remember to consider the possibility that they're onto something you've missed. Being part of a team means taking turns learning &amp; teaching.</p> <p>No single person has all the answers.</p>
<p>There is already some very good advice here but you'll still have a job to convince your colleagues if all you have to back you up is a few supportive comments on stackoverflow. And, if they are as sceptical as they sound, you are going to need more ammo. First, get a copy of Martin Fowler's "Patterns of Enterprise ...
5,804
<p>I'm failing at finding the commands I need to send to authenticate to a SMTP server using NTLM. </p> <p>I think it goes something like:</p> <pre><code>AUTH NTLM &lt;bae64encode something&gt; 334 &lt;bae64encode something&gt; 235 </code></pre>
<p>SVN with Siteminder has been implemented and is working now. Since there is not much of information out there on this, I would like to post the overview of steps followed:</p> <ol> <li>Cookie based authentcation was disabled on Siteminder end</li> <li>HTTP AUTH was enabled (in Siteminder) and all webdav methods wer...
<p>Look for information about <strong>Apache</strong> and Siteminder as Apache is responsible for the HTTP transport stuff in Subversion</p>
9,937
<p>I have a silverlight 2 app that has an ObservableCollection of a class from a separate assem/lib. When I set my ListBox.ItemsSource on that collection, and run it, I get the error code:</p> <blockquote> <p>4004 &quot;System.ArgumentException: Value does not fall within the expected range.&quot;</p> </blockquote> <p>...
<p>Are you trying to use a standard class library or a "Silverlight Class Library"?</p> <p>Because Silverlight 2 uses a subset of the CLR it cannot access standard class libraries that were compiled using the full CLR. To use an external assembly you must create it as a "Silverlight Class Library". This will create ...
<p>It may be because you're not handling a failure in SubmittedChanges(). See <a href="http://www.scottleckie.com/2010/04/code-4004-unhandled-error-in-silverlight-application/" rel="nofollow noreferrer">http://www.scottleckie.com/2010/04/code-4004-unhandled-error-in-silverlight-application/</a> for more info</p>
47,177
<p>I'm trying to set up <a href="http://octoprint.org/" rel="nofollow noreferrer">OctoPrint</a> on my Linux Ubuntu 16.04 desktop to work with my Micro3D printer. The printer works fine on Mac and Windows: <a href="https://i.stack.imgur.com/Kmil9.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Kmil9.p...
<p>I just discovered that OctoPrint only reads .gcode files for printing (apparently, unless you have a slicing software embedded in it), so I installed <a href="http://slic3r.org/download" rel="nofollow">Slic3r</a> separately, and ran</p> <pre><code>./slic3r mystlfile.stl </code></pre> <p>to generate a .gcode file (...
<p>For me it sounds like you've missed to install the CuraEngine for slicing, but I'm only guessing, as I'm not using OctoPrint at all.</p> <p>Instead I'm using Cura directly and save gcode to a SD or use USB printing for quick/small prints.</p> <p>Regrads ;)</p>
281
<p>Is the documentation for Rich Edit Controls really as bad (wrong?) as it seems to be? Right now I'm manually calling LoadLibrary("riched20.dll") in order to get a Rich Edit Control to show up. The documentation for Rich Edit poorly demonstrates this in the first code sample for using Rich Edit controls.</p> <p>It...
<p>Using MFC, RichEdit controls just work.</p> <p>Loading with InitCommonControlsEx() - ICC_USEREX_CLASSES doesn't load RichEdit AFAIK, you don't need it as it only does the 'standard' common controls, which don't include richedit. Apparently you only need to call this to enable 'visual styles' in Windows, not to get ...
<p>I think you have to call CoInitializeEx before you create any of the common controls.</p> <p>The LoadLibrary is not needed. If you link with the correct .lib file the exe-loader will take care of such details for you. </p>
11,096
<p>Why should I do <strong>Nightly Builds?</strong></p>
<p>You should do nightly builds to ensure that your codebase stays healthy.</p> <p>A side effect of doing nightly builds is that it forces the team to create and maintain a fully automated build script. This helps to ensure that your build process is documented and repeatable.</p> <p>Automated builds are good at fin...
<p>Nightly builds aren't always necessary - I think they're only really useful on big projects. But if you're on a big project, a nightly build is a good way of checking that everything is working - you can run all your tests (unit tests, integration tests), build all your code - in short, verify that nothing is broken...
25,048
<p>Sometimes you're developing and you decide to commit, forgetting you created a few files on your project. Then a few days down the line your buddy gets your build out of Subversion and complains that some files appear to be missing. You realize, ah crap, I forgot to add those files!</p> <p>How can I get a list of t...
<p>Use the <a href="http://svnbook.red-bean.com/en/1.0/re26.html" rel="noreferrer"><code>svn status</code></a> command:</p> <pre><code>svn status | grep ^? </code></pre> <p>Files that are not versioned are indicated with a ? at the start of the line.</p> <p>If you find that you always have some specific files that s...
<p>You can use this command to list all paths for not-versioned files:</p> <pre><code>svn status | awk '/^?/ {print $2}' </code></pre> <p>The first part will do an <code>svn status</code>, and then it will redirect the output to <a href="http://en.wikipedia.org/wiki/AWK" rel="nofollow noreferrer">AWK</a> which will d...
26,559
<p>If I have the string <code>.....ZZ..ZZ.....</code> or <code>.Z.1.Z.23Z.4.Z55</code>,</p> <p>Is there an easy way of shifting all <code>Z</code>characters in the string one space right of the current position?</p> <p>Some additional test strings are:</p> <ul> <li><code>.Z</code></li> <li><code>Z.</code></li> <li><...
<p>Just iterate through the text and swap characters:</p> <pre><code>int main () { char text[] = "...Z.Z.Z...", temp; int text_len = strlen (text), i; for (i = text_len - 1; i &gt;= 0; i--) { if (text[i] == 'Z') { temp = text[i+1]; text[i+1] = text[i]; ...
<p>Slight fix to the previous answer (shift to the right and assume '.' means "can move here"):</p> <pre><code> char text[] = "...Z.Z.Z..."; for (int i = strlen(text) - 2); i &gt; 0; --i) { if (text[i] == 'Z' &amp;&amp; text[i + 1] == '.') { text[i] = '.'; text[i + 1] = 'Z'; } } </code></pre>...
27,201
<p>Pretty new to css and trying to make the tags on my page smaller on all sides. What are the best settings to modify? Margin doesn't seem to do what I want.</p> <pre><code>.story .content .tags .tag { margin: 10px 5px 10px 5px; background-color: #99FF33; font-weight: 500; color: #330099; font-sty...
<p>This entirely depends on what you are trying to style. Is it a text component like paragraph? A Div?</p> <p>You can use width and height on a div.</p> <pre><code> width:200px; height:20px; </code></pre> <p>etc.</p> <p>But we need some html to recommend meaningful solutions.</p>
<p>I think you're looking for padding. My guess is that you're looking to decrease the space between the edge of the text and where the background colour stops filling (basically) and where the border starts, and changing the padding will give the effect you want.</p> <p>If you want to decrease the font size, look in...
40,366
<p>I believe any programmer who has been dealing with database requests in a gui application has run into some or all of the following problems:</p> <ul> <li>Your GUI freezes because you call database layer from within the event dispatch thread</li> <li>When you have multiple windows/panels/jframes where user can star...
<p>Such a thing should be found in Netbeans for example. See RequestProcessor. But in simpler cases this is not required. Last time I need something like thread scheduling and control I simply used new concurrency packages included in J5 (I used J6). With its ExecutorFactory-ies you can simply achieve basic control ove...
<p>I doubt you will find something specific for database requests. You can try to reuse existing generic task scheduling libraries. An example is the Eclipse jobs API. This does not depend on the IDE.</p> <p>See <a href="http://www.eclipse.org/articles/Article-Concurrency/jobs-api.html" rel="nofollow noreferrer">http:...
17,311
<p>I have a problem wih a logging setup in a apring webapp deployed under tomcat 6.</p> <p>The webapp uses the commons-logging api, on runtime log4j should be used. The log file is created but remains empty - no log entries occur.</p> <p>the setup is the following:</p> <p>WEB-INF/web.xml:</p> <pre><code> &lt;contex...
<p>There are numerous documented instances on the web warning people about the use of commons-logging. So much so, that <a href="http://www.slf4j.org/" rel="nofollow noreferrer">SLF4J</a> is gaining a lot of popularity.</p> <p>Considering that you are not interested in using Tomcat with Log4j, you should just use Log...
<p>May be i am wrong. Please try the following:</p> <p> A) Add appender to my.package as: <b>OR</b> B) Reduce the log leve of root to INFO </p>
26,793
<p>With the JavaFX 1.0 release I am trying to layout some SwingButton instances in a HBox such that they are aligned to the right. A lot of the tutorials on the net (admittedly pre 1.0 release) talk about layout classes (FlowPanel et. al) which dont seem to be in this release. Whats the simplest way to achieve this see...
<p>Copying and pasting from the MS-DOS <code>tree</code> command might also work for you. Examples: </p> <p><strong>tree</strong></p> <pre><code>C:\Foobar&gt;tree C:. ├───FooScripts ├───barconfig ├───Baz │ ├───BadBaz │ └───Drop ... </code></pre> <p><strong>tree /F</strong></p> <pre><code>C:\Foobar&gt;tree C:. ├...
<p>The advice to use Graphviz is good: you can generate the dot file and it will do the hard work of measuring strings, doing the layout, etc. Plus it can output the graphs in lot of formats, including vector ones.</p> <p>I found a Perl program doing precisely that, in a mailing list, but I just can't find it back! I ...
45,227
<p>What is the best way to interop with NHibernate 2.0 and ASP.NET 3.5? How can I easily develop a CRUD application?</p> <p>Is the ObjectDataSource the way to go?</p> <p>Thank you.</p>
<p>you can watch screencasts at <a href="http://www.summerofnhibernate.com/" rel="nofollow noreferrer">http://www.summerofnhibernate.com/</a> that will explain how to set up CRUD, and will shed some light on more advanced topics</p>
<p>you can watch screencasts at <a href="http://www.summerofnhibernate.com/" rel="nofollow noreferrer">http://www.summerofnhibernate.com/</a> that will explain how to set up CRUD, and will shed some light on more advanced topics</p>
45,203
<p>I have a simple little test app written in Flex 3 (MXML and some AS3). I can compile it to a SWF just fine, but I'd like to make it into an EXE so I can give it to a couple of my coworkers who might find it useful.</p> <p>With Flash 8, I could just target an EXE instead of a SWF and it would wrap the SWF in a proj...
<p>In your Flex SDK folders you should see a 'runtimes\player\win\FlashPlayer.exe' which is a stand alone Flash player. Open your SWF with that and you'll see a 'Create Projector...' menu item in the File menu which will create the stand-alone EXE.</p>
<p>There's also <a href="http://www.multidmedia.com/software/zinc/" rel="nofollow noreferrer">Zinc</a> that also provides API:s for accessing the filesystem and other thinks that AIR does, but less restrictive.</p>
4,333
<p>I have over a million text files compressed into 40 zip files. I also have a list of about 500 model names of phones. I want to find out the number of times a particular model was mentioned in the text files. </p> <p>Is there any python module which can do a regex match on the files without unzipping it. Is there a...
<p>There's nothing that will automatically do what you want.</p> <p>However, there is a python zipfile module that will make this easy to do. Here's how to iterate over the lines in the file.</p> <pre><code>#!/usr/bin/python import zipfile f = zipfile.ZipFile('myfile.zip') for subfile in f.namelist(): print su...
<p>You could loop through the zip files, reading individual files using the zipfile module and running your regex on those, eliminating to unzip all the files at once. </p> <p>I'm fairly certain that you can't run a regex over the zipped data, at least not meaningfully.</p>
3,505
<p>What steps do I take? Any gotchas to be aware of or tips to enhance the IDE experience that are specific to SQL Server when using Emacs?</p>
<p><strong>Connecting</strong></p> <p>To connect to a SQL Server database instance from Emacs:</p> <pre><code>M-x sql-ms RET M-x sql-mode </code></pre> <p>You will be prompted for standard connection information specifically the following: </p> <ul> <li>User </li> <li>Password</li> <li>Server</li> <li>Database...
<p>Also, see here:</p> <p><a href="https://github.com/kiwanami/emacs-edbi" rel="nofollow">https://github.com/kiwanami/emacs-edbi</a></p> <p>This way i just use odbc to connect to everything through DBD::ODBC. </p>
38,375
<p>I am converting an old Makerbot Replicator 2 to Marlin Firmware and everything works. The printer heats up, auto bed levels, and starts the print. However, after a couple minutes (usually after the 1st or 2nd layer), the printer crashes and stops. It does not continue printing and I have to restart it again. It cras...
<p>I see a couple likely culprits for a hardcrash like this</p> <ul> <li>problems with the power supply. If the power supply does not provide enough voltage an/or current to the board, this can lead to a lockup of the board.</li> <li>temperature issues of the board. If the board overheats, it could fail to execute prop...
<p>Few things to try,</p> <p><strong>Check G-Code</strong> - Verify that the slicer is not the problem, slice using some other program / make a new default profile and re-slice.</p> <p><strong>3D File</strong> - Also In parallel with the above point, I would get a standard test cube STL to start with. This will be a si...
1,714
<p>The project I'm working on uses a window.onerror event handler to report user problems. I've noticed a single user that just cannot seem to load the Google Analytics script. Our site doesn't see a lot of traffic so I'm not sure how widespread this is, but so far it seems to just effect one user. </p> <p>His user...
<p>This problem occurs when leaving a page in Firefox before all scripts have finished loading. So I assume that it is safe to ignore the error.</p> <p>You don't see this error in the Firefox error console, but you can make it visible by binding an alert to the window.onerror event. Then you will be able to see the al...
<p>I'm sure this is long resolved.. but to anyone who stumbles across this page: this error is triggered by firefox when an external script fails to load (it's easy to find the code that triggers this in the source code). We were catching these errors on our site and it turned out that we were returning 404s for the sc...
23,398
<p>How can I unset variable? For example, PHP has an <code>unset($var)</code> function.</p>
<p>There is not really an equivalent to "unset".</p> <p>The closest match I know is the use of the <a href="http://msdn.microsoft.com/en-us/library/xwth0h0d(VS.80).aspx" rel="noreferrer">default</a> keyword.</p> <p>For example:</p> <pre><code>MyType myvar = default(MyType); string a = default(string); </code></pre> ...
<p>personally I just go</p> <p><strong>variable = Nothing</strong></p> <p>that seems to free up the resources especially when working with mobile phones!</p>
24,002
<p>PowerShell is definitely in the category of dynamic languages, but would it be considered strongly typed? </p>
<p>There is a certain amount of confusion around the terminlogy. <a href="http://eli.thegreenplace.net/2006/11/25/a-taxonomy-of-typing-systems/" rel="noreferrer">This article</a> explains a useful taxonomy of type systems.</p> <p>PowerShell is dynamically, implicit typed:</p> <pre><code>&gt; $x=100 &gt; $x=dir </code...
<p>I retract my previous answer -- quoted below. I should have said something more nuanced like:</p> <p><strong>PowerShell has a strong type system with robust type inference and is dynamically typed.</strong></p> <p>It seems to me that there are several issues at work here, so the answers asking for a better definit...
14,092