instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I develop rich client software on Mac OS X and Linux. I wish to port an application to Windows and not being a user of Microsoft products, I'm not very familiar with Windows in general.</p> <p>What I'm familiar with:</p> <p>On Mac OS X, I have the option of Cocoa and Objective C or Carbon and C/C++. On Linux, I ha...
<p>If you can get your C++ to compile with the Visual Studio toolchain (rather than gcc or mingw), I would very much recommend that you make a .lib and then link it into a C++/CLI assembly where you expose a managed API to your library.</p> <p>Then you can use C# and WinForms API or WPF and have an extremely rich and ...
<p>I'm leaning towards the Windows Presentation Foundation. I suppose it's Microsoft's answer to Cocoa on Mac OS X insofar as "it aims to unify a number of application services: user interface, 2D and 3D drawing, fixed and adaptive documents, advanced typography, vector graphics, raster graphics, animation, data bindin...
36,043
<p>Is it possible to get gdb or use some other tools to create a core dump of a running process and it's symbol table? It would be great if there's a way to do this without terminating the process. </p> <p>If this is possible, what commands would you use? (I'm trying to do this on a Linux box)</p>
<pre> $ gdb --pid=26426 (gdb) gcore Saved corefile core.26426 (gdb) detach </pre>
<p>You can used <code>generate-core-file</code> command in gdb to generate core dump of running process.</p>
9,367
<p>We are trying to build a Crystal Report that sends control characters directly to the printer, without going through the (buggy) Windows driver for that printer. Does anyone know a way to do this from within a Crystal Report? </p> <p>The specific control character we are trying to send is CHR(2). However when we pu...
<p>If you need more than looking at extension, one way would be to read the JPEG header, and check that it matches valid data. The format for this is:</p> <pre><code>Start Marker | JFIF Marker | Header Length | Identifier 0xff, 0xd8 | 0xff, 0xe0 | 2-bytes | "JFIF\0" </code></pre> <p>so a quick recogniser ...
<p>Use <a href="http://www.pythonware.com/products/pil/" rel="nofollow noreferrer">PIL</a>. If it can open the file, it's an image.</p> <p>From the tutorial...</p> <pre><code>&gt;&gt;&gt; import Image &gt;&gt;&gt; im = Image.open("lena.ppm") &gt;&gt;&gt; print im.format, im.size, im.mode </code></pre>
33,429
<p>I am starting to learn the <a href="http://en.wikipedia.org/wiki/Clojure" rel="noreferrer">Clojure</a> programming language. Are there any recommendations for Clojure editors/IDEs on Mac OS X?</p> <p><strong>Update 2009-09-23</strong>: The Clojure space has changed tremendously since I originally posted this questi...
<p>You can try <a href="http://netbeans.org" rel="nofollow noreferrer">NetBeans</a> with <a href="http://enclojure.wikispaces.com" rel="nofollow noreferrer">Enclojure</a>.</p>
<p>I use Clojure on MacOSX for about 3 months. I am very happy with Emacs and use it for more an more tasks. The start was quite hard but now i would say it was worth the efforts to learn emacs. For IntelliJ 10 the La Clojure Plugin has been updated so that it should work now with Clojure 1.2.0 again.</p>
32,109
<p>I am trying to print a fairly simple object yet I keep getting the same issue.</p> <p>As you can see in the picture the print quality is bad with all the blobs on the vertical part of the print.</p> <p>I have leveled the bed many times and I keep getting this issue. I have also calibrated the E-steps. I have replace...
<ol> <li><p>Print the same file, with the same settings, on both machines.</p> </li> <li><p>If the problem persists, try swapping the filament between the two printers. If the problem now occurs on the other printer, that suggests that the filament is the issue. Label the bad one &quot;For lumpy prints&quot; and put it...
<p>Maybe it's only about the slicer settings, it's over extruding problem. I recommend lowering the extrusion multiplier.</p>
1,898
<p>I'm trying to setup a stress/load test using the WCAT toolkit included in the IIS Resources.</p> <p>Using LogParser, I've processed a UBR file with configuration. It looks something like this:</p> <pre><code> [Configuration] NumClientMachines: 1 # number of distinct client machines to use NumClientThrea...
<p>I'd look at updating to WCat 6.3 - available <a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;i=1466&amp;g=6" rel="nofollow noreferrer">here for x86</a> and <a href="http://www.iis.net/downloads/default.aspx?tabid=34&amp;i=1467&amp;g=6" rel="nofollow noreferrer">here for x64</a></p> <p>They've change...
<p>I don't have an answer for you, but have you considered using other tools for your testing? The WCAT tools seems pretty limited and complicated to use.</p> <p>OpenSTA and JMeter are good open source tools for load/stress/performance testing.</p>
14,007
<p>I'm playing around at the start of a personal project in C# and MySQL.</p> <p>I am familiar with the use of the Gentle Framework (using MyGeneration to generate the classes, based on the data model). Here's what I like about Gentle; </p> <ul> <li>Simple-to-use [class].Retrieve(id) / [object].Persist() semantics w...
<p>I had some experience with Gentle and I do have to admit that it was pretty inefficient with queries. I would suggest looking into NHibernate, since it has a rich community. It is true that XML definitions are preferred, but there are ways of doing the mappings using class-level attributes.</p> <p>SubSonic (especia...
<p>Thanks to both Filip and Snorkpete for your suggestions - your comments and links proved helpful.</p> <p>I will probably try SubSonic first; it looks like something I will understand and be able to get going with quickly (today should answer that), and I was surprised to see that it is indirectly supported by MS as...
37,389
<p>Is it possible to delete rows in an excel worksheet from SSIS?</p>
<p>From <a href="http://www.sqlservercentral.com/Forums/Topic328124-148-1.aspx" rel="nofollow noreferrer">forum</a></p> <ol> <li>create a file system task in control flow, deleting the file.</li> <li>create a sql task, excel connection type, i used my previous excel connection for this, then used a create table script...
<p>An arctile by microsoft claims that you cannot delete an entire row however you can delete a value in a cell. <a href="http://support.microsoft.com/kb/257819" rel="nofollow noreferrer">http://support.microsoft.com/kb/257819</a></p> <p>This thread relates to someone with the same problem: <a href="http://www.tech-ar...
30,272
<p>Ok, so I keep seeing how VS2008 has this nice unit test display and I can see people running NUnit tests within it on Dimecasts.net and <a href="http://weblogs.asp.net/astopford/archive/2008/07/03/mbunit-v3-in-visual-studio-team-system-2008.aspx" rel="nofollow noreferrer">this article</a> seems to imply that MbUnit ...
<p>I had to install Gallio 3.0.5 or better from <a href="http://www.gallio.org" rel="nofollow noreferrer">http://www.gallio.org</a>. It automatically installed in Visual Studio Professional or Team Editions. Note: VS Standard doesn't support test projects. After installing Gallio, you can create MbUnit test projects...
<p>Try using MbUnit v3 alpha 3 (if you aren't already), and see if this article helps:</p> <p><a href="http://weblogs.asp.net/astopford/archive/2008/07/03/mbunit-v3-in-visual-studio-team-system-2008.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/astopford/archive/2008/07/03/mbunit-v3-in-visual-studio-team-syst...
48,664
<p>I was given one big JPG of the HTML interface. Now I need to break it down into pieces and assemble them with html table. Without a slicer it's pretty arduous and error prone. I do not have photoshop or firework, does anybody know of any free utilities that I can use?</p>
<p>I guess you could do it with <a href="http://www.websiterepairguy.com/ebooks/gimp/How_Slice_Image.html" rel="noreferrer">GIMP</a>. It is free and <a href="http://www.gimp.org/source/" rel="noreferrer">opensource</a>. </p>
<p>Here is a crazy or possibly not crazy sounding idea that I have never seen anyone put forth before. I have not tried it but I think it would work pretty well in many cases.</p> <ol> <li><p>Cut the image up into pieces using a "paint" program like Microsoft Paint, GIMP, Apple Preview (with command-option-shift-4 an...
24,201
<p>I have pretty much finished my first working Symbian application, but in my hastened learning have paid little attention to memory management and pushing to and cleaning up the stack?</p> <p>Could somebody please point me in the direction of some of the best practises to use here, and maybe some of the best leak de...
<p>I have in the past used <a href="http://www.newlc.com/Hooklogger-Tracking-leaked-heap.html" rel="nofollow noreferrer">HookLogger from Symbian</a> to trace and investigate memory leaks. It is not the best, but it sure does help. Also, the heap markers raise ALLOC panics in case of memory leaks whenever your exit your...
<p>It takes a little under 10 pages to properly exmplain all you need to know about the CleanupStack and Memory management for Symbian C++.</p> <p>Shameless plug : this book was written specifically for your level of n00bness: <a href="http://www.quickrecipesonsymbianos.com" rel="nofollow noreferrer">http://www.quickr...
43,690
<p>I just want an ASP.NET DropDownList with no selected item. Setting SelectedIndex to -1 is of no avail, so far. I am using Framework 3.5 with AJAX, i.e. this DropDownList is within an UpdatePanel. Here is what I am doing:</p> <pre><code> protected void Page_Load (object sender, EventArgs e) { this.myD...
<p>Bare in mind myDropDownList.Items.Add will add a new Listitem element at the bottom if you call it after performing a DataSource/DataBind call so use myDropDownList.Items.Insert method instead eg...</p> <pre><code>myDropDownList.DataSource = DataAccess.GetDropDownItems(); // Psuedo Code myDropDownList.DataTextField...
<p>Please try below syntax:</p> <pre><code>DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByValue("Select")) </code></pre> <p>or</p> <pre><code>DropDownList1.SelectedIndex = DropDownList1.Items.IndexOf(DropDownList1.Items.FindByText("SelectText")) </code></pre> <p>or </p> <pre><c...
10,680
<p>I've got a 'task list' database that uses the adjacency list model (see below) so each 'task' can have unlimited sub-tasks. The table has an 'TaskOrder' column so everything renders in the correct order on a treeview.</p> <p>Is there an SQL statement (MS-SQL 2005) that will select all the child nodes for a specifie...
<p>If you're only using TaskOrder for sorting, it would certainly be simpler to simply leave the holes in TaskOrder, because simply deleting items won't make the sorting incorrect. But then I'm not sure about your application's needs.</p>
<p>Not directly. This is a <a href="http://en.wikipedia.org/wiki/Topological_sorting" rel="nofollow noreferrer">Topological Sort</a> where you are 'hanging' the child nodes off a parent. If there is no dependency within the children the order that they are executed does not matter. If the children must be executed i...
18,035
<p>I am using CodeDom to generate dynamic code based on user values. One of those values controls what the name of the class I'm generating is. I know I could sterilize the name based on language rules about valid class names using regular expressions, but I'd like to know if there is a specific method built into the f...
<p>An easy way to determine if a string is a valid identifier for a class or variable is to call the static method </p> <pre><code>System.CodeDom.Compiler.CodeGenerator.IsValidLanguageIndependentIdentifier(string value) </code></pre>
<pre><code>public static bool IsReservedKeyWord(string identifier) { Microsoft.CSharp.CSharpCodeProvider csharpProvider = new Microsoft.CSharp.CSharpCodeProvider(); return csharpProvider.IsValidIdentifier(identifier); } </code></pre>
11,833
<p>In 64 bit versions of windows, 32 bit software is installed in "c:\program files (x86)". This means you cannot use $(programfiles) to get the path to (32 bit) software. So I need a $(ProgramFiles32) to overcome this in my MSBuild project. I don't want to change the project depending on the os it is running on.</p> ...
<p>In MSBuild 4.0+, there's <a href="http://msdn.microsoft.com/en-us/library/ms164309.aspx" rel="noreferrer">a <code>$(MSBuildProgramFiles32)</code> property</a> for it, which you can confidently employ directly (especially if you're prepared to put a <code>ToolsVersion="4.0"</code> at the top of the file to guarantee ...
<p>I stumbled across this question trying to find a generic way in MSbuild to see if it was a 32- or 64-bit os. In case someone else also find this, I used the following:</p> <pre><code>&lt;PropertyGroup&gt; &lt;OSBits Condition="$(ProgramW6432) != ''"&gt;x64&lt;/OSBits&gt; &lt;OSBits Condition="$(OSBits) == ''"&g...
45,047
<p>I am building an application where a page will load user controls (x.ascx) dynamically based on query string. </p> <p>I have a validation summary on the page and want to update it from the User Controls. This will allow me to have multiple controls using one Validation Summary. How can I pass data between controls ...
<p><b>Found a way of doing this:</b></p> <p>Step 1: Create a Base User Control and define Delegates and Events in this control.</p> <p>Step 2: Create a Public function in the base user control to Raise Events defined in Step1.</p> <pre> 'SourceCode for Step 1 and Step 2 Public Delegate Sub UpdatePageHeaderHandler(By...
<p>Assuming you're talking about asp's validator controls, making them work with the validation summary should be easy: use the same Validation Group. Normally, I derive all usercontrols from a base class that adds a ValidationGroup property whose setter calls a overriden method that changes all internal validators to ...
15,852
<p>I am writing an .NET wrapper API for the Netflix API.</p> <p>At this point I can choose to represent URLs as either strings or URI objects. Seems to me there is a good case for both.</p> <p>So if you were using an API, which would you prefer?</p>
<p>The below quote is from: <a href="https://rads.stackoverflow.com/amzn/click/com/0321246756" rel="noreferrer" rel="nofollow noreferrer">Framework Design Guildelines</a> <br> I <strong>highly</strong> recommend this book to anyone developing frameworks on .Net</p> <blockquote> <p><strong>Do use</strong> System.Uri ...
<p>One thing I found was that while writing <code>string</code>-accepting methods, I'd always have to initialize a <code>Uri</code> object anyway just to validate the string, such that the <code>UriFormatException</code> would then propagate out of the method if the user passed a bad string. But if you accept <code>Uri...
26,398
<p>I'm running WAMP v2.0 on WindowsXP and I've got a bunch of virtual hosts setup in the http-vhosts.conf file.</p> <p>This was working, but in the last week whenever I try &amp; start WAMP I get this error in the event logs:</p> <blockquote> <p>VirtualHost *:80 -- mixing * ports and non-* ports with a NameVirtua...
<blockquote> <p>NameVirtualHost *:80</p> <p>I get this error:</p> <p>Only one usage of each socket address (protocol/network address/port) is normally >permitted. : make_sock: could not bind to address 0.0.0.0:80</p> </blockquote> <p>I think this might be because you have somthing else listening to port 80...
<p>Well, it seems the problem there is the way (and order) in which you assign the ports. </p> <p>Basically, *:80 means "use port 80 for all hosts in this configuration". When you do this, Apache tries to bind that host to 0.0.0.0:80, which means that host will receive every single packet coming to the machine through...
6,003
<p>I have one table that saves comments for a varied set of content types. These are saved in other tables (news, articles, users). I wonder what's the best way to connect these tables? In previous projects I used a second table for each kind of content. They held the id of the certain content mapped to ids of the com...
<p>There are a few obvious ways to design your table:</p> <p>1) You can have a master Comments table, and intermediate tables to connect each comment to your Articles, News, and Users tables:</p> <pre>Comments -------- ID News NewsComments ---- ------------ ID NewsID CommentID Articles A...
<p>Your question seems to be similar to </p> <p><a href="https://stackoverflow.com/questions/298319/how-do-i-relate-one-table-to-many-different-tables">How do I relate one table to many different tables?</a></p>
42,531
<p>After moving to .NET 2.0+ is there ever a reason to still use the systems.Collections namespace (besides maintaining legacy code)? Should the generics namespace always be used instead?</p>
<p>For the most part, the generic collections will perform faster than the non-generic counterpart and give you the benefit of having a strongly-typed collection. Comparing the collections available in System.Collections and System.Collections.Generic, you get the following "migration":</p> <pre> Non-Generic ...
<p>In some circumstances the generic containers perform better than the old ones. They should at least perform as well as the old ones in all circumstances. And they help to catch programming errors. It's a rare combination of a more helpful abstraction and better performance, so there isn't much of a reason to avoid t...
42,598
<p>Here is the problem I have:</p> <p>I have a lot (tens of thousands) of mp3 files that my users would like to be able to search. Is there is software out there that you've used or heard good things about that would allow me to index that content and put it in a database so I can search on it later?</p>
<p>I've heard very good reviews of <a href="http://www.nuance.co.uk/naturallyspeaking/" rel="nofollow noreferrer" title="Dragon Naturally Speaking">Dragon Naturally Speaking</a>, by Nuance. They offer a <a href="http://www.nuance.com/naturallyspeaking/products/sdk.asp" rel="nofollow noreferrer">software development kit...
<p>I've heard very good reviews of <a href="http://www.nuance.co.uk/naturallyspeaking/" rel="nofollow noreferrer" title="Dragon Naturally Speaking">Dragon Naturally Speaking</a>, by Nuance. They offer a <a href="http://www.nuance.com/naturallyspeaking/products/sdk.asp" rel="nofollow noreferrer">software development kit...
9,799
<p>I am considering Smarty as my web app templating solution, and I am now concerned with its performance against plain PHP. </p> <p>The Smarty site says it should be the same, however, I was not able to find anyone doing real benchmarking to prove the statement right or wrong.</p> <p>Did anyone do some benchmarking ...
<p>Because in the end, Smarty compiles and caches the templates files to native PHP-code, there is indeed no theoretical performance difference. Of course there will always be some performance loss due to the chunk of Smarty-code that needs to be interpreted every time.</p>
<p>There is <a href="http://templatelite.sourceforge.net/" rel="nofollow noreferrer">a drop in replacement for Smarty called Template Lite</a> which is much more lightweight in respect to the library file size. That said, I have used the original Smarty in some extremely high load situations without needing to swap in ...
47,646
<p>Does anyone have any strategies/tips/traps for moving to Team System? Should it be done in baby steps, or all at once? Should we migrate our SourceSafe library over, or draw a line in the sand and move forward? Is it worth brining SharePoint into the mix? Any thoughts are appreciated.</p>
<p>I've never had to migrate to TFS, but have used it pretty extensively for the past couple of years.</p> <p>Regarding your question on Sharepoint, we've found it pretty useful in conjunction with TFS. We use it primarily for documentation management and for storing other "non-technical" artifacts related to the proj...
<p>It may just be too much work to do it all at once. I feel that it is easier to divvy out projects to different people one at a time. That way they can move them across and ensure that each works okay before closing out the SourceSafe.</p> <p>You will always want a backup of the SourceSafe "database" around just in...
33,924
<p>I have a list of stores, departments within the stores, and sales for each department, like so (created using max(sales) in a subquery, but that's not terribly important here I don't think):</p> <pre><code>toronto baskets 500 vancouver baskets 350 halifax baskets 100 toronto noodles 275 vancouver noodles...
<p>This works in Oracle, other implementations may have different syntax for analytic functions (or lack them entirely):</p> <pre><code>select store , max(department) keep(dense_rank last order by sales) , max(sales) from ( ...query that generates your results... ) group by store </code></p...
<p>Maybe this could work. Haven't tried it though, there could be a better solution...</p> <pre><code>select yourTable.store, dept, sales from yourTable join ( select store, max(sales) as maxSales from yourTable group by store ) tempTable on tempTable.store = yourTable.store and tempTable.maxSales = your...
32,546
<p>I've got a script that dynamically calls and displays images from a directory, what would be the best way to paginate this? I'd like to be able to control the number of images that are displayed per page through a variable within the script. I'm thinking of using URL varriables (ie - <a href="http://domain.com/pag...
<p>pagination is the same concept with or without sql. you just need your basic variables, then you can create the content you want. here's some quasi-code:</p> <pre><code>$itemsPerPage = 5; $currentPage = isset($_GET['page']) ? $_GET['page'] : 1; $totalItems = getTotalItems(); $totalPages = ceil($totalItems / $items...
<p>If you name your images 01.jpg, 02.jpg it makes it easier to paginate. Then use glob to get all the images into an array and sort it.</p>
25,389
<p>Most people say <em>never</em> throw an exception out of a destructor - doing so results in undefined behavior. Stroustrup makes the point that <em>"the vector destructor explicitly invokes the destructor for every element. This implies that if an element destructor throws, the vector destruction fails... There is r...
<p>Throwing an exception out of a destructor is dangerous.<br /> If another exception is already propagating the application will terminate.</p> <pre><code>#include &lt;iostream&gt; class Bad { public: // Added the noexcept(false) so the code keeps its original meaning. // Post C++11 destructors ar...
<p>I currently follow the policy (that so many are saying) that classes shouldn't actively throw exceptions from their destructors but should instead provide a public "close" method to perform the operation that could fail...</p> <p>...but I do believe destructors for container-type classes, like a vector, should not ...
15,801
<p>I have a user sign off report where it shows a users rights/access to the system which all fits nicely onto one page when I hit preview. However when I then go to print layout it shows me two pages with the second page only containg the footer. </p> <p>Any ideas please?</p>
<p>Are you sure the page size matches the paper size? </p> <p>If so, have you tried setting the page footer's PrintOnLastPage property to false? Then again, if you really need that footer to be there (seeing that there's only one page), you might have to try fiddling with the margins to get it to fit within the first ...
<p>Yes I have scrunched it all up so that it is WELL within the page size and I have tried all combinations of Footers (and headers).</p> <p>It is a slightly wierd report in that it has fields that need to grow to show all the information and a small table too, but even at full growth the data looks like it fits on on...
31,565
<p>I have double (or float) variables that might be "empty", as in holding no valid value. How can I represent this condition with the built in types float and double?</p> <p>One option would be a wrapper that has a float and a boolean, but that can´t work, as my libraries have containers that store doubles and not ob...
<p>In Visual C++, there is a non-standard <a href="http://msdn.microsoft.com/en-us/library/tzthab44.aspx" rel="noreferrer"><code>_isnan(double)</code></a> function that you can import through <code>float.h</code>.</p> <p>In C, there is a <a href="http://www.opengroup.org/onlinepubs/009695399/basedefs/math.h.html" rel=...
<p><strong><em>One option would be a wrapper that has a float ad a boolean, but that can´t work, as my libraries have containers that store doubles and not objects that behave as doubles.</em></strong></p> <p>That's a shame. In C++ it's trivial to create a templated class that auto-converts to the actual double (refe...
43,108
<p>Thanks to a library upgrade (easymock 2.2 -> 2.4), we're having tests that have started locking up. I'd like to have a time out on individual tests, all of them. The idea is to identify the locked up tests - we're currently guessing - and fix them.</p> <p>Is this possible, preferably on a suite-wide level? We have ...
<p>The <a href="http://code.google.com/p/testng/source/browse/trunk/src/main/org/testng/xml/XmlSuite.java" rel="nofollow noreferrer">suite tag</a> can have the time-out attribute. This time-out will be used as default for all test methods.</p> <p>This default time-out can than be overridden on a per test method basis....
<p>You can do a search and replace for "@Test" with "@Test(timeout=)" Should work to find the locked up test and can be undone after that.</p>
45,684
<p>Is there a way to write a BitmapEffect in 100% Managed Code? I know that it would run a lot slower than using unmanaged code, but I'd like to write a BitmapEffect but its been a long time since I've done any C++ programing, plus the application might have to run in partial trust (so unmanaged code won't be permissib...
<p>We've used <a href="http://www.openssl.org/" rel="noreferrer">OpenSSL</a> with good success. Portable, standards compliant and easy to use.</p>
<p><a href="http://www.gnupg.org/related_software/gpgme/index.en.html" rel="nofollow noreferrer">GPGme</a>. Simple to use and compatible with the <a href="http://www.ietf.org/rfc/rfc4880.txt" rel="nofollow noreferrer">OpenPGP format</a></p>
21,822
<p>I am using a library that has headers without the .h<br> This defeats visual studio's intellisense (declaration/definition lookup)</p> <p>Anyone know how to tell VS2008 that a file is a header?</p>
<p>Go to Tools::Options::Text Editor::File Extension tab in Visual Studio. Check the "Map extensionless headers" checkbox, and select the language you want from the combobox.</p>
<p>I'd hazard a guess that you should ensure the headers are included from a source file (usually a .cpp file).</p> <p>Where the properties for the source file have the Tool property set to C/C++ Compiler Tool. I would guess Intellisense starts with them, and would follow #includes to files regardless of their extensi...
25,802
<p>I thought this code would work, but the regular expression doesn't ever match the \r\n. I have viewed the data I am reading in a hex editor and verified there really is a hex D and hex A pattern in the file.</p> <p>I have also tried the regular expressions /\xD\xA/m and /\x0D\x0A/m but they also didn't match.</p> ...
<p>Use <a href="http://ruby-doc.org/core-2.0.0/String.html#method-i-strip" rel="noreferrer">String#strip</a></p> <blockquote> <p>Returns a copy of str with leading and trailing whitespace removed.</p> </blockquote> <p>e.g</p> <pre><code>" hello ".strip #=&gt; "hello" "\tgoodbye\r\n".strip #=&gt; "good...
<pre><code>def dos2unix(input) input.each_byte.map { |c| c.chr unless c == 13 }.join end remove_all_the_carriage_returns = dos2unix(some_blob) </code></pre>
36,611
<p>There's an executable file generated from my program in MFC and I want to use it as the default program to open the <code>.jpg</code> files. That is to say, each time I double click a <code>.jpg</code> file, my program will run. </p> <p>I tried to add some registry entries linking <code>.jpg</code> files with my pr...
<p>The more typical/standard way for doing this is to set the default value of the ".jpg" key to a name that identifies the file type more clearly, and then setup the various associated actions there. So for jpgs, you might do this:</p> <pre><code>HKCR\.jpg @default = MyApp.JpegImage HKCR\MyApp.JpegImage\shell\open...
<p>Note that by writing a key to HKCR, you're actually writing to HKLM\Software\Classes. This will require administrative privileges. However, you can make per-user changes within a user context by writing your keys to HKCU\Classes\Root instead.</p> <p>Also, user preferences in HKCU will override the system defaults i...
40,828
<p>I have a WordPress installation with an <code>.htaccess</code> file that looks like this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] &lt;/IfModule&gt; # END WordPr...
<p>For future reference, you may want to try this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase /blog2/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /blog2/index.php [L] &lt;/IfModule&gt; # END WordPress </code></pre>
<p><strong>Edit#2</strong>: ok i think i figured this out, but it's pretty messy.</p> <p>modify your base wordpress install's .htaccess file to look like this:</p> <pre><code># BEGIN WordPress &lt;IfModule mod_rewrite.c&gt; RewriteEngine On RewriteBase / RewriteCond %{REQUEST_URI} !^/blog2/.* RewriteCond %{RE...
23,871
<p>Here is the problem: we have lots of Javascripts and lots of CSS files, which we'd rather be serving minified. Minification is easy: set up the YUI Compressor, run an Ant task, and it spits out minified files, which we save beside the originals.</p> <p>So we end up with the following directory structure somewhere i...
<p>Here is the configuration that finally worked:</p> <p>/js/.htaccess:</p> <pre><code>RewriteEngine On RewriteBase /js RewriteCond %{REQUEST_URI} ^/js/((.+)\.js)$ RewriteCond %{DOCUMENT_ROOT}/js/min/%2-min.js -f RewriteRule ^(.+)$ min/%2-min.js [L] </code></pre> <p>Same for <strong>css</strong> directory.</p>
<p>Is it possible to change your build scripts? If so, you can configure them to minify the files and give them the same file name, but only when provided the proper flag, e.g. <code>ant productionDeploy</code> instead of <code>ant integrationDeploy</code>. That way the minification process is completely transparent to...
30,114
<p>I heard about SSIS, a new replacement of the old DTS. I believe it has the same functionality which I used to perform. Now, like any other product from Microsoft, you have to mess with 10 different choices for a single package.</p> <p>I would like to get your opinion of which edition of SQL Server 2005 I should buy...
<p>Sorry dude, but SSIS is not as easy and solid as DTS... if possible I would stay with a copy of SQL 2000 to use DTS</p>
<p>I believe you probably want <strong>SQL Server 2005 - Workgroup edition</strong>.</p> <p>The SSIS is not available in the Express version, and as long as you are not wanting to replicate the data out to various subscribers then Workgroup is probably all you need. Here is a <a href="http://www.microsoft.com/Sqlserv...
27,714
<p>Using a standard ASP.NET ListView with a LinqDataSource and pagination enabled (with a DataPager), what would be the best way to default to displaying the last page of results?</p>
<p>So like the others say, no, you can't have #include statements inside a macro, since the preprocessor only does one pass. However, you can make the preprocessor do basically the same thing with a gnarly trick I found myself using recently.</p> <p>Realise that preprocessor directives won't do anything inside a macro...
<p>Contagious is right -- if you're doing:</p> <p>myFile.c:</p> <pre><code>#include "standardAppDefs.h" #myStandardIncludeMacro </code></pre> <p>standardAppDefs.h:</p> <pre><code>#define myStandardIncludeMacro #include &lt;foo.h&gt; </code></pre> <p>Why not just say:</p> <p>myFile.c:</p> <pre><code>#include "sta...
33,413
<p>In an ActionScript 2 project I can create a new MovieClip, right-click on it on the library and select "Component Definition" to add parameters that can be referenced inside the MovieClip. This parameters can be easily changed in the MovieClips's properties.</p> <p>Now, I'm working on an ActionScript 3 project but ...
<p>In as3 you have to create an external class file with one or more <code>public var</code> declarations that you will use (you can also use public <code>get</code>/<code>set</code> functions). Google this if you're not sure how.</p> <p>In your external file, use the <code>[Inspectable]</code> metadata tag just befor...
<p>I haven't used this specific functionality, but likely you will need to define a custom class for that MovieClip (just subclass MovieClip) and add that extra variable. Actionscript 3 has moved away from the dynamic nature of actionscript 2, this can be a bit confusing to start with, but in the end it's much more ro...
41,727
<p>a little new to the windows workflow stuff so go easy :)</p> <p>I wish to design a workflow host environment that has high availability - a minimum of 2 WF runtime hosts on separate hardware both pointing to the same persistance or tracking SQL database.</p> <p>I am looking for a pattern whereby I can asynchronous...
<p>If you use a WCF service with a netMsmqBinding, you can receive queued messages without having to poll. Messages will wait if there is no service running to pick them up. You would want to make sure to use a clustered queue for reliability in case the main queuing machine goes down. </p> <p>Also be aware when upgra...
<p>I would go with MSMQ/event table. Polling is only dirty if you do it wrong.</p> <p>One thing to keep in mind: you say you want multiple WF servers for high availability, <em>but both of them use the same SQL backend</em>? High availability only works if you remove <em>all</em> single points of failure, not just som...
3,234
<p>We are custom building a Cartesian 3D printer to be used in a production 3D printing environment, with the following requirements:</p> <ul> <li>Intended Z resolution 0.13mm;</li> <li>Dual extruders (primary + support material);</li> <li>Four spools (two per material with y connector, perhaps add auto switch-over fu...
<p>Your choice of firmware depends on a lot of factors, but to name a few important ones: features, your driver board (RAMPS vs Sanguinololu vs Gen..etc), and G-code support.</p> <p>Smooth/quiet operation is dependent on the motors and the driver chip's micro-stepping capabilities. The way the firmware interfaces with...
<blockquote> <p>Given that this printer will have the Pi3 to control "higher functions", is it worth considering a compact firmware like Teacup?</p> </blockquote> <p>A few days ago I came across <a href="https://github.com/KevinOConnor/klipper" rel="noreferrer">klipper</a>.</p> <p>It seems to do exactly that functi...
430
<p>After developing a WPF application without Source Control, I decided to add the solution to TFS.</p> <p>After doing so whenever I opened the main window.xaml file in Design View Visual Studio would disappear and the following event would be logged in the Application Event log:</p> <blockquote> <p>.NET Runtime ve...
<p>Same issue, but without Power Commands installed. The only workaround I've been able to consistently use is to Clean/Rebuild the solution before opening ANY xaml file. If you can't get into your solution because the XAML is loading on start up, delete the suo.</p>
<p>There is an hot-fix available from Microsoft: <a href="https://connect.microsoft.com/VisualStudio/Downloads/DownloadDetails.aspx?DownloadID=16827&amp;wa=wsignin1.0" rel="nofollow noreferrer">Microsoft Connect</a>. I found this link on <a href="http://karlshifflett.wordpress.com/2009/03/13/clr-hotfix-available-for-vi...
18,595
<p>Is it possible to extract all of the VBA code from a Word 2007 "docm" document using the API?</p> <p>I have found how to insert VBA code at runtime, and how to delete all VBA code, but not pull the actual code out into a stream or string that I can store (and insert into other documents in the future).</p> <p>Any ...
<p>You'll have to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3 (or whatever version you have). I have the VBA SDK and such on my box - so this may not be exactly what office ships with.</p> <p>Also you have to enable access to the VBA Object Model specifically - see the "Trust Center" i...
<p>You'll have to add a reference to Microsoft Visual Basic for Applications Extensibility 5.3 (or whatever version you have). I have the VBA SDK and such on my box - so this may not be exactly what office ships with.</p> <p>Also you have to enable access to the VBA Object Model specifically - see the "Trust Center" i...
7,233
<p>What are the benefits of PHP's CLI over other scripting languages/environments such as VBScript or even windows scripting?</p>
<p>One use would be as a scheduled maintenance task that is related to a web application. You will be able to use the libraries and functionality from the web app.</p> <p>I guess another benefit is that if you are familiar with php web development, then hacking out a quick cli script in php may be a quick way to get ...
<p>First thing that springs to mind is a PHP application that you could easily render as a daemon in conjunction with a task scheduler to constantly do certain updates because you can't/wouldn't want to depend on user activity to trigger the execution of the application - but you really <strong>don't need</strong> an i...
49,305
<p>In addition, are there any performance advantages to static methods over instance methods?</p> <p>I came across the following recently: <a href="http://www.cafeaulait.org/course/week4/22.html" rel="noreferrer">http://www.cafeaulait.org/course/week4/22.html</a> :</p> <blockquote> <p>When should a method be static...
<p>Make methods static when they are not part of the instance. Don't sweat the micro-optimisations.</p> <p>You might find you have lots of private methods that could be static but you always call from instance methods (or each other). In that case it doesn't really matter that much. However, if you want to actually be...
<p>Here is a related discussion as to <a href="https://stackoverflow.com/questions/23228/why-is-stringformat-static"><strong>why String.Format is static</strong></a> that will highlight some reasons.</p>
7,119
<p>I was trying the ASP.NET login control tutorial and everything works well. However, I do not know how to have the Log-in control use my own database (SQL Server 2005) instead of using it's mdf file. I also have no idea where this file was created from since it doesn't show up at all on my solution. Any literature th...
<p>When you use ASP.NET's Membership features, you need to specify a provider. In the machine.config file (which lives in C:\WINDOWS\Microsoft.NET\Framework\[version]\CONFIG) a default provider is specified that uses a local .mdf file in the app_data folder. Since you don't want that, you can override it in your app's ...
<p>A few excellent references for asp.net login controls:</p> <p><a href="http://www.sitepoint.com/article/asp-net-2-security/" rel="nofollow noreferrer">Sitepoint</a></p> <p><a href="http://msdn.microsoft.com/en-us/library/ms178329.aspx" rel="nofollow noreferrer">MSDN</a></p> <p>And <a href="http://www.asp.net/lear...
41,157
<p>Is there a way that we could override the default mac address / set a new mac address on a Vista machine for a Broadcom adapter ?</p>
<p>Can't say for your particular case, but I've used one of the two tools mentioned <a href="http://ayaz.wordpress.com/2007/11/24/spoofing-mac-address-i-be-very-bad/" rel="nofollow noreferrer">over here</a> to spoof/change the MAC address of the Ethernet adapter on Windows Vista before.</p>
<p>Probably not - this is easy in Linux though :)</p>
39,648
<p>What is important to keep in mind when designing a database?</p> <p>I don't want to limit your answer to my needs as I am sure that others can benefit from your insights as well. But I am planning a content management system for a multi-client community driven site.</p>
<p>"Normalize till it hurts; de-normalize till it works."</p>
<p>Don`t use a large set of columns as primary keys</p>
17,044
<p>Simple case:</p> <p>i put a DataTable in Cache</p> <pre><code>DataTable table = SomeClass.GetTable(); Cache["test"] = table; then in later calls i use DataTable table = (DataTable)Cache["test"]; </code></pre> <p>now the question is: should i call table.dispose() on each call, though its stored in the Cache? Mean...
<p>All you are doing is storing a pointer in cache... The actual "table" is still on the heap, where all .Net reference types are stored... You are not making a copy of it... The variable in cache just acts to stop the garbage collector from erasing the object on the heap... </p> <p>and no, you don't want to call dis...
<p>i believe that you should only call Dispose once when you are completely done with the datatable; calling Dispose changes the state of the object.</p> <p>note that 'cached' does not always mean 'copied'!</p>
42,279
<p>When I do:</p> <pre><code>$ find / </code></pre> <p>It searches the entire system.<br> How do I prevent that?</p> <p>(This question comes from an "<a href="https://stackoverflow.com/questions/18836/why-doesnt-find-find-anything#26182">answer</a>" to another question.)</p>
<p>Consider:</p> <pre><code>-maxdepth n True if the depth of the current file into the tree is less than or equal to n. -mindepth n True if the depth of the current file into the tree is greater than or equal to n. </code></pre>
<p>Use the <strong>-prune</strong> option.</p>
4,673
<p>Could someone please explain the best way to connect to an Interbase 7.1 database using .NET/C#?</p> <p>The application will be installed on many end user computers so the less "add-ons" that I will have to package with my application the better.</p>
<p>CodeGear offers a free ADO.NET 2.0 driver for registered users of InterBase here:</p> <p><a href="http://cc.embarcadero.com/item/25497" rel="noreferrer">http://cc.embarcadero.com/item/25497</a></p> <p>Note that "registered users of InterBase" includes the free InterBase 2007 Developers Edition. The download says t...
<p>Check this providers:</p> <ul> <li><a href="http://www.ibprovider.com/eng/documentation/firebird_adonet/firebird_adonet.html" rel="nofollow noreferrer">Interbase and Firebird Developer's for Visual Studio .Net</a></li> <li><a href="http://www.firebirdsql.org/index.php?op=files&amp;id=netprovider" rel="nofollow nore...
27,045
<p>We have a database on SQL Server 2000 which should be truncated from time to time. It looks like the easiest solution would be to create a duplicate database and copy the primary database there. Then the primary database may be safely truncated by specially tailored stored procedures.</p> <p>One way replication wou...
<p>While replication is usually robust, there are times where it can break and require a refresh. Managing and maintaining replication can become complicated. Once the primary database is truncated, you'll have to make sure that action is not replicated. You may also need an improved system of row identification as ...
<p>While replication is usually robust, there are times where it can break and require a refresh. Managing and maintaining replication can become complicated. Once the primary database is truncated, you'll have to make sure that action is not replicated. You may also need an improved system of row identification as ...
43,580
<p>I think all of the tutorials and stuff are great on blogs, but sometimes when you actually build an application the way you would code or interact with a system is quite different.</p> <p>I was wondering if you all knew some good real world type ASP.NET MVC applications that have the source code available for exper...
<p>I'm sure you know of <a href="http://blog.wekeroad.com/mvc-storefront/" rel="nofollow noreferrer">storefront</a>. I've heard it's a good tutorial and it comes with source code.</p>
<p>Check out <a href="http://www.codeplex.com/Project/ProjectDirectory.aspx?TagName=MVC" rel="nofollow noreferrer">Code Plex</a></p>
24,179
<p>I'd like to get the Tree icon to use for a homegrown app. Does anyone know how to extract the images out as .icon files? I'd like both the 16x16 and 32x32, or I'd just do a screen capture.</p>
<p>In Visual Studio, choose "File Open..." then "File...". Then pick the Shell32.dll. A folder tree should be opened, and you will find the icons in the "Icon" folder.</p> <p>To save an Icon, you can right-click on the icon in the folder tree and choose "Export".</p>
<p>If you're on Linux, you can extract icons from a Windows DLL with <a href="https://github.com/muflone/gextractwinicons" rel="nofollow">gExtractWinIcons</a>. It's available in Ubuntu and Debian in the <code>gextractwinicons</code> package.</p> <p>This blog article has a <a href="http://ubuntugenius.wordpress.com/201...
2,983
<p>Intermittently in our app, we encounter LockTimeoutExceptions being throw from SQL CE. We've recently upgraded to 3.5 SP 1, and a number of them seem to have gone away, but we still do see them occasionally. I'm certain it's a bug in our code (which is multi-threaded) but I haven't been able to pin it down precisely...
<p>I have been using mono for upwards of 2 years now. Work is windows and .Net, home is mono on GNU/Linux. I have been able to run both GUI and ASP.NET apps with no problems from the same SVN repository. The only changes I had to make were in connection strings. ASP.NET works well under mod_mono for apache and xsp2...
<p>To learn the language, you will be just fine. There are some libraries missing in mono, but that would not prevent you from learning the language. You can find more information at the <a href="http://www.mono-project.com/FAQ:_General" rel="nofollow noreferrer">Mono Project Page: FAQ</a>.</p>
11,807
<p>An array of ints in java is stored as a block of 32-bit values in memory. How is an array of Integer objects stored? i.e.</p> <pre><code>int[] vs. Integer[] </code></pre> <p>I'd imagine that each element in the Integer array is a reference to an Integer object, and that the Integer object has object storage overhe...
<p>No VM I know of will store an Integer[] array like an int[] array for the following reasons:</p> <ol> <li>There can be <strong>null</strong> Integer objects in the array and you have no bits left for indicating this in an int array. The VM could store this 1-bit information per array slot in a hiden bit-array thoug...
<p>It won't be much slower, but because an Integer[] must accept "null" as an entry and int[] doesn't have to, there will be some amount of bookkeeping involved, even if Integer[] is backed by an int[].</p> <p>So if every last ounce of performance matters, user int[]</p>
10,217
<p>I have an application written in java, and I want to add a flash front end to it. The flash front end will run on the same computer as the java app in the stand alone flash player. I need two way communication between the two parts, and have no idea how to even start going about this. I suppose I could open a socke...
<p><a href="http://en.wikipedia.org/wiki/Action_Message_Format" rel="nofollow noreferrer">AMF</a> is a messaging protocol commonly used to talk between flash and a backend system. There're several Java implementations, but I haven't used any of them so can't tell you which is best.</p> <ul> <li><a href="http://labs.ad...
<p>MERAPI is a bridge framework for communication between Java and Flash.</p>
10,308
<p>I'm getting weak prints on Ender 3 Pro with Cura after Cura upgrade.</p> <p>Prints on my Ender 3 Pro have been good until I was forced to update Cura due to having to update the OS on my laptop. Now my prints are weak even after using Infill 50 % from 20 %.</p> <p>Upgraded to Cura 4.8.0.</p> <p>I noticed that it se...
<p>Total user error on my end. With the new version of this app somehow I did not catch that material selected on the UI dropdown was set to some custom material and not Generic PLA. Once I selected the proper material, all worked as expected.</p>
<p>There are three settings you will want to check in Cura to help with this.</p> <p><strong>Nozzle Diameter</strong></p> <p>Check your &quot;Nozzle Diameter&quot; if you've moved to a larger nozzle and haven't changed it in the new Cura version then it'll be under-extruding, or the default option may just be incorrect...
1,808
<p>I want to decode a string that has been encoded using the <code>java.net.URLEncoder.encode()</code> method.</p> <p>I tried using the <code>unescape()</code> function in javascript, but a problem occurs for blank spaces because <code>java.net.URLEncoder.encode()</code> converts a blank space to '+' but <code>unesca...
<p>When I wrote my diploma project, I had to choose between Flash and Java Applets. Here are some pros and cons: </p> <p>Java Applets: </p> <ul> <li>[plus] you program in Java, which is mature and stable</li> <li>[plus] you can use the Java GUI frameworks that pack a lot of punch</li> <li>[minus] the first time the u...
<p>Not an exact answer, as it would be very opinionated, just sharing my experience... </p> <p>In a recent project, where we were building a WAI compliant site, we were asked to avoid flash objects as accessiblity was a major issue. Applets on a different note don't go very well with most web developers ;). One reason...
37,305
<p>I have a dataprovider and a filterfunction for my array that's assigned to my dataprovider.</p> <p>How can I get a list of the properties that are in each row of the dataprovider (item.data) as it gets passed to the filterfunction?</p> <p>For instance, if my object contained:</p> <ul> <li>Object <ul> <li>name</l...
<p>If it's a dynamic object I believe you can just do something like this:</p> <pre><code>var obj:Object; // I'm assuming this is your object for(var id:String in obj) { var value:Object = obj[id]; trace(id + " = " + value); } </code></pre> <p>That's how it's done in AS2, and I believe that still works for dyna...
<p>you can use a for .. in loop to get the properties names, or a for each .. in loop to get the property values ...</p> <pre><code> for( var o : * in object){ trace( o + " = " + object[o] ); } /************* OR ******************/ for each( var o : * in object ){ trace( "object has property: " + o ); } </code...
48,667
<p>I think I shall reframe my question from </p> <p>Where should you use BlockingQueue Implementations instead of Simple Queue Implementations ?</p> <p>to </p> <p><strong>What are the advantages/disadvantages of BlockingQueue over Queue implementations taking into consideration aspects like speed,concurrency or othe...
<p>A limited capacity <code>BlockingQueue</code> is also helpful if you want to throttle some sort of request. With an unbounded queue, a producers can get far ahead of the consumers. The tasks will eventually be performed (unless there are so many that they cause an <code>OutOfMemoryError</code>), but the producer may...
<p>You would see <code>BlockingQueue</code> in multi-threaded situations. For example you need pass in a <code>BlockingQueue</code> as a parameter to create <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/concurrent/ThreadPoolExecutor.html" rel="nofollow noreferrer"><code>ThreadPoolExecutor</code></a> if you...
46,745
<p>Does anyone remember the <code>XMP</code> tag?</p> <p>What was it used for and why was it deprecated?</p>
<p>A quick Google search on W3C reveals that <code>XMP</code> was introduced for displaying <strong>preformatted text</strong> in HTML 3.2 and earlier. When W3C deprecated the <code>XMP</code> tag, it suggested using the <code>PRE</code> tag as a preferred alternative.</p> <p>Update: <a href="http://www.w3.org/TR/REC-...
<p>Still works to show raw html - if you use it in script, break the start tag.</p> <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false"> <div class="snippet-code"> <pre class="snippet-code-js lang-js prettyprint-override"><code>var stuff='&lt;xmp'+'&gt;this is shown as is&...
2,655
<p>I'm looking to find a way to access the .net query string contained in the standard ASP.NET request object inside a web service. In other words if I set a SOAP web service to this url:</p> <p><a href="http://localhost/service.asmx?id=2" rel="noreferrer">http://localhost/service.asmx?id=2</a></p> <p>Can I access th...
<p>I just looked for "Request" of the context in asmx file and I saw that. But I'm not sure if it is right.</p> <pre><code>this.Context.Request.QueryString["id"]; </code></pre>
<p>Since you ask, I guess there is no HttpContext.Current.Request ?</p>
38,165
<p>I hope this is a simple enough question for any SQL people out there...</p> <p>We have a table which hold system configuration data, and this is tied to a history table via triggers so we can track who changed what, and when. </p> <p>I have a requirement to add another value in to this table, but it is one that w...
<p>Given that a WHERE clause did not work, maybe this will:</p> <pre><code>CREATE TRIGGER [dbo].[SystemParameterInsertUpdate] ON [dbo].[SystemParameter] FOR INSERT, UPDATE AS BEGIN SET NOCOUNT ON If (SELECT Attribute FROM INSERTED) LIKE 'NoHist_%' Begin Return End I...
<p>Using LIKE will give you options for defining what the rest of the string should look like, but if the rule is just starts with 'NoHist_' it doesn't really matter.</p>
35,533
<p>I'm trying to search using the windows search one of my web directories for any uses of scriptlets. However, the search seems to be ignoring all files ending in .jsp. I searched for plain words, and that didn't work either. Is there a reason Windows ignores these files when searching?</p>
<p>Try searching for *.jsp and see if any files come up.</p>
<p>I can suggest you StopKa - desktop search tool; i do not post link here (or it is possible?) cause it will look like ads - cause i am author - try to google for it.</p>
43,808
<p>It seems that I can't control the NSApp delegate from within a System Preferences pane, which is understandable. Is there any other way I can have my object notified when the program becomes active?</p>
<p>Most delegate methods in the Cocoa frameworks are simply notification methods. This includes <code>application{Will,Did}{Become,Resign}Active:</code>, which are notification methods for <code>NSApplication{Will,Did}{Become,Resign}ActiveNotification</code>. The notifications are in the same place as the delegate meth...
<p>NSPreferencePane gives you a few methods you can override to respond to changes. In particular, <code>mainViewDidLoad:</code> gives you a chance to do initialization when your preference pane becomes active for the first time.</p> <p>If you actually meant you want to keep track of when the System Preferences window...
42,329
<p>In what situations should one catch <code>java.lang.Error</code> on an application?</p>
<p>Generally, never.</p> <p>However, sometimes you need to catch specific errors.</p> <p>If you're writing framework-ish code (loading 3rd party classes), it might be wise to catch <code>LinkageError</code> (no class def found, unsatisfied link, incompatible class change). </p> <p>I've also seen some stupid 3rd-part...
<p>ideally we should never catch Error in our Java application as it is an abnormal condition. The application would be in abnormal state and could result in carshing or giving some seriously wrong result.</p>
45,949
<p>Objective-C 2.0 gave us @properties.</p> <ul> <li>They allow for introspection.</li> <li>They allow for declarative programming.</li> <li>The @synthesize and @dynamic mechanisms relieve use from having to write repetitive, stock accessors.</li> <li>Finally, there is the ‘dot’ property syntax, which some love, and s...
<p>My recommendation to people is to use property's wherever possible. If you are working in a framework, the ability to use non-fragile instance variables in the modern runtime is a huge bonus and if you aren't, properties make it clear how your ivars are to be managed (assigned vs retained vs copied). There isn't a...
<p>I would avoid using properties if the accessor method does something non-obvious to the object, like setting an unrelated instance variable. Also if the property being returned doesn't really "belong" to the object. For instance, in one of my projects I have a <code>stringValue</code> method that I decided not to ma...
36,087
<p>I'm curious to know how people are using table aliases. The other developers where I work always use table aliases, and always use the alias of a, b, c, etc.</p> <p>Here's an example:</p> <pre><code>SELECT a.TripNum, b.SegmentNum, b.StopNum, b.ArrivalTime FROM Trip a, Segment b WHERE a.TripNum = b.TripNum </code>...
<p>There are two reasons for using table aliases.</p> <p>The first is cosmetic. The statements are easier to write, and perhaps also easier to read when table aliases are used. </p> <p>The second is more substantive. If a table appears more than once in the FROM clause, you need table aliases in order to keep them...
<p>Always. Make it a habit.</p>
24,138
<p>Can anyone point to live examples of SOAP or REST web services? How do you use or test an existing web service with a client?</p>
<p>A SOAP webservice which converts the temperature Celsius to Fahrenheit and other way around <a href="http://www.w3schools.com/webservices/tempconvert.asmx" rel="nofollow noreferrer">http://www.w3schools.com/webservices/tempconvert.asmx</a></p> <p>A description and source code is here <a href="http://www.w3schools.c...
<p>Here is nice collection of example web services. I usually use them for experiments <a href="http://www.webservicex.net/" rel="nofollow noreferrer">http://www.webservicex.net/</a></p> <p>And for WS debug - I generate wrapper with VS and write unit tests.</p>
27,222
<p>Under the View-Model-ViewModel pattern for WPF, I am trying to databind the Heights and Widths of various definitions for grid controls, so I can store the values the user sets them to after using a GridSplitter. However, the normal pattern doesn't seem to work for these particular properties.</p> <p><em>Note: I'm ...
<p>There were a number of gotchas I discovered:</p> <ol> <li>Although it may appear like a double in XAML, the actual value for a *Definition's Height or Width is a 'GridLength' struct.</li> <li>All the properties of GridLength are readonly, you have to create a new one each time you change it.</li> <li>Unlike every o...
<p>Another possibility, since you brought up converting between <code>GridLength</code> and <code>int</code>, is to create an <code>IValueConverter</code> and use it when binding to <code>Width</code>. <code>IValueConverter</code>s also handle two-way binding because they have both <code>ConvertTo()</code> and <code>Co...
17,810
<p>I'm looking to build a VM into a game and was wondering if anyone knew of any really simple VM's (I was thinking RISC/PIC was close to what I wanted) that are usually used for embedded projects such as controlling robots, motors, sensors, etc. My main concern is having to write a compiler/assembler if I roll my own....
<p>if you want something rooted in the real world, one of the most-used embedded RISC microcontrollers is the PIC family. google gives several emulators, but i don't think the source is available for most.</p> <p>another possibility is QEMU, which already emulates several ARM varieties.</p> <p>and, of course, if you...
<p>If you want simple, consider the Manchester Mark I. See page 15 of <a href="http://www.seas.gwu.edu/~rhyspj/cs41talk.pdf" rel="nofollow noreferrer">this PDF</a>. The machine has 7 instructions. It takes about an hour to write an interpreter for it. Unfortunately, the instructions are pretty dang limited (which i...
33,334
<p>If I'm using an ArrayList in C#.NET, is the order guaranteed to stay the same as the order I add items to it?</p>
<p>Yes, elements are always added to the end (unless you specify otherwise, e.g. with a call to <a href="http://msdn.microsoft.com/en-us/library/system.collections.arraylist.insert.aspx" rel="noreferrer">Insert</a>). In other words, if you do:</p> <pre><code>int size = list.Count; int index = list.Add(element); Assert...
<p>When you add an item to a ArrayList the item will always stay at that index. Unless of course if you change it.</p> <p>(the framework might rearrange the memory but your index will always stay the same)</p>
41,544
<p>I am trying to find a way to get the source code for (user defined) PHP functions in a string.</p> <p>For normal code this is easy, using reflection I can find the file and line numbers where the function is defined; then I can open the file and read the function source code.</p> <p>This will not work if a functio...
<p>There is an option in Google Maps API DirectionsRequest called optimizeWaypoints, which should do what you want. This can only handle up to 8 waypoints, though.</p> <p>Alternatively, there is an open source (MIT license) library that you can use with the Google Maps API to get an optimal (up to 15 locations) or pre...
<p>Just found <a href="http://gebweb.net/optimap/" rel="nofollow">http://gebweb.net/optimap/</a> It looks nice and easy. Online version using google maps. </p>
43,810
<p>Our Software Package uses MS-Access Database, this database has been modified many times, so, it's a bit complicated to just see the files (relationship between tables are small hell), anyway, </p> <p>Is there a way or program to convert this mdb file to SQL Script (Any sort of SQL Script will do it for now).</p> ...
<p>Have you looked at the <a href="http://www.microsoft.com/sqlserver/2005/en/us/migration-access.aspx" rel="nofollow noreferrer">SQL Server Migration for Microsoft Access</a>?</p> <p>If you convert a copy to SQL Server, you may be able to get a better feel for the database. </p>
<p><a href="http://subsonicproject.com/" rel="nofollow noreferrer">SubSonic</a> has options for dumping the database's design - as well as its' data - into SQL. I have found it incredibly handy in the past for backing up my test database to source code control.</p> <p>Download and install version 2.1 of SubSonic.</p>...
49,006
<p>In Clearcase I can generate a "label" for a given set of files and always go back to that label to regenerate all the files as they were when I generated the label.</p> <p>How do I do this in Subversion? I'm using the Tortoise front end [Windows] to SVN and I'm not sure how to accomplish this functionality.</p>
<p>In fact in SVN <strong>every commit creates a 'label'</strong>. You can go back to every revision (commit) at any moment. </p> <p>There is <strong>no difference between a branch and a tag</strong> in theory. Just that a branch is developed further and merged with commits from different developers whereas noone shou...
<p>Use svn copy and create a copy in the tags folder. This is more convention than anything else, but most repositories will have folders called trunk, tags, and branches.</p> <p>Don't worry about creating extra copies - it's not really duplicating all those files -- copies are cheap in subversion.</p> <p>For exampl...
45,634
<p>I have an application which I have made a 256 x 256 Windows&nbsp;Vista icon for.</p> <p>I was wondering how I would be able to use a 256x256 PNG file in the ico file used as the application icon and show it in a picture box on a form.</p> <p>I am using VB.NET, but answers in C# are fine. I'm thinking I may have to...
<p>Today, I made a very nice function for <strong>extracting the 256x256 Bitmaps from Vista icons</strong>. </p> <p>Like you, Nathan W, I use it to display the large icon as a Bitmap in "About" box. For example, this code gets Vista icon as PNG image, and displays it in a 256x256 PictureBox:</p> <pre><code>picboxAppL...
<p>Have a look at the Windows <a href="http://msdn.microsoft.com/en-us/library/ms674654(VS.85).aspx" rel="nofollow noreferrer">icon functions</a> that are available. There's also an <a href="http://msdn.microsoft.com/en-us/library/ms648050(VS.85).aspx" rel="nofollow noreferrer">overview</a> that mentions querying for d...
27,152
<p>I am trying to figure out this:</p> <pre><code>c = 1 def f(n): print c + n def g(n): c = c + n f(1) # =&gt; 2 g(1) # =&gt; UnboundLocalError: local variable 'c' referenced before assignment </code></pre> <p>Thanks!</p>
<p>Within a function, variables that are assigned to are treated as local variables by default. To assign to global variables, use the <a href="https://docs.python.org/3/reference/simple_stmts.html#the-global-statement" rel="noreferrer"><code>global</code></a> statement:</p> <pre><code>def g(n): global c c = c...
<p>Other than what Greg said, in Python 3.0, there will be the nonlocal statement to state "here are some names that are defined in the enclosing scope". Unlike global those names have to be already defined outside the current scope. It will be easy to track down names and variables. Nowadays you can't be sure where "g...
17,625
<p>I've been asked to maintain a large C++ codebase full of memory leaks. While poking around, I found out that we have a lot of buffer overflows that lead to the leaks (how it got this bad, I don't ever want to know). </p> <p>I've decided to removing the buffer overflows first, starting with the dangerous functions. ...
<p>In general, any function that does not check bounds in the arguments. A list would be</p> <ul> <li>gets()</li> <li>scanf()</li> <li>strcpy()</li> <li>strcat()</li> </ul> <p>You should use size limited versions like stncpy, strncat, fgets, etc. Then be careful while giving the size limit; take into consideration th...
<p>Basically, anything which accept a pointer and writes to it, without checking the length. So thing like strcpy(), sprintf() etc.</p>
20,189
<p>I've recently had to dust off my Perl and shell script skills to help out some colleagues. The colleagues in question have been tasked with providing some reports from an internal application with a large Oracle database backend, and they simply don't have the skills to do this. While some might question whether I h...
<p>Best practice, IMHO, would be to NOT hold any passwords in a shell / Perl script. That is what public key authentication is for.</p>
<p>In UNIX, I always make these scripts setuid and store the user and password info in a file that's heavily protected (the entire directory tree is non-readable/searchable by regular users and the file itself is readable only by the owner of the script).</p>
10,608
<p>When I use my browser to test my web service, it opens at <a href="http://localhost:4832/" rel="nofollow noreferrer">http://localhost:4832/</a> -- where can I find its files physically on my drive?</p> <h2>Update</h2> <p>I do not want to know where the files of my VS.NET solution are located but where I should put...
<p>So when you launch a webservice out of VS - Cassini (the built in web server) runs those files directly out of the bin file of that project. </p> <p><a href="http://localhost:4832/" rel="nofollow noreferrer">http://localhost:4832/</a> will point to the folder that your code is located in (as suggested by ALassek) ...
<p>LFSR answer was quite fine and I was ready to accept it BUT just to be sure I added the line</p> <p>"Assembly.GetExecutingAssembly().Location" in the code to show me the path of the executing assembly and it seem to have all DLL in a temporary folder:</p> <p>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Temporary ...
37,052
<p>0x34363932353433373538323038353135353439</p>
<p>From the Unix / cygwin command line, you can use bc.</p> <pre><code>$ bc ibase=16 34363932353433373538323038353135353439 1164362276596472215941024063897591129839055929 </code></pre> <p>There is also <a href="http://sciencesoft.at/bc/?lang=en" rel="nofollow noreferrer">an online version</a>. If you want to do it i...
<p>Looks like ASCII to me! On a big-endian system, you get the string "4692543758208515549". :-)</p> <p>Anyway, to actually answer your question, Ruby is useful for that purpose:</p> <pre><code>ruby -e 'p 0x34363932353433373538323038353135353439' </code></pre>
30,584
<p>I've got a client that, during testing, is giving me conflicting information. I don't think they are lying but more confused. So, I would like to setup some simple auditing in my ASP.Net application. Specifically, right when any page is called, I want to immediately insert the Querystring and/or form POST data in...
<p>All of the form data should be in <a href="http://msdn.microsoft.com/en-us/library/system.web.httprequest.params.aspx" rel="nofollow noreferrer">Request.Params</a>. You'd need to do this on every page, though or maybe use an HttpModule.</p> <p>[EDIT] If you want to get the form parameters separately use <a href=...
<p>I would recommend implementing and HttpHandler or an HttpModule for this type of scenario. You can get to the POST Data from the Page_Load event but implementing this logging facility here is not as maintainable.</p>
23,665
<p>I'm attempting to write a couple of NAnt tasks for interacting with Microsoft Virtual Server 2005 R2 SP1, and I've lifted the code found on "Virtual PC Guy's WebLog", in the <a href="http://blogs.msdn.com/virtual_pc_guy/archive/2006/06/13/630165.aspx" rel="nofollow noreferrer">"Controlling Virtual Server through Pow...
<p>You can use <code>M-x describe-function</code> (or <code>C-h f</code> with default keybindings) to answer this question, here's the output for <code>find-grep</code>:</p> <pre><code>find-grep is an alias for `grep-find' in `progmodes/grep.el'. (find-grep COMMAND-ARGS) ... </code></pre>
<p>They seem the same. See <a href="http://www.impernix.org/Manuals/emacs/Grep-Searching.html" rel="nofollow noreferrer">the manual</a></p>
42,424
<p>I have a coldfusion web site I need to change. Have no idea or experience with this environment (I do know ASP.NET). All I need to do is to write a condition based on the referral value (the URL) of the page, and redirect to another page in some cases. Can anyone give me an example of the syntax that would perform t...
<p>All of the other examples would work...also if you're looking to redirect based on a referral from an external site, you may want to check CGI.HTTP_REFERER. Check out the CGI scope for several other options.</p> <pre><code>&lt;cfif reFindNoCase('[myRegex]',cgi.http_referer)&gt; &lt;cflocation url="my_new_url"&g...
<p>A dynamic version. </p> <pre><code>&lt;cfif isdefined("somecondition")&gt; &lt;cfset urlDestination = "someurl"&gt; &lt;cfelseif isdefined("somecondition")&gt; &lt;cfset urlDestination = "someurl"&gt; . . . &lt;cfelse&gt; &lt;cfset urlDestination = "someurl"&gt; &lt;/cfif&gt; &lt;cflocation url = ur...
49,038
<p>I was always wondering why it is a big deal having version control support inside an IDE.</p> <p>I always preferred to use a command-line/standalone version of the version control of choice and never found IDE integration helpful.</p> <p>I know it can be helpful sometimes, for example to automatically keep track of ...
<p>Integrated Source Control also helps to only keep the important files under Source control. For example, when I add a new File in Visual Studio, the Plugin (visualSVN) will allow me to add it easily without me having to remember to go outside of my IDE and run the command to add it to the repository. On the other ha...
<p>Version control support in an IDE generally gives you a better view. The IDE actually knows what type of file you are looking at when doing a diff, which means it can do context highlighting and help you do merges more effectively.</p> <p>I also think it saves setup time. In stead of installing all kinds of tools, ...
39,337
<p>Is it possible to copy a single file to multiple directories using the cp command ?</p> <p>I tried the following , which did not work: </p> <pre><code>cp file1 /foo/ /bar/ cp file1 {/foo/,/bar} </code></pre> <p>I know it's possible using a for loop, or find. But is it possible using the gnu cp command?</p>
<p>You can't do this with <code>cp</code> alone but you can combine <code>cp</code> with <code>xargs</code>:</p> <pre><code>echo dir1 dir2 dir3 | xargs -n 1 cp file1 </code></pre> <p>Will copy <code>file1</code> to <code>dir1</code>, <code>dir2</code>, and <code>dir3</code>. <code>xargs</code> will call <code>cp</co...
<p>This will copy to the immediate sub-directories, if you want to go deeper, adjust the <code>-maxdepth</code> parameter. </p> <pre><code>find . -mindepth 1 -maxdepth 1 -type d| xargs -n 1 cp -i index.html </code></pre> <p>If you don't want to copy to all directories, hopefully you can filter the directories you ar...
23,774
<p>I'm trying to figure out a way to detect files that are not opened for editing but have nevertheless been modified locally. <code>p4 fstat</code> returns a value <code>headModTime</code> for any given file, but this is the change time in the depot, which should not be equal to the filesystem's <code>stat</code> last...
<p>From: <a href="http://answers.perforce.com/articles/KB/3481/?q=disconnected&amp;l=en_US&amp;fs=Search&amp;pn=1" rel="noreferrer">http://answers.perforce.com/articles/KB/3481/?q=disconnected&amp;l=en_US&amp;fs=Search&amp;pn=1</a></p> <p>See step 2 specifically:</p> <hr> <p>2 . Next, open for "edit" any files that ...
<p>Here's a unix solution that has worked very well for me.</p> <p><a href="https://stackoverflow.com/questions/9272/finding-untracked-files-in-a-perforce-tree/100126#100126">How to find untracked files in a Perforce tree? (analogue of svn status)</a></p>
33,442
<p><strong>I do not currently have this issue</strong>, but you never know, and thought experiments are always fun.</p> <p><strong>Ignoring the obvious problems that you would have to have with your architecture to even be attempting this</strong>, let's assume that you had some horribly-written code of someone else's...
<pre><code>public delegate void VoidDelegate(); public static class Utils { public static void Try(VoidDelegate v) { try { v(); } catch {} } } Utils.Try( () =&gt; WidgetMaker.SetAlignment(57) ); Utils.Try( () =&gt; contactForm["Title"] = txtTitle.Text ); Utils.Try( () =&gt; Casserole.Season(true...
<p>Hilite each line, one at a time, 'Surround with' try/catch. That avoids the copying pasting you mentioned</p>
14,273
<p>I'm playing around with LinqToSQL using an existing multi-lingual database, but I'm running into issues mapping a fairly important one-to-one relationship, so I suspect I am using the feature incorrectly for my database design.</p> <p>Assume two tables, Category and CategoryDetail. Category contains the CategoryId ...
<p>You can view properties of the association. (Right click on the line representing the association and show properties.) The properties will tell you if it is a one-to-one or one-to-many relationship. This is reflected in code by having either a single entity association (one-to-one) or an entity set association (one...
<p>I think LINQ to SQL models the database structure directly. You have two tables so it creates 2 objects. <BR></p> <p>Have you had a look at LINQ to Entities this allows you to create another layer above the database strucure to make for more readable classes.</p>
18,386
<p>Here's an example:</p> <pre><code>Double d = (1/3); System.out.println(d); </code></pre> <p>This returns 0, not 0.33333... as it should.</p> <p>Does anyone know?</p>
<p>That's because <code>1</code> and <code>3</code> are treated as <code>integers</code> when you don't specify otherwise, so <code>1/3</code> evaluates to the <code>integer</code> <code>0</code> which is then cast to the <code>double</code> <code>0</code>. To fix it, try <code>(1.0/3)</code>, or maybe <code>1D/3</code...
<p>Use <strong>double</strong> and not <strong>Double</strong> unless you need to use these values in the object sense. Be aware about the <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html" rel="nofollow noreferrer">Autoboxing</a> concepts</p>
47,807
<p>When I see Lua, the only thing I ever read is "great for embedding", "fast", "lightweight" and more often than anything else: "World of Warcraft" or in short "WoW".</p> <p>Why is it limited to embedding the whole thing into another application? Why not write general-purpose scripts like you do with Python or Perl?<...
<p>Just because it is "marketed" (in some general sense) as a special-purpose language for embedded script engines, does not mean that it is limited to that. In fact, WoW could probably just as well have chosen Python as their embedded scripting language.</p>
<p>I think the answer about it being a "marketing" thing is probably correct, along with the lack of a large set of libraries to choose from. I would like to point out another case of this: Ruby. Ruby is meant to be a general purpose scripting language. The problem is that since Ruby on Rails has risen to be so popula...
31,116
<p>I have report on my asp page and every time I change a filter and click view report, I get this error:</p> <p>Microsoft JScript runtime error: 'this._postBackSettings.async' is null or not an object</p> <p>I tried change the EnablePartialRendering="true" to EnablePartialRendering="false" but then people can't logi...
<p>This problem is solved by setting <code>EnablePartialRendering</code> to false of <code>ScriptManager</code>.</p> <pre><code>ScriptManager1.EnablePartialRendering = false; </code></pre> <p>In <code>OnInit</code> event of the page where <code>rsweb:ReportViewer</code> is used. If you want to enable for other page ...
<p>Put the button inside a panel (not update panel), then add this line to the panel DefaultButton="Button1"</p> <p>This will avoid the error.</p>
18,370
<p>In the .xsd file for a typed DataSet in .NET, there's a <code>&lt;Connections&gt;</code> section that contains a list of any data connections I've used to set up the DataTables and TableAdapters.</p> <p>There are times when I'd prefer not to have those there. For instance, sometimes I prefer to pass in a connectio...
<p>This has bugged me for a long time as well and I did some testing recently. Here is what I came up with. For the record, I'm using VS 2008 SP1.</p> <ul> <li>Datasets <em>will</em> store connection string information whether you want them to or not.</li> <li>You <em>can</em> make sure datasets won't store password...
<p>The best way to do this will be to create a connection at runtime with your preferred connection string and assign it TableAdapter.Connection. This has worked for me in the past.</p> <p>Secondly, if you remove the <code>&lt;connections&gt;</code> section from xsd it will surely throw an error becuase it is not onl...
37,905
<p>Does Java 6 consume more memory than you expect for largish applications?</p> <p>I have an application I have been developing for years, which has, until now taken about 30-40 MB in my particular test configuration; now with Java 6u10 and 11 it is taking several hundred while active. It bounces around a lot, anywh...
<p>In response to a discussion in the comments to Ran's answer, here's a test case that proves that the JVM <em>will</em> release memory back to the OS under certain circumstances:</p> <pre><code>public class FreeTest { public static void main(String[] args) throws Exception { byte[][] blob = new byte[...
<p>Are you using the ConcMarkSweep collector? It can increase the amount of memory required for your application due to increased memory fragmentation, and "floating garbage" - objects that become unreachable only after the collector has examined them, and therefore are not collected until the next pass.</p>
47,854
<p>I am working on a C++ code base that was recently moved from X/Motif to Qt. I am trying to write a Perl script that will replace all occurrences of Boolean (from X) with bool. The script just does a simple replacement. </p> <pre><code>s/\bBoolean\b/bool/g </code></pre> <p>There are a few conditions. </p> <p>...
<blockquote> <p>s/[^:]\bBoolean\b(?!")/bool/g</p> </blockquote> <p>This does not match strings where Boolean is at that the beginning of the line becuase [^:] is "match a character that is not :".</p>
<p>To fix condition 1 try:</p> <pre><code>s/[^:]\bBoolean\b(?!")/bool/g </code></pre> <p>The [^:] says to match any character other than ":". </p>
5,560
<p>Often, the pre-generated G-code is enough for start and end. However, sometimes we want to have something different. In this case: how to generate an audible alert of something like 4 bleeps at the end of the print, after putting the printer into the end position and when the bed has reached a "safe" 30 °C?</p>
<p>Let's put the parts one by one:</p> <ul> <li>Wait for bed temperature being at 30 °C: <code>M190 R30</code></li> <li>Play Bleep for 1/5th of a second: <code>M300 S440 P200</code></li> <li>Wait for 1/5th of a second: <code>G4 P200</code></li> </ul> <p>That gives:</p> <pre><code>M190 R30 M140 S0 M300 S440 P200 G4 P...
<p>Trish's version is good but wait for bed temperature being at 30 °C (<code>M190 R30</code>) before setting the temperature to 0 °C (<code>M140 S0</code>)</p> <p>So this is my version:</p> <pre><code>G91 ;relative positioning G1 E-1 F300 ;retract the filament a bit before lifting the nozzle, to release some of the p...
1,472
<p>Given a filename, I need to be able to access certain metadata in an image for a (closed source) project I'm currently developing, without regard to how the metadata is stored (that is, Exif, IPTC, or XMP). In particular, I want to access geotagging data.</p> <p>Is there a way of doing this <b>without</b> requiring...
<p>Check the <a href="http://freeimage.sourceforge.net/" rel="nofollow noreferrer">FreeImage project</a> - a C++ image loading and processing that has .NET wrapper. perhaps it can do that </p>
<p>Old question, I know, but EXIF can be extracted with just the base .NET framework (no third party DLLs). EXIF items can be extracted from an Image object as PropertyItems. I'm using a method similar to this to extract a particular property as a string (e.g. Date Taken or Maker Note):</p> <pre><code>public static st...
23,500
<p>I've created a package that contains a stored procedure that I plan to invoke from a separate application. The stored procedure will return a sorted list of all the views and tables in the schema. To do that, it performs a simple select on the DBA_TABLES and DBA_VIEWS synonyms, as shown below:</p> <pre><code>CREATE...
<p>Use ALL_TABLES and ALL_VIEWS instead of DBA_TABLES and DBA_VIEWS. ALL_% views should be accessible to all users.</p>
<p>If you select from a table or a view in a stored PL/SQL-procedure or a stored PL/SQL-function you need a direct grant. A grant via a database role isn't enough. </p> <p>You probably need a direct grant on view dba_tables. (public) synonyms are just (public) synonyms. You need directly granted select rights. </p> <...
49,748
<p>I'm converting an old app that records folder sizes on a daily basis. The legacy app uses the Scripting.FileSystemObject library:</p> <pre><code>Set fso = CreateObject("Scripting.FileSystemObject") Set folderObject = fso.GetFolder(folder) size = folderObject.Size </code></pre> <p>There isn't an equivalent mechanis...
<p>I think that you already know the answer; you will need to add up all of the files in the directory (as well as its child directories.) I don't know of any built in function for this, but hey, I don't know everything (not even close).</p>
<p>Mads Kristensen <a href="http://madskristensen.net/post/Calculate-the-total-size-of-a-directory-in-C.aspx" rel="nofollow noreferrer">posted</a> about this a while back...</p> <pre><code>private double size = 0; private double GetDirectorySize(string directory) { foreach (string dir in Directory.GetDirectories(...
16,616
<p>It's been mentioned to me that I'll be the sole developer behind a large new system. Among other things I'll be designing a UI and database schema.</p> <p>I'm sure I'll receive some guidance, but I'd like to be able to knock their socks off. What can I do in the meantime to prepare, and what will I need to keep i...
<p>Do you know much about OOP? If so, look into Spring and Hibernate to keep your implementation clean and <a href="http://codebetter.com/blogs/jeremy.miller/archive/2007/01/08/Orthogonal-Code.aspx" rel="noreferrer">orthogonal</a>. If you get that, you should find TDD a good way to keep your design compact and lean, ...
<p>Split the big system to smaller pieces. And don't think that it's so complex, because it usually isn't. By thinking too complex it just ruins your thoughts and eventually the design. Some point you just realize that you could do the same thing easier, and then you redesign it.</p> <p>Atleast this has been my major ...
3,647