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 run a background task that reads input from a TextReader and processes it a line at a time. I want the background task to block until the user types some text into a field and clicks the submit button. Is there some flavour of TextReader that will block until text is available and lets you somehow add more...
<p>It seems that there is no implementation of this - which is strange, since I agree that it would be a useful construct. But it should be simple to write. Something like this should work:</p> <pre><code> public class BlockingStream: Stream { private readonly Stream _stream; public BlockingStream(Stream s...
<p>I think you'd be much better off creating an event in your main application that is raised when the user hits Submit. The text data would be passed in the event args. Each plugin registers an event handler for the event, and handles the data passed in when the event is raised. This allows many plugins to process the...
30,880
<p>Is there a way to programatically access the DragHandleTemplate of a ReorderList (ASP.NET AJAX Control Toolkit) ... Specifically during ItemDataBound for the ReorderList, in order to change its appearance at the per item level?</p>
<p>Unfortunately there is no way of getting drag holder from ReorderListItem. Instead, you can create a server control inside DragHandleTemplate (e.g. PlaceHolder) and then find it in your ItemDataBound event handler:</p> <p>In aspx file:</p> <pre><code>&lt;DragHandleTemplate&gt; &lt;div class="dragHandle"&gt; ...
<p>You can not access DragHandleTemplate programatically <strong>on the server</strong>, but if you create the surrounding elements with unique ID's (per row) you should be able the use CSS-selectors or Javascript to only change some of the items.</p>
38,358
<p>I am running a sproc on an SQL Server 2005 server which is resulting in the following error:</p> <blockquote> <p>Msg 64, Level 20, State 0, Line 0 A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - The specified network name is no longer avai...
<p>This happens when the DB server is made unavailable with a client connection open.</p> <p>To reproduce: If you have a query open in SSMS, restart the SQL instance, run the query again to get this error.</p> <p>Thoughts:</p> <ul> <li>Is the SQL instance being restarted?</li> <li>Is the DB being <a href="http://msd...
<p>Some thoughts:</p> <p>This may be caused when you have connection pooling enabled, and for whatever reason, one connection in the pool loses its connection to the DB (due to a network hickup, or any other reason).</p> <p>Is this happening everytime you call this sproc?</p> <p>Does that sproc attempt to access a l...
43,082
<p>Is there any way to check if a given index of an array exists? I am trying to set numerical index but something like 1, 5, 6,10. And so I want to see if these indexes already exist and if they do just increase another counter.</p> <p>I normally work with php but I am trying to do this in c++, so basically I am tryi...
<p>In C++, the size of an array is fixed when it is declared, and while you can access off the end of the declared array size, this is very dangerous and the source of hard-to-track-down bugs:</p> <pre><code>int i[10]; i[10] = 2; // Legal but very dangerous! Writing on memory you don't know about </code></pre> <p>It ...
<p>It sounds to me as though really a map is closest to what you want. You can use the Map class in the STL (standard template library)(<a href="http://www.cppreference.com/wiki/stl/map/start" rel="nofollow noreferrer">http://www.cppreference.com/wiki/stl/map/start</a>).</p> <p>Maps provide a container for objects whi...
32,042
<p>This is regarding the circuit of my 3D printer Tronxy X5SA's stepper motor for X axis.</p> <p><strong>I had an observation:</strong> It has a cooling fan (40X10 24V) which is having issues lately - it stops working sometimes, and when pushed to rotate, spins back.</p> <p><strong>Problem:</strong> Now one of the step...
<p>I think this is resolved. After looking at every conceivable source of over-extrusion and coming up negative, <code>R.. GitHub STOP HELPING ICE</code> suggested that it might be a mechanical problem in Z axis movement, like in <a href="https://3dprinting.stackexchange.com/questions/8022/first-3-mm-prints-poorly-then...
<p>I had the same problem with my Ender-3 V2.</p> <p>You need to check if the feeder bracket is square like explained in <a href="https://www.youtube.com/watch?v=xnzNd_FIMKY" rel="nofollow noreferrer">this YouTube</a></p> <p>If that is not the problem maybe you need a custom bracket to change the spacing between the Z-...
1,696
<p>Without using any third party program to do this (i.e. without VMware ThinApp, U3 or MojoPac etc.) How to move MSVC++ 6.0 from from its install on C: over to a USB drive? So that it can be used on different PCs with no admin rights and without installing anything on the host PC? Even if it's only usable as a console...
<p>Move the two folders that install created under <code>c:\program files\</code> to the USB drive (e.g. to <code>e:\progs\msvc\msvc6</code> and <code>e:\progs\msvc\vc98</code>), and append to the file <code>e:\progs\msvc\vc98\bin\vcvars32.bat</code> to suit e.g.</p> <pre><code>prompt $g set path=e:\progs\uedit;e:\pr...
<p>I haven't done this, but it should "just" be a matter of:</p> <ul> <li>Copying all the application files to a USB drive. Remember there will be shared files and stuff that may need to go into the Windows directory.</li> <li>Identifying and copying all of the registry entries, although you may need to be admin to cr...
45,919
<p>I'm running a project on a Postgres database and need to retrieve the comments on columns within the DB to be used as table headings and such. I have seen that there are a couple of built in functions (<a href="http://www.postgresql.org/docs/9.1/static/catalog-pg-description.html" rel="noreferrer">pg_description</a>...
<pre><code>select c.table_schema, c.table_name, c.column_name, pgd.description from pg_catalog.pg_statio_all_tables as st inner join pg_catalog.pg_description pgd on ( pgd.objoid = st.relid ) inner join information_schema.columns c on ( pgd.objsubid = c.ordinal_position and c.table_schema ...
<p>Ok, so i worked it out to degree...</p> <p>select col_description(table id, column number)...</p> <p>ie: select col_description(36698,2);</p> <p>That worked, but is there an easier way to do this maybe bringing all the comments on all the columns and using the table name instead of the oid???</p>
44,617
<p>Is there a way to browse and edit/delete saved form entries in Firefox?</p> <p>I know I can:</p> <ul> <li>Delete all form data, using the <em>Clear Private Data</em> dialog;</li> <li><a href="http://kb.mozillazine.org/Deleting_autocomplete_entries" rel="nofollow noreferrer">Delete specific entries</a> in a form usin...
<p>The <a href="https://addons.mozilla.org/addon/sqlite-manager-webext/" rel="noreferrer">SQLite Manager</a> extension can open the <code>formhistory.sqlite</code> file (as well as any other <code>.sqlite</code> file in a Firefox profile folder) and make it available for adding, editing, and deleting records with the s...
<p>I develop <a href="https://en.wikipedia.org/wiki/Adobe_Integrated_Runtime" rel="nofollow noreferrer">Adobe AIR</a> applications and use Lita to view their SQLite databases. I just tried it on the Firefox forms database and I like it better than the Firefox extension.</p> <p>The good thing about the extension is tha...
38,767
<p>I generally build web based applications. But, there is sometimes a need to distribute these applications to various platforms and have them act more like regular applications than web apps. A quick solution might be to create an icon that opens the browser with no menu, url bar, or icons.</p> <p>It looks like IE...
<p>There is <a href="http://gears.google.com/" rel="nofollow noreferrer">Google Gears</a> designed specifically to do this. It however only works on windows for the time being but it is intended to be ported to Linux/Mac although no current planned release date.</p>
<p>There's the Prism add-on for FireFox and Google Chrome has this functionality built-in.</p>
24,828
<p>Is there any way to take a Class and determine if it represents a primitive type (is there a solution that doesn't require specifically enumerating all the primitive types)?</p> <p>NOTE: I've seen <a href="https://stackoverflow.com/questions/180097/dynamically-find-the-class-that-represents-a-primitive-java-type">t...
<p>There is a method on the Class object called <a href="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#isPrimitive()" rel="nofollow noreferrer">isPrimitive</a>.</p>
<p>This method will also check whether it's a wrapper of a primitive type as well:</p> <pre><code>/** * Checks first whether it is primitive and then whether it's wrapper is a primitive wrapper. Returns true * if either is true * * @param c * @return whether it's a primitive type itself or it's a wrapper for a primiti...
25,692
<p>Under visual studio if you run a web project by pressing the <kbd>Go</kbd> button on the Debugging toolbar, then stop it by pressing the <kbd>Stop</kbd> button on the debugging toolbar, Internet Explorer is opened and closed by the IDE.</p> <p>Is there a way to prevent the IDE from closing Internet Explorer when st...
<p>Use the <code>Detach All</code> option from the <code>Debug</code> menu.</p>
<p>This is the way I do it: Get the URL for your project, you may have to run it once to get the port number and to start up the webserver (if you are using the built in one).</p> <p>Then open a browser session, and put your URL in.</p> <p>IF you want/need to debug, then just do an attach to process under the debug m...
35,552
<p>What program can I use to decompile a class file? Will I actually get Java code, or is it just JVM assembly code?</p> <p>On Java performance questions on this site I often see responses from people who have "decompiled" the Java class file to see how the compiler optimizes certain things.</p>
<p>Update February 2016:</p> <p><a href="http://www.javadecompilers.com/" rel="noreferrer">www.javadecompilers.com</a> lists JAD as being:</p> <blockquote> <p>the most popular Java decompiler, but primarily of this age only. Written in C++, so very fast.<br> Outdated, unsupported and does not decompile correctly ...
<p>For OSX I recommend: jarzilla or JD-GUI</p> <p>They both allow you to view jar,war,etc. file content and decompiles any class files inside of them.</p> <p>Jarzilla: <a href="https://code.google.com/p/jarzilla/" rel="nofollow noreferrer">https://code.google.com/p/jarzilla/</a><br> JD-GUI: <a href="http://jd.benow.c...
34,306
<p>PLEASE DON'T CLOSE -- IT'S PROGRAMMING-RELATED (BUT NO CODE INCLUDED)</p> <p>I develop MOSS sites, and I need to make sure my sites are compatible with IE 7,8 and FireFox. </p> <p>I have an external testing site (Windows 2003, IIS 6) and when I browse to this MOSS site, I can authenticate without any problems usin...
<p>You should try some network sniffing to see exactly what is happening over the wire. <a href="http://www.wireshark.org/" rel="nofollow noreferrer">WireShark</a> is pretty good. </p>
<p>Try using <a href="http://www.fiddlertool.com/fiddler/" rel="nofollow noreferrer">Fiddler</a> to see what status code IIS is returning to you.</p>
45,837
<p>I have a simple database:</p> <pre><code>ARTICLE ---------- ArticleId (PK), ArticleTitle ..other stuff... USER-ARTICLE ------------ ArchiveId (PK), UserId, ArticleId ..other stuff... </code></pre> <p>The <code>articleId</code>'s are foreign keys. </p> <p>I want to be able to delete a user article row by <code>Us...
<p>This may be an example of this <a href="http://connect.microsoft.com/VisualStudio/feedback/ViewFeedback.aspx?FeedbackID=351358" rel="nofollow noreferrer">bug</a>, which Microsoft says is fixed in .NET 4.0.</p>
<p>try setting ON CASCADE DELETE for <code>ArticleId</code></p>
33,188
<p>When you're adding javaDoc comments to your code and you're outlining the structure of an XML document that you're passing back, what's the best way to represent attributes? Is there a best practice for this?</p> <p>My general structure for my javaDoc comments is like this:</p> <pre><code>/** * ... * * @return...
<p>Not sure I clearly understand your question.</p> <p>My preferred solution would be to embed the schema XSD or DTC in the description of the return parameter. Your solution seems to lead to personal idioms on how to represent things like multiple elements or others. Using a standard like XSD or DTD allows you to ha...
<p>In the end, I just went with:</p> <pre><code>/** * ... * * @return XML document in the form: * * &lt;pre&gt; * &amp;lt;ROOT_ELEMENT&amp;gt; * &amp;lt;AN_ELEMENT attribute1 attribute2&amp;gt; * &amp;lt;MULTIPLE_ELEMENTS&amp;gt;* * &amp;lt;/ROOT_ELEMENT&amp;gt; * &lt;/pre&gt; */ </code></pre>
19,009
<p>I am wondering what is the key thing that helps you in GPGPU development and of course what is the constraints that you find unacceptable.</p> <p>Comes to mind for me:</p> <ul> <li>Key advantage: the raw power of these things</li> <li>Key constraint: the memory model</li> </ul> <p>What's your view?</p>
<p>I found this article to be interesting about how GPU's won't be as necessary with the speed of CPU's and # of cores ever increasing.</p> <p><a href="http://arstechnica.com/articles/paedia/gpu-sweeney-interview.ars" rel="nofollow noreferrer">http://arstechnica.com/articles/paedia/gpu-sweeney-interview.ars</a></p>
<p>Used to be interesting for their parallel architectures and extra silicon that was mostly idle and hence could be used on the side for general purpos programming tasks - </p> <p>see - <a href="http://en.wikipedia.org/wiki/CUDA" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/CUDA</a> </p> <p>but it might no...
15,109
<p>I have a reprap printer with 0.3mm nozzle. It prints quite well, I am really surprised with quality of all the surfaces and the general precision of the parts printed. BUT I HAVE a problem: when making (for example) a 10mm x 10mm x 10mm cube with a 2.8mm diameter hole from top to bottom (to fit a screw) after I prin...
<p>It's a generally accepted fact that FDM/FFF printers will have <a href="https://innovationstation.utexas.edu/tip-design/" rel="nofollow noreferrer">deviations when it comes to holes and perimeters</a>. Typically, holes print smaller than designed and external surfaces end up larger than designed.</p> <p>In your cas...
<p>For one thing, the entire part generally shrinks, as it's printed (at whatever precision of nozzle location) as molten plastic, and then cools and solidifies.</p> <p>Given that you are getting a bigger hole in the finished part, I'd start by measuring the part's actual overall outside size, as printed (is that 10mm...
568
<p>I am writing some code to determine whether a network domain is registered. For example, I want to check if "Google123.com" is available. There are at least two ways I can do this programmatically, but I'm not sure which is more valid:</p> <ul> <li>A) In linux/cygwin, I can launch the whois command to see if a doma...
<p>nslookup hits your dns server that's in your system settings. It can be behind the times or not have any dns entry. I would think the best way would be to have a tcp connection to whois.internic.net port 43 (the whois port), pass the name you want to check, and then you should get a response letting you know. If ...
<p>This will give you a quick yes/no, but if you think it is free, and you want it, try to register it, you may find it is already taken.</p>
13,233
<p>So I'm creating some HTML using javascript based on where the user clicks on the page. On page load the script replaces an empty div with a ul and some data. The user clicks on that data to receive more and so on. Now when the user navigates off the page and then hits the back button to go back to the page, IE displ...
<p>I would insert nulls to fill the holes in your matrix, something such as:</p> <pre><code>a = [[1, 2, 3], [3, 4]] # This would throw the error you're talking about # a.transpose # Largest row size = a.max { |r1, r2| r1.size &lt;=&gt; r2.size }.size # Enlarge matrix inserting nils as needed a.each { |r| r[size - 1...
<pre><code># Intitial CSV table data csv_data = [ [1,2,3,4,5], [10,20,30,40], [100,200] ] # Finding max length of rows row_length = csv_data.map(&amp;:length).max # Inserting nil to the end of each row csv_data.map do |row| (row_length - row.length).times { row.insert(-1, nil) } end # Let's check csv_data # =&gt; ...
31,216
<p>Scientific computing is algorithm intensive and can also be data intensive. It often needs to use a lot of memory to run analysis and release it before continuing with the next. Sometime it also uses memory pool to recycle memory for each analysis. Managed language is interesting here because it can allow the develo...
<p>You are asking a fundamentally flawed question. The entire point of managed languages is that you don't handle memory. That is handled by the Garbage Collector, while you can make certain actions to better allow it to do its job in an efficient manner, it is not your job to do its job.</p> <p>The things you can do ...
<p>With a managed language you don't get that control as easily. The whole point in these languages is to handle malloc, garbage, and so on. Each managed language will handle that differently.</p> <p>With Perl running out of memory is considered a fatal error. You can save the day via some small measure with $^M but t...
15,257
<p>I have a ListBox control that I want to change into having a toggle selection. i.e. Click once on an item selects it, click again it deselects it. Also, clicking another item in the list should do the default action of deselecting the previous item and selecting the new one.</p> <p>What's the best way of achieving ...
<p>What you want is a RadioButtonList. You can create one by creating an ItemDataTemplate and put a RadioButton inside it. Then you can modify the template of the RadioButton to looks like a button. </p>
<p>I would keep the standard ListBox as that way you will keep the default behaviour you want, then for deselecting an item could you just handle it in the mouse down event? i.e. use something like this:</p> <pre><code>Point newPoint = e.GetPosition(backgroundImage); HitTestResult result = VisualTreeHelper.HitTest(th...
38,681
<p>I currently filter some message from my inbox with these steps:</p> <pre><code>select inbox pick messages set \Deleted tag </code></pre> <p>and then repeat the process after selecting Trash.</p> <p>Is there a more direct way of disposing of these messages? Or is it just the feature of the Mail server that deleti...
<p>I believe you have to call EXPUNGE after setting the tag Deleted.</p> <p><a href="http://www.faqs.org/rfcs/rfc3501.html" rel="nofollow noreferrer">RFC 3501</a></p>
<p>With my mail client (thunderbird), to direct delete instead of send to trash, I hold down the Shift key along with the Delete key.</p>
15,107
<p>From what I've been able to find out, online sources recommend around 205ºC for PLA and around 240ºC for ABS. But these are only guidelines, of course. Optimal printing temperature can be different depending on the printer, the filament, the model and other slicer settings.</p> <p>For example, I've had success prin...
<h1>Printing temperature basics</h1> <p>Manufacturers generally specify a somewhat wide range of printing temperatures, and what temperature you should actually need can only be determined by trial and error:</p> <ol> <li><p>The thermistor in your hotend is not 100 % accurate and may have an offset of a few degrees com...
<ol> <li><p>Some manufacturers give a recommended temperature which would be the best place to start at and adjust from there. Otherwise you could print calibration objects and find the best temp that way. Here is a <a href="http://www.thingiverse.com/thing:915435" rel="nofollow">temp tower</a> for that purpose. Mostly...
302
<p>I'm building a site with a Flex frontend and Django backend.</p> <p>The problem I'm facing is that it's tedious to write a CRUD frontend for every model.</p> <p>I've checked out <a href="http://code.google.com/p/django-rest-interface/" rel="nofollow noreferrer">django-rest-interface</a> but it is not obvious on ho...
<p>@Matt Briggs, The DjangoAMF tutorial wasn't clear enough and I was unable to make headway there.</p> <p>I've finally gotten hold of <a href="http://www.pyamf.org/wiki/DjangoHowto" rel="nofollow noreferrer">how to use PyAMF</a> and so far, so good.</p>
<p>Asked a buddy who is doing just that, he said he uses the <a href="http://djangoamf.sourceforge.jp/index.php?UserManual_en" rel="nofollow noreferrer">DjangoAMF</a> library</p>
47,424
<p>I'm just trying to get a general idea of what views are used for in RDBMSes. That is to say, I know what a view is and how to make one. I also know what I've used them for in the past.</p> <p>But I want to make sure I have a thorough understanding of what a view is useful for and what a view shouldn't be useful fo...
<p><i>1) What is a view useful for? </i></p> <blockquote><b>IOPO</b> In One Place Only<br/><br/>&bull;Whether you consider the data itself or the queries that reference the joined tables, utilizing a view avoids unnecessary redundancy. <br/><br/>&bull;Views also provide an abstracting layer preventing direct access to...
<p>Anytime you need [my_interface] != [user_interface].</p> <p>Example:</p> <p>TABLE A:</p> <ul> <li>id</li> <li>info</li> </ul> <p>VIEW for TABLE A:</p> <ul> <li>Customer Information</li> </ul> <p>this is a way you might hide the id from the customer and rename the info to a more verbose name both at once. </p> ...
26,329
<p>I have an Asp.net Mvc site where I want to give a separate access and user interface to different clients like: <a href="http://company1.mysite.com" rel="nofollow noreferrer">http://company1.mysite.com</a><br> <a href="http://company2.mysite.com" rel="nofollow noreferrer">http://company2.mysite.com</a><br> <a href="...
<p>There are a number of things you can do. The first level, as already mentioned is to use a different CSS file. You can dynamically put in a different path to your CSS file, by creating a Helper method. So it would be used something like this:</p> <pre><code>&lt;link href="&lt;%=AppHelper.GetCSSPath("mysite.css")...
<p>You have to check the incoming URL and serve different CSS files for each one. You can use background images if you want to change images between companies.</p> <p>Other recommendations:</p> <ul> <li>Keep separate folders for different companies (and use the root for common things)</li> <li><p>If you have to disab...
43,848
<blockquote> <p><strong>Possible Duplicate:</strong><br> <a href="https://stackoverflow.com/questions/174796/watermarked-textbox-for-compact-framework">Watermarked Textbox for Compact Framework</a> </p> </blockquote> <p>Using Visual Studio 2008 SP1, the latest Compact framework and Windows Mobile 5.</p> <p>I n...
<p>Here is the Powershell way:</p> <pre><code>gci -ex "*.xyz" | ?{!$_.PsIsContainer} | ren -new {$_.name + ".txt"} </code></pre> <p>Or to make it a little more verbose and easier to understand:</p> <pre><code>Get-ChildItem -exclude "*.xyz" | WHere-Object{!$_.PsIsContainer} | Rename-Item -newname {$_.name +...
<p>Consider the DOS command FOR in a standard shell.</p> <pre><code>C:\Documents and Settings\Kenny&gt;help for Runs a specified command for each file in a set of files. FOR %variable IN (set) DO command [command-parameters] %variable Specifies a single letter replaceable parameter. (set) Specifies a set o...
31,379
<p>I am using BeautifulSoup in Python to parse some HTML. One of the problems I am dealing with is that I have situations where the colspans are different across header rows. (Header rows are the rows that need to be combined to get the column headings in my jargon) That is one column may span a number of columns abo...
<p>You've actually got a lot going on in this example.</p> <ol> <li><p>You've "over-processed" the Beautiful Soup Tag objects to make lists. Leave them as Tags.</p></li> <li><p>All of these kinds of merge algorithms are hard. It helps to treat the two things being merged symmetrically.</p></li> </ol> <p>Here's a ve...
<p>I guess I am going to answer my own question but I did receive a lot of help. Thanks for all of the help. I made S.LOTT's answer work after a few small corrections. (They may be so small as to not be visible (inside joke)). So now the question is why is this more Pythonic? I think I see that it is less denser /...
34,974
<p>Is there a way to do this without iterating through the List and adding the items to the ObservableCollection?</p>
<p>No, there is no way to directly convert the list to an observable collection. You must add each item to the collection. However, below is a shortcut to allow the framework to enumerate the values and add them for you. </p> <pre><code>Dim list as new List(of string) ...some stuff to fill the list... Dim observable a...
<pre><code>ObservableCollection&lt;yourobjectname&gt; result = new ObservableCollection&lt;yourobjectname&gt;(yourobjectlist); </code></pre>
30,200
<p>I've been adding css support for <strong>handheld</strong> to my website but haven't been able to find a good tool for testing. </p> <p>I tried using the webdeveloper plugin for Firefox but it doesn't work for me. Maybe that is because all my css is in the html and not a seperate css file.</p> <p>Are there any oth...
<p>With a bit of hunting I found what I was looking for, thanks for the leads guys.</p> <p>Opera will display the <strong>handheld</strong> css if you select "Small Screen" from the View menu.</p>
<p>For testing the iPhone, you can get the iPhone SDK <a href="http://developer.apple.com/iphone/program/download.html" rel="nofollow noreferrer">here</a> But you need OS X / Apple computer for it to run the official way.</p> <p>Not official/hacks:</p> <ul> <li>There are ways to get OS X running on standart PC hardw...
32,395
<p>I have a dump of a windows service i made. The exception is that my code can't move a file (for some reason). Now, in my code there's a number of places where i move files around the filesystem. So, using Windbg, i'm trying to see the code where the exception occurs.</p> <p>here's my !clrstack dump..</p> <pre><cod...
<p>Firefox does not carry over tags, attributes or CSS styles it does not understand from the code to the DOM. That is by design. Javascript only has access to the DOM, not the code. So no, there is no way to access a property from javascript that the browser itself does not support.</p>
<p>Maybe you can try with <a href="http://lesscss.org/" rel="nofollow">LESS</a>. It's The Dynamic Stylesheet language and you can create non-standard css attributes, commands that will compile later.</p>
31,098
<p>We have some really old code that calls WebServices using behaviours (webservice.htc), and we are having some strange problems... since they've been deprecated a long time ago, I want to change the call.</p> <p>What's the correct way of doing it? It's ASP.NET 1.1</p>
<p>You should be able to generate a proxy class using wsdl.exe. Then just use the web service as you normally would.</p>
<p>While I'm not 100% sure what the Web Service behavior does, I recall it allows client-side script to call Web Services, which would make AJAX it's contemporary replacement.</p> <p>Since you're using .NET 1.1 how about using <a href="http://www.ajaxpro.info" rel="nofollow noreferrer">Ajax.NET Professional</a> to con...
5,541
<p>Short of putting a UIWebView as the back-most layer in my nib file, how can I add a repeating background image to an iPhone app (like the corduroy look in the background of a grouped UITableView)?</p> <p>Do I need to create an image that's the size of the iPhone's screen and manually repeat it using copy and paste?...
<p>Apparently a UIColor is not necessarily a single color, but can be a pattern as well. Confusingly, this is not supported in Interface Builder. </p> <p>Instead you set the backgroundColor of the view (say, in -viewDidLoad) with the convenience method +colorWithPatternImage: and pass it a UI Image. For Instance:</p> ...
<p>You should use colorWithPatternImage</p>
27,741
<p>At my house I have about 10 computers all different processors and speeds (all x86 compatible). I would like to cluster these. I have looked at openMosix but since they stopped development on it I am deciding against using it. I would prefer to use the latest or next to latest version of a mainstream distribution of...
<p>I recently set up an OpenMPI cluster using Ubuntu. Some existing write up is at <a href="https://wiki.ubuntu.com/MpichCluster" rel="nofollow noreferrer">https://wiki.ubuntu.com/MpichCluster</a> .</p>
<p>I think he's looking for something similar with openMosix, some kind of a general cluster on top of which any application can run distributed among the nodes. AFAIK there's nothing like that available. MPI based clusters are the closest thing you can get, but I think you can only run MPI applications on them.</p>
10,260
<p>I have a CGI-script which produces a <code>.pdf</code> file from the HTML page. My problem is that when it is launched from the Web Browser, there is no creation of the <code>.pdf</code> document.</p> <p>What I have done so far:</p> <ul> <li>chmod settings set to above recommended (777)</li> <li>tested normal outp...
<p>i'm going to take a guess here and say..</p> <p>you don't need a static directory.</p> <p>I think what you need is to get the 'base directory' programatically.</p> <pre> NSString *docsDirectory = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0]; NSString *path = [d...
<p>If you simply relaunch the app from within the simulator springboard it will keep using the same directory. If you rebuild the app in Xcode it will move, and there is no way to prevent that. Xcode should migrate any data you have from the old directory to the new directory when it installs the new build.</p>
34,157
<p>I have set up a repository using SVN and uploaded projects. There are multiple users working on these projects. But, not everyone requires access to all projects. I want to set up user permissions for each project.</p> <p>How can I achieve this?</p>
<p>In your <strong>svn\repos\YourRepo\conf</strong> folder you will find two files, <strong>authz</strong> and <strong>passwd</strong>. These are the two you need to adjust.</p> <p>In the <strong>passwd</strong> file you need to add some usernames and passwords. I assume you have already done this since you have peopl...
<p>Apache Subversion supports <a href="https://www.visualsvn.com/support/svnbook/serverconfig/pathbasedauthz/" rel="nofollow noreferrer">path-based authorization</a> that helps you configure granular permissions for user and group accounts on paths in your repositories (files or directories). Path-based authorization s...
10,702
<p>Suppose one had inherited a complex codebase (in Visual C++, assume 2003 or perhaps later) with a large and complex inheritance graph. Suppose it's deep, and there's lots of virtual functions and possibly even multiple inheritance as well. (Yes, a bit of a maintenance nightmare). Any attempt to refactor this class h...
<p>With Visual Studio 2005 there are two undocumented flags that does exactly what you need. They are the <strong>reportAllClassLayout</strong> and <strong>reportSingleClassLayout</strong> flags. For example try "/d1 reportAllClassLayout" on the cl.exe commandline. It will show you the full class layout including vi...
<p>I would highly recommend using <a href="http://www.doxygen.org/" rel="nofollow noreferrer">Doxygen</a> as a tool for any sort of code analysis like this. I don't think it has a quick way to find the final overrider for any function in a type, but it should provide a listing of what is inherited and what is implement...
38,836
<p>I've got a bunch of FoxPro (VFP9) DBF files on my Ubuntu system, is there a library to open these in Python? I only need to read them, and would preferably have access to the memo fields too.</p> <p><strong>Update</strong>: Thanks @cnu, I used Yusdi Santoso's <a href="http://www.physics.ox.ac.uk/users/santoso/dbf....
<p>You can try this <a href="http://code.activestate.com/recipes/362715/" rel="nofollow noreferrer">recipe on Active State</a>. </p> <p>There is also a <a href="http://code.google.com/p/lino/source/browse/lino/utils/dbfreader.py" rel="nofollow noreferrer">DBFReader module</a> which you can try.</p> <p>For support for...
<p>If you're still checking this, I have a GPL FoxPro-to-PostgreSQL converter at <a href="https://github.com/kstrauser/pgdbf" rel="noreferrer">https://github.com/kstrauser/pgdbf</a> . We use it to routinely copy our tables into PostgreSQL for fast reporting.</p>
5,827
<p>I'm taking my first crack at <a href="http://en.wikipedia.org/wiki/Ajax_%28programming%29" rel="noreferrer">Ajax</a> with jQuery. I'm getting my data onto my page, but I'm having some trouble with the JSON data that is returned for Date data types. Basically, I'm getting a string back that looks like this:</p> <pre...
<p><code>eval()</code> is not necessary. This will work fine:</p> <pre><code>var date = new Date(parseInt(jsonDate.substr(6))); </code></pre> <p>The <code>substr()</code> function takes out the <code>/Date(</code> part, and the <code>parseInt()</code> function gets the integer and ignores the <code>)/</code> at the end...
<p>Your JSON should probably be returning an object of some sort (well, a string representation thereof).</p> <pre><code>"{ myDate : Date(1224043200000) }" </code></pre> <p>Using jQuery, you can access your data object this way:</p> <pre><code>$.get( "myJSONFile.php", function (data) { // data.myDate...
25,282
<p>I have an XPath expression which provides me a sequence of values like the one below:</p> <p><code>1 2 2 3 4 5 5 6 7</code></p> <p>This is easy to convert to a sequence of unique values <code>1 2 3 4 5 6 7</code> using <code>distinct-values()</code>. However, what I want to extract is the list of duplicate values = ...
<p><strong>Use this simple XPath 2.0 expression</strong>:</p> <pre><code>$vSeq[index-of($vSeq,.)[2]] </code></pre> <p>where <code>$vSeq</code> is the sequence of values in which we want to find the duplicates.</p> <p><strong>For explanation of how this "works", see</strong>:</p> <p><strong><a href="http://dnovatche...
<p>Calculate the difference between your original set and the set of distinct values. This is the set of numbers that occur more than once. Note that numbers in this result set are not necessarily distinct if they occur more than twice in the original sequence so convert again to a set of distinct values if this is req...
16,113
<p>Using a thermoplastic MDF printer with a 0.4mm extruder nozzle, I frequently have trouble with the nozzle getting clogged.</p> <p>I am not sure what's causing the clog, but my guesses are dust and/or burnt filament (from leaving the hot end on without extruding).</p> <p>What can I do to prevent, or at least minimi...
<p>Different types of hotends and extruders can lead to different problems associated with clogging. Based on my personal experience the leading causes of clogs and jams are the following</p> <ol> <li>Foreign material in the nozzle (dirt, dust, low quality filament)</li> <li>Mixing materials in the hotend (running ABS...
<p>First, you don't.</p> <p>To reduce the likelyhood, use good plastics without contaminations. </p> <p>Do not over heat the plastic, causes faster carbon build up.</p> <p>Buy hand drills, mini drills to clear it.</p> <p>Don't switch materials around a lot. Low temp plastic residue will cook when you switch to high...
132
<p>Does anyone know of a better GUI client for displaying Windows <a href="http://support.microsoft.com/kb/248345" rel="nofollow noreferrer">System Monitor</a> log files? (System Monitor is sometimes called <a href="http://support.microsoft.com/?kbid=330138" rel="nofollow noreferrer">Performance Monitor</a>.) I'm tryin...
<p>See <a href="https://stackoverflow.com/questions/37425/what-is-the-best-way-to-interpret-perfmon-analysis-into-application-specific-ob#158314">this</a> question.</p> <p>The PAL tool does a nice job of creating an HTML report with charts and graphs. By creating your own Threshold file you can control what goes into ...
<p>One of the tricks that I have used in the past is to use performance/system monitor to log this data to a SQL database. SQL Expression can work great for this. Then you can generate reports using Reporting Services or for the more adventurous types you can do some cube analysis with Analysis Services. So while this ...
29,125
<p>I'm trying to use a .NET assembly from VB6 via interop without placing it in the GAC and without using the /codebase argument for regasm.exe.</p> <p>From what I understand, when I run regasm.exe on a .NET class library, it creates a registry entry for each class in the class library telling the COM clients they sho...
<p>From <a href="http://msdn.microsoft.com/en-us/library/tzat5yw6(VS.80).aspx" rel="nofollow noreferrer">MSDN</a>:</p> <blockquote> <p><strong>/Codebase</strong> : Creates a Codebase entry in the registry. The Codebase entry specifies the file path for an assembly that is not installed in the global assembly ...
<p>To achieve what you want, I think you need to create .manifest files for both your .NET assembly and your VB6_App.EXE (referencing the .NET assembly). Check Google for registration-free COM.</p>
30,026
<p>After installing VMware Server I get the following error when I try to access the VMware web-based server manager:</p> <blockquote> <p>The VMware Infrastructure Web Service at "<a href="http://localhost:8222/sdk" rel="nofollow noreferrer">http://localhost:8222/sdk</a>" is not responding</p> </blockquote>
<p>Go into the services manager and check that the <strong>'VMware Host Agent'</strong> service is running. If not, then start it and then try browsing to the site again.</p>
<p>Try accessing via "<a href="http://localhost:8222" rel="nofollow noreferrer">http://localhost:8222</a>" without the /sdk. You can also try the secure site via "<a href="https://localhost:8333" rel="nofollow noreferrer">https://localhost:8333</a>".</p>
18,228
<p>My colleague has written a DLL which drives Excel.<br /> When I reference his DLL in my .NET app, I get a warning:</p> <pre><code>The dependency 'Microsoft.Office.Interop.Excel' could not be found. </code></pre> <p>My app will compile.<br /> However, when I get to the bit that uses my colleague's DLL to access Exce...
<p>You may need to install the <a href="https://msdn.microsoft.com/en-us/library/aa302338.aspx" rel="nofollow noreferrer">Primary Interop Assemblies</a> for Office, which can be downloaded from <a href="https://www.microsoft.com/en-us/download/details.aspx?id=3508" rel="nofollow noreferrer">Here.</a> Depending on the ...
<p>I had the same problem trying to run the "official" F# samples on CodePlex. Projects were referencing interop V11. I removed the references and went to add them again, noticing I had V9, V12 and V14. I added V12 and everything worked fine without any further changes.</p> <p>Something you might want to try before in...
36,071
<p>I am planning to develop an operating system for the x86 architecture.</p> <ul> <li>What options of programming languages do I have?</li> <li>What types of compilers are there available, preferably on a Windows environment? </li> <li>Are there any good sources that will help me learn more about operating system dev...
<p>For my final year project in collage I developed a small x86 OS with a virtual memory manager, a virtual file system and fully preemptive multitasking. I made it open source and the code is heavily commented, check out its source forge page at: </p> <p><a href="https://github.com/stephenfewer/NoNameOS" rel="norefer...
<p>If you want write an OS then you need a couple of people. A OS can not write a single people. I think it is better to work on existing OS projects</p> <ul> <li><a href="http://www.reactos.org" rel="nofollow noreferrer">Reactos</a> --> C, Assembler</li> <li><a href="http://www.reactos.org" rel="nofollow noreferrer">...
15,796
<p>Question says it all really...</p> <p>I have tried changing the "Allow non-admin users to run this program" setting on the property pages, and have also given the non-admin user in question what looks like the correct privileges in Component Services -> DCOM Config.</p> <p>Is there anything else I can do ?</p> <p...
<p><a href="http://support.microsoft.com/kb/183607" rel="nofollow noreferrer">http://support.microsoft.com/kb/183607</a></p>
<p>I saw your question a few days ago, but didn't answer because all I have is something for you to try. I expected someone else with knowledgeable answer to respond, but since you still have no answers I'll tell you the little bit I know. When our tech support department installs our app onto a computer running XP or ...
38,284
<p>Currently I am setting up an application that can deploy other web apps to Tomcat 6 clusters. It is set up right now to have a one to one relationship between deployed web application and a cluster. My current reasoning for this is so that I can change the JVM args of the Tomcat server without disrupting other app...
<p>Divide your services by resource requirements at the very least. For example, if you are running a photo album site, separate your image download server from your image upload server. The download server will have many more requests, and because most people have a lower upload speed the upload server will have longe...
<p>Divide your services by resource requirements at the very least. For example, if you are running a photo album site, separate your image download server from your image upload server. The download server will have many more requests, and because most people have a lower upload speed the upload server will have longe...
5,017
<p>I've used the Views Theming Wizard to output a template and it gave me the following chunk of code to go in template.php.</p> <p>I'd prefer to just maintain the one template, so all my functions will be calling the same one, and rather than writing numerous versions of the same function, I'm wondering if there's a ...
<p>You could just have the templates you need call one version of the actual function.</p> <p>Something like:</p> <pre><code>function phptemplate_views_view_list_recent_articles($view, $nodes, $type){ actual_template_function($view, $nodes, $type); } function phptemplate_views_view_list_popular_articles($v...
<p>One correction above that slowed me down for a 1/2 hour... your need to include a return:</p> <pre><code>return actual_template_function($view, $nodes, $type); </code></pre> <p>Other than that, works great.</p>
45,775
<p>Anyone have any idea how to get the value of "Language for Non-Unicode Programs" in Control Panel Regional Settings programmatically using c#?</p> <p>Already tried CultureInfo, RegionInfo and getting the default encoding using the Encoding object, but I can only get the Standards and Formats value or the main code ...
<p><a href="https://msdn.microsoft.com/en-us/library/dd318122(v=vs.85).aspx" rel="nofollow noreferrer">GetSystemDefaultLocaleName</a> or <a href="https://msdn.microsoft.com/en-us/library/dd318121(v=vs.85).aspx" rel="nofollow noreferrer">GetSystemDefaultLCID</a> (and its <a href="http://pinvoke.net/default.aspx/kernel32...
<p>IIRC, <code>Thread.CurrentUICulture</code> gets that value.</p>
26,767
<p>like whether it is pentium or AMD etc. </p>
<p><strong>Please note that this is from VS2003:</strong></p> <pre><code>using(ManagementObjectSearcher win32Proc = new ManagementObjectSearcher("select * from Win32_Processor"), win32CompSys = new ManagementObjectSearcher("select * from Win32_ComputerSystem"), win32Memory = new ManagementObjectSe...
<p><strong>This code will get CPU properties</strong></p> <pre><code>Imports System.Management Private Sub InsertInfo() lstView.Items.Clear() Dim searcher As New ManagementObjectSearcher("select * from Win32_Processor") Try For Each share As ...
44,222
<p>I have tested all my systems developed in Delphi (in Windows XP) on Wine (OpenSuse Linux) and they work perfectly. My question is: should I start distributing my systems (on a local basis that I can support) as Wine ready or are there other issues I should take into account?</p>
<p>You could do what Google does and package Wine with the application. That way there's no fear that Wine will change something in the future and prevent your app from working.</p>
<p>I would post a notice that your application has been certified to work with WINE version whatever, and that it may or may not work with other versions of WINE. You should consider testing your application with the beta and rc versions of wine to ensure they will remain compatible during release cycles.</p> <p>It is...
24,713
<p>I have read around 4-5 books on design patterns, but still I don't feel I have come closer to intermediate level in design patterns? </p> <p>How should I go studying design patterns?</p> <p>Is there any good book for design patterns?</p> <p>I know this will come only with experience but there must be some way ...
<p>The best way is to begin coding with them. Design patterns are a great concept that are hard to apply from just reading about them. Take some sample implementations that you find online and build up around them.</p> <p>A great resource is the <a href="http://web.archive.org/web/20110216121401/http://www.dofactory....
<p>I would think it is also difficult to study design patterns. You have to know more about OOP and some experiences with medium to big application development. For me, I study as a group of developers to make discussion. We follow <a href="http://www.industriallogic.com/papers/learning.html" rel="nofollow noreferrer">...
40,660
<p>I need to parse <a href="https://www.rfc-editor.org/rfc/rfc3339" rel="noreferrer">RFC 3339</a> strings like <code>&quot;2008-09-03T20:56:35.450686Z&quot;</code> into Python's <code>datetime</code> type.</p> <p>I have found <a href="https://docs.python.org/library/datetime.html#datetime.datetime.strptime" rel="norefe...
<h1><code>isoparse</code> function from <em>python-dateutil</em></h1> <p>The <a href="https://pypi.python.org/pypi/python-dateutil" rel="nofollow noreferrer"><em>python-dateutil</em></a> package has <a href="https://dateutil.readthedocs.io/en/stable/parser.html#dateutil.parser.isoparse" rel="nofollow noreferrer"><code>...
<pre><code>def parseISO8601DateTime(datetimeStr): import time from datetime import datetime, timedelta def log_date_string(when): gmt = time.gmtime(when) if time.daylight and gmt[8]: tz = time.altzone else: tz = time.timezone if tz &gt; 0: ...
15,556
<p>Are square brackets in URLs allowed?</p> <p>I noticed that <a href="http://hc.apache.org/httpclient-3.x/index.html" rel="noreferrer">Apache commons HttpClient</a> (3.0.1) throws an IOException, wget and Firefox however accept square brackets.</p> <p>URL example:</p> <pre><code>http://example.com/path/to/file[3].h...
<p><a href="http://www.ietf.org/rfc/rfc3986.txt" rel="noreferrer">RFC 3986</a> states</p> <blockquote> <p>A host identified by an Internet Protocol literal address, version 6 [RFC3513] or later, is distinguished by enclosing the IP literal within square brackets ("[" and "]"). This is the only place where...
<p>Best to URL encode those, as they are clearly not supported in all web servers. Sometimes, even when there is a standard, not everyone follows it.</p>
6,179
<p>The ASP.NET ViewState feature can sometimes be a double edged sword. I rely on it on most of my projects and it speeds up development considerably.</p> <p>My problem is that sometimes users will try to refresh a page which will cause the viewstate to be lost, other times the user might want to bookmark a page but w...
<p>My 2 cents: Instead of using the simplicity of <strong>ViewState</strong> sandbag use the simplicity of <strong>Session</strong> - which really is the same simplicity and you won't have to bother worrying about page refresh and stuff. Moreover session is way more flexible since you can use it to store more than jus...
<p>This might not be an elegant solution, but I think if you change the form method to GET it solves both your bookmarking problem and refresh one. </p> <p>It's <em>the same</em> as using query strings, but with the abstraction of VIEWSTATE left untouched.</p>
45,596
<p>If I spawn a new thread, and then within it I push a new controller onto my UINavigationController, using code like this...</p> <p>(a) not working</p> <pre><code>-(void)myCallbackInThread { // move on... UIApplication* app = [UIApplication sharedApplication]; [app changeView]; } </code></pre> <p>then ...
<p>In your case, it really depends on what's happening in [app changeView], but the reason it stops responding is most likely that you have no run loop dispatching events on your new, secondary thread (more on this below). In general, however, it is a very bad idea to update the GUI from a secondary thread. As you've a...
<p>Almost none of the UI code in UIKit or AppKit is threadsafe. How it fails is irrelevent, because if you are worrying about how it fails you are doing something that is going to result in all sorts of weird bugs that will subtly change between different OS release anyway.</p> <p>My best advice is to not use things f...
20,229
<p>From within a DLL that's being called by a C#.NET web app, how do you find the base url of the web app?</p>
<p>Will this work?</p> <pre><code>HttpContext.Current.Request.Url </code></pre> <p>UPDATE:</p> <p>To get the base URL you can use:</p> <pre><code>HttpContext.Current.Request.Url.GetComponents(UriComponents.SchemeAndServer, UriFormat.Unescaped) </code></pre>
<p>You can use Assembly.GetExecutingAssembly() to get the assembly object for the DLL.</p> <p>Then, call Server.MapPath, passing in the FullPath of that Assembly to get the local, rooted path.</p>
23,858
<p>There's something very unsatisfactory about this code:</p> <pre><code>/* Given a command string in which the first 8 characters are the command name padded on the right with whitespace, construct the appropriate kind of Command object. */ public class CommandFactory { public Command getCommand(String cmd) { ...
<p>Your map of strings to commands I think is good. You could even factor out the string command name to the constructor (i.e. shouldn't StartCommand know that its command is "START"?) If you could do this, instantiation of your command objects is much simpler:</p> <pre><code>Class c = commandMap.get(cmdName); if (...
<p>At the very least, your command should have a getCommandString() -- where StartCommand overrides to return "START". Then you can just register or discover the classes.</p>
14,055
<p>Excuse me if I'm off on my terminology, I only have around 2.4 years of programming experience, mostly in .NET.</p> <p>Currently I'm one of two .NET developers in a mainframe shop, the other developer set the standards and is a great coder with a lot more experience plus a CS degree(I am 100% self taught). </p> <p...
<p>When it comes to optimising and collections you should first look at algorithmic complexity.</p> <p>A simple example is - if you have a list of objects, and you are constantly looking stuff up in that list, and it gets quite large, then you'll probably be better off using a Dictionary instead. Dictionary lookups ha...
<p>I have recently collected a number of situations (and benchmarks) where the use of custom collections may be valuable. It is not directly related to .NET but, however, its a rather general consideration and may be helpful to decide what collection better fits the particular problem.</p> <p><a href="http://sibirjak....
30,987
<p>I met strange issue during designing winform. I placed a few controls inside toolstripcontainer and now I cannot delete them. It's also impossible to delete whole Toolstripcontainer. I'm using Visual Studio 2008 SP1 plus some extra patches. Is it a bug in Visual Studio? Is there any workaround? Or I'm lacking of kno...
<p>Try closing the designer, clean your solution and reopen the designer window?</p>
<p>Can you go in the .Designer.Cs and delete line manually?</p>
39,763
<p>I use Assert.Fail a lot when doing TDD. I'm usually working on one test at a time but when I get ideas for things I want to implement later I quickly write an empty test where the name of the test method indicates what I want to implement as sort of a todo-list. To make sure I don't forget I put an Assert.Fail() in ...
<p>For this scenario, rather than calling Assert.Fail, I do the following (in C# / NUnit)</p> <pre><code>[Test] public void MyClassDoesSomething() { throw new NotImplementedException(); } </code></pre> <p>It is more explicit than an Assert.Fail.</p> <p>There seems to be general agreement that it is preferable to...
<p>If you're writing a test that just fails, and then writing the code for it, then writing the test. This isn't Test Driven Development.</p> <p>Technically, Assert.fail() shouldn't be needed if you're using test driven development correctly.</p> <p>Have you thought of using a Todo List, or applying a GTD methodology...
14,672
<p>Does anyone know how to implement the standard bubble message that warns users whenever Caps Lock is enabled and a password control has focus? Is this built into the .NET framework, or do I need to write my own class to do this?</p>
<p>This is an old question, and already answered, but I came across this same problem and I first started with <code>Keyboard.IsKeyToggled(Key.CapsLock)</code> but that returned <code>false</code> if Caps Lock was set prior to the application running. So I found another solution that works perfectly.</p> <pre><code>Co...
<p>If you use a MaskedTextBox and specify a passwordChar the .NET framework will automatically do this for you</p>
41,569
<p>I have found that my HTML is, to be honest, very clunky. Small, simple pages are OK. But there comes a point when between indenting and the kinds of tags I have, it's impossible to keep lines short. Is there a W3C (or otherwise "official" or well accepted) formatting guide for clean, maintainable HTML? If not, what ...
<p>My advice is to not even worry about it. HTML and XML, unlike most languages, are almost trivial to re-indent to any style the programmer wants. In HTML I use width-2 tabs, and regularly have sections that run off the edge of the editor window. There's not really any way to avoid that unless you just skip indenting ...
<p>I just indent properly and don't worry about line length.</p> <p>If you are using a templating system then you don't have any content in the view anyway, so the lines will only have variables and tags.</p> <p>Basically keep as much out of the HTML as possible and it's less of a problem.</p>
22,878
<p>I was discussing multiple inheritance vs. single inheritance with a friend of mine, and discovered that plainly, my conception of Object-Oriented design is completely different than his. I am mostly an Obj-C programmer, so Multiple Inheritance is not something I use daily. He is mostly a C++ programmer under Window...
<p>The parents are also humans, which are part of the family of creatures called mammals. Your thoughts seem most logical to me.</p> <pre><code>public class Human extends Mammal implements HunterGatherer, Speech, CognitiveThought { public Human(Human mother, Human father) { super(mother, father); ...
<p>Well I think the parents are also human. So parents is a property of Human. It has nothing to do with OOP inheritance. It may do so if you are referring to types of human as represented by race such as Caucasian extends Human</p>
42,244
<p>I've installed passenger a little while back and when I restarted my mac tonight, Apache2 won't start.</p> <p>Here is what I get. </p> <p>Anyone have any ideas? Re-install Apache2?</p> <pre><code>dyld: Library not loaded: /usr/lib/libaprutil-1.0.dylib Referenced from: /usr/sbin/httpd Reason: no suitable image...
<p>Looks like the module was compiled for the wrong architecture. As trivial as it might seem, try uninstalling passenger to see whether this was the problem and then try to reinstall it.</p>
<p>Sounds like that module isn't installed correctly. Try disabling it in your apache configuration (in /etc/apache2/)</p>
43,585
<p>Some questions about Function Points:</p> <p>1) Is it a reasonably precise way to do estimates? (I'm not unreasonable here, but just want to know compared to other estimation methods)</p> <p>2) And is the effort required worth the benefit you get out of it? </p> <p>3) Which type of Function Points do you use?</...
<p>Mike Cohn in his <a href="https://rads.stackoverflow.com/amzn/click/com/0131479415" rel="noreferrer" rel="nofollow noreferrer">Agile Estimating and Planning</a> consider FPs to be great but difficult to get right. He (obviously) recommends to use story points-based estimation instead. I tend to agree with this as wi...
<ol> <li>No because any particular requirement can have an arbitrary amount of effort based on how precise (or imprecise) the author of the requirement is, and the level of experience of the function point assessor.</li> <li>No because administration of imprecise derivations of abstract functionality yield no reliable ...
14,362
<p>Before I start, I know there is this post and it doesn't answer my question: <a href="https://stackoverflow.com/questions/3017/how-to-generate-getters-and-setters-in-visual-studio">How to generate getters and setters in Visual Studio?</a></p> <p>In Visual Studio 2008 there is the ability to auto generate getters an...
<p>Sorry, you really need to install <a href="http://www.jetbrains.com/resharper/download/" rel="nofollow noreferrer">Resharper</a> to get approximately the same amount of refactoring support as you are used to in Eclipse.</p> <p>However, Resharper gives you a dialog very similar to the one you are used to in Eclipse:...
<p>Possibly a macro. There are also addins (like ReSharper, which is great but commercial) capable of doing that quickly.</p>
11,140
<p>I am using 3D maths in my application extensively. How much speed-up can I achieve by converting my vector/matrix library to SSE, AltiVec or a similar SIMD code?</p>
<p>In my experience I typically see about a 3x improvement in taking an algorithm from x87 to SSE, and a <em>better</em> than 5x improvement in going to VMX/Altivec (because of complicated issues having to do with pipeline depth, scheduling, etc). But I usually only do this in cases where I have hundreds or thousands...
<p>Most likely you will see only very small speedup, if any, and the process will be more complicated than expected. For more details see <a href="http://www.farbrausch.de/~fg/articles/ubiquitous_sse_vector.html" rel="nofollow noreferrer">The Ubiquitous SSE vector class</a> article by Fabian Giesen.</p> <blockquote> ...
14,058
<p>If you develop for ATG Dynamo, how do you structure your modules and dependencies?</p> <p>How do you structure the projects? source directories, JARs configs etc.</p> <p>How do you build and deploy? What tools do you use?</p>
<p>We have a monolithic architecture with a single ATG module. We originally developed this site with JHTML and have since created a (monolithic) J2EE web app within this ATG module and converted all of our JHTML to JSP.</p> <p>Our project on disk looks like this:</p> <pre><code>root deploy class (compile java ...
<p>Here is the layout that we use:</p> <p>root<br> &nbsp;src (java src)<br> &nbsp;test/src (unit test)<br> &nbsp;build (directory created by ant)<br> &nbsp;&nbsp;&nbsp;classes<br> &nbsp;&nbsp;&nbsp;config<br> &nbsp;&nbsp;&nbsp;javadoc<br> &nbsp;&nbsp;&nbsp;lib<br> &nbsp;&nbsp;&nbsp;liveconfig<br> &nbsp;buildlib (libra...
25,184
<p>Good morning, afternoon, evening or night (depending on your timezone).</p> <p>This is just a general question about XML commenting within C#. I have never been very big into commenting my programs, I've always been more of a verbose variable/property/method namer and letting the code speak for itself. I do write c...
<p>Personally, we make sure that every public and protected method has XML comments. It also will provide you with Intellisense, and not just end-user help documentation. In the past, we also have included it on privately scoped declarations, but do not feel it is 100% required, as long as the methods are short and o...
<p>We document the public methods/properties/etc on our libraries. As part of the build process we use NDoc to create an MSDN-like web reference. It's been very helpful for quick reference and lookup.</p> <p>It's also great for Intellisense, especially with new team members or, like you said, when the original author ...
46,407
<p>I'm trying to assert that one object is "equal" to another object. </p> <p>The objects are just instances of a class with a bunch of public properties. Is there an easy way to have NUnit assert equality based on the properties?</p> <p>This is my current solution but I think there may be something better:</p> <pre...
<p>Override .Equals for your object and in the unit test you can then simply do this:</p> <pre><code>Assert.AreEqual(LeftObject, RightObject); </code></pre> <p>Of course, this might mean you just move all the individual comparisons to the .Equals method, but it would allow you to reuse that implementation for multipl...
<p>Stringify and compare two strings</p> <p>Assert.AreEqual(JSON.stringify(LeftObject), JSON.stringify(RightObject))</p>
41,120
<pre><code>Imports System.Data.OleDb Public Class Log Private mConnectionString As String = "Provider=OraOLEDB.Oracle;Data Source=(DESCRIPTION=(CID=GTU_APP)(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=xxx)(PORT=1521)))(CONNECT_DATA=(SID=xxx)(SERVER=DEDICATED)));User Id=xxx;Password=xxx;" Dim ds As New DataSet ...
<p>I've had fairly good luck with the <a href="http://www.oracle.com/technology/tech/oci/instantclient/index.html" rel="nofollow noreferrer">Oracle Instant Client</a> and <a href="http://www.oracle.com/technology/tech/windows/odpnet/index.html" rel="nofollow noreferrer">ODP.NET</a>, which is pretty much a straight XCOP...
<p>I'm pretty certain you have to install the Oracle provider in order for this to work. OleDb can easily connect to SQL Server and Access and so on, but only because these providers come pre-installed in Windows.</p> <p>I think your only option (other than installing the Oracle provider on every machine) is to creat...
47,533
<p>While HTML Scraping is pretty well-documented from what I can see, and I understand the concept and implementation of it, what is the best method for scraping from content that is tucked away behind authentication forms. I refer to scraping from content that I legitimately have access to, so a method for automatical...
<p>Check out the Perl <a href="http://search.cpan.org/~petdance/WWW-Mechanize-1.34/lib/WWW/Mechanize.pm" rel="nofollow noreferrer">WWW::Mechanize</a> library - it builds on LWP to provide tools for doing exactly the kind of interaction you refer to, and it can maintain state with cookies while you're about it!</p> <bl...
<p>Yes, you can use other libraries for your own language if it other than asp.net.</p> <p>For example, in Java you can use <a href="http://hc.apache.org/httpclient-3.x/" rel="nofollow noreferrer">httpclient</a> or <a href="http://httpunit.sourceforge.net/index.html" rel="nofollow noreferrer">httpunit</a> (that even h...
23,109
<ul> <li>What is it?</li> <li>How do I implement connection pooling with MS SQL?</li> <li>What are the performance ramifications when</li> <ul> <li>Executing many queries one-after-the other (i.e. using a loop with 30K+ iterations calling a stored procedure)?</li> <li>Executing a few queries that ...
<p>Connection pooling is a mechanism to re-use connections, as establishing a new connection is slow.</p> <p>If you use an MSSQL connection string and System.Data.SqlClient then you're already using it - in .Net this stuff is under the hood most of the time.</p> <p>A loop of 30k iterations might be better as a server...
<p>Your question was also partially answered by <a href="https://stackoverflow.com/questions/8223/connection-pooling-in-netmssql">this thread</a>. A search would have revealed this.. The definition of Connection Pooling, of which a <a href="http://www.google.com/search?q=connection+pooling" rel="nofollow noreferrer">Go...
3,063
<p>This is the constraint I have on the Customers table.</p> <pre><code>ALTER TABLE Customers ADD CONSTRAINT CN_CustomerPhone CHECK (Phone LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]') </code></pre> <p>Why does this fail?</p> <pre><code>INSERT INTO Customers (CustomerName, Address, City, Sta...
<p>Check the length of the Phone field.<br> Is it 15 or more characters?</p> <p>Using your code with a temp table here<br></p> <pre> <code> create table #temp (phone varchar(15)) ALTER TABLE #temp ADD CONSTRAINT CN_CustomerPhone CHECK (Phone LIKE '([0-9][0-9][0-9]) [0-9][0-9][0-9]-[0-9][0-9][0-9][0-9]') INS...
<p>I'm an idiot, the field was declared as an nchar, and I didn't' take the padding spaces into account.</p>
24,312
<p>I thought this would be really simple, but it's presenting some difficulties. If I have</p> <pre><code>std::string name = &quot;John&quot;; int age = 21; </code></pre> <p>How do I combine them to get a single string <code>&quot;John21&quot;</code>?</p>
<p>In alphabetical order:</p> <pre><code>std::string name = &quot;John&quot;; int age = 21; std::string result; // 1. with Boost result = name + boost::lexical_cast&lt;std::string&gt;(age); // 2. with C++11 result = name + std::to_string(age); // 3. with FastFormat.Format fastformat::fmt(result, &quot;{0}{1}&quot;, ...
<p>There is a function I wrote, which takes the int number as the parameter, and convert it to a string literal. This function is dependent on another function that converts a single digit to its char equivalent:</p> <pre><code>char intToChar(int num) { if (num &lt; 10 &amp;&amp; num &gt;= 0) { return ...
23,288
<p>Newish to Oracle programming (from Sybase and MS SQL Server). What is the "Oracle way" to avoid filling the trans log with large updates?</p> <p>In my specific case, I'm doing an update of potentially a very large number of rows. Here's my approach:</p> <pre><code>UPDATE my_table SET a_col = null WHERE my_table_...
<p>The amount of updates to the redo and undo logs will not at all be reduced if you break up the UPDATE in multiple runs of, say 1000 records. On top of it, the total query time will be most likely be higher compared to running a single large SQL.</p> <p>There's no real way to address the UNDO/REDO log issue in UPDAT...
<p>Any UPDATE is going to generate redo. Realistically, a single UPDATE that updates all the rows is going to generate the smallest total amount of redo and run for the shortest period of time.</p> <p>Assuming you are updating the vast majority of the rows in the table, if there are any indexes that use A_COL, you ma...
24,322
<p>I've got a ant <code>build.xml</code> that uses the <code>&lt;copy&gt;</code> task to copy a variety of xml files. It uses filtering to merge in properties from a <code>build.properties</code> file. Each environment (dev, stage, prod) has a different <code>build.properties</code> that stores configuration for that...
<p>If you are looking for a specific property, you can just use the fail task with the unless attribute, e.g.:</p> <pre class="lang-xml prettyprint-override"><code>&lt;fail unless=&quot;my.property&quot;&gt;Computer says no. You forgot to set 'my.property'!&lt;/fail&gt; </code></pre> <p>Refer to <a href="https://ant.ap...
<p>if exec command is deprecated in your version of ant you can use redirectors, something like:</p> <pre><code>&lt;exec executable="grep"&gt; &lt;arg line="@ ${build.dir}"/&gt; &lt;redirector outputproperty="grep.out"/&gt; &lt;/exec&gt; &lt;exec executable="wc" inputstring="${grep.out}"&gt; &lt;arg line="-l"/&g...
28,035
<p>I am modifying some Slic3r config parameters and comparing the results. How can I have two instances (or equivalent: I would like to see two model windows with their associated configuration screens) of Slic3r at the same time? I'm on OS X, but if there is a generic (e.g. within Slic3r) solution that will be prefe...
<p>From a terminal window, run the command</p> <pre><code>open -n -a slic3r </code></pre> <p>Each time the command is executed, a new instance of Slic3r is created.</p> <p>As per Carl's note, keep in mind that both instances of Slic3r will be sharing the same configuration files, so it will be safest not to save con...
<p>From a terminal window, run the command</p> <pre><code>open -n -a slic3r </code></pre> <p>Each time the command is executed, a new instance of Slic3r is created.</p> <p>As per Carl's note, keep in mind that both instances of Slic3r will be sharing the same configuration files, so it will be safest not to save con...
1,081
<p>I am not new to *nix, however lately I have been spending a lot of time at the prompt. My question is what are the advantages of using KornShell (ksh) or Bash Shell? Where are the pitfalls of using one over the other? </p> <p>Looking to understand from the perspective of a user, rather than purely scripting.</p>
<p>Bash. </p> <p>The various UNIX and Linux implementations have various different source level implementations of ksh, some of which are real ksh, some of which are pdksh implementations and some of which are just symlinks to some other shell that has a "ksh" personality. This can lead to weird differences in executi...
<p>Bash is the benchmark, but that's mostly because you can be reasonably sure it's installed on every *nix out there. If you're planning to distribute the scripts, use Bash.</p> <p>I can not really address the actual programming differences between the shells, unfortunately.</p>
10,046
<p>I'm working on a django app right and I'm using cherrypy as the server. Cherrypy creates a new thread for every page view. I'd like to be able to access all of these threads (threads responsible for talking to django) from within any of them. More specifically I'd like to be able to access the thread_data for each o...
<p>CherryPy's wsgiserver doesn't create a new thread for every request--it uses a pool. Each of those worker threads is a subclass of threading.Thread, so all of them should be accessible via threading.enumerate().</p> <p>However, if you're talking specifically about cherrypy.thread_data, that's something else: a thre...
<p>My first response to a question like this isn't to tell you how to do it but to stress that you really should reconsider before moving forward with this. I normally shy away from threaded web-servers, in favor of multi-process or asynchronous solutions. Adding explicit inter-thread communication to the mix only incr...
16,684
<p>For a new project that I'm doing in PHP I've created an SQLMethods class to connect to the database and perform queries. Tonight was the first night that I actually got to test it (I wrote it a week or so ago and forgot about it) and an unexpected error occured: When it was calling my ExecuteQuery() function, it wou...
<p>you should declare $SQLConnection in your class, and you should refer to it as </p> <pre><code> $this-&gt;SQLConnection </code></pre> <p>and not simply $SQLConnection.</p>
<p>The variable <code>$SQLConnection</code> <code>ExecuteQuery()</code> is trying to use is created within another scope. (The <code>SQLMethods</code> function).</p> <p>The connection closes when the PHP script has done its work or if you close it yourself (if the connection is made within that script)</p> <p>You sho...
16,782
<p>I need to create a backup of a SQL Server 2005 Database that's only the structure...no records, just the schema. Is there any way to do this?</p> <p>EDIT: I'm trying to create a backup file to use with old processes, so a script wouldn't work for my purposes, sorry</p>
<p>Use a 3 step process:</p> <ol> <li>Generate a script from the working database</li> <li>Create a new database from that script</li> <li>Create a backup of the new database</li> </ol>
<p>I make heavy use of this tool:<br> <a href="http://www.dswsoft.com/sqlbalance.php" rel="nofollow noreferrer">SQLBalance for MySQL</a> </p> <p>Unfortunately; its windows only... but works like a charm to move databases around, data or no data, merge or compare.</p>
2,567
<p>My BLTouch was working great. Until one day, it just started showing the right side as being high on every read.</p> <p>I've tried leveling many times manually and with the BLTouch. But every time I use the bed visualizer, it shows high on the right. I've even rotated the glass build plate with the same result.</p> ...
<p>I think I found the problem. I think there was some crosstalk between the BLTouch wires and the other wires it was tied together leading to the hotend. When I moved the BLTouch wires away from the others the problem went away.</p> <p>I will be added a sheild to the cable in the future like in this <a href="https://w...
<p>The OP already found the problem and <a href="/a/16632/">answered</a> the question hinting to shielding of the cable. If this is the actual problem, of fiddling with the cables might have caused this, an alternative solution is presented as I've experienced similar behavior.</p> <p>If one side of the bed is higher t...
1,968
<p>Has anyone succeeded in installing the auto bed levelling on a Rumba board with Marlin firmware?</p> <p>I have the last stable version <a href="https://github.com/MarlinFirmware/Marlin/releases/tag/1.1.0-RC6" rel="nofollow noreferrer">1.1.0 RC6</a>.</p> <p>I would appreciate some direction especially about:</p> <...
<p>General note, I do not have this board so I cannot test these steps myself, read the documentation in configuration.h, it is very detailed and should guide you pretty well. I am specifically looking at Marlin 1.1 RC7 on Github, so the lines below may vary slightly from what you see.</p> <p>As to the pins to connect...
<p><strong>For future reference.</strong></p> <p>My issue about the servo not moving was caused by a wiring mistake. The Exp. 3 has 14 pins has per this diagram.</p> <p><a href="https://i.stack.imgur.com/g4yyn.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/g4yyn.png" alt="enter image description h...
416
<p>I have been reading about the differences between Table Variables and Temp Tables and stumbled upon the following issue with the Table Variable. I did not see this issue mentioned in the articles I pursued. </p> <p>I pass in a series of PKs via a XML data type and successfully create the records in both temp table...
<p>A quick test works when I literalize the table var reference in the last update:</p> <pre><code>UPDATE @ERTableVariable SET ExpenseReportProjectID = ( SELECT TOP 1 ExpenseReportProjectID FROM ExpenseReportItem WHERE ExpenseReportID = [@ERTableVariable].ExpenseReportID ) </code...
<p>Try this:</p> <pre><code>CREATE PROCEDURE ExpenseReport_AssignApprover ( @ExpenseReportIDs XML ) AS BEGIN DECLARE @ERTableVariable TABLE ( ExpenseReportID INT, ...
33,839
<p>I want to replace a single file inside a msi. How to do it?</p>
<p>Use <a href="http://msi2xml.sourceforge.net/" rel="noreferrer">msi2xml</a>.</p> <ol> <li><p>This command extracts the MSI files:</p> <p>msi2xml -c OutputDir TestMSI.MSI</p></li> <li><p>Open <strong>OutputDir</strong> and modify the file.</p></li> <li><p>To rebuild the MSI run:</p> <p>xml2msi.exe -m TestMSI.xml</p...
<p>The easiest way to do it is to repackage MSI:</p> <ol> <li>Open MSI file in Wise for Windows Installer. Choose an option to to extract files.</li> <li>Locate the file on disk and replace it.</li> <li>Build MSI.</li> </ol> <p>These steps should also work for InstallShield.</p>
15,395
<p>For example, never define a macro like this:</p> <pre><code>#define DANGER 60 + 2 </code></pre> <p>This can potentially be dangerous when we do an operation like this:</p> <pre><code>int wrong_value = DANGER * 2; // Expecting 124 </code></pre> <p>Instead, define like this because you don't know how the user of t...
<p>Not only should you put parens around the arguments, you should put parens around the expression returned.</p> <pre><code>#define MIN(a,b) a &lt; b ? a : b // WRONG int i = MIN(1,2); // works int i = MIN(1,1+1); // breaks #define MIN(a,b) (a) &lt; (b) ? (a) : (b) // STILL WRONG int i = MIN(1,2); // wor...
<p>See how I hate this:</p> <pre><code>void bar(void) { if(some_cond) { #define BAZ ... /* some code */ #undef BAZ } } </code></pre> <p>Always put them like this:</p> <pre><code>void bar(void) { if(some_cond) { #define BAZ ... /* some code */ #undef BAZ } } </code></pr...
41,558
<p>We have the question <a href="/q/24886">is there a performance difference between <code>i++</code> and <code>++i</code> <strong>in C</strong>?</a></p> <p>What's the answer for C++?</p>
<p>[Executive Summary: Use <code>++i</code> if you don't have a specific reason to use <code>i++</code>.]</p> <p>For C++, the answer is a bit more complicated.</p> <p>If <code>i</code> is a simple type (not an instance of a C++ class), <a href="https://stackoverflow.com/a/24887/194894">then the answer given for C ("N...
<p><code>++i</code> is faster than <code>i++</code> because it doesn't return an old copy of the value.</p> <p>It's also more intuitive:</p> <pre><code>x = i++; // x contains the old value of i y = ++i; // y contains the new value of i </code></pre> <p><a href="http://ideone.com/ivrj9b" rel="nofollow">This C exam...
4,454
<p>Right now we just use something like this</p> <pre><code> stopWatch.Start(); try { method(); } finally { stopWatch.Stop(); } </code></pre> <p>Which works fine for synchronous methods, but some are executing asynchronously, s...
<p>Hmm, from Jon Skeet's answer to this question:</p> <p><a href="https://stackoverflow.com/questions/252793/timing-a-line-of-code-accurately-in-a-threaded-application-c">Timing a line of code accurately in a threaded application, C#</a></p> <p>And also this article: </p> <p><a href="http://lyon-smith.org/blogs/code...
<p>That's a cool tool: <a href="http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx" rel="nofollow noreferrer">http://technet.microsoft.com/en-us/sysinternals/bb896647.aspx</a></p>
49,069
<p>I'm in an <strong>ASP.NET UserControl</strong>. When I type Control-K, Control-D to reformat all the markup, I get a series of messages from VS 2008:</p> <p>"Could not reformat the document. The original format was restored."</p> <p>"Could not complete the action."</p> <p>"The operation could not be completed. ...
<p>There's probably some malformed markup somewhere in your document. Have you tried it on a fresh document?</p>
<p>Just to add some more information. This issue is caused due to some invalid markup in <code>html</code>. It won't cause any blocking while running the application. </p> <p>Unfortunately the solutions mentioned here did not work for me. 1. Restarting visual studio 2. Replacing spaces using regex etc</p> <p>The bes...
10,093
<p>Following up from this question: <a href="https://stackoverflow.com/questions/242882/how-can-i-unlock-a-file-that-is-locked-by-a-process-in-net">How can I unlock a file that is locked by a process in .NET</a>, how do I programmatically get a list of files that are locked in a particular folder and its subfolders?</p...
<p>As answered in another question :<a href="https://stackoverflow.com/questions/1304/checking-for-file-lock-in-c">How to check for file lock?</a></p> <p>The only way would be trying them all and add them to the list if it throws an exception. As mentioned in the above question, it would not be a reliable list to use,...
<p>The only reliable way to detect locked files in real time would be to write a device driver (like <a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel="nofollow noreferrer">filemon</a>), but I don't think you can do that in C#.</p>
30,121
<p>We have a Java application that needs to be brought to the foreground when a telecontrol mechanism activates something in the application.</p> <p>In order to get this, we have realized in the called method of the class which represents the frame of our application (extension of a <code>JFrame</code>) following impl...
<p>A possible solution is:</p> <pre><code>java.awt.EventQueue.invokeLater(new Runnable() { @Override public void run() { myFrame.toFront(); myFrame.repaint(); } }); </code></pre>
<p>There are numerous <a href="http://java.sun.com/javase/6/docs/api/java/awt/Window.html#toFront()" rel="nofollow noreferrer">caveats</a> in the javadoc for the toFront() method which may be causing your problem. </p> <p>But I'll take a guess anyway, when "only the tab in the taskbar flashes", has the application bee...
39,818
<p>In Java, given a timestamp, how to reset the time part alone to 00:00:00 so that the timestamp represents the midnight of that particular day ?</p> <p>In T-SQL, this query will do to achieve the same, but I don't know how to do this in Java.</p> <p><code>SELECT CAST( FLOOR( CAST(GETDATE() AS FLOAT ) ) AS DATETIME)...
<p>You can go Date->Calendar->set->Date:</p> <pre><code>Date date = new Date(); // timestamp now Calendar cal = Calendar.getInstance(); // get calendar instance cal.setTime(date); // set cal to date cal.set(Calendar.HOUR_OF_DAY, 0); // set hour to midnigh...
<p>Using Calendar.set() would certanly be "by the book" solution, but you might also use java.sql.Date:</p> <pre><code>java.util.Date originalDate = new java.util.Date(); java.sql.Date wantedDate = new java.sql.Date(originalDate.getTime()); </code></pre> <p>That would do exactly what you want since:</p> <blockquote>...
28,086
<p>The <a href="http://www.cvsnt.org/manual/html/commit-files.html#syntax" rel="nofollow noreferrer">cvsnt manual</a> provides a detailed list of parameters than can be passed to the postcommand module, but none of them specify the file name.</p> <p>Is anybody aware of an option not listed here that would provide the ...
<p>The answer (thanks to an answer to a different question by <a href="https://stackoverflow.com/questions/86515/does-anyone-know-the-cvs-command-line-options-to-get-the-details-of-the-last-ch#213003">Sally</a>) is to not use the postcommand file, but use the <a href="http://ximbiot.com/cvs/manual/cvs-1.11.23/cvs_18.ht...
<p>Doesn't the %c parameter pass in the command issued (including the files being committed)?</p>
3,690
<p>Does any one know of an opensource Java VNC server, that can be run from a web page, so requiring no installation on the server end, possibley applet based.</p>
<p>A signed Java applet (or application) can use the Robot class to get screenshots of the current window and use this for remote control. It will never be very efficient, but it can be done.</p>
<p><a href="http://vncj.com/default.aspx" rel="nofollow noreferrer">http://vncj.com/default.aspx</a> Once you get it setup you wont know how you lived w/o it. The server and the client are using the same .jar file all in the html page pointing where your listen client is at.</p>
16,521
<p>I'm trying to improve performance under high load and would like to implement opcode caching. Which of the following should I use?</p> <ul> <li>APC - <a href="http://www.howtoforge.com/apc-php5-apache2-debian-etch" rel="noreferrer">Installation Guide</a></li> <li>eAccelerator - <a href="http://www.howtoforge.com/ea...
<p>I think the answer might depend on the type of web applications you are running. I had to make this decision myself two years ago and couldn't decide between Zend Optimizer and eAccelerator.</p> <p>In order to make my decision, I used ab (apache bench) to test the server, and tested the three combinations (zend, ea...
<p>I've been using XCache for more than a year now with no problems at all.</p> <p>I tried to switch to eAccelerator, but ended up with a bunch of segmentation faults (it's less forgiving of errors). The major benefit to eAccelerator is that it's not just an opcode cache, it's also an optimizer.</p> <p>You should ful...
4,834
<p>I want to monitor the modifications in a specified directory, and retrieve the exact change information. So I've decided to use the <a href="http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx" rel="nofollow noreferrer">ReadDirectoryChangesW()</a> function. But I want to use it asynchronously, which means I...
<p>I tend to use <code>ReadDirectoryChangesW()</code> with an I/O Completion Port, which is good for when you want to monitor multiple directories because you can have a single thread servicing the IOCP and dealing with the results from all of your calls to ReadDirectoryChangesW(). </p> <p>First create an IOCP, once, ...
<p>From the <a href="http://msdn.microsoft.com/en-us/library/aa365465(VS.85).aspx" rel="nofollow noreferrer">MSDN documentation for ReadDirectoryChnagesW()</a>:</p> <blockquote> <p>For asynchronous completion, you can receive notification in one of three ways:</p> <ul> <li>Using the GetOverlappedResult func...
44,130
<p>i wonder if there is a simple way to remove already registered types from a unity container or at least replace existing Interface/Type mappings with another one. is it enough to just map another class type to an interface and the old one is overwritten?</p> <hr> <p>this should not happen very often. actually hard...
<p>Listening to the webcast (see msdn webcasts search for unity) it replaces registered types in a last in wins scenario. So if you use config to load your container, then use code to register the same type the code one wins (the reverse also true btw).</p>
<p>I haven't checked out Unity, so I might be wrong, but I imagine it's not possible what you're trying to do, as with my work on our own DI feature in our framework it turned out to be much more efficient to do the discovery of types first, then let the app run because you then don't have to lock the type store for ev...
48,107