instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am writing a batch file script using Windows command-line environment and want to change each occurrence of some text in a file (ex. "FOO") with another (ex. "BAR"). What is the simplest way to do that? Any built in functions?</p>
<p>A lot of the answers here helped point me in the right direction, however none were suitable for me, so I am posting my solution.</p> <p>I have Windows 7, which comes with PowerShell built-in. Here is the script I used to find/replace all instances of text in a file:</p> <pre><code>powershell -Command &quot;(gc myFi...
<p>I have faced this problem several times while coding under Visual C++. If you have it, you can use Visual studio Find and Replace Utility. It allows you to select a folder and replace the contents of any file in that folder with any other text you want.</p> <p>Under Visual Studio: Edit -> Find and Replace In the ...
8,483
<p>I am trying to create an Xercesc DOM Parser in my code and for some reason and try to instiate an XercescDOM object I get a NULL pointer returned. I am using xercesc version 2.8 Here the code.</p> <pre><code>using namespace xercesc; int main(int argc, char*argv[]) { try { XMLPlatformUtils::Initialize(); } catch...
<p>@Doug: no, this is not related, afaik, because the code you linked to tries to fetch the document from the parse() method, but this is a <a href="http://xerces.apache.org/xerces-c/apiDocs-2/classAbstractDOMParser.html#c0b30b3d2116c488920646f0d700d9f0" rel="nofollow noreferrer">void function</a>, so the result will a...
<p>It was a bug some where else in my code.</p>
26,452
<p>I am working on g code for my homebrew 3d printer and i have found the line <code>G1 -2.000 F2400.000</code>. From what i understand there should be an axis before the number and x and y shouldnt have negative. I am using grbl which is for cnc milling but and i have been deleting this line with no problems but i am ...
<blockquote> <p>G1 -2.000 F2400.000</p> </blockquote> <p>Is not valid G-code. As you note, <code>-2.000</code> should be prefixed with an axis (X,Y,Z or E).</p> <p>Marlin would ignore the <code>-2.000</code> bit and simply treat the command as equivalent to</p> <pre><code>G1 F2400.000 </code></pre> <p>which doesn...
<p>G1 indicates a movement and -2.000 the distance, F2400.000 the feed rate mm/min, normally the <strong>(-)</strong> values are for retraction on extrusion <strong>E</strong>, for example:</p> <p>G0 X12 (move to 12mm on the X axis) <br> G0 F1500 (Set the feedrate to 1500mm/minute) <br> G1 X90.6 Y13.8 E22.4 (Move to ...
727
<p>I have a directory of files that I'd like to append file extension to as long as they don't have an existing, specified extension. So add .txt to all file names that don't end in .xyz. PowerShell seems like a good candidate for this, but I don't know anything about it. How would I go about it?</p>
<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,378
<p>How solid is Mono for C# development on Linux and OS X? I've been thinking about learning C# on the side, and was wondering if learning using Mono would suffice.</p>
<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,806
<p>I'll be using the <a href="http://www.codeplex.com/MSFTDBProdSamples/Release/ProjectReleases.aspx?ReleaseId=4004" rel="nofollow noreferrer">AdventureWorks Database</a> to illustrate my problem.</p> <p>I need to show for a particular customer a list of OrderDate with the most Orders.</p> <p>My intial attempt was as...
<p>You should use <code>TOP</code> <i><code>n</code></i> <code>WITH TIES</code> clause to accomplish the task:</p> <pre><code>SELECT TOP 1 WITH TIES CustomerID, OrderDate, COUNT(*) Cnt FROM Sales.SalesOrderHeader WHERE CustomerID = 11300 GROUP BY CustomerID, OrderDate ORDER BY Cnt DESC </code></pre> <p>Alternatively,...
<p>I don't have a copy of AdventureWorks handy to test with, but could the WITH TIES clause help out? You could do something like:</p> <pre><code>SELECT TOP 1 WITH TIES CustomerID, OrderDate, COUNT(*) Cnt ... ORDER BY COUNT(*) DESC </code></pre> <p>... which should get you all the rows that match the value in your OR...
45,206
<p>Here's my scenario. I created an application which uses Integrated Windows Authentication in order to work. In <code>Application_AuthenticateRequest()</code>, I use <code>HttpContext.Current.User.Identity</code> to get the current <code>WindowsPrincipal</code> of the user of my website.</p> <p>Now here's the funn...
<p>I've had similar issues lately and as stated in Robert MacLean's <a href="https://stackoverflow.com/questions/168946/iis-returning-old-user-names-to-my-application/581346#581346">answer</a>, AviD's group policy changes don't work if you're not logging in as the users.</p> <p>I found changing the <strong>LSA Lookup ...
<p>Login to the server that runs the IIS using the new login name in question. This will refresh the credential without re-starting IIS or rebooting the server.</p>
20,391
<p>I know that in Unix (specifically, Mac OS X) the superblock stores information about the layout of data on the disk, including the disk addresses at which the inodes begin and end. I want to scan the list of inodes in my program to look for deleted files. How can I find the disk address at which the inodes begin? ...
<p>Since you mention Mac OS X, let's assume you mean to do this for HFS+ only. The <a href="http://en.wikipedia.org/wiki/HFS_Plus" rel="nofollow noreferrer">Wikipedia page</a> provides some information about possible ways to start, for instance it says this about the on-disk layout:</p> <blockquote> <p>Sectors 0 and 1 ...
<p>You'll have quite some trouble to find deleted files because there's not much left on the disk to find when you delete a file.</p> <p>If you delete a file on a FAT (or UDF) file system, its directory entry simply gets marked as "deleted", with most of the dir entry still intact.</p> <p>On HFS volumes, due to their...
44,133
<p>Some time ago I wrote a piece of code to update multiple rows in a database table. The code was like this</p> <pre><code>var db = new MyDataContext(); db.Execute("UPDATE Details SET IsActive = 0 WHERE MasterId = 1"); </code></pre> <p>Then the other day when I got the latest version of the file I saw that somebody ...
<p>Check the approach used in this article:</p> <ul> <li><a href="https://terryaney.wordpress.com/2008/04/14/batch-updates-and-deletes-with-linq-to-sql/" rel="nofollow noreferrer">Batch Updates and Deletes with LINQ to SQL</a></li> </ul>
<p>The Linq-to-SQL version is going to <code>SELECT</code> every row from the <code>details</code> table that matches the query, pull them into memory, and create objects for them. Then when it applies the updates, it will use a separate <code>UPDATE</code> statement for each object, and will (by default) include a <co...
45,334
<p>Hy, does anyone worked with N2 Content Management System(<a href="http://www.codeplex.com/n2" rel="nofollow noreferrer">http://www.codeplex.com/n2</a>). If yes, how does it perform, performance wise(under heavy load)? It seems pretty simple and easy to use.</p> <p>Adrian</p>
<p>Maybe try this question at <a href="http://www.codeplex.com/n2/Thread/List.aspx" rel="nofollow noreferrer">http://www.codeplex.com/n2/Thread/List.aspx</a></p> <p>They might be able to tell you about performance limitations or bottlenecks.</p>
<p>I tried it and it looked promising at first but quickly had issues actually deploying it to a Medium Trust host.</p>
3,332
<p>Not of the site collection itself, but the individual SPWeb's.</p>
<p>You should take a look at this blog entry by Alexander Meijers : <a href="http://www.bloggix.com/blogs/microsoft/archive/2008/04/03/size-of-spweb-based-on-its-folders-and-files.aspx" rel="noreferrer">Size of SPWeb based on its Folders and Files</a></p> <p>It provides a clever way of finding the size of an SPWeb or ...
<p>For anyone who comes back to this question, here is the missing method:</p> <pre><code>private long GetFolderSize(SPFolder folder) { long folderSize = 0; foreach (SPFile file in folder.Files) { folderSize += file.Length; } foreach (SPFolder subfolder in folder.SubFolders) { ...
24,584
<p>The most favorite feature of StackOverflow for me is that it can automatically detect code in post and set appropriate color to the code.</p> <p>I'm wondering how the color is set. When I do a <kbd>Ctrl</kbd>+<kbd>F5</kbd> on a page, the code seems first be black text, then change to be colorful. Is it done by jQue...
<p>In reply to..</p> <blockquote> <p>Spolsky: How do they know, how do they even know what language you're writing in?</p> </blockquote> <p>It doesn't. The highlighter is very dumb, but manages to gets away with it because most programming languages are so similar. Nearly everything uses syntax close-enough to..</p...
<p>As said by dbr, it does a dummy highlight of most common constructs of languages. Which doesn't work well with some exotic syntaxes. I wonder if we can do code sections without highlighting, BTW.</p> <pre><code>For id = 1 To 10 Do CallSomething() // It likes CamelCase identifiers... End for id = 1 to 10 do # Als...
29,203
<p>I'm looking for a free (GPL or BSD-type license) outliner library that works in a browser. </p> <p>It doesn't have to be too complicated, just allow keyboard control of collapsing and expanding items, and changing their order.</p> <p>Anyone know a good library for this? Do any of the big UI component libraries hav...
<p>The <a href="http://mjsarfatti.com/sandbox/nestedSortable/" rel="noreferrer">nestedSortable jQuery plugin</a> is probably a good place to start. Below is an example of using form fields in each draggable and nest-able <code>&lt;li&gt;</code>. Then it's just a matter of implementing something to handle indenting by k...
<p>The most difficult part will be enabling the keyboard to control the collapsing and expanding. The same functionality using only mouse events is pretty easy and you should find examples <a href="http://www.google.es/search?q=jquery+outliner" rel="nofollow noreferrer">googling</a></p>
32,091
<p>How would one configure trac to allow anonymous submission of tickets? </p>
<p>In your trac config you need to give the anonymous user the TICKET_CREATE permission.</p>
<p>Setup a trac site to allow anonymous (no actual login) login. Grant the anonymous user permission to only create tickets, and maybe view existing tickets if you wish. But deny all other permissions.</p> <p>The trac admin plugin makes this pretty easy.</p>
14,737
<p>Can you create websites with Chinese characters in PHP? </p> <p>UPDATE: Perhaps I should have said - is it straight forward. Because some languages like Java make it extremely easy. Perhaps localisation in PHP isn't as easy as Java???</p>
<p>Yes on both counts. Read <a href="http://www.herongyang.com/PHP-Chinese/" rel="nofollow noreferrer">this guide</a> on building Chinese websites in PHP.</p>
<p>Sure.</p> <p><a href="http://www.onlamp.com/pub/a/php/2002/11/28/php_i18n.html" rel="nofollow noreferrer">http://www.onlamp.com/pub/a/php/2002/11/28/php_i18n.html</a></p>
16,869
<p>I am planning to use jquery in Rails instead of prototype. </p> <p>I am not sure to use jRails or to use plain jquery and stay away from RJS.</p> <p>What do you think about this? </p> <p>EDIT: Two weeks later I found this <a href="http://www.loudthinking.com/posts/32-myth-3-rails-forces-you-to-use-prototype" rel=...
<p>If you ask me, staying away from RJS is a great idea. RJS is an amazingly cool hack, but for production code it's a pain to test and debug. I recommend sticking to UJS (Unobtrusive JavaScript), and jQuery is a great way to do UJS.</p>
<p>Prototype and Scriptaculous are parts of Rails framework. IMHO, you can remove these libraries and insert others but then it will be not Rails framework and Rails project.</p> <p>The other variant is to add jQuery to the standard Rails configuration. After that you have to fix few compatibility problems between the...
30,482
<p>Here's a silly fun question:</p> <p>Let's say we have to perform a simple operation where we need half of the value of a variable. There are <em>typically</em> two ways of doing this:</p> <pre><code>y = x / 2.0; // or... y = x * 0.5; </code></pre> <p>Assuming we're using the standard operators provided with the l...
<p>I think this is getting so nitpicky that you would be better off doing whatever makes the code more readable. Unless you perform the operations thousands, if not millions, of times, I doubt anyone will ever notice the difference.</p> <p>If you really have to make the choice, benchmarking is the only way to go. Find...
<p>Well, if we assume that an add/subtrack operation costs 1, then multiply costs 5, and divide costs about 20.</p>
28,007
<p>I'm using Zend Studio for Eclipse (Linux), and I'm trying to generate getter and setters methods in a PHP class.</p> <p>I try to do this: <a href="http://files.zend.com/help/Zend-Studio-Eclipse-Help/creating_getters_and_setters.htm" rel="nofollow noreferrer">http://files.zend.com/help/Zend-Studio-Eclipse-Help/creat...
<p>It has to be there under the menu - source in Eclipse. Could you provide a snapshot of your Eclipse to verify. EDITED: I guess it is not possible to generate getters and setters automatically in your version, though you would be able to create templates for the same and use it as per your requirements. Omnipotent (0...
<p>If there is a 'Refactor' menu, check in there as well. A lot of those methods have been moved to the 'Refactor' menu in later versions of eclipse and if Zend has updated recently and not updated it's documentation, the items may have encountered an undocumented move.</p>
17,852
<p>I'm working with jQuery for the first time and need some help. I have html that looks like the following:</p> <pre><code>&lt;div id='comment-8' class='comment'&gt; &lt;p&gt;Blah blah&lt;/p&gt; &lt;div class='tools'&gt;&lt;/div&gt; &lt;/div&gt; &lt;div id='comment-9' class='comment'&gt; &lt;p&gt;Blah bl...
<p>Event callbacks are called with an event object as the first argument, you can't pass something else in that way. This event object has a <code>target</code> property that references the element it was called for, and the <code>this</code> variable is a reference to the element the event handler was attached to. S...
<p>You don't have a lot of control over the arguments passed to a bound event handler.</p> <p>Perhaps try something like this for your definition of <strong>doSomething()</strong>:</p> <pre><code>function doSomething() { var commentId = $(this).parent().attr('id'); alert(commentId); } </code></pre>
15,729
<p>I have an index on columns A, B, C, D of table T</p> <p>I have a query that pulls from T with A, B, C in the WHERE clause.</p> <p>Will the index be used or will a separate index be needed that only includes A, B, C?</p>
<p>David B is right that you should check the execution plan to verify the index is being used.</p> <blockquote>Will the index be used or will a separate index be needed that only includes A, B, C?</blockquote> <p>To answer this last part of the question, which I think is the core underlying topic (as opposed to the ...
<p>Generally speaking yes it will be, all modern databases are clever enough to do this. There are exceptions, for example, if the statistics on the table show that the volume of data in it is sufficiently small that a full table read will be more efficient then the index will be discounted, but as a rule, you can rel...
16,412
<p>How can I send keyboard input messages to either the currently selected window or the previously selected window? </p> <p>I have a program which I use to type some characters which are not present on my keyboard and I would like it if I could just send the input directly rather than me having to copy and paste all ...
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.sendkeys.send.aspx" rel="noreferrer">SendKeys.Send</a> will help you with that.</p>
<p>If it's not present on your keyboard, you might simply add a button and send the code key of this character to the reference object you want to append this character. Give us an example of what you want, we might be able to show you some code.</p> <p>Short example of code:</p> <pre><code>myField.Text += "®"; //Thi...
44,279
<p>I am running tomcat and I have some custom images which when I store on my C drive do not show up.If I move them to webapp root foder, they r fine but I do not want these images to end up in the war file.As I am using Windows symbolic link is not an option. Any idea as to how I can make the images show up without st...
<p>The web server will need the images to be stored in a web folder (root or virtual directory) to interperet the URL to a local file location.</p> <p>If on the other hand you are referencing your images using file:// then the web server is not serving the files, the OS is, and will only work for local users that have...
<p>Well, you can also manage them by your app - that is when you get the request for the image, your application reads it from the disk, sets proper Content-type and outputs the image. </p> <p>That is not recommended tho. Better leave this job to the web server.</p>
29,575
<p>I'm wondering if there are any good .NET recommendation algorithms available in open source projects, whether attached to a search engine or not. By recommendation I mean something that accepts a full-text article and recommends other articles from its index based on keyword similarity.</p> <p>At the high end ther...
<p>I think that in StackOverflow they extract all common english words from the text and then compare this words with the remaining words of other posts to get the "Related" posts.</p>
<p>Question is not very clear (algorithm or library???) but only thing that comes to mind is Lucene.NET, the porting of the popular Lucene library on the .Net framework. HTH.</p>
9,759
<p>I am developing a web application which has Chart Controls. I have developed a common chart User Control to use across the application. </p> <p>I am looking for an elegent way to set the Chart control's along with other control's width, height based on the screen(browser size).</p> <p>Please help me Thanks Shaik...
<p>Sounds like you want to resize a server-side dynamic image based on a client-side value. You would first need to load the page once, use Javascript to get the screen size. (Google for that. You can get the full cross browser technical list of which Javascript elements to use at <a href="http://www.quirksmode.org/dom...
<p>a hidden div set to 100% by 100% can be used to tell you the browser window client area size; i don't think there is a way to measure the screen without a postback/callback</p> <p>see <a href="https://stackoverflow.com/questions/90595/how-to-implement-a-web-page-that-scales-when-the-browser-window-is-resized">How t...
16,182
<p>I've been reading through a lot of the rookie Java questions on <code>finalize()</code> and find it kind of bewildering that no one has really made it plain that finalize() is an unreliable way to clean up resources. I saw someone comment that they use it to clean up Connections, which is really scary since the onl...
<p>You could use it as a backstop for an object holding an external resource (socket, file, etc). Implement a <code>close()</code> method and document that it needs to be called.</p> <p>Implement <code>finalize()</code> to do the <code>close()</code> processing if you detect it hasn't been done. Maybe with something ...
<p>iirc - you can use finalize method as a means of implementing a pooling mechanism for expensive resources - so they don't get GC's too.</p>
19,123
<p>I'm developing a script that involves creating an email contact and forwarding mail to that contact. Last part of the script is to automatically send a test email to the address to make sure the forwarding works.</p> <p>So I use the following code:</p> <pre><code>[void] [Reflection.Assembly]::LoadWithPartialName("...
<p>I was having similar issues where some of the COM objects do not seem to populate fully (seems to have something to do with the corporate Outlook setup - perhaps anti-virus measures?). However, if you comment out the <code>$msg.Recipients.Add("me@example.com")</code> line and added <code>$msg.Display()</code> you ca...
<p>If you change your mind about using Outlook, look at the PowerShell Community Extensions (free) on CodePlex. They offer a cmdlet to send SMTP e-mail, which would suffice to test the newly-created address. Not sure if there's value in having the test in your Sent Items? Especially if you're doing these in bulk - it'd...
44,522
<p>I'm working on my first Django application. In short, what it needs to do is to display a list of film titles, and allow users to give a rating (out of 10) to each film. I've been able to use the {{ form }} and {{ formset }} syntax in a template to produce a form which lets you rate one film at a time, which corresp...
<p>"At first, I thought this was what formsets were for, but I can't see any way to automatically iterate over the contents of a database table to produce items to go in the form, if you see what I mean."</p> <p>You need to get a queryset. And you need to provide that queryset to your form as initial data. See <a hr...
<p>I have found my answer, using modelformset_factory instead formset_factory solves the problem, Thanks...</p>
38,260
<p>I would like to write a driver to talk to my Suunto t3 watch in Python on a Mac. My day job is doing basic web work in C# so my familiarity with Python and developing on a Mac is limited.</p> <p>Can you suggest how one would start doing driver development in general and then more specifically on a Mac. I.e. how to ...
<p>If the watch supports a <a href="http://www.usb.org/developers/devclass_docs#approved" rel="nofollow noreferrer">standard USB device class specification</a> such as HID or serial communication, there might already be a Macintosh driver for it built into the OS. Otherwise, you're going to have to get information abou...
<p>If the watch supports a <a href="http://www.usb.org/developers/devclass_docs#approved" rel="nofollow noreferrer">standard USB device class specification</a> such as HID or serial communication, there might already be a Macintosh driver for it built into the OS. Otherwise, you're going to have to get information abou...
20,546
<p>When loading XML into an XmlDocument, i.e.</p> <pre> XmlDocument document = new XmlDocument(); document.LoadXml(xmlData); </pre> <p>is there any way to stop the process from replacing entities? I've got a strange problem where I've got a TM symbol (stored as the entity #8482) in the xml being converted into the TM...
<p>This is a standard misunderstanding of the XML toolset. The whole business with "&amp;#x", is a syntactic feature designed to cope with character encodings. Your XmlDocument isn't a stream of characters - it has been freed of character encoding issues - instead it contains an abstract model of XML type data. Words ...
<p>I beleive if you enclose the entity contents in the CDATA section it should leave it all alone e.g.</p> <pre><code>&lt;root&gt; &lt;testnode&gt; &lt;![CDATA[some text &amp;#8482;]]&gt; &lt;/testnode&gt; &lt;/root&gt; </code></pre>
18,448
<p>How do I parse the first, middle, and last name out of a fullname field with SQL? </p> <p>I need to try to match up on names that are not a direct match on full name. I'd like to be able to take the full name field and break it up into first, middle and last name. </p> <p>The data does not include any prefixes or...
<p>Here is a self-contained example, with easily manipulated test data. </p> <p>With this example, if you have a name with more than three parts, then all the "extra" stuff will get put in the LAST_NAME field. An exception is made for specific strings that are identified as "titles", such as "DR", "MRS", and "MR".</...
<ol> <li>Get a sql regex function. Sample: <a href="http://msdn.microsoft.com/en-us/magazine/cc163473.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/magazine/cc163473.aspx</a></li> <li>Extract names using regular expressions. </li> </ol> <p>I recommend Expresso for learnin/building/testing regular exp...
19,303
<p>How do I ping a website or IP address with Python?</p>
<p>Depending on what you want to achive, you are probably easiest calling the system ping command..</p> <p>Using the subprocess module is the best way of doing this, although you have to remember the ping command is different on different operating systems!</p> <pre><code>import subprocess host = "www.google.com" p...
<p>Use this it's tested on python 2.7 and works fine it returns ping time in milliseconds if success and return False on fail.</p> <pre><code>import platform,subproccess,re def Ping(hostname,timeout): if platform.system() == "Windows": command="ping "+hostname+" -n 1 -w "+str(timeout*1000) else: ...
40,918
<p>Objective: take a UIImage, crop out a square in the middle, change size of square to 320x320 pixels, slice up the image into 16 80x80 images, save the 16 images in an array.</p> <p>Here's my code:</p> <pre><code>CGImageRef originalImage, resizedImage, finalImage, tmp; float imgWidth, imgHeight, diff; UIImage *squa...
<p>After some more experimentation, I found the following solution (I still don't know why it didn't work as originally written, though.) But anyway, the slicing works after the resize code is put in place even when resizing is unnecessary:</p> <pre><code>if(newDim != 320.0){ CGSize finalSize = CGSizeMake(...
<p>Just out of curiosity, why did you make your mutable array with bound of 0 when you know you're going to put 16 things in it?</p> <p>Well, aside from that, I've tried the basic techniques you used for resizing and slicing (I did not need to crop, because I'm working with images that are already square) and I'm unab...
30,903
<p>I'm trying to use one of the RAMPS GPIOs to control an external device that requires a 5V low-current logic level signal from Marlin. In order to do this programmatically, my host software (Octoprint) is sending an M42 command. I am using the following syntax:</p> <pre><code>M42 P4 S255 </code></pre> <p>according ...
<p>I looked at the current Marlin code and the P24 command should work as you expect it unless the pin you are trying to use in listed as the "SENSITIVE_PINS" list:</p> <pre><code>#define SENSITIVE_PINS { 0, 1, \ X_STEP_PIN, X_DIR_PIN, X_ENABLE_PIN, X_MIN_PIN, X_MAX_PIN, \ Y_STEP_PIN, Y_DIR_PIN, Y_ENABLE_PIN, Y_MIN_PI...
<p>Might be because servo pins are not connected to 5V. use Jumper as shown</p> <p><a href="https://i.stack.imgur.com/ycegg.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ycegg.png" alt="enter image description here"></a></p>
485
<p>All this originated from me poking at a compiler warning message (C4267) when attempting the following line:</p> <pre><code>const unsigned int nSize = m_vecSomeVec.size(); </code></pre> <p><code>size()</code> returns a size_t which although typedef'd to unsigned int, is not actually a unsigned int. This I believe ...
<p>It depends on the implementation. <code>std::size_t</code> for example has a minimal required size. But there is no upper limit. To avoid these kind of situations, always use the proper typedef:</p> <pre><code>const std::vector&lt;T&gt;::size_type nSize = m_vecSomeVec.size(); </code></pre> <p>You will be always on...
<p>Depending on the compiler, <code>int</code> may be 32-bits in 64-bit land.</p>
44,357
<p>In the last 3 companies I've worked at, the phone number columns are of type varchar(n). The reason being that they might want to store extensions (ext. 333). But in every case, the "-" characters are stripped out when inserting and updating. I don't understand why the ".ext" characters are okay to store but not the...
<p>Quick test: are you going to add/subtract/multiply/divide Phone Numbers? Nope. Similarly to SSNs, Phone Numbers are discrete pieces of data that can contain actual numbers, so a string type is probably most appropriate.</p>
<p>Stripping some characters and allowing others may have an impact if the database table is going to drive another system, e.g. IP Telephony of some sort. Depending on the systems involved, it may be legitimate to have etc.333 as a suffix, whereas the developers may not have accounted for "-" in the string (and yes, ...
37,047
<p>I am sure this is a very simple problem, but I am new to VB.NET, so I am having an issue with it.</p> <p>I have a <code>Decimal</code> variable, and I need to split it into two separate variables, one containing the integer part, and one containing the fractional part. </p> <p>For example, for x = 12.34 you would ...
<p>You can use <a href="http://msdn.microsoft.com/en-us/library/7d101hyf.aspx" rel="noreferrer">Math.Truncate(decimal)</a> and then subtract that from the original. Be aware that that will give you a negative value for both parts if the input is decimal (e.g. -1.5 => -1, -.5)</p> <p>EDIT: Here's a version of Eduardo's...
<p>Fractional and decimal part of a number have different significance when a number is above zero or below zero. Therefore, you have to consider both cases. I suggest using the below code:</p> <pre><code>Dim dbl as double = 13.067 Dim int1 As Integer = 0 Dim fraction As Double = 0 If dbl &gt;= 0 Then int1 = Math.F...
47,303
<p>I am in the process of setting up CruiseControl.NET. The problem I am having is that I am running CC as a console application and when my build completes successfully and executes (using exec) it launches it within the CruiseControl DOS prompt. I am just using simple batch files to launch my app but having it run wi...
<p>I think this works:</p> <pre><code>start cmd.exe </code></pre>
<p>I also tried executing batch file that run daemon process/server at the end of CCNET task; The only way to make CruiseControl spawn an independent asynchronous process WITHOUT waiting for the end of process is: </p> <ol> <li>create a batch file to run the daemon process (server application) </li> <li><p>use task s...
39,040
<p>For my website I configured some custom error pages. If I generate a 404, the redirect works fine. When hitting a 400, the "bad request" text shows up instead of the configured URl.</p> <p>As a test I copied the URL from 404 to 400. No change. Then I changed the redirect to a file. No change.</p> <p>Any ideas?</p>...
<p>Maybe <a href="https://learn.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/cc753103(v=ws.10)" rel="nofollow noreferrer">this</a> is your answer: this Microsoft site says re configuring custom errors in IIS6 that </p> <blockquote> <p>The following errors are not customizabl...
<p>Check what's in your web.config file in the <code>customErrors</code> section. That has a <code>defaultRedirect</code> attribute, and an <code>error</code> subtag with a <code>redirect</code> attribute. These can conflict with your other configuration settings in IIS.</p>
33,713
<p>I'm new to .NET, so please be patient with me ;)</p> <p>On my Windows Form, I have a DataGridView that is bound to a data source. Since my grid is read-only, I have a set of controls (textbox, checkbox, etc.) outside the grid that will be used to edit the data.</p> <p>I want the controls to be binded to the curren...
<p>to keep this completely within Visual Studio's databinding environment, you can use two BindingSources, one for the DataGridView and another for your detail controls. This is very similar to the example found here:</p> <p><a href="http://msdn.microsoft.com/en-us/library/y8c0cxey.aspx" rel="nofollow noreferrer">htt...
<p>You want to check out the custom datagridviewcolumn types that are available with the datagridview. Add in special columns and then bind a list of business objects to the grid (or a DataSet).</p> <p>I think you can even ask the grid to autogenerate sensible columns based upon the objects you give it.</p> <p>I woul...
32,437
<p>Does C# have the notion of private / protected inheritance, and if not, why?</p> <p><strong>C++</strong></p> <pre> <code> class Foo : private Bar { public: ... }; </code> </pre> <p><strong>C#</strong></p> <pre> <code> public abstract NServlet class : private System.Web.UI.Page { // error "type expected...
<p>C# allows public inheritance only. C++ allowed all three kinds. Public inheritance implied an "IS-A" type of relationship, and private inheritance implied a "Is-Implemented-In-Terms-Of" kind of relationship. Since layering (or composition) accomplished this in an arguably simpler fashion, private inheritance was onl...
<p>No it doesn't. What would the benefit be of allowing this type of restriction?</p>
5,312
<p>If I were to include .Net Framework setup file along with my apps (installation process is done by our own technician), to be install on a clean Windows (XP SP2/SP3 or Vista SP1) without prior installation of any framework, which of the .Net Framework setup do I need to install in sequence, to get to 3.5 SP1? Curren...
<p>The .Net Framework 3.5 SP1 redistributable (the one that's around 230MB) contains everything (2.0 + SP1 + SP2, 3.0 + SP1 + SP2, 3.5 + SP1) in all supported architectures (x86, x64, ia64). <strong>This is the only download you need.</strong></p> <p><a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=AB...
<p>NET 3.5 SP1 introduces a new setup package option for developers building .NET client applications called the "<a href="http://weblogs.asp.net/scottgu/archive/2008/05/12/visual-studio-2008-and-net-framework-3-5-service-pack-1-beta.aspx" rel="nofollow noreferrer">.NET Framework Client Profile</a>".This provides a new...
30,509
<p>EDIT, 2020/09: If anyone is wondering, 12 years later, yes, we've all moved to JSON and Kubernetes by now. Original text follows.</p> <p>Obviously, there is no one single solution that would satisfy everyone's needs; an architecture is always a trade-off. I want to create a framework, originally aimed at RAD of web ...
<p>XSLT can be bulky to manage, and essentially adds an extra programming language that developers would have to work in (at least if I understand your description correctly). My experience has been that relatively few people know it, and even fewer can make it do what they want.</p>
<p>I've worked on a few web games in the past and, to be honest, none of them have ever needed anything this complex and unwieldy.</p>
22,618
<p>In ruby, is there a way to "undefine" a variable or constant once it's been defined?</p> <p>In our rails environemnts, we define one of three contants to be <code>true</code>, depending on the environment: <code>TESTING</code>, <code>DEVELOPMENT</code>, or <code>PRODUCTION</code>. Then, in controller code, we use ...
<p>I found <a href="http://www.ruby-forum.com/topic/2530" rel="noreferrer">this answer</a> </p> <pre><code>Object.send(:remove_const, "TESTING") </code></pre> <p>If I remember correctly, using <code>send</code> here is kind of a hack, because remove_const is really a private method. You want to ask yourself why you n...
<p>Instead of checking each constant, why not do something like:</p> <pre><code>environment = :TESTING if(environment == :TESTING) </code></pre>
44,045
<p>I'd like to show a div that has a background-color with the height and width set to 100% but no content. Is it possible to do that without putting a &amp;nbsp; inside?</p> <p>Edit: Thanks to Mark Biek for pointing out that empty div with width and height styles shows how I'd expect. My div is in a table cell, where...
<p>This seems to work in Firefox, Safari, IE6, &amp; IE7.</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;style&gt; #foo{ background: #ff0000; width: 100%; height: 100%; border: 2px dashed black; } &lt;/style&g...
<p>You should include <code>&amp;nbsp;</code> at all times.</p>
24,118
<p>This should be easy for many of you, but for me it's just another bit of rust needing to be chipped away as I get back into basic Java coding. Using bloody associative arrays for so long in other languages have turned me nice and spoiled. :P</p> <p>My problem is simple: I'm storing a set of objects, each containin...
<p>there is a great <a href="http://java.sun.com/docs/books/tutorial/collections/index.html" rel="nofollow noreferrer">writeup on java collections</a> which covers most of your needs.</p> <p>short advice concerning this: use a <a href="http://java.sun.com/j2se/1.5.0/docs/api/java/util/TreeMap.html" rel="nofollow noref...
<p>I have done something similar to that, I used ArrayList to store them objects and write comparators for sorting the arraylist.</p>
43,779
<p>We are using Subversion. We would like to </p> <pre><code>1. search across all commit messages ? 2. monitor the commits on certain important files ? 3. identify files that are never/rarely used ? 4. identify files that are most frequently changed ? 5. identify files that most developers have accessed ? 6....
<p><a href="http://www.statsvn.org/" rel="nofollow noreferrer" title="StatSVN">StatSVN</a> should be able to do the majority of that for you. You'll need to set up a scheduled task to run it over your repository, however, or you can integrate it into an Ant build if you happen to use that. </p> <p>Some of the more c...
<p>What platform are you using? On linux, a quick shell script using <code>sed</code> should do the trick.</p>
32,031
<p>How do I detect what browser (IE, Firefox, Opera) the user is accessing my site with? Examples in Javascript, PHP, ASP, Python, JSP, and any others you can think of would be helpful. Is there a language agnostic way to get this information?</p>
<p>If it's for handling the request, look at the <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43" rel="noreferrer">User-Agent</a> header on the incoming request.</p> <p>UPDATE: If it's for reporting, configure your web server to log the User-Agent in the access logs, then run a log analysis to...
<p>It may be dependent of your setting. With apache on linux, its written in the access log /var/log/apache2/access_log</p>
14,753
<p>I'm having an issue where prints with narrow tolerance come out fused. This makes it pretty much impossible to print anything with narrow parts. It seems to be mostly (maybe only) an issue in the bottom skin layers. Once it gets through those, the rest of the print goes smoothly and tight tolerances are not a proble...
<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,694
<p>i search a good tutorial to learn how to use entity framework in the right manner. in particular with asp.net mvc.</p>
<p>I'd point you in the direction of this rather <a href="http://blogs.msdn.com/efdesign/archive/2008/11/20/n-tier-improvements-for-entity-framework.aspx" rel="nofollow noreferrer">(1) lengthy article</a> from the Entity Framework team. </p> <p>They've done a pretty good job of explaining both the shortcomings of the...
<p>We're currently working on an EF 4.0 Reference Implementation using ASP.NET MVC at the front end. Check it out <a href="http://dataguidance.codeplex.com/" rel="nofollow noreferrer">here</a> - We'd love to hear your feedback.</p>
44,195
<p>I have a requirement of reading subject, sender address and message body of new message in my Outlook inbox from a C# program. But I am getting security alert 'A Program is trying to access e-mail addresses you have stored in Outlook. Do you want to allow this'.</p> <p>By some googling I found few third party COM l...
<p>Sorry, I have had that annoying issue in both Outlook 2003 and Outlook 2007 add-ins, and the only solution that worked was to purchase a <a href="http://www.dimastr.com/redemption/" rel="noreferrer">Redemption</a> license. In Outlook 2007 that pesky popup should only show up if your firewall is down or your anti-vir...
<p>You can disable the security pop-up using Outlook's Trust Center. Check <a href="http://msdn.microsoft.com/en-us/library/bb226709.aspx" rel="nofollow noreferrer">here</a>.</p>
29,112
<p>I have not developed web services applications that publicly faced the Internet. As I begin to consider the issues of exposing schema definitions to a wide audience, I believe a certain amount of consideration should be spent on properly formatting the schema namespaces.</p> <p>Has anybody come across a guideline d...
<p>I like using separate domains, but there could be no site there now, or just xml schemas and later on could be a combination of docs and schemas. You probably should NOT include any part of the organisation's structure in either the domain name or URL path, those things change, so try to design it for the longer te...
<p>The closest thing i have read that mentions about how a namespaced ought to be style is this article</p> <p><a href="http://www.builderau.com.au/strategy/architecture/soa/Good-schema-management-helps-to-maintain-XML-namespace/0,339028264,320273067,00.htm" rel="nofollow noreferrer">http://www.builderau.com.au/strate...
30,966
<p>Are there any decent tutorials for setting up F# in Visual Studio 2005? Everything I have found points at VS2008.</p> <p>ie: 'F# projects' under projects, etc.</p>
<p>Unfortunately the CTP release of F# doesn't support VS 2005. Two options:</p> <ol> <li>Use 1.9.4.19, the most recent pre-CTP release</li> <li>Download the free <a href="http://www.microsoft.com/downloads/details.aspx?FamilyId=40646580-97FA-4698-B65F-620D4B4B1ED7&amp;displaylang=en" rel="nofollow noreferrer">VS2008<...
<p><a href="http://research.microsoft.com/fsharp/manual/install.aspx" rel="nofollow noreferrer">Installing F# Editing for Microsoft Visual Studio 2005</a></p> <p>That page also links to <a href="http://blogs.msdn.com/dsyme/" rel="nofollow noreferrer">Don Syme's F# blog</a>, which has a lot of useful stuff on working w...
14,680
<p>I have a web site running via IIS7 on Vista. The site is running on port 88, so <a href="http://localhost:88" rel="noreferrer">http://localhost:88</a> should render the default /Home/Index view. </p> <p>This works correctly, as do all other views. </p> <p>However, one problem is resident. My script paths point to ...
<p>I hope the continuation of this thread conveys a willingness to make sure this problem doesn't drive anyone off the cliff. There's a lot of documentation in various forums about solving this issue on Vista but I couldn't find any likewise articles for 2K8. As indicated in this <a href="http://forums.iis.net/p/114359...
<p>The problem not lies precisely in the authorization/authentication but in the modules that now manages the IIS. Inside system.webServer you should have <strong>runAllManagedModulesForAllRequests</strong> set to <strong>false</strong> so you can display all images/css without problems with authentication.</p> <p>In ...
46,076
<p>Can somebody give some clear explanation of the meaning of the SIZE and RSS values we get from prstat in Solaris?</p> <p>I wrote a testing C++ application that allocates memory with <code>new[]</code>, fills it and frees it with <code>delete[]</code>.</p> <p>As I understood, the SIZE value should be related to how...
<p>RSS is (AFAIK reliably) representing how much physical memory a process is using. Using Solaris default memory allocator, freeing memory doesn't do anything about RSS as it just changes some pointers and values to tell that memory is free to be reused. If you don't use again that memory by allocating it again, it wi...
<p>As a general rule once memory is allocated to a process it will never be given back to the operating system. On Unix systems the sbrk() call is used to extend the processes address space, and there is not analogous call to go in the other direction.</p>
45,068
<p>I need to validate an XML agaist a schema. </p> <p>I tried XML::SAX::ParserFactory; XML::Validator::Schema and related modules but looks like they are limited.<br> Limited in the sense that it didn't recognize schema elements such as xsd:unique, xsd:group, xsd:keyref, xsd:union and xsd:key. </p> <p>Are these xsd...
<p>Have you tried validating it with xmllint?</p>
<p>@Thushan Is it absolutely necessary for you to use Perl? If not, why not give a try to <strong>XMLSTARLET</strong>? It's a quite nice toolkit for manipulating XMLs in a terminal!</p> <p>It supports not just legacy DTDs and the XSD as you need, also it supports Relax-NG schemas. Check it's documentation to learn how...
41,692
<p>In a project I am working on, Apache is set up to only forward requests that come in as /prefix/* to mongrel. How can I tell ruby on rails to generate all URLs with that prefix? </p> <p>I have the routes set up for forward to the correct controller action by doing this:</p> <pre><code>map.connect 'sfc/:controller/...
<p>The <code>RAILS_RELATIVE_URL_ROOT</code> environment variable should do the trick, though I haven't tried it myself.</p>
<p>What about using the :path_prefix option:</p> <pre><code>map.connect ':controller/:action', :path_prefix =&gt; 'sfc' </code></pre>
28,637
<p>I have a table in a MySql database that stores user accounts. One of the columns, expires, stores an expiration date but defaults to NULL. I need to be able to remove an expiration date and set it back to the default value.</p> <p>Currently, all of my CRUD routines are written using MySqlCommand with parameters. Ca...
<p>The problem was DBNull, doing:</p> <pre><code>command.Parameters.AddWithValue("@parameter", null); </code></pre> <p>compiles OK.</p>
<p>It's not clear what conditions you're talking about. If you want to set column to default value, you can use <a href="http://msdn.microsoft.com/en-us/library/system.dbnull.value.aspx" rel="nofollow noreferrer">DbNull.Value</a>;</p> <pre><code>command.AddWithValue("@param", DbNull.Value); or command.Parameters.Add...
7,424
<p>I've made a Django site, but I've drank the Koolaid and I want to make an <em>IPhone</em> version. After putting much thought into I've come up with two options:</p> <ol> <li>Make a whole other site, like i.xxxx.com. Tie it into the same database using Django's sites framework.</li> <li>Find some time of middlewa...
<p>Rather than changing the template directories dynamically you could modify the request and add a value that lets your view know if the user is on an iphone or not. Then wrap render_to_response (or whatever you are using for creating HttpResponse objects) to grab the iphone version of the template instead of the stan...
<p>A simple solution is to create a wrapper around <code>django.shortcuts.render</code>. I put mine in a <code>utils</code> library in the root of my application. The wrapper works by automatically rendering templates in either a "mobile" or "desktop" folder.</p> <p>In <code>utils.shortcuts</code>:</p> <blockquote> <...
19,882
<p>I'm attempting to register an anonymous function when a user clicks a cell in an HTML table. Here's some of the raw, unadulterated code:</p> <pre><code>document.getElementById( "course"+displayed_year_index+occurrences_indices[displayed_year_index]).onclick = eval("function() {PrintReceipt("+result.yea...
<p>Have you tried something like this?</p> <pre><code>document.getElementById('course' + displayed_year_index + occurences_indices[displayed_year_index]) = function (nr) { return function () { PrintReceipt(nr) } } (result.years[result_year_index].rul_code); </code></pre> <p>Can you please post the...
<p>It seems like this is the direction that you would want to go:</p> <pre><code>document.getElementById("course"+displayed_year_index+occurrences_indices[displayed_year_index]).addeventlistener("click", function() { var current_rul_code = result.years[result_year_index].rul_code; PrintReceipt(current_rul_cod...
37,792
<p>Does the CCK api allow me to create a node type, from a custom module, with a bunch of fields that use CCK to store their state? If so can these fields be locked so that users may not alter them, but still allow the user to add more fields to the node type?</p> <p>Thanks</p>
<p>I <em>think</em> the answer to your first question is "yes" (for Drupal 6, at least, which has elements of the CCK integrated into Drupal Core). I believe the <a href="http://drupal.org/project/amazon" rel="nofollow noreferrer" title="Amazon module">Amazon module</a> does this sort of thing, albeit it with just one...
<p>You could add validation code in the GUI which restricts CCK fields being interfered with on your content type. This would not prevent another module getting in there with an axe, though.</p> <p>You could add checks which restore your preferred CCK settings whenever they detect some unwanted changes.</p>
35,288
<p>We all know the various ways of testing OO systems. However, it looks like I'll be going to do a project where I'll be dealing with PLC ladder logic (don't ask :/), and I was wondering if there's a good way of testing the validity of the system.</p> <p>The only way I see so far is simply constructing a huge table w...
<p>The verification of "logical" systems in the IC design arena is known as "Design Verification", which is the process of ensuring that the system you design in hardware (RTL) implements the desired functionality. </p> <p>Ladder logic can be transformed to one of the modern HDL's like Verilog.. transform each ladder...
<p>There is a program called LogixPro which has an IO simulator for ladder logic, you can try that.</p>
9,642
<p>So i'm used to PHPMySQL where if I want to transfer a table from one database to another, I:</p> <ul> <li>go to the table</li> <li>click "export"</li> <li>CTRL-C</li> <li>go to the other database, insert SQL, CTRL-V</li> </ul> <p>In MS SQL Server 2008 Express, I try:</p> <ul> <li>right-click, script table as, CRE...
<p>From the SQL Server Management Studio you can right click on your database and select:</p> <p>Tasks -> Generate Scripts - Next -> Select objects that you need from list -> click on the advanced Then simply proceed through the wizard. Make sure to set 'Script Data' to TRUE when prompted to choose the script options...
<p>Look here: <a href="http://www.simonholywell.com/article/sql-server-2005-dump-to-sql-statements.html" rel="nofollow noreferrer">Simon Holywell: SQL Server 2005 Dump to SQL statements</a>.</p> <p>What Simon says (no pun intended) is this: There is nothing built-in, but there is a "scripting way" to do it. He made a ...
40,287
<p>I really want to put in some sort of section handler into App.config that will execute some code before the application actually starts executing at Main. Is there any way to do such a thing?</p>
<p>Why dont you put that call as the first instruction in your main function?</p> <p>Otherwise you can define another entry point for your program and call your main from there but its basicaly the same</p>
<p>Why dont you put that call as the first instruction in your main function?</p> <p>Otherwise you can define another entry point for your program and call your main from there but its basicaly the same</p>
23,466
<p>I've had a Windows app in production for a while now, and have it set up to send us error reports when it throws exceptions. Most of these are fairly descriptive and help me find the problem very quickly (I use the MS Application Exception Block). </p> <p>On a few occasions I have reports that are issues that I can...
<p>One option is to generate a (mini-)dump file as close to the point where the exception is thrown as possible. This <a href="http://blogs.microsoft.co.il/blogs/sasha/archive/2008/05/28/programmatically-generating-a-dump-file.aspx" rel="nofollow noreferrer">article</a> talks about how to do this from managed code.</p...
<p>I'd make use of the event log. Take a look here:</p> <p><a href="http://support.microsoft.com/kb/307024" rel="nofollow noreferrer">http://support.microsoft.com/kb/307024</a></p>
7,613
<p>I'm trying to squeeze some more performance out of my rendering pipeline. The (by far) slowest part is performing a java.awt.imaging.LookupOp on a large image. </p> <p>The image size is about 2048x2048.</p> <p>I have figured out that having the filter done along with the drawing operation is much faster than cal...
<p>I've not used java in close to eight years so some of the syntax may be irrelevant.</p> <p>The key to any kind of performance regarding a loop is to push as many things as possible outside the loop. If you can't then only perform calculations when they change. Often it is better to wait until the last minute to rec...
<p>Do you have the ability to push this processing on to the GPU? Multiple hardware pipelines will significantly speed up the processing.</p> <p>If you can't then you should look into parallelising the LookupOp on the CPU. From what I understand of it each lookup can be done in isolation. Therefore you can spin up mul...
33,104
<p>Is there a way to read a module's configuration ini file? </p> <p>For example I installed php-eaccelerator (<a href="http://eaccelerator.net" rel="nofollow noreferrer">http://eaccelerator.net</a>) and it put a <code>eaccelerator.ini</code> file in <code>/etc/php.d</code>. My PHP installation wont read this <code>.i...
<p>This is just a wild guess, but try to add all the directives from eaccelerator.ini to php.ini. First create a <code>&lt;?php phpinfo(); ?&gt;</code> and check where it's located.</p> <p>For example, try this:</p> <pre><code>[eAccelerator] extension="eaccelerator.so" eaccelerator.shm_size="32" eaccelerator.cache_di...
<p>If using Apache, and mod-php, you can configure/override some php settings locally with a <a href="http://www.php.net/manual/en/apache.configuration.php" rel="nofollow noreferrer">.htaccess file</a>. Your webserver has to "AlloweOverride" appropriately in the main config file to allow you to override these settings ...
13,607
<p>How do I get the HTTP status code (eg 200 or 500) after calling curl_easy_perform? </p>
<p><a href="http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html" rel="noreferrer">http://curl.haxx.se/libcurl/c/curl_easy_getinfo.html</a></p> <pre> CURLINFO_RESPONSE_CODE Pass a pointer to a long to receive the last received HTTP or FTP code. This option was known as CURLINFO_HTTP_CODE in libcurl 7.10.7 and earlier...
<p>The other answer is absolutely correct, but I would also like to add that it might not be wise to check the error code by hand, the <code>200</code> code is not the only code that signifies success.</p> <p>I'd recoment using the libcurl option <a href="https://curl.haxx.se/libcurl/c/CURLOPT_FAILONERROR.html" rel="n...
37,109
<p>We are currently researching ways of enhancing image quality prior to submission to OCR. The OCR engine we are currently utilizing is the Scansoft API from Nuance (v15). We were researching the <a href="http://leadtools.com/" rel="nofollow noreferrer">Lead Tools</a> but have since decided to look elsewhere. The l...
<p>Kofax is good for pre-processing, but for the types of cleanup you are talking about may be overkill unless the images are really bad. Unless your specialty is in image processing, I'd recommend working with a provider that does the image cleanup and the OCR so you can focus on the value you actually add.</p> <p>W...
<p>Not sure if this would be quite up to the standards that you guys would need, but perhaps you should look at some of the <a href="http://www.getpaint.net/" rel="nofollow noreferrer">Paint.Net</a> APIs. I don't know how easy it would be to extract their image processing algorithms for use in your project, but I beli...
17,246
<p>Relatively new to rails and trying to model a very simple family "tree" with a single Person model that has a name, gender, father_id and mother_id (2 parents). Below is basically what I want to do, but obviously I can't repeat the :children in a has_many (the first gets overwritten).</p> <pre><code>class Person &l...
<p>Found a simple answer on IRC that seems to work (thanks to Radar):</p> <pre><code>class Person &lt; ActiveRecord::Base belongs_to :father, :class_name =&gt; 'Person' belongs_to :mother, :class_name =&gt; 'Person' has_many :children_of_father, :class_name =&gt; 'Person', :foreign_key =&gt; 'father_id' has_ma...
<p>I prefer to use scopes for this issue. Like this: </p> <pre><code>class Person &lt; ActiveRecord::Base belongs_to :father, :class_name =&gt; 'Person' belongs_to :mother, :class_name =&gt; 'Person' has_many :children_of_father, :class_name =&gt; 'Person', :foreign_key =&gt; 'father_id' has_many :children_of...
39,587
<p>I can make a DAO recordset in VB6/Access do anything - add data, clean data, move data, get data dressed in the morning and take it to school. But I don't even know where to start in .NET. </p> <p>I'm not having any problems retrieving data from the database, but what do real people do when they need to edit data a...
<p>I had the same problem last week and the solution was pretty simple for me.</p> <p>Run:</p> <pre><code>sudo -i -u www-data </code></pre> <p>And then try navigating the path, directory by directory. You will notice at some point that you don't have access to open the dir. If you get into the last directory, check ...
<p>This is a permissions problem where the user that your web server is running under does not have read and/or execute permissions to the necessary directories in the symbolic link path. The quick and easy way to check is to <code>su - web-user</code> (where <code>web-user</code> is the user account that the web serv...
11,162
<p>What is the time complexity of dynamic memory allocation using new, malloc, etc.? I know very little about how memory allocators are implemented, but I assume the answer is that it depends on the implementation. Therefore, please answer for some of the more common cases/implementations.</p> <p>Edit: I vaguely re...
<p>One of the things you have to realise when dealing with O notation is that it is often very important to understand what <em>n</em> is. If the <em>n</em> is something related to something you can control (eg: the number of elements in a list you want sorted) then it makes sense to look hard at it.</p> <p>In most he...
<p>I would think it would generally be O(n) where n is the number of available memory blocks (since you have to scan the available memory blocks to find a suitable one).</p> <p>Having said that, I've seen optimizations that can make it faster, specifically maintaining multiple lists of available blocks depending on th...
35,847
<p>how to create a shortcut for a exe from a batch file.</p> <p>i tried </p> <pre><code>call link.bat "c:\program Files\App1\program1.exe" "C:\Documents and Settings\%USERNAME%\Desktop" "C:\Documents and Settings\%USERNAME%\Start Menu\Programs" "Program1 shortcut" </code></pre> <p>but it did not worked.</p> <p>link...
<p>Your link points to a Windows 95/98 version and I guess you have at least Windows 2000 or XP. You should try the NT version <a href="http://www.robvanderwoude.com/amb_shortcutsnt.html" rel="noreferrer">here</a>.</p> <p>Alternatively use a little VBScript that you can call from the command line:</p> <pre><code>set ...
<p>This worked for me on Windows XP ms-dos, I still haven't tried it on Windows 7. It's just like creating a symbolic link in Linux.</p> <pre><code>shortcut -T source.exe destination.lnk </code></pre>
45,037
<p>Does anyone know how to databind the .Source property of the WebBrowser in WPF ( 3.5SP1 )? I have a listview that I want to have a small WebBrowser on the left, and content on the right, and to databind the source of each WebBrowser with the URI in each object bound to the list item.</p> <p>This is what I have as a...
<p>The problem is that <a href="https://learn.microsoft.com/en-us/dotnet/api/system.windows.controls.webbrowser.source?view=netframework-4.8" rel="noreferrer"><code>WebBrowser.Source</code></a> is not a <code>DependencyProperty</code>. One workaround would be to use some <code>AttachedProperty</code> magic to enable th...
<p>You need to declare it at the first few lines of the <code>xaml</code> file which is pointing to the class file </p> <pre><code>xmlns:reportViewer="clr-namespace:CoMS.Modules.Report" </code></pre>
32,998
<p>A client asked me if I knew anything about the HOME development method. I, together with wikipedia and acronymfinder, drew a complete blank.</p> <p>Has anyone here heard about a development method called HOME?</p>
<p>The best answer to this is to follow this link and read the shrt description of the method by the authors themselves.<br> <a href="http://nyttf.dk/?pagetype=book&amp;vareid=44021-1" rel="nofollow noreferrer">http://nyttf.dk/?pagetype=book&amp;vareid=44021-1</a><br> I can recommend this method as I teach it in projec...
<p>I've never heard of it, either.</p> <p>I'm sure there's a way for you to garner insight from your client as to what he means.</p> <p>Perhaps you could ask something like, "In what context are you interested in knowing more about HOME?"</p>
30,649
<p>I'd like to make a debug logging function with the same parameters as <code>printf</code>. But one that can be removed by the pre-processor during optimized builds.</p> <p>For example:</p> <pre><code>Debug_Print("Warning: value %d &gt; 3!\n", value); </code></pre> <p>I've looked at variadic macros but those aren...
<p>I still do it the old way, by defining a macro (XTRACE, below) which correlates to either a no-op or a function call with a variable argument list. Internally, call vsnprintf so you can keep the printf syntax:</p> <pre><code>#include &lt;stdio.h&gt; void XTrace0(LPCTSTR lpszText) { ::OutputDebugString(lpszText)...
<p>Having come across the problem today, my solution is the following macro:</p> <pre><code> static TCHAR __DEBUG_BUF[1024]; #define DLog(fmt, ...) swprintf(__DEBUG_BUF, fmt, ##__VA_ARGS__); OutputDebugString(__DEBUG_BUF) </code></pre> <p>You can then call the function like this:</p> <pre><code> int valu...
3,604
<p>My colleagues are attempting to connect BizTalk 2006 R2 via DB2/MVS adapter to a database hosted on z/OS mainframe. When testing the connecting settings, they are getting the following error</p> <pre><code>Could not connect to data source 'New Data Source': The network connection was terminated because the host fai...
<p>Why, it certainly took Microsoft long enough to explicitly confirm this:</p> <p><strong>proxy connections via DB2Connect is not supported by BizTalk DB2 Adapter</strong></p> <p>Since our customer's policy is to only access DB2 databases via DB2Connect, the adapter is out of the question.</p> <p><strong>MORE BACKG...
<p>I've never used this adapter but myself, so I'm guessing, but maybe it's to do with the account that BizTalk is using to connect or your ports are not configured correctly.</p>
4,455
<p>We have a piece of functionality that is used by several different applications (clients) on the same server. It can best be modeled as a service, has a backend database, and there will only be one version of the functionality and the database in use at any one time.</p> <p>Until now we have employed simple DLL-reu...
<p>This is a problem I've struggled with many times and there really isn't any best answer other then it depends. My personal opinion is that you need to stay away from option 1 for a couple of reasons:</p> <ol> <li>By having all your clients share a single binary it will now require all of your clients to be tested e...
<p>I'd say that using Option 1 would be simpler and easier, especially as youwill just have to spend extra time limiting the availability of the REST. (pun intended!)</p>
42,926
<p>I don't like WYIWYG editors, I want to be responsible for the selection and placement of each tag and attribute! Is there a good editor out there that allows you complete control over the HTML but offers useful features such as:</p> <ul> <li>syntax highlighting (of course)</li> <li>suggestions of tags, attributes ...
<p>I'm a big fan of <a href="http://www.aptana.com/" rel="nofollow noreferrer">Aptana</a> for generic HTML/CSS/Javascript editing. Based on Eclipse, but nicer usability. Automatic formatting, code suggestion (with native support for jQuery &amp; ExtJs) and embedded browser tabs for checking your work.</p> <p>It's also...
<p>Depending on what code you will be using (ASP v. php v. ruby, etc), I would suggest Dreamweaver. It is WYSIWYG, but many of the best editors you would find are, including VS 2008. Of course, that doesn't mean you have to use it! I used Dreamweaver quite often at my last job and it was great for editing code and q...
28,571
<p>Can anyone reccomend some good tutorials for ext js and adobe air? The ones I have seen seem to start with you knowing a lot or already having a lot of code in place.</p> <p>What I am looking for is a simple step by step guide that takes you through the basics of Ext Js in use with adobe air, in fact i suppose just...
<p>If your window is the active window, then you can simply override the forms ProcessCmdKey as such below.</p> <pre><code>protected override bool ProcessCmdKey(ref Message msg, Keys keyData) { const int WM_KEYDOWN = 0x100; const int WM_SYSKEYDOWN = 0x104; if ((msg.Msg == WM_KEYDOWN) || (msg.Msg == WM_SYS...
<p>And if your application is NOT the main window, take a look at the <a href="http://msdn.microsoft.com/en-us/library/ms646309.aspx" rel="nofollow noreferrer">RegisterHotkey</a> Win32 API, with some info on <a href="http://pinvoke.net/default.aspx/user32/RegisterHotKey.html" rel="nofollow noreferrer">p/invoke here</a>...
26,317
<p>I've got a webapp whose original code base was developed with a hand crafted hibernate mapping file. Since then, I've become fairly proficient at 'coding' my hbm.xml file. But all the cool kids are using annotations these days.</p> <p>So, the question is: <strong>Is it worth the effort</strong> to refactor my cod...
<p>"If it ain't broke - don't fix it!"</p> <p>I'm an old fashioned POJO/POCO kind of guy anyway, but why change to annotations just to be cool? To the best of my knowledge you can do most of the stuff as annotations, but the more complex mappings are sometimes expressed more clearly as XML.</p>
<p>All the features are supported both in the XML and in annotations. You will still be able to override your annotations with xml declaration.</p> <p>As for the effort, i think it is worth it as you will be able to see all in one place and not switch between your code and the xml file (unless of-course you are using ...
10,790
<blockquote> <p><code>dict</code> methods <code>dict.keys()</code>, <code>dict.items()</code> and <code>dict.values()</code> return “views” instead of lists.</p> </blockquote> <p><a href="https://docs.python.org/3/whatsnew/3.0.html#views-and-iterators-instead-of-lists" rel="nofollow noreferrer">Source</a></p> <p>First ...
<p>You are effectively getting a list. It's just not a copy of the internal list, but something that acts as if it where a list but only represents the internal state.</p> <p>That's the same way it's implemented in Java (and probably many other languages/environments as well).</p> <p>The main reason is that for many ...
<p>As was already mentioned in the related question, view has <code>len()</code> method, which the iterator lacks (yet list has it).</p> <p>Another benefit of returning a view instead of a list is that at least for the keys it has an optimized membership testing in O(1) operations instead of O(N) for the list (or iter...
44,284
<p>I have seen bind and eval used interchangeably especially in ASP.NET GridViews. What is the difference?</p>
<p>Eval is one-way, read only databinding. </p> <p>Bind is two-way, read/write databinding. </p> <p>See <a href="http://weblogs.asp.net/leftslipper/archive/2007/06/29/how-asp-net-databinding-deals-with-eval-and-bind-statements.aspx" rel="noreferrer">here</a> and <a href="http://msdn.microsoft.com/en-us/library/ms1783...
<p>Bind() is used for two-way databinding. So when used with the proper type of datasource, it will pull the altered values out of the GridView or other control, and save them back to the database.</p> <p>Eval() is a one-way, "read only" way to bind the values.</p>
32,369
<p>In terms of Webserver and low package size installation.</p>
<p>To be honest, the best distro for VMWare is the one the admin has the most experience with. With the GUI stuff all disabled I've not found any difference in performance between RedHat, Centos and Ubuntu when running VMWare.</p> <p>Picking the distro that you can adminster easiest will save you hassle. If you alre...
<p>It is not clear to me if you are asking about the distro for the Vmware host, or for the guest operating system that will be your web server.</p> <p>I generally really like Debian or Debian based distributions. But as far as Vmware is concerned Centos or anything really should work.</p> <p>If you are looking at s...
13,867
<p>I have this bit of javascript written with jQuery 1.2.5. It's contained inside the main function() of a plugin that I wrote. The plugin is a horizontal gallery scroller very similar to jCarousel. It does alot of auto calculating of widths and determines how many to scroll based on that and the size of the images,...
<p>Just use a global busy flag. When you enter your click handler, check it, and only proceed if it's false. Immediately set it to true, and then set it back to false when the animation ends. JavaScript is single-threaded, so there is no race condition to worry about.</p> <pre><code>var busy = false; $("...").oncli...
<p>Since JavaScript functions calls are asyncronus, you can pass as a in parameter a callback function that's called when the previous call ends (same for errors).</p> <p>You can pass the function you wrote in this post as the callback for the function that fire before.</p> <p>Hope this helps.</p> <p>Regards</p>
14,961
<p>Is there a way to increase the stack size of a Windows application at compile/link time with GCC?</p>
<p>IIRC, In GCC you can provide the --stack,[bytes] parameter to ld.</p> <p>E.g.</p> <pre><code>gcc -Wl,--stack,16777216 -o file.exe file.c </code></pre> <p>To have a stack of 16MiB, I think that the default size is 8MiB.</p>
<p>When creating threads you use the dwStackSize paremater, but I'm not sure how to change the size for the main thread, this indicates its in the exe's header, so it may be an option for the compiler/linker, else you need to find the relevant part of the header and change it yourself.</p> <p><a href="http://msdn.micr...
18,935
<p>I am making a strong effort to discipline my projects and create a Vision/Scope document at the onset. Included in this are the use case diagrams. Just listing out the use cases has really helped me fully see all the requirements that the customer is asking for, and it has opened up dialog.</p> <p>I am wondering ...
<p>the advantage of use-case diagrams is that they are simple and end-users can read and understand them</p> <p>the columns to go on a report are part of a design or requirements specification (details of a feature, in agile terms) and do <em>not</em> belong on a use-case diagram</p> <p>anything that clutters the use-c...
<p>Use case description should be between:</p> <ul> <li>Low details: so that user understands it, and thinks: "<em>How easy is that to do</em>"</li> <li>High details: No open possibilities (Detailed description of what happens after each step)</li> </ul>
28,605
<p>If I have a printer hooked directly to a pc (a kiosk with a printer), how would I go about creating the ability for a web page (.net web app) to print a jpg to the kiosks printer with no user intervention other than clicking a button on the page?</p>
<p>This has been asked several times already, and the result is always that you <em>can't</em> do it via normal web technologies (HTML + Javascript). The best you can do is open the print dialog, and that is <em>by design</em>. What you can do since you control the kiosks is create some kind of browser extension (lik...
<p>I solve this problems in 2 different ways:</p> <ol> <li>Using ActiveX</li> <li>Creating a protocol like myprint://PRINT_DATA</li> </ol>
25,352
<p>Why or why not?</p>
<p>For performance, especially when you're iterating over a large range, <code>xrange()</code> is usually better. However, there are still a few cases why you might prefer <code>range()</code>:</p> <ul> <li><p>In python 3, <code>range()</code> does what <code>xrange()</code> used to do and <code>xrange()</code> does ...
<p>Go with range for these reasons:</p> <p>1) xrange will be going away in newer Python versions. This gives you easy future compatibility.</p> <p>2) range will take on the efficiencies associated with xrange.</p>
16,357
<p>I have to sort a number of integers, which can have values between 30.000.000 and 350.000.000. There will be between 0 and 65.535 integers, with the average count being 20.000. RAM usage is irrelevant and speed only is important.</p> <p>Later on i will also have to split them into groups, with the divide always bei...
<p>I'd just make an array of buckets before running the algorithm, one for each group of 65536 consecutive values. The buckets will contain a min and max value of their contents, but won't store the contents themselves. After running the algorithm, do a single pass over the buckets. If there are two consecutive non-...
<p>If you use the number as an index to an array, and then increment the count of that position, you've "grouped" them, and done it in one pass.</p> <p>in pseudocode:</p> <pre><code>while(morenumbers) sorted[[unsorted[number]]++ number++ </code></pre> <p>If the range is known ahead of time, you can reduce index ...
36,175
<p>I want to get a type of a "BasePage" object that I am creating. Every Page object is based off BasePage. For instance, I have a Login.aspx and in my code-behind and a class that has a method Display:</p> <pre><code>Display(BasePage page) { ResourceManager manager = new ResourceManager(page.GetType()); } </code>...
<p>If your code-beside looks like this:</p> <pre><code>public partial class _Login : BasePage { /* ... */ } </code></pre> <p>Then you would get the <code>Type</code> object for it with <em><code>typeof(_Login)</code></em>. To get the type dynamically, you can find it recursively:</p> <pre><code>Type GetCodeBehin...
<p>It depends where you're calling Display() from. If you're calling it from the ASPX, then you'llse "ASP_login.aspx". If you're calling it from the code-behind (i.e. the Page_Load() method) you should get the Login page type.</p> <p>Instead of passing the Page in, you might consider just using the Page property (i.e....
24,696
<p>I've started to use constructs like these:</p> <pre><code>class DictObj(object): def __init__(self): self.d = {} def __getattr__(self, m): return self.d.get(m, None) def __setattr__(self, m, v): super.__setattr__(self, m, v) </code></pre> <p>Update: based on this thread, I've re...
<p>Your DictObj example is actually quite common. Object-style dot-notation access can be a win if you are dealing with ‘things that resemble objects’, ie. they have fixed property names containing only characters valid in Python identifiers. Stuff like database rows or form submissions can be usefully stored in this k...
<p>Because you ask for undesirable side-effects:</p> <p>A disadvantage is that in visual editors like eclipse+pyDev, you will see many undefined variable errors on lines using the dot notation. Pydef will not be able to find such runtime "object" definitions. Whereas in the case of a normal dictionary, it knows that y...
27,671
<p>I basically want to do this:</p> <pre><code>grep 'example.com' www_log &gt; example.com.YYYY-MM-DD-H:i:S.log </code></pre> <p>...with of course the filename being <b>example.com.2008-09-27-11:21:30.log</b></p> <p>I'd then put this in crontab to run daily.</p>
<p>The verbose method:</p> <pre><code>grep 'example.com' www_log &gt; `date +example.com.%Y-%m-%d-%H:%M:%S.log` </code></pre> <p>The terse method:</p> <pre><code>grep 'example.com' www_log &gt; `date +example.com.%F-%T.log` </code></pre>
<p>Here is another way, that I usually use:</p> <pre><code>grep 'example.com' www_log &gt; example.com.`date +%F-%T`.log </code></pre> <hr> <p>Backticks are a form of command substitution. Another form is to use $():</p> <pre><code>$(command) </code></pre> <p>which is the same as:</p> <pre><code>`command` </code...
17,548
<p>I need to know when my Window goes out of input focus, so I overloaded the OnKillFocus() method of the CWnd. </p> <p>However it doesn't invoke this method when I focus another application (alt+tab), or even minimize the window. But it DOES invoke the method when I restore it from being minimized. Are these the inte...
<p>My guess is that you've got some sort of template that generates the same HTML header and footer regardless of the page that is requested. Sometime before the exportCSV function is called, the header is generated.</p> <p>You don't show the bottom of the output, but I'll bet the footer is there too, since I suspect...
<p>You've got a control flow problem somewhere - it seems the html head part and navigation is included by default in any page, including in the one that generates the CSV. One solution would be to check for a CSV request and if that's the case, don't include the html code, another one would be to use output buffering ...
25,373
<p>I know that this is somewhat subjective, but I wonder if there is a generally accepted standard for naming assemblies which contain some "core" functions.</p> <p>Let's say you got a larger Projects, with Assemblies like</p> <ul> <li>Company.Product.WebControls.dll</li> <li>Company.Product.Net.dll</li> <li>Company....
<p>With .Net this is relatively easy to change, so I'd go with convenience.</p> <p>Fewer, larger, assemblies compile quicker than many small ones, so I'd start with your 'core' stuff as a namespace inside Company.Product.dll, and split it out later if you need to.</p>
<p>i also used .Core, especially for the .dll</p> <p>Its all a matter of taste imo, if the root namespace is a company name, i feel .Core/framework/common is more descriptive than just the company name.</p> <p>However if you're working on something like a opensource project where the name of the dll/namespace is also...
14,979
<p>Does anyone know where I can get a free 3D design (STEP or STL) of an M4 Screw and nut? I have found only an M3 on Thingiverse: <a href="http://www.thingiverse.com/thing:729842" rel="nofollow noreferrer">M3 Bolt</a> by <a href="http://www.thingiverse.com/Kaleta" rel="nofollow noreferrer">Kaleta</a>.</p>
<p>You can get a model for nearly everything McMaster-Carr sells from their website.</p> <p>M4 Hex Head Screw - <a href="https://www.mcmaster.com/#91280a140/=15dmpx8" rel="nofollow noreferrer">https://www.mcmaster.com/#91280a140/=15dmpx8</a></p> <p>M4 Nut - <a href="https://www.mcmaster.com/#90592a090/=15dmqjy" rel="...
<p>The thing you linked to describes itself as being generated from a parametric model: <a href="http://www.thingiverse.com/apps/customizer/run?thing_id=193647" rel="nofollow noreferrer">http://www.thingiverse.com/apps/customizer/run?thing_id=193647</a></p> <p>To generate any different bolt or nut, you will need to id...
444
<p>I am trying to create controller actions which will return either JSON or partial html depending upon a parameter. What is the best way to get the result returned to an MVC page asynchronously?</p>
<p>In your action method, return Json(object) to return JSON to your page.</p> <pre><code>public ActionResult SomeActionMethod() { return Json(new {foo="bar", baz="Blech"}); } </code></pre> <p>Then just call the action method using Ajax. You could use one of the helper methods from the ViewPage such as </p> <pre><...
<p>Flexible approach to produce different outputs based on the request</p> <pre><code>public class AuctionsController : Controller { public ActionResult Auction(long id) { var db = new DataContext(); var auction = db.Auctions.Find(id); // Respond to AJAX requests if (Request.IsAjaxRequest()) ...
28,175
<p>I am looking for a utility that can be used against .NET assemblies to validate code against best practices, and most importantly can review the code for Security, Injection, and Cross Site Scripting vulnerabilities. I know that it isn't an exact science, but I'm looking for anyones experience/recommendations on th...
<p><a href="http://msdn.microsoft.com/en-us/library/bb429476(VS.80).aspx" rel="nofollow noreferrer">FxCop</a> is a static code analysis tool, though not specifically targetting security, it will pick up alot of common errors (be sure to turn off the naming rules you aren't interested in).</p> <p>Also, I came across th...
<p>We have licenses for <a href="http://www.ouncelabs.com/" rel="nofollow noreferrer">Ounce</a> for the development side, and I've heard great things about SpiDynamics for testing applications post development.</p>
24,076
<p>I'm asking this question purely from a usability <code>standpoint</code>!</p> <p>Should a website <code>expand/stretch</code> to fill the viewing area when you resize a browser window?</p> <p>I know for sure there are the obvious cons:</p> <ul> <li>Wide columns of text are hard to read.</li> <li>Writing html/css ...
<p>Raw HTML does just that. Are you changing your data so that it doesn't render so good in random sized windows?</p> <p>In the olden days, everyone had VGA screens. Now, that resolution is most uncommon. Who knows what resolutions are going to be common in the future? And why expect a certain minimum width or hei...
<p>Paragraph widths larger than your display make a web site completely unusable. You have to jiggle the horizontal scrollbar back and forth for every single line you read. I'm doing a web design subject at university and the textbook calls the designs which adapt to your screen width <i>fluid layout</i>.<p> I'm design...
4,700
<p>Is there a way to use <code>JQuery</code> to cloak or encrypt email addresses on an <code>HTML</code> page without changing the syntax in the <code>href</code>?</p>
<p>Using JQuery may not be the route you want to take since this would be on the client side... Is there a reason you're not encrypting on server side?</p>
<p>Semantic nazis would say "encoding", not "encrypting". Encrypting implies a secret is required to decode. Converting to <a href="http://www.asciitable.com/" rel="nofollow noreferrer">HTML entity syntax</a> would be a decent <em>encoding</em> process to keep out prying humans, but bots could easily decode it.</p>
6,861
<p>I have the following (pretty standard) table structure:</p> <pre><code>Post &lt;-&gt; PostTag &lt;-&gt; Tag </code></pre> <p>Suppose I have the following records:</p> <pre><code>PostID Title 1, 'Foo' 2, 'Bar' 3, 'Baz' TagID Name 1, 'Foo' 2, 'Bar' PostID TagID 1 1 1 2 2 2 </code>...
<p>Yay! It worked. </p> <p>If anyone is having the same problem here's what I did:</p> <pre><code>public IList&lt;Post&gt; GetPosts(int page, int record) { var options = new DataLoadOptions(); options.LoadWith&lt;Post&gt;(p =&gt; p.PostTags); options.LoadWith&lt;PostTag&gt;(pt =&gt; pt.Tag); using (va...
<p>I've answered this in another post : <a href="https://stackoverflow.com/questions/50169/optimizing-a-linq-to-sql-query#50240">About eager loading</a>. In your case it would probably be something like :</p> <pre><code>DataLoadOptions options = new DataLoadOptions(); options.LoadWith&lt;Post&gt;(p =&gt; p.PostTag...
10,537