instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have a rails application that I am running with Vista,IIS7 and SQL 2005. For some reason the CSS is not being rendered. The CSS works fine when I use Webrick.</p>
<p>Any ideas how to get CSS working correctly with IIS7. I have uninstalled and reinstalled windows components "Common Http Features" with no luck.</p>... | <p><a href="http://weblogs.asp.net/meligy/archive/2009/10/12/funny-problem-windows-7-iis-7-5-images-css-not-showing.aspx" rel="nofollow noreferrer">My Solution was here</a></p>
<p>You need to add some additional features to IIS from programs and features</p>
| <p>Is your CSS file a linked resource? If not, and it's inline, I find it incredibly strange that your CSS is not rendering - as CSS is only processed by the web browser.</p>
<p>If, as is likely, the CSS is a linked resource then it's a safe bet that is not finding the CSS file - perhaps your web root is configured in... | 28,436 |
<p>A semaphore is a programming concept that is frequently used to solve multi-threading problems. My question to the community: </p>
<p>What is a semaphore and how do you use it?</p>
| <p>Think of semaphores as bouncers at a nightclub. There are a dedicated number of people that are allowed in the club at once. If the club is full no one is allowed to enter, but as soon as one person leaves another person might enter.</p>
<p>It's simply a way to limit the number of consumers for a specific resource.... | <p>A semaphore is a way to lock a resource so that it is guaranteed that while a piece of code is executed, only this piece of code has access to that resource. This keeps two threads from concurrently accesing a resource, which can cause problems.</p>
| 5,482 |
<p>I've had to create a custom membership provider for my current ASP .Net project in order to fit in with our database schema, and am having problems configuring it to lockout a user if they get their password wrong three times, as is supported by the standard providers.</p>
<p>Is this something I need to implement m... | <p>Scott Mitchell has written an excellent series of tutorials on the ASP.NET site. This link includes information on creating a custom provider and discusses the locking logic:</p>
<p><a href="http://www.asp.net/LEARN/security/tutorial-06-cs.aspx" rel="noreferrer">http://www.asp.net/LEARN/security/tutorial-06-cs.aspx... | <p>In your custom membership provider, you should implement the ValidateUser function. There you not only check if the username and password are valid, but you also retrieve the number of invalid password attempts etc from your datastore. If the username/password is valid, reset the password attempt count, otherelse in... | 46,348 |
<p>What do I need to add to my <code>.spec</code> file to create the desktop shortcut and assign an icon to the shortcut during install of my <code>.rpm</code>? If a script is required, an example would be very helpful.</p>
| <p>You use a .desktop file for icons under linux. Where to put the icon depends on what distribution and what desktop environment you are using. Since I'm currently running Gnome on Fedora 9, I will answer it in those terms.</p>
<p>An example foo.desktop file would be:</p>
<pre><code>[Desktop Entry]
Encoding=UTF-8
Ge... | <p>To create a desktop icon to an application follow the two steps below.</p>
<ol>
<li><p>In an Editor create a new file.</p>
<pre><code>gedit ~/.local/share/applications/NameYouWantForApplication.desktop
</code></pre></li>
<li><p>Place this section within the file and save it.</p>
<pre><code>[Desktop Entry]
Type=Ap... | 9,964 |
<p>Browsing through the git documentation, I can't see anything analogous to SVN's commit hooks or the "propset" features that can, say, update a version number or copyright notice within a file whenever it is committed to the repository.</p>
<p>Are git users expected to write external scripts for this sort of functio... | <p>Quoting from the <a href="https://git.wiki.kernel.org/index.php/GitFaq#Does_git_have_keyword_expansion.3F" rel="noreferrer">Git FAQ</a>:</p>
<blockquote>
<p>Does git have keyword expansion?</p>
<p>Not recommended. Keyword expansion causes all sorts of strange problems and
isn't really useful anyway, especially withi... | <p>Perhaps the most common SVN property, 'svn:ignore' is done through the .gitignore file, rather than metadata. I'm afraid I don't have anything more helpful for the other kinds of metadata.</p>
| 6,088 |
<p>I currently have an MS Access application that connects to a PostgreSQL database via ODBC. This successfully runs on a LAN with 20 users (each running their own version of Access). Now I am thinking through some disaster recovery scenarios, and it seems that a quick and easy method of protecting the data is to use <... | <p>onnodb,</p>
<p>The PostgreSQL ODBC driver is <a href="http://www.postgresql.org/ftp/odbc/versions/msi/" rel="noreferrer">actively developed</a> and an Access front-end combined with PostgreSQL server, in my opinion makes a great option on a LAN for rapid development. I have been involved in a reasonably big system ... | <p>PostgreSQL works great as a backend for MS Access, there are a couple of support functions you should use to make things easier. See here for more info on this:</p>
<p><a href="http://www.amsoftwaredesign.com/smf/index.php?board=8.0" rel="nofollow noreferrer">http://www.amsoftwaredesign.com/smf/index.php?board=8.0... | 5,884 |
<p>We are rewriting our legacy <a href="https://en.wikipedia.org/wiki/Accounting_information_system" rel="nofollow noreferrer">accounting system</a> in VB.NET and SQL Server. We brought in a new team of .NET/ SQL Programmers to do the rewrite. Most of the system is already completed with the dollar amounts using floats... | <blockquote>
<p>Should Float or Decimal data type be used for dollar amounts?</p>
</blockquote>
<p>The answer is easy. Never floats. <em>NEVER</em>!</p>
<p>Floats were according to <a href="http://ieeexplore.ieee.org/xpl/mostRecentIssue.jsp?punumber=4610933" rel="nofollow noreferrer">IEEE 754</a> always binary, only th... | <p>Your accountants will want to control how you round. Using float means that you'll be constantly rounding, usually with a <code>FORMAT()</code> type statement, which isn't the way you want to do it (use <code>floor</code> / <code>ceiling</code> instead).</p>
<p>You have currency datatypes (<code>money</code>, <cod... | 8,718 |
<p>After logging in using the Login control the browser loses the session. This only occurs in Internet Explorer 7. Has anyone else run into this problem? If so, do you know a work around?</p>
| <p>I would suggest downloading a tool like <a href="http://www.blunck.se/iehttpheaders/download.html" rel="nofollow noreferrer">ieHTTPHeaders</a> to trace the request/respnonse headers in IE and seeing at what point either IE stops sending the cookie or the server clears it. </p>
<p>You should see a POST to your login... | <p>Turns out the page, in the process of serving the request, referenced a page that clears the session. This only happened in IE.</p>
| 34,619 |
<p>I have been looking to buy a new extruder. One of the options I have seen comes in "right handed" and "left handed". What does this mean? How can I tell what my current extruder is, so I get the right replacement?</p>
| <p>The short answer to identify what extruder type you have is the <strong>rotation of the extruder gear</strong>. </p>
<p>CCW rotation to extrude = right-handed extruder</p>
<p>Detailed explanation is below.</p>
<hr>
<p>In addition to the other answers, the right-handed designation comes from math and pysics conve... | <p>This is an example of a right handed extruder setup:</p>
<p><a href="https://i.stack.imgur.com/UKSrb.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/UKSrb.png" alt="Right Handed Extruder Setup"></a></p>
<p>And this is an example of a left handed extruder setup:</p>
<p><a href="https://i.stack.i... | 1,313 |
<p>This is a problem that only occurs on application update (only tested through Admin Console, not CLI). Also, this is only happening on our development environment, which is identical to our prod env. On uninstall/install, everything is compiled properly. However, this is a large application and it takes long enou... | <h1>Solution:</h1>
<p><strong>Problem was</strong>: WAS had debugging enabled. This generated .smap files (source mappings) instead of .class files. Once we discovered this, we disabled the debugging service under the Admin Console (Application Servers > server1 > Debugging Processes > uncheck 'Start service'). I d... | <p>One suggestion:</p>
<p>Have you checked that your environment has a JAVA_HOME pointing to a JDK and not just a JRE. The JRE doesn't have javac, so there won't be any way to compile .java files created at runtime by the JSP compiler into .classes?</p>
<p>EDIT: Also, perhaps this <a href="http://publib.boulder.ibm.c... | 25,118 |
<p>List Comprehension for me seems to be like the opaque block of granite that regular expressions are for me. I need pointers.</p>
<p>Say, I have a 2D list:</p>
<pre><code>li = [[0,1,2],[3,4,5],[6,7,8]]
</code></pre>
<p>I would like to merge this either into one long list</p>
<pre><code>li2 = [0,1,2,3,4,5,6,7,8]
<... | <p>Like so:</p>
<pre><code>[ item for innerlist in outerlist for item in innerlist ]
</code></pre>
<p>Turning that directly into a string with separators:</p>
<pre><code>','.join(str(item) for innerlist in outerlist for item in innerlist)
</code></pre>
<p>Yes, the order of 'for innerlist in outerlist' and 'for item... | <pre><code>import itertools
itertools.flatten( li )
</code></pre>
| 12,948 |
<p>I have an SSIS package that needs to lookup two different types of excel files, type A and type B and load the data within to two different staging tables, tableA and tableB. The formats of these excel sheets are different and they match their respective tables.</p>
<p>I have thought of putting typeA.xls and typeB.... | <p>You can do it this way, but it might require several complex string expressions. </p>
<p>E.g. create a ForEach loop over .xls files, inside the loop add an empty script task, then a data flow to load this file. Connect them with a precedence constraint and make it conditional: precedence constraint expression will ... | <p>You can get the SQL File watcher Task and add it to your SSIS. I think this is a cleaner way to do what you want.</p>
<p><a href="http://www.sqlis.com/post/File-Watcher-Task.aspx" rel="nofollow noreferrer">SQL File Watcher</a></p>
| 36,477 |
<p>What's the best (halting) algorithm for determining if a linked list has a cycle in it?</p>
<p>[Edit] Analysis of asymptotic complexity for both time and space would be sweet so answers can be compared better.</p>
<p>[Edit] Original question was not addressing nodes with outdegree > 1, but there's some talk about ... | <p>Have two pointers iterating through the list; make one iterate through at twice the speed of the other, and compare their positions at each step. Off the top of my head, something like:</p>
<pre><code>node* tortoise(begin), * hare(begin);
while(hare = hare->next)
{
if(hare == tortoise) { throw std::logic_er... | <p>What about using a hash table to store the already seen nodes (you look at them in order from the start of the list)? In practise, you could achieve something close to O(N).</p>
<p>Otherwise, using a sorted heap instead of a hash table would achieve O(N log(N)).</p>
| 5,444 |
<p>I got a problem at my blog. I got visits from kind bots who leave "nice" comments to my blog posts :( </p>
<p>I'm wondering if there is a smarter way to keep them out, besides using the captcha modules.
My problem with the captcha modules is that I thinks they are anoying to the user :( </p>
<p>I don't know if it'... | <p>Have you thought about using this? </p>
<p><strong><a href="http://akismet.com/" rel="nofollow noreferrer">http://akismet.com/</a></strong></p>
<p>From their FAQ</p>
<blockquote>
<p>When a new comment, trackback, or pingback comes to your blog it is submitted to the Akismet web service which runs hundreds of te... | <p>I think you have several options...</p>
<ol>
<li><p>Require registration to post comments - but thats more annoying than captcha, so probably not the best idea</p></li>
<li><p>Examine the user-agent of the poster (see <a href="http://www.user-agents.org/" rel="nofollow noreferrer">here</a>) for something that looks... | 32,507 |
<p>I need to implement a spell checker in C. Basically, I need all the standard operations... I need to be able to spell check a block of text, make word suggestions and dynamically add new words to the index.</p>
<p>I'd kind of like to write this myself, tho I really don't know where to begin.</p>
| <p>Read up on <a href="http://en.wikipedia.org/wiki/Tree_traversal" rel="nofollow noreferrer">Tree Traversal</a>. The basic concept is as follows:</p>
<ol>
<li> Read a dictionary file into memory (this file contains the entire list of correctly spelled words that are possible/common for a given language). You can downl... | <p>Splitting a word into root and suffix is knonw as the "Porter Stemming Algorithm" it's a good way of fitting an English ditionary into an amazingly small memory.<br>
It's also useful for seach so "spell checker" will also find "spelling check" and "spell checking"</p>
| 45,114 |
<p>This is what my browser sent, when logging into some site:</p>
<pre>
POST http://www.some.site/login.php HTTP/1.0
User-Agent: Opera/8.26 (X2000; Linux i686; Z; en)
Host: www.some.site
Accept: text/html, application/xml;q=0.9, application/xhtml+xml, image/png, image/jpeg, image/gif, image/x-xbitmap, */*;q=0.1
Accept... | <p>Every data sent trought a http connection can be seen by someone in your route to the server (man in the middle attack).</p>
<p>type="password" only hides the character on-screen, and even other programs on your computer can read the data.</p>
<p>The only way to protect the data is to send it trought SSL (HTTPS in... | <p>Yes, your credentials are passed in cleartext, anyone who can hear your network traffic can sniff them.</p>
| 17,605 |
<p>How do I get command line utilities like ping to use the default proxy in Windows XP.</p>
<p>proxycfg -u sets the proxy to the default (IE) proxy alright, but it doesn't seem to be working.</p>
<p><strong>Update</strong>: I am behind a proxy and would like a way to check if a site is up or not hence trying to use ... | <p>A proxy is usually used for web (HTTP) traffic, ping uses ICMP, which is a completely separate protocol. What, exactly are you trying to do?</p>
| <p>Your best bet will probably be a command line browser for Windows.</p>
<p>You can try out <a href="http://pachome1.pacific.net.sg/~kennethkwok/lynx/" rel="nofollow noreferrer">lynx</a>, which is nearly a full browser, or you can go something simpler and use <a href="http://gnuwin32.sourceforge.net/packages/wget.htm... | 17,768 |
<p>I have a Guid.NewGuid() call that is creating an Empty Guid. </p>
<p>What would cause such a problem and how can I fix it?</p>
<p><b>Edit:</b> The code:<br /></p>
<pre><code><WebMethod()> _
Public Function CreateRow(rowValue As String) as String
Dim rowPointer As Guid = System.Guid.NewGuid()
Dim ro... | <p>This is an old problem in VB.NET. It is only the debug visualizer that is broken.</p>
<p><a href="http://www.thesoftwaredevotional.com/2008/12/guid-visualizer-broken-in-vbnet.html" rel="nofollow noreferrer">http://www.thesoftwaredevotional.com/2008/12/guid-visualizer-broken-in-vbnet.html</a></p>
| <p>Try this</p>
<pre><code>Dim g As New Guid();
Dim whereDoYouWantToSeeIt As String = g.ToString();
</code></pre>
| 44,464 |
<p>I am starting a project for which we will have a thin client, sending requests and getting responses from a server.</p>
<p>We are still in the planning stages, so we have a choice to settle on either an Eclipse based GUI (Eclipse plugin) or using GWT as a fromtend for the application.</p>
<p>I am not very familiar... | <p>You <code>render :action => :new</code> rather than redirecting.</p>
| <p>Capture <code>@obj</code> in the flash hash as well, and then check for it in the <code>new</code> action.</p>
<pre><code>@obj = SomeObject.new(params[:some_obj])
if @obj.save
flash[:notice] = "ok"
# success
else
flash[:error] = @obj.errors.full_messages.collect { |msg| msg + "<br/>" }
flash[:obj] = ... | 19,142 |
<p>I'm working against a large COM library (ArcObjects) and I'm trying to pinpont a memory leak.<BR>
What is the most reliable way to determine the amount of memory used by unmanaged code/objects.<BR>
What performance counters can be used?</p>
| <p>Use <a href="http://support.microsoft.com/kb/268343" rel="nofollow noreferrer">UMDH</a> to get snapshot of your memory heap, run it twice then use the tools to show all the allocations that occurred between the 2 snapshots. This is great in helping you track down which areas might be leaking.</p>
<p><a href="http:/... | <p>The 'Virtual Bytes' counter for a process represents the total amount of memory the process has reserved. If you have a memory leak then this will trend upwards.</p>
| 12,777 |
<p>What's the penetration of design patterns in the real world? Do you use them in your day to day job - discussing how and where to apply them with your coworkers - or do they remain more of an academic concept? </p>
<p>Do they actually provide actual value to your job? Or are they just something that people talk abo... | <p>Any large program that is well written will use design patterns, even if they aren't named or recognized as such. That's what design patterns are, designs that repeatedly and <em>naturally</em> occur. If you're interfacing with an ugly API, you'll likely find yourself implementing a <code>Facade</code> to clean it... | <p>I absolutely use design patterns. At this point I take MVC for granted as a design pattern. My primary reason for using them is that I am humble enough to know that I am likely not the first person to encounter a particular problem. I rarely start a piece of code knowing which pattern I am going to use; I constan... | 3,268 |
<p>The other day I set up an Ubuntu installation in a VM and went to gather the tools and libraries I figured I would need for programming mostly in C++.</p>
<p>I had a problem though, where to put things such as 3rd party source libraries, etc. From what I can gather, a lot of source distributions assume that a lot o... | <p>Short answer: don't do a "heaps of code in local dir" thing.</p>
<p>Long answer: don't do a "heaps of code in local dir" thing, because it will be nightmare to keep up-to-date, and if you decide to distribute your code, it will be nightmare to package it for any decent distribution.</p>
<p>Whenever possible, stick... | <p>Ubuntu = Debian = apt-get goodness</p>
<p>Start with <a href="http://packages.debian.org/stable/base/util-linux" rel="nofollow noreferrer">Linux Utilities</a>:</p>
<pre><code>%> sudo apt-get install util-linux
</code></pre>
| 27,617 |
<p>About a year ago, I picked up Scott Ambler's <a href="https://rads.stackoverflow.com/amzn/click/com/0321293533" rel="noreferrer" rel="nofollow noreferrer">Refactoring Databases: Evolutionary Database Design</a>. I was won over to the idea that just as you can develop your code with TDD, you probably should be coveri... | <p>I only know of two unit testing frameworks:</p>
<ul>
<li><a href="http://dbunit.sourceforge.net/" rel="nofollow noreferrer">DBUnit</a></li>
<li><a href="http://tsqlunit.sourceforge.net/" rel="nofollow noreferrer">TSQLUnit</a></li>
</ul>
<p>As for change management, these are some recommended tools:</p>
<ul>
<li><... | <p>Microsoft's next version of Visual Studio for Database is supposed to have these. </p>
| 18,265 |
<p>Martin Fowler defines an elegant object model for the scheduling of recurring tasks <a href="http://www.martinfowler.com/apsupp/recurring.pdf" rel="noreferrer">here</a>, which maps to OO code very nicely. Mapping this to a relational database schema for persistence, however, is tricky.</p>
<p>Can anyone suggest a ... | <p>I'm afraid this answer will be a lot of references and very little practical code, and it has been a while since I last messed with this, but...</p>
<p>I think the two technologies you want to mix here are <a href="http://en.wikipedia.org/wiki/Active_database" rel="nofollow noreferrer">'active databases'</a> and <a ... | <p>SQL is a language for querying sets of data. It doesn't easily support encoding of domain-specific logic operations. In other words, "rule to be evaluated" is not a data type in SQL. That's an object-oriented concept, that both data and logic are components of an object instance.</p>
<p>So I would say the most y... | 40,071 |
<p>I am aware of how to setup autocompletion of python objects in the python interpreter (on unix). </p>
<ul>
<li>Google shows many hits for explanations on how to do this.</li>
<li>Unfortunately, there are so many references to that it is difficult to find what I need to do, which is slightly different.</li>
</ul>
... | <p>Use Python's <code>readline</code> bindings. For example,</p>
<pre><code>import readline
def completer(text, state):
options = [i for i in commands if i.startswith(text)]
if state < len(options):
return options[state]
else:
return None
readline.parse_and_bind("tab: complete")
readl... | <p>The posted answers work fine but I have open sourced an autocomplete library that I wrote at work. We have been using it for a while in production and it is fast, stable and easy to use. It even has a demo mode so you can quickly test what you would get as you type words.</p>
<p>To install it, simply run: <code>pip ... | 22,733 |
<p>Let's say you have a aspx page that does not rely on session, but does rely on viewstate for persistance between postbacks. </p>
<p>If a user is accessing this page, and leaves for a long lunch, will viewstate still be valid when he returns?</p>
| <p>No ViewState is kept as part of the PostBack process. You can, however, <a href="http://msdn.microsoft.com/en-us/library/ms972976.aspx#viewstate_topic10" rel="noreferrer">override</a> the Page class's SavePageStateToPersistenceMedium() and LoadPageStateFromPersistenceMedium(), to implement that behavior if desired... | <p>No Viewstate doesnot expires.After redirecting to other page then value of view state lost or expire viewstate.
for more detail <a href="http://www.c-sharpcorner.com/UploadFile/78d182/Asp-Net-state-management-techniques/" rel="nofollow">http://www.c-sharpcorner.com/UploadFile/78d182/Asp-Net-state-management-techniqu... | 28,943 |
<p>I have this <a href="https://www.tme.eu/en/details/mf50151vx-a99/dc12v-fans/sunon/mf50151vx-b00u-a99/" rel="noreferrer">fan model</a>, it is a SUNON model number <a href="https://www.tme.eu/en/Document/b30ea71fee61d11101012e50df6ac0ad/MF50151VX-A99-DTE.pdf" rel="noreferrer">MF50151VX-B00U-A99</a>
and it is a blower ... | <p>As discussed in the comments...</p>
<p>The problem with the fan seems to be its flimsy attachment to the printer head. The fact the fan chassis is not firmly kept in place allows for it to act as a soundboard, amplyfing whatever vibration nomally occurs in the motor.</p>
<p>You could probably get a fan that is mo... | <p>In response to Answer from MAC above. The Sunon Maglev Fan is actually an exceptional fan that is superior in all aspects from static pressure, CFM, Decibels... far superior to that of a radial fan like a Noctua. </p>
<p><a href="http://www.sunon.com/index2/uFiles/file/03_products/08-catalog%20download/Sunon%20DC%2... | 843 |
<p>I've been having this problem with my delta 3D printer where my nozzle isn't moving flat with my print bed (as if the bed is bent) but I have used the edge of my steel ruler and it seems to be perfectly flat. I have properly leveled my bed with a piece of paper and have checked the whole printer to make sure it's sq... | <p>In an earlier comment you stated that you cannot take it apart. So without taking it apart, you could try to determine the profile the old-fashion way with a piece of cardboard and a short pencil, just cut the rough shape of the rod and place it onto the rod, then take the short pencil and draw the profile onto the ... | <p>You could pull it apart and have it 3d scanned if you want to know the exact dimensions. There are companies that can do that for you at a certain price. Our company has used such services in scanning various parts before we obtained our own laser scanning device. </p>
<p>The question is whether you want exactly th... | 908 |
<p>I am trying to add a <code>UIButton</code> at runtime however it is not visible. What am I doing wrong?</p>
<pre><code>- (id)initWithFrame:(CGRect)frame {
if (self = [super initWithFrame:frame]) {
UIButton *btn = [[UIButton buttonWithType:UIButtonTypeRoundedRect] retain];
btn.frame = CGRectMake(... | <p>First, make sure the initWithFrame: method is being called. If your view is in a Nib, initWithCoder: is being called instead.</p>
<p>Second, is the button the only subview (from your code it looks like it is, but you never know). The button could be hidden behind another subview. Call bringSubviewToFront: if you ne... | <p>if it still doesn't work, try removing the : at the end of the selector name: @selector(buttonClick)</p>
| 39,637 |
<p>It seems like most examples of JPA/Hibernate entity bean classes I've seen do no explicit synchronization. Yet, it is possible to call getters/setters on those objects in the context of building up a transaction. And it's possible for those methods to be called across multiple threads (although maybe that's unusua... | <p>"And it's possible for those methods to be called across multiple threads (although maybe that's unusual and weird)."</p>
<p>I can speak for hibernate ONLY since I don't have much experience with JPA.
The object on which you call set is NOT always the same object on which you call get. When Hibernate is loading the... | <p>JPA/Hibernate entities are POJOs. Hibernate and any JPA-Provider does not change runtime sematics.</p>
<p>So if you would have concurrency issues with a simple POJO, you will also have them with your entity!</p>
<p>In all the Systems I have seen the domain model is not threadsave, entity instances are not accessed... | 22,206 |
<p>I'm trying to understand how you are supposed to add page numbers to the bottom of each page using ActiveReports3. </p>
<p>E.g.</p>
<p>Page 1 of 10.</p>
<p>Thanks,</p>
<p>Mo</p>
| <p>Use the ReportInfo object with the following FormatString </p>
<p>Page {PageNumber} of {PageCount}</p>
<p>You can also use the ReportInfo object to display the print time with this FormatString</p>
<p>Printed: {RunDateTime}</p>
| <p>There are two walkthroughs on how to do this at Data Dynamics website. You can see a link to both from the following page: <a href="http://www.datadynamics.com/Help/ARNET3/ar3oriPageNumberingWalkthroughs.html" rel="nofollow noreferrer">http://www.datadynamics.com/Help/ARNET3/ar3oriPageNumberingWalkthroughs.html</a> ... | 39,425 |
<p>I am an art rubber stamp maker, using a vulcanizer to make art rubber stamps from molds that are usually created with a magnesium plate. </p>
<p>The normal process is to send artwork off to an engraving firm to acid etch the magnesium plate (11 pt depth is desired) and that metal plate is then used with uncured ma... | <p>This would likely not work. ABS has a <em>glass transition</em> temperature of 105 °C. It doesn't have <em>a</em> melting point because it's amorphous. Rather, as you heat the part up, it gradually transitions from a solid to a viscous liquid, but there is no "hard" transition from solid to molten at one partic... | <p>I don't know if I understood your question properly. You using the mold to create a rubber stamp and then you use that to stamp over stuff? If so, you simply can use 3D printing to create the stamp, if not, my answer is rubbish. </p>
<p>You can use a flex material to create the stamp itself and then use some hard m... | 675 |
<p>I've been trying to come up with a way to write generic repositories that work against various data stores:</p>
<pre><code>public interface IRepository
{
IQueryable<T> GetAll<T>();
void Save<T>(T item);
void Delete<T>(T item);
}
public class MemoryRepository : IRepository {...}
p... | <ol>
<li><p>The first approach is feasible, I have done something similar in the past when I wrote my own mapping framework that targeted RDBMS and <code>XmlWriter</code>/<code>XmlReader</code>. You can use this sort of approach to ease unit testing, though I think now we have superior OSS tools for doing just that.</... | <p>Actually there is a general consensus now that Domain repositories should not be generic. Your repository should express what you can do when persisting or retrieving your entities.</p>
<p>Some repositories are readonly, some are insert only (no update, no delete), some have only specific lookups...</p>
<p>Using a... | 34,051 |
<p>I have three DIVs, something like this:</p>
<pre><code><div id="header">
...
</div>
<div id="content">
<div id="popup">
...
</div>
</div>
</code></pre>
<p>DIV#header is "position: fixed" and used as a non-scrolling header at the top of the screen. DIV#conten... | <p>Turns out that the edit control (At least in my development environment) is a combo box, so <code>EM_SETLIMITTEXT</code> isn't appropriate. </p>
<p>Instead, I tracked down the combo box using <code>GetDlgCtrl</code> on the parent of the file open dialog (I do this in the <code>OnInitDialog</code> handler), cast it ... | <p>I believe this is a hard limit that cannot be bypassed. The only time it should matter is when you want to select more than one file, since the limit is enough for the maximum file name length.</p>
<p>I have added an "All Files" button to these dialogs for opening all of the files in a folder; that's the only worka... | 47,158 |
<p>I have a large inherited C/C++ project. Are there any good tools or techniques to produce a report on the "sizeof" of all the datatypes, and a breakdown of the stack footprints of each function in such a project. </p>
| <p>I'm curious to know why you want to do this, but that's merely a curiosity.</p>
<p>Determining the sizeof for every class used should be simple, unless they've been templated, in which case you'd have to check every instantiation, also.</p>
<p>Likewise, determining the <strong>per call</strong> sizeof on a functio... | <p>I'm not aware of any tools, but if you're working under MSVC you can use <a href="http://msdn.microsoft.com/en-us/library/t6tay6cz(VS.80).aspx" rel="nofollow noreferrer">DIA SDK</a> to extract size information from .PDB files. Sadly, this wont work for stack footprints IIRC.</p>
| 11,732 |
<p>I want to build a threaded forum for an elearning site (opensource asp.net mvc ofcourse, though this doesn't matter for this question). </p>
<p>What should be the DB structure which will help retrieve the forum postings with optimum performance? I am not putting a no. to it as it may vary with the amount of rows ... | <p>When you have non-recursive top-down (Forum -> Thread -> Postings) retrieval of your data in mind for the most common use case, than this table structure is a good start, because this would result mainly in <code>WHERE ParentId = @SomeId</code> queries.</p>
<p>When you want to be able to calculate things like... | <p>Table: Post </p>
<pre><code>· ThreadId
· UUID
· Author
· Subject
· Body
· PostedDate
</code></pre>
<p>Table: Thread </p>
<pre><code>·ThreadID
·Forum
·UUID
·Author
·Subject
·Body
·PostedDate
</code></pre>
<p>Only on a MySQL server with Caching and Indexing. Otherwise this Structure is not the best but with th... | 47,269 |
<p>I"m considering making my own filament, with a device like the one at <a href="http://www.thingiverse.com/thing:380987" rel="nofollow noreferrer">http://www.thingiverse.com/thing:380987</a>. Partly because it's another machine to build, which is cool, but also to save money on filament.</p>
<p>Has anyone here tried... | <ol>
<li><p>Quality depends on 3 things:</p>
<ol>
<li><p>Quality of pellets (purity, fillers, color)</p></li>
<li><p>Where/how they are stored before and during the extrusion (humidity, contaminants)</p></li>
<li><p>Have a filter in your extruder to get rid of random junk and air bubbles ending up in your filament (25... | <p>You can basically use any machine that pulverizes your pellets into small pieces.</p>
<p><a href="https://www.3dhubs.com/talk/thread/how-make-your-own-filament-recycling-old-3d-prints-part-1" rel="noreferrer"><strong>One guy on 3dhubs, explained it in details.</strong></a></p>
<p>My conclusion is that you can recy... | 166 |
<p>I have a simple function that I want to call in the code behind file name Move
and I was trying to see how this can be done and Im not using asp image button because not trying to use asp server side controls since they tend not to work well with ASP.net MVC..the way it is set up now it will look for a javascript fu... | <p>Scott Guthrie has a <a href="http://weblogs.asp.net/scottgu/archive/2007/12/03/asp-net-mvc-framework-part-2-url-routing.aspx" rel="nofollow noreferrer">very good example</a> on how to do this using routing rules.</p>
<p>This would give you the ability to have the user navigate to a URL in the format /Search/[Query]... | <p>You cannot do postbacks or call anything in a view from JavaScript in an ASP.NET MVC application. Anything you want to call from JavaScript must be an action on a controller. It's hard to say more without having more details about what you're trying to do, but if you want to call some method "Move" in your web appli... | 49,590 |
<p>I am looking for good tutorials that go through every step of creating an AR application. It would be beneficial if it also covers some of the theory behind optics and such.</p>
| <p>A good setup is to use <a href="http://artoolkit.sourceforge.net/" rel="nofollow noreferrer">ARToolKit</a> plus <a href="http://www.osgart.org" rel="nofollow noreferrer">osgART</a>.</p>
<p>The tutorial of ARToolKit also explains also some of the principles of Computer Vision:</p>
<p><a href="http://www.hitl.washin... | <p>Not a trivial learning curve but <a href="http://www.openscenegraph.org" rel="nofollow noreferrer">OpenScenegraph</a> is probably the main FOSS app for large applications like flight simulators.</p>
| 36,446 |
<p>I am quite new to JavaScript libraries. I wanted to replace my current code with jQuery. My current code looks like this:</p>
<pre><code>var req;
function createRequest() {
var key = document.getElementById("key");
var keypressed = document.getElementById("keypressed");
keypressed.value = key.value;
va... | <pre><code>$.get(url, {}, callback);
</code></pre>
<p>should do the trick. Your callback could be simplified like this:</p>
<pre><code>function callback(content){
$('#decimal').val(content);
}
</code></pre>
<p>Or even shorter:</p>
<pre><code>$.get(url, {}, function(content){
$('#decimal').val(content);
});
... | <p>In the end I guess it was added the type. This seems to work for me.</p>
<pre><code> function convertToDecimal(){
var key = document.getElementById("key");
var keypressed = document.getElementById("keypressed");
keypressed.value = key.value;
var url = "/My_Servlet/response?key="+ escape(key.val... | 12,990 |
<p>I want to enforce CHECK constraint on a date range such that all dates in column BIRTH_DATE are less than tomorrow and greater than or equal to 100 years ago. I tried this expression in a CHECK constraint:</p>
<pre><code>BIRTH_DATE >= (sysdate - numtoyminterval(100, 'YEAR')) AND BIRTH_DATE < sysdate + 1
</co... | <p>A check constraint expression has to be deterministic, so this sort of sliding date range is not enforcable in a check constraint. From the <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF01111" rel="nofollow noreferrer">SQL Reference</a></p>
<blockquote>
<p>Conditions... | <p>A check constraint expression has to be deterministic, so this sort of sliding date range is not enforcable in a check constraint. From the <a href="http://download.oracle.com/docs/cd/B28359_01/server.111/b28286/clauses002.htm#SQLRF01111" rel="nofollow noreferrer">SQL Reference</a></p>
<blockquote>
<p>Conditions... | 25,376 |
<p>I'm building a distributed C++ application that needs to do lots of serialization and deserialization of simple data structures that's being passed between different processes and computers.</p>
<p>I'm not interested in serializing complex class hierarchies, but more of sending structures with a few simple members ... | <p>I would strongly suggest protocol buffers. They're incredibly simple to use, offer great performance, and take care of issues like endianness and backwards compatibility. To make it even more attractive, serialized data is language-independent thanks to numerous language implementations.</p>
| <p>Don't pre-emptively optimize. Measure first and optimize second.</p>
| 41,634 |
<p>Is it possible to have XML-embedded JavaScript executed to assist in client-side (browser-based) XSL transformations? How is it done and how official is it?</p>
<p>Microsoft's XML DOM objects allow this on the server-side (i.e. in ASP/ASP.NET).</p>
<p><strong>Clarification:</strong> I do not mean HTML DOM scripti... | <p>To embed JavaScript for the aid of transformation you can use <xsl:script>, but <a href="http://www.topxml.com/xsl/tutorials/intro/xsl10.asp" rel="nofollow noreferrer">it is limited</a> to Microsoft's XML objects implementation. Here's an <a href="https://oxampleski.googlecode.com/svn/trunk/XSL" rel="nofollow... | <p>Yes. It's browser dependant but you can use Javascript. There is a small but practical tutorial on w3schools.com. It's part of the XSLT tutorial.</p>
<p>The page:</p>
<p><a href="http://www.w3schools.com/xsl/xsl_client.asp" rel="nofollow noreferrer">http://www.w3schools.com/xsl/xsl_client.asp</a></p>
<p>The XSLT ... | 9,166 |
<p>Even if it requires manual input. Is there any good-enough option available?</p>
| <p>I don't know anything about this site, but a little googling found <a href="http://code2code.net/" rel="nofollow noreferrer">this</a>.</p>
| <p>If it was in managed C++ or C++/CLI, you could compile it and then disassemble the assembly into C# using a tool like Reflector. Of course, that's not open source but maybe you can find an open source Reflector-style tool?</p>
<p>If it's native C++, that's much more difficult.</p>
| 19,382 |
<p>Can I call a stored procedure in Oracle via a database link?</p>
<p>The database link is functional so that syntax such as...</p>
<pre><code>SELECT * FROM myTable@myRemoteDB
</code></pre>
<p>is functioning. But is there a syntax for...</p>
<pre><code>EXECUTE mySchema.myPackage.myProcedure('someParameter')@myRem... | <p>The syntax is</p>
<pre><code>EXEC mySchema.myPackage.myProcedure@myRemoteDB( 'someParameter' );
</code></pre>
| <p>for me, this worked</p>
<pre><code>exec utl_mail.send@myotherdb(
sender => 'myfromemail@giggle.com',recipients => 'mytoemail@giggle.com,
cc => null, subject => 'my subject', message => 'my message'
);
</code></pre>
| 29,804 |
<p>I have a MySQL database table with a couple thousand rows. The table is setup like so:</p>
<p><code>id | text</code></p>
<p>The <code>id</code> column is an auto-incrementing integer, and the <code>text</code> column is a 200-character varchar.</p>
<p>Say I have the following rows:</p>
<p><code>3 | I think I'll ... | <p>MySQL already does this for you.</p>
<p>First make sure your table is a MyISAM table</p>
<p>Define a FULLTEXT index on your column</p>
<p>On a shell command line navigate to the folder where your MySQL data is stored, then type:</p>
<pre><code>myisam_ftdump -c yourtablename 1 >wordfreq.dump
</code></pre>
<p>... | <p>Extract to flat file and then use your favorite quick language, perl, python, ruby, etc to process the flat file.</p>
<p>If you don't have one these languages as part of your skillset, this is a perfect little task to start using one, and it won't take you long.</p>
<p>Some database tasks are just so much easier t... | 30,929 |
<p>I'm porting a Forms app to a VB.NET web app, and one of the feature the users really liked was the ability to narrow the possible choices as the user typed in a search box. The search itself goes against multiple tables and columns (and takes several seconds), so it's not a simple AutoComplete or anything. What's th... | <p>JQuery will be a good solution to filter the ListView at client side. Check this recent <a href="http://beckelman.net/post/2008/10/16/Client-Side-ASPNET-ListView-Sorting-via-jQuery-TableSorter-Plugin-Demo.aspx" rel="nofollow noreferrer">article</a> and another cool <a href="http://beckelman.net/post/2008/11/20/jQue... | <p>Check out the ASP.NET AJAX controls. There is a specific control for autocompletion:</p>
<blockquote>
<p>AutoComplete is an ASP.NET AJAX
extender that can be attached to any
TextBox control, and will associate
that control with a popup panel to
display words that begin with the
prefix typed into the tex... | 39,466 |
<p>I believe I need a DTD to define the schema and an XSLT if I want to display it in a browser and have it look "pretty". But I'm not sure what else I would need to have a well-defined XML document that can be queried using XQuery and displayed in a web browser.</p>
| <p>Strictly speaking, you need nothing. XML, even without a schema definition, works.</p>
<p>A schema definition (in XSD, RelaxNG or DTD) helps various tools that work with the XML, because they can verify that the structure of the XML conforms to what you want.</p>
<p>An XSLT translation to HTML is nice if the XML c... | <p>Strictly speaking, you need nothing. XML, even without a schema definition, works.</p>
<p>A schema definition (in XSD, RelaxNG or DTD) helps various tools that work with the XML, because they can verify that the structure of the XML conforms to what you want.</p>
<p>An XSLT translation to HTML is nice if the XML c... | 9,048 |
<p>I have this method in my db class</p>
<pre><code>public function query($queryString)
{
if (!$this->_connected) $this->_connectToDb(); //connect to database
$results = mysql_query($queryString, $this->_dbLink) or trigger_error(mysql_error());
return mysql_num_rows($results) > 0 ?... | <pre><code>public function query($queryString)
{
if (!$this->_connected) $this->_connectToDb(); //connect to database
$results = mysql_query($queryString, $this->_dbLink) or trigger_error(mysql_error());
$data = array();
while($row = mysql_fetch_assoc($results))
... | <p>Look at <a href="http://pear.php.net/package/MDB2" rel="nofollow noreferrer">PEAR::MDB2</a> (<a href="http://codeschmie.de/archives/127-MDB2-Cheatsheet.html" rel="nofollow noreferrer">Quickstart Cheatsheet</a>). It provides lots of different functions for doing something like this. It also does not tie you down into... | 44,071 |
<p>I have written a simple <a href="http://en.wikipedia.org/wiki/Brainfuck" rel="noreferrer">brainfuck</a> interpreter in MATLAB script language. It is fed random bf programs to execute (as part of a genetic algorithm project). The problem I face is, the program turns out to have an infinite loop in a sizeable number o... | <p>Alan Turing would like to have a word with you.</p>
<p><a href="http://en.wikipedia.org/wiki/Halting_problem" rel="noreferrer">http://en.wikipedia.org/wiki/Halting_problem</a></p>
| <p>Off the top of my head (and I could be wrong), I would think it would be a little bit difficult to detect whether or not a program has an infinite loop without actually executing the program itself.</p>
<p>As the conditional execution of portions of the program depends on the execution state of the program, it will... | 47,976 |
<p>I've been unable to find a source for this information, short of looking through the Python source code myself to determine how the objects work. Does anyone know where I could find this online?</p>
| <p>Checkout the <a href="http://wiki.python.org/moin/TimeComplexity" rel="noreferrer">TimeComplexity</a> page on the py dot org wiki. It covers set/dicts/lists/etc at least as far as time complexity goes.</p>
| <p>If your asking what I think your asking, you can find them <a href="http://books.google.com/books?id=vpTAq4dnmuAC&pg=RA1-PA476&lpg=RA1-PA476&dq=Big-O+of+Python+data+structures&source=web&ots=AOM5B5D7yA&sig=deLGb6VrftTpnNYN6fILVbiirXM&hl=en&sa=X&oi=book_result&resnum=7&ct=r... | 6,704 |
<p>I've just purchased an Alladinbox SkyCube 3D that I want to use to print board game miniatures and other fun stuff.</p>
<p>However, the instructions do not give the settings I need to put into software like Ultimaker Cura, and this is where I need some help so that I can generate the G-code files from models I down... | <p>Okay, after some research and experimentation, I've come up with some settings that seem to work.</p>
<p>Firstly, some specs about the Alladinbox SkyCube 3D:</p>
<ul>
<li>Firmware: Marlin</li>
<li>Nozzle diameter: 0.4 mm</li>
<li>Nozzle speed: 20 to 70 mm/s</li>
<li>Layer thickness: 0.1 to 0.4 mm</li>
<li>Printing... | <p>Ultimaker Cura comes with pre-defined profiles for various materials. PLA filament is present in between them. This could be a good starting point to derive your specific profile for your own material. To do we usually print test objects and look at the quality of the product. Test prints can consist of simple X-Y-Z... | 909 |
<p>Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement like the following:</p>
<p><code>"batman*... | <p>After some more researching, I'm going to try and use Lucene.Net for my movie-title search engine, and not rely on Full-Text Searching in SQL Server 2005. Early testing shows that the results have been better and more relevant with Lucene. A search for "batman" returns the following partial result-set:</p>
<ul>
<l... | <p>I think you find SQL Server Full Text works just as good but you have to understand how to build the keywords. It is not the same as Lucene, especially in terms of indexing. I think you will find that SQL Server would be better , in terms of scalability and features - especially SQL 2008 now it is part of the engine... | 37,988 |
<p>Windows has <a href="http://msdn.microsoft.com/en-us/library/ms724320(VS.85).aspx" rel="nofollow noreferrer">GetFileTime</a> API which allows getting file time information by open file handle. What I wanted to know is, if it is possible to get this information by file name without opening the file explicitly. And if... | <p>If you call CreateFile with a dwFileAccess value of zero, it "<a href="http://msdn.microsoft.com/en-us/library/ms923949.aspx" rel="noreferrer">specifies device query access to the object. An application can query device attributes without accessing the device.</a>" No clue why they removed that really informative b... | <p>GetFileTime is available on all versions of Windows CE. You're unlikely to find a way to accomplish this without a valid file handle in Win32.</p>
| 46,131 |
<p>I would like to upgrade my web projects on an IIS 5 server from .NET 2.0 to .NET 3.5. These web applications live on a server with other web applications that will not be upgraded to .NET 3.5. The server administrator is reluctant to install .NET 3.5 because he is afraid it will break the applications on that mach... | <p>If you have .NET 2 SP1 you shouldn't have a problem.</p>
<p>To be exact .NET 3 & 3.5 are built on top of .NET 2.0 SP 1, we had a problem deploying 3.5 onto a server which only had .NET 2 (not SP1) and it caused the apps on there to break. The reason is your core framework assemblies in .NET 2 are upgraded and h... | <p>It won't have any problem and you will be able to run your 2.0 and 3.5 application using the same server. This is because the code base for both of the frameworks is the same. </p>
| 19,944 |
<p>What is a good mobile programming platform to go with for a <code>c++</code> developer? </p>
<p>Is learning <code>android</code> a good option?</p>
| <p>If you already know C++ then Symbian has the largest install base, and isn't sandboxed like java/android vm/iphone.</p>
<p>Whilst the iPhone and Andriod may seem interesting, if you actually look at the figures Symbian really is the only option when looking at market share. Despite apple's advertising behemoth and ... | <p>Personally, I started out with the Windows Mobile platform and Microsoft Embedded C++. </p>
<p>It was a natural shift because I'd come from the MSVC compiler/Visual Studio 6 environment, so I was already quite familiar with aspects of the compiler and the IDE. </p>
<p>In fact, because I was so familiar with thos... | 20,880 |
<p>I would like to have my CodeGear Delphi 2007 project to automatically set the debug module attributes depending on whether my project is in debug or release mode.</p>
<p>I can manually set this value by right clicking on the project->Version Info->Edit values as needed. These are for the project as a whole and are ... | <p>You could if you do it the other way around if you use the commandline compiler. Tell the compiler to compile for debug or release. Set a compiler directive to DEBUG for the debug build (it does that by default).</p>
<p>msbuild YourProject.dproj /p:Configuration=Release</p>
<p>msbuild YourProject.dproj /p:Configur... | <p>There is a Delphi wiki writeup about exactly this question:</p>
<p><a href="http://delphi.wikia.com/wiki/Easily_Switching_between_%22Debug%22_and_%22Release%22_Builds" rel="nofollow noreferrer">Easily Switching between "Debug" and "Release" Builds</a></p>
| 37,081 |
<p>My organization's main project went live on Monday. That was my third day here. Now that I've been here almost a week, I'm tasked with creating a change management plan for the maintenance of the application and preparation for phase 2, which will commence "someday." We're a Microsoft shop but open-minded.</p>
<p>I... | <p>Establish a review board, with senior representatives from development, operations, qa, the business, etc., with the CM manager as the chair. All changes have to be presented to the board. </p>
<p>In one place I worked you needed unanimous approval to implement a change. In another a 2/3 majority was enough. At bot... | <p>More companies in the UK seem to be embracing ITIL for Change Management. The last couple of places I've worked have used an application called Sostenuto which tries to match with the areas like Incident, Problem and Change Management. I'm not convinced whether it's the best way to go about things yet though.</p>
| 22,326 |
<p>I have a winforms application, the issue has to do with threading.
Since I am calling 'MyCustomCode() which creates a new thread, and calls the method
'SomeMethod()' which then accesses MessageBox.Show(...).</p>
<p>The problem has to do with threading, since the newly created thread is trying to access
a control t... | <p>You cannot acces UI elements from multiple threads.</p>
<p>One way to solve this is to call the Invoke method of a control with a delegate to the function wich use the UI elements (like the message box). Somethin like:</p>
<pre><code>public delegate void InvokeDelegate();
public void SomeMethod()
{
button1.I... | <p>You should <strong>NOT</strong> use BeginInvoke, you should use Invoke, then once you grasp that, you can look into using BeginInvoke if really needed.</p>
| 18,004 |
<p>I have a simple problem when querying the SQL Server 2005 database. I have tables called Customer and Products (1->M). One customer has most 2 products. Instead of output as</p>
<p>CustomerName, ProductName ...</p>
<p>I like to output as </p>
<p>CustomerName, Product1Name, Product2Name ...</p>
<p>Could anybody h... | <p>Like others have said, you can use the PIVOT and UNPIVOT operators. Unfortunately, one of the problems with both PIVOT and UNPIVOT are that you need to know the values you will be pivoting on in advance or else use dynamic SQL.</p>
<p>It sounds like, in your case, you're going to need to use dynamic SQL. To get thi... | <p>in sql2005, there are functions called "PIVOT" and "UNPIVOT" which can be used to transform between rows and columns.</p>
<p>Hope that could help you.</p>
| 45,240 |
<p>Can you tell me if there anybody has implemented a <strong>custom validator for checking that one of two (or N)</strong> input fields are filled?</p>
<pre><code> "Insert phone number or email address"
</code></pre>
<p>I'm using ASP.NET (Ajax) 3.5, the ajaxToolkit:ValidatorCalloutExtender (and jQuery if it's nece... | <p>Oh, sure, about 10 minutes later I found this Code Project article <strong><a href="http://www.codeproject.com/KB/validation/MultipleFieldsValidator.aspx" rel="nofollow noreferrer">Multiple Fields Validator - An ASP.NET Validation Control by Adam Tibi</a></strong> by myself:</p>
<p><img src="https://www.codeproject... | <p>Code project also has this control (by yours truly):<br>
<a href="http://www.codeproject.com/KB/validation/AtLeastOneOfValidator.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/validation/AtLeastOneOfValidator.aspx</a></p>
| 43,716 |
<p>I'd like to use a database to store i18n key/value pairs so we can modify / reload the i18n data at runtime. Has anyone done this? Or does anyone have an idea of how to implement this? I've read several threads on this, but I haven't seen a workable solution.</p>
<p>I'm specifically refering to something that would... | <p>I finally got this working with danb's help above.</p>
<p>This is my resource bundle class and resource bundle control class.</p>
<p>I used this code from @[danb]'s.</p>
<pre><code>ResourceBundle bundle = ResourceBundle.getBundle("AwesomeBundle", locale, DbResourceBundle.getMyControl());
javax.servlet.jsp.jstl.co... | <p>Actuly what ScArcher2 needed is davids response which is not marked a correct or helpfull.</p>
<p>The solution ScArcher2 chose to use is imo terrible mestake:) Loading ALL the translations at one time... in any bigger application its gonna kill it. Loading thousends of translations each request...</p>
<p>david's m... | 3,973 |
<p>I am writing controls that work nice with JavaScript, but they have to work even without it. Now testing with selenium works fine for me. But all test with disabled JavaScript (in my browser) won't run with selenium. Is there a way to do automated test for this purpose?</p>
| <p>I don't know Selenium, but with the NoScript Firefox extension, you can disable scripts on a per-domain basis. So could you use that to allow Selenium but disable your page's scripts?</p>
| <p>If it's just plain html with no javascript, you could just use normal screenscraping techniques to compare the html you downloaded from the server to what you expect, no need to test in a browser.</p>
| 26,019 |
<p>After some time I wanted to update my git repo, and then something went wrong. What is the proper way out of this situation?</p>
<pre><code>mblsha@siruba:~/src/psi/ $ git status
iris: needs merge
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: sr... | <p>When it comes to git submodules, almost any problem you encounter can be solved by:</p>
<pre><code>1. deleting the submodule (rm -r iris)
2. recreating it again (git submodule update)
</code></pre>
<p>Obviously if you have made local changes to your submodule this will DELETE them PERMANENTLY, so if you have local... | <p>I posted a similar <a href="https://stackoverflow.com/questions/826715/how-do-i-manage-conflicts-with-git-submodules/835368#835368">question</a> here on stackoverflow and ended up answering it myself, but I found that using <code>git reset HEAD iris</code> worked for my issue with submodule conflicts.</p>
| 35,177 |
<p>I recently found a log statement in my projects codebase that says
"here i am with search parameter==>===========11/30/2008===1====00:00 AM"</p>
<p>what guidelines do you adhere to for writing good log messages in an application?</p>
| <p>That `log' statement looks more like a trace statement.</p>
<p>Logging: show the normal events and errors</p>
<p>Tracing: show the execution path as well as the all of the logging events</p>
<p>Personally, I want logging to find out what work has been done by my program, and I want trace statements to verify the ... | <p>In my logs, I need the date and the time, the process that creates the logs, and the PID. There's nothing worse than looking at logs and wondering whether they came in five minutes ago, or whether they were left behind 5 years ago before your changes. Date and time are important.</p>
<p>When I report errors, I stat... | 34,026 |
<p>What's the best way to get the contents of the mixed <code>body</code> element in the code below? The element might contain either XHTML or text, but I just want its contents in string form. The <code>XmlElement</code> type has the <code>InnerXml</code> property which is exactly what I'm after.</p>
<p>The code as... | <p>I wanted to see which of these suggested solutions performed best, so I ran some comparative tests. Out of interest, I also compared the LINQ methods to the plain old <strong>System.Xml</strong> method suggested by Greg. The variation was interesting and not what I expected, with the slowest methods being <strong>mo... | <pre><code>public static string InnerXml(this XElement xElement)
{
//remove start tag
string innerXml = xElement.ToString().Trim().Replace(string.Format("<{0}>", xElement.Name), "");
////remove end tag
innerXml = innerXml.Trim().Replace(string.Format("</{0}>", xElement.Name), "");
return... | 2,582 |
<p>Is there a reason to sort MultiMap in Java and how to do that?</p>
| <p>Assuming you're talking about <a href="https://commons.apache.org/proper/commons-collections/apidocs/org/apache/commons/collections4/MultiMap.html" rel="nofollow noreferrer"><code>org.apache.commons.collections.MultiMap</code></a>, then you can't; since it returns a <code>Collection</code> and not a <code>List</code... | <p>Easiest solution is to use TreeMultimap from guava. Use either directly</p>
<pre><code>TreeMultimap<...> sortedMap = TreeMultimap.create(notSortedMultiMap);
</code></pre>
<p>if your keys and values are sortable naturally (implement Comparable), or</p>
<pre><code>TreeMultimap<...> sortedMap = TreeMulti... | 33,111 |
<p>Do any C++ GNU standalone classes exist which handle paths cross platform? My applications build on Windows and LInux. Our configuration files refer to another file in a seperate directory. I'd like to be able to read the path for the other configuration file into a class which would work on both Linux or Windows... | <p>Unless you're using absolute paths, there's no need to translate at all - Windows automatically converts forward slashes into backslashes, so if you use relative paths with forward slash path separators, you'll be golden. You should really avoid absolute paths if at all possible.</p>
| <p>There are many ways, IMHO the correct answer is to redesign your program to avoid manipulating paths. I posted an answer here: <a href="https://stackoverflow.com/a/40980510/2345997">https://stackoverflow.com/a/40980510/2345997</a> which is relevant.</p>
<p><strong>ways:</strong></p>
<ol>
<li>Add a command line opt... | 14,897 |
<p>I need a data structure that can store non-overlapping ranges within a single dimension. The entire range of the dimension need not be completely covered.</p>
<p>An example would be a conference room scheduler. The dimension is time. No two schedules may overlap. The conference room isn't always scheduled. In other... | <p>The <em>normalized</em> way to represent your data would be to store a record for each unit of time. This can be done in the example of the conference scheduling application. Your constraint would be a unique constraint for </p>
<pre><code>(RoomId, StartTime)
</code></pre>
<p>In the case of continuous ranges, you ... | <p>A lot depends on what you'll be doing with the data, and therefore which operations need to be efficient. However, I'd consider a doubly linked list of Ranges with logic in the setters of Start and End to check whether it now overlaps its neighbours, and to shrink them if so (or throw an exception, or however you wa... | 25,874 |
<p>I want to convert a <code>std::string</code> to lowercase. I am aware of the function <code>tolower()</code>. However, in the past I have had issues with this function and it is hardly ideal anyway as using it with a <code>std::string</code> would require iterating over each character.</p>
<p>Is there an alternative... | <p>Adapted from <a href="http://notfaq.wordpress.com/2007/08/04/cc-convert-string-to-upperlower-case/" rel="noreferrer"><em>Not So Frequently Asked Questions</em></a>:</p>
<pre><code>#include <algorithm>
#include <cctype>
#include <string>
std::string data = "Abc";
std::transform(data.begin(), data.... | <p>I tried std::transform, all i get is abominable stl criptic compilation error that only druids from 200 years ago can understand (cannot convert from to flibidi flabidi flu)</p>
<p>this works fine and can be easily tweaked</p>
<pre><code>string LowerCase(string s)
{
int dif='a'-'A';
for(int i=0;i<s.len... | 40,493 |
<p>A question mainly for web developers. </p>
<p>When you develop web applications and add an admin area to it, how do you name it? Leaving it 'admin' is a bit out of fashion and insecure. </p>
<p>Mind sharing any other nouns, verbs, adjectives or whatnot, that holds the title of any websites you know/can think of.</... | <p>If you have real security protecting the admin area, it should not matter what you call it. Security through obscurity is a bad idea.</p>
| <p>I won't use /admin/ because it is too obvious, but I don't really see why it matter what you call it.</p>
<p>The one thing I do though is make sure it can change that url anytime just by changing one config variable.</p>
<p>I'd rather not have people know what I use, because it's a lot harder to gain access to a b... | 44,960 |
<pre><code>var e1 = new E1();
e1.e2s.Add(new e2()); //e2s is null until e1 is saved, i want to save them all at the same time
context.e1s.imsertonsubmit(e1);
context.submitchanges();
</code></pre>
| <p>The sub items will be saved along with the main item, and even identities will be set properly, if you give your DataClasses an association between these classes.</p>
<p>You do this by adding LoadOptions to your O/R-Designer DataClasses like this:</p>
<pre><code> MyDataContext mydc = new MyDataContext();
System... | <p>Well - I don't know if your initial code block would work, but I'm guessing you have to mark your new e2 as insert on submit. Thus:</p>
<pre><code>var e1 = new E1();
var e2 = new e2();
e1.e2s.Add(e2); //e2s is null until e1 is saved, i want to save them all at the same time
context.e1s.insertonsubmit(e1);
context.e... | 7,614 |
<p>I am going to be using Subversion for source control on a new J2EE web application. What directory structure will you recommend for organizing code, tests and documentation?</p>
| <p>I usually have</p>
<pre>
Project Directory
src - actual source
doc - documentation
lib - libraries referenced from source
dep - installation files for dependencies that don't fit in lib
db - database installation script
</pre>
<p>In work with Visual Studio, I'm not sure if this works the same in the jav... | <p>I use Eclipse for creating J2EE web applications and this will create the following project structure:</p>
<pre><code>WebAppName\
\lib
\src
\tests
etc...
</code></pre>
<p>I would then create an SVN folder on our trunk called WebAppNameProject. Within this folder I would create folders called WebApp... | 6,284 |
<p>Is there a web service of some sort (or any other way) to pull a current time zone settings for a (US) city. For the parts of the country that don't follow the Daylight Saving Time and basically jump timezones when everyone else is switching summer/winter time... I don't fancy creating own database of the places tha... | <p>earthtools.org provides a free web service to get the time zone from a city here:</p>
<p><a href="http://www.earthtools.org/webservices.htm#timezone" rel="noreferrer">http://www.earthtools.org/webservices.htm#timezone</a></p>
<p>You just pass in the long/lat values like this: (This is for New York)</p>
<p><a href... | <p>I know this is answered, but I am posting this answer as people might still find it useful - The selected answer does not work successfuly right now.</p>
<p>Google have their own service, which is very reliable and easy to use, and outputs info in JSON format. It even allows for specifying a custom time, e.g get t... | 7,975 |
<p>The size of the generated hash and the speed of the algorithm are not important. I'm really only interested in it being the most secure option. I don't want to use any third party libraries either.</p>
<p>The version of the .NET framework I'm using if 3.5 if that makes any difference.</p>
| <p>I would think <a href="http://msdn.microsoft.com/en-us/library/system.security.cryptography.sha512.aspx" rel="noreferrer">SHA512</a> would be your best bet from the built-in hash algorithms. It's the largest hash form of a very secure algorithm.</p>
<p>Also, don't forget to use a salt to help protect the hash again... | <p>User asked what is most secure Hashing algorithm in .NET, PBKDF2 is not a hashing algorithm, it is a method of deriving encryption keys and yes the underlying pseudo random function MAY be a hashing algorithm however in Rfc2898DeriveBytes it is actually HMACSHA1 over x passes with each byte of each hash value from e... | 30,047 |
<p>How do I handle the window close event (user clicking the 'X' button) in a Python Tkinter program?</p>
| <p>Tkinter supports a mechanism called <a href="http://web.archive.org/web/20201111215134/http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm#protocols" rel="noreferrer"><em>protocol handlers</em></a>. Here, the term <em>protocol</em> refers to the interaction between the application and the window manager. T... | <p>i say a lot simpler way would be using the <code>break</code> command, like</p>
<pre><code>import tkinter as tk
win=tk.Tk
def exit():
break
btn= tk.Button(win, text="press to exit", command=exit)
win.mainloop()
</code></pre>
<p>OR use <code>sys.exit()</code></p>
<pre><code>import tkinter as tk
import s... | 13,632 |
<p>I have a text area and a function to do syntax highlighting on it. Right now it reads the entire RichTextBox. How would I get a string variable containing the current line? Below is the code i currently have.</p>
<pre><code>Private Sub HighLight()
Dim rm As System.Text.RegularExpressions.MatchCollection
Dim... | <p>Not tried it but:</p>
<pre><code>rtbMain.Lines(lineNumber)
</code></pre>
<p>if not assign the Lines property to an array and access the array element.</p>
| <p>I think you want</p>
<pre><code>rtbMain.Lines(rtbMain.GetLineFromCharIndex(rtbMain.SelectionStart))
</code></pre>
| 39,017 |
<p>I have a div with two nested divs inside, the (float:left) one is the menu bar, and the right (float:right) should display whatever content the page has, it works fine when the window is at a maximum, but when i resize it the content is collapsed until it can no longer has any space, at which it is forced to be disp... | <p>This should do it (container is the parent div containing that 2 divs):</p>
<pre><code>.container {
width: 1024px;
display: block;
}
</code></pre>
| <p>Simply don't make the right div floating. Menu is already floating left of any other content. Just set a left-margin for the right div so the content in that div won't be wrapped around the floating div.</p>
| 46,466 |
<p>Do T-SQL queries in SQL Server support short-circuiting?</p>
<p>For instance, I have a situation where I have two database and I'm comparing data between the two tables to match and copy some info across. In one table, the "ID" field will always have leading zeros (such as "000000001234"), and in the other table, ... | <p>SQL Server does <strong>NOT</strong> short circuit where conditions.
it can't since it's a cost based system: <a href="http://weblogs.sqlteam.com/mladenp/archive/2008/02/25/How-SQL-Server-short-circuits-WHERE-condition-evaluation.aspx" rel="noreferrer">How SQL Server short-circuits WHERE condition evaluation </a>.</... | <p>fix the database to be consistent</p>
<pre><code>select * from table1 where table1.ID LIKE '%1234'
</code></pre>
<p>will match '1234', '01234', '00000000001234', but also '999991234'. Using LIKE pretty much guarantees an index scan (assuming table1.ID is indexed!). Cleaning up the data will improve performance sig... | 49,968 |
<p>I have redirected some valuable information into a text file. How can I execute each line of that text file in a loop?</p>
<p>What im thinking is to double space my text file, then to use a loop to execute each line invidually. I'm hoping that when i double space the text file every string of commands will have th... | <p>Why not just have the line separator delimit the commands? You don't need a blank line to delimit them unless your command must be able to contain line separators - and then what if it needed to contain 2 in a row?</p>
| <p>I'm afraid I don't understand the problem you are trying to solve. If you write commands into a file called commands.txt, you can execute them simply by</p>
<pre><code>sh commands.txt
</code></pre>
<p>That executes each line of the file. If you want to do this in a loop I suppose you might try something like</p>... | 44,972 |
<p>I'm trying to duplicate the effect used in the Firefox search box where, if the search field does not have focus ( the user has not clicked inside of it ), it just says <i>Google</i> in gray text. Then, when the user clicks in the box, the text is removed and they can fill in their search term.</p>
<p>I want to use... | <pre><code><style type='text/css'>
input #ghost { color: #CCC; }
input #normal { color: #OOO; }
</style>
<script type='text/javascript'>
function addTextHint(elem, hintText)
{
if (elem.value == '')
{
elem.value = hintText;
... | <pre>
$(selector).text('Google');
$(selector).click(function(){
$(this).text('');
});
</pre>
<p>There's probably a more elegant way to do it, but this assumes your box has no text in it at page load. If it does you can remove the first line.</p>
<p>I haven't tested this, but it should work.</p>
| 36,191 |
<p>I'm making a WinForms app with a ListView set to detail so that several columns can be displayed.</p>
<p>I'd like for this list to scroll when the mouse is over the control and the user uses the mouse scroll wheel. Right now, scrolling only happens when the ListView has focus.</p>
<p>How can I make the ListView sc... | <p>You'll normally only get mouse/keyboard events to a window or control when it has focus. If you want to see them without focus then you're going to have to put in place a lower-level hook.</p>
<p><a href="https://web.archive.org/web/20190831061836/https://blogs.msdn.microsoft.com/toub/2006/05/03/low-level-mouse-hoo... | <p>You'll normally only get mouse/keyboard events to a window or control when it has focus. If you want to see them without focus then you're going to have to put in place a lower-level hook.</p>
<p><a href="https://web.archive.org/web/20190831061836/https://blogs.msdn.microsoft.com/toub/2006/05/03/low-level-mouse-hoo... | 11,263 |
<p>How should I run another program from within my <code>C</code> program? I need to be able to write data into <code>STDIN</code> of the launched program (and maybe read from it's <code>STDOUT</code>)</p>
<p>I am not sure if this is a standard C function. I need the solution that should work under Linux.</p>
| <p>You want to use <code>popen</code>. It gives you a unidirectional pipe with which you can access stdin and stdout of the program.</p>
<p>popen is standard on modern unix and unix-like OS, of which Linux is one :-)</p>
<p>Type</p>
<pre><code>man popen
</code></pre>
<p>in a terminal to read more about it.</p>
<p>... | <p>I think you can use </p>
<blockquote>
<p><code>freopen</code></p>
</blockquote>
<p>for this .</p>
| 9,632 |
<p>I am running oracle and have a query which pulls some results from the database. I would like to write the results as a text file. How would I go about doing this?</p>
<p>My prefered way would be by using UTL_FILE. Would some one have an example of how to do this?</p>
| <p>If you're using Sql Plus, is as easy as:</p>
<pre>
SQL> spool c:\temp\out.txt
SQL> SELECT * FROM USERS;
SQL> spool off
</pre>
<p>This three sentences will output the result of the query "SELECT * FROM USERS" to the file c:\temp\out.txt.</p>
<p>You can format this query using the string manipulation functions of O... | <p>This seems to be a reasonable tutorial with a few simple examples <a href="http://www.adp-gmbh.ch/ora/plsql/utl_file.html" rel="nofollow noreferrer">UTL_FILE example</a></p>
| 4,715 |
<p>I see APIs in Quartz for drawing lines and circles. But all I want to do is to specify the (x,y) cartesian coordinate to color a pixel a particular value. How do I do that?</p>
| <p>Quartz is not a pixel-oriented API, and its contexts aren’t necessarily pixel buffers. If you want to draw pixmaps, create a bitmap context with <code>CGBitmapContextCreate()</code>. You provide a buffer, which you can manipulate directly, and can copy to another context by creating a <code>CGImage</code> from the s... | <p>I'm having the same issue - i find the best solution is similar to the last, but at least it doesn't leave something that looks like a "dash"... of course, should ensure x/y are both > 0.</p>
<p>CGContextFillRect(context, CGRectMake(x - 0.5, y - 0.5, 1.0 , 1.0));</p>
| 40,346 |
<p>I need to update a group of cells by inserting the same two characters into all of them, but I'm just drawing a blank on how to do this. Could someone point me in the right direction?</p>
<p><b>Old Cells</b><br>
HI.1 <br>
HI.2<br>
HII.1</p>
<p><b>New Cells</b><br>
H08I.1<br>
H08I.2<br>
H08II.1</p>
| <pre><code>UPDATE Cells SET Cell = LEFT(Cell, 1) + '08' + SUBSTRING(Cell, 1, LEN(Cell)-1)
</code></pre>
| <p>If all your cells look like that:</p>
<pre><code>update cells
set cell = Replace(cell,'H','H08');
</code></pre>
<p>(But note that Replace doesn't care where the 'H' appears).</p>
<p>Note: I am assumign we are talking about SQL and tables here - maybe a "cell" is something else?</p>
| 44,305 |
<p>In JavaScript:</p>
<pre><code>encodeURIComponent("©√") == "%C2%A9%E2%88%9A"
</code></pre>
<p>Is there an equivalent for C# applications? For escaping HTML characters I used:</p>
<pre><code>txtOut.Text = Regex.Replace(txtIn.Text, @"[\u0080-\uFFFF]",
m => @"&#" + ((int)m.Value[0]).ToString() + ";");
</co... | <p><code>Uri.EscapeDataString</code> or <code>HttpUtility.UrlEncode</code> is the correct way to escape a string meant to be part of a URL.</p>
<p>Take for example the string <code>"Stack Overflow"</code>:</p>
<ul>
<li><p><code>HttpUtility.UrlEncode("Stack Overflow")</code> --> <code>"Stack+Overflow"</code></p></li>
... | <p>You can use the Server object in the System.Web namespace</p>
<p>Server.UrlEncode, Server.UrlDecode, Server.HtmlEncode, and Server.HtmlDecode.</p>
<p>Edit: poster added that this was a windows application and not a web one as one would believe. The items listed above would be available from the HttpUtility class ... | 11,197 |
<p><strong>Is an Enterprise Service Bus</strong> (a tool that acts as a mediator, a message broker, a service enabler, schema transformation enhancer, transparent location provider, service aggregator, load balancer, monitor, and all that stuff) <strong>responsible to orchestrate services</strong>?</p>
<p>What about p... | <p>Yes and no. There's a thin, and sometimes indistinguishable line between orchestration and aggregation/service augmentation.</p>
<p>In general, if you've got any long-running or complex business process (process being the key word, although I'm going to avoid defining it) - that's best suited to BPEL.</p>
<p>Simpl... | <p>An Enterprise Service Bus should never be responsible for orchestrating services. </p>
<p>Orchestration implies a minimum of "smarts", specifically the ability to compensate for failed transactions. Service bus tools will often say they offer "try-catch" or something like that but the ability to run scoped componsa... | 44,984 |
<p>I have to develop an application which parses a log file and sends specific data to a server. It has to run on both Linux and Windows. </p>
<p>The problem appears when I want to test the log rolling system (which appends .1 to the name of the creates a new one with the same name). On Windows (haven't tested yet on ... | <blockquote>
<p>Is there a way to open file in a non-exclusive way,</p>
</blockquote>
<p>Yes, using Win32, passing the various FILE_SHARE_Xxxx flags to CreateFile.</p>
<blockquote>
<p>is it cross platform?</p>
</blockquote>
<p>No, it requires platform-specific code.</p>
<p>Due to annoying backwards compatibilit... | <p>I'd make sure you don't keep files open. This leads to weird stuff if your app crashes for example.
What I'd do:</p>
<ol>
<li>Abstract (reading / writing / rolling over to a new file) into one class, and arrange closing of the file when you want to roll over to a new one in that class. (this is the neatest way, and... | 4,734 |
<p>Whats the best 3D game engine available for java? I am looking for something that has a good set visual development tools. I have checked out the list available on wikipedia:</p>
<p><a href="http://en.wikipedia.org/wiki/List_of_game_engines" rel="noreferrer">http://en.wikipedia.org/wiki/List_of_game_engines</a></p... | <p><a href="http://www.jmonkeyengine.com/" rel="noreferrer">jMonkeyEngine</a> has a nice set of open source tools for 3d java development. They have been used for a few commercial games (<a href="http://www.banghowdy.com/" rel="noreferrer">Bang!Howdy</a> and one that NCSoft was developing that was recently cancelled c... | <p>The <a href="http://lwjgl.org/" rel="nofollow noreferrer">Lightweight Java Game Library </a> is a pretty good one. </p>
| 33,918 |
<p>I have a .NET application which has different configuration files for Debug and Release builds. E.g. the debug app.config file points to a development <a href="http://en.wikipedia.org/wiki/Microsoft_SQL_Server" rel="noreferrer">SQL Server</a> which has debugging enabled and the release target points to the live SQL ... | <p>Any configuration that might differ across environments should be stored at the <strong>machine level</strong>, not the <strong>application level</strong>. <a href="http://msdn.microsoft.com/en-us/library/1xtk877y.aspx" rel="nofollow noreferrer">(More info on configuration levels.)</a></p>
<p>These are the kinds of... | <p>It says asp.net above, so why not save your settings in the database and use a custom-cache to retrieve them?</p>
<p>The reason we did it because it's easier (for us) to update the continuously database than it is to get permission to continuously update production files.</p>
<p><strong>Example of a Custom Cache:<... | 16,072 |
<p>I'm using Crystal Reports 11 (and VB6) to open a report file, load the data from an Access database and either print the report to a printer or export the report to another .rpt file (for later printing without the database)</p>
<p>Even for small amounts of data the process is somewhat slow. Profiling showed about ... | <p>If you know how many there are you can allocate it with</p>
<pre><code>struct VstEvents *evnts;
evnts = (struct VstEvents*)malloc(sizeof(struct VstEvents) +
numEvents*sizeof(VstEvent*));
</code></pre>
<p>This will allocate 2 <strong>extra</strong> slots </p>
| <p>What the structure is declaring is an array (of size 2) of pointers to VstEvent objects. You should allocate a VstEvent and assign it to events[0], setting numEvents to 1. If you have 2 VstEvents, then allocate another VstEvent, assign it to events[1], and set numEvents to 2. If you need more than 2, then you'll ... | 46,839 |
<p>To commemorate the public launch of Stack Overflow, what's the shortest code to cause a stack overflow? Any language welcome.</p>
<p>ETA: Just to be clear on this question, seeing as I'm an occasional Scheme user: tail-call "recursion" is really iteration, and any solution which can be converted to an iterative sol... | <p>All these answers and no Befunge? I'd wager a fair amount it's shortest solution of them all:</p>
<pre><code>1
</code></pre>
<p>Not kidding. Try it yourself: <a href="http://www.quirkster.com/iano/js/befunge.html" rel="nofollow noreferrer">http://www.quirkster.com/iano/js/befunge.html</a></p>
<p>EDIT: I guess I n... | <p>Ruby:</p>
<pre><code>def i()i()end;i()
</code></pre>
<p>(17 chars)</p>
| 8,755 |
<p>I have a program with two TForm classes and have added a TMainMenu to them each. I am then trying to merge them dynamically at run-time.</p>
<p>My problem is that when they merge the menu items in the merged in TMainMenu now display images stored in the imagelist in the form they were merged into rather than the im... | <p>The way I handle this is to have a single image list on a datamodule, and then include that in each form so that they can share that single set of icons.</p>
| <p>I had exactly the same problem a while ago, but I also ran into other menu merge problems because my app was MDI, so I decided to do things in a completely different way.</p>
<p>What you could try, though, is dynamically adding one form's images to the other form's ImageList, and 'redirecting' the <code>ImageIndex<... | 18,388 |
<p>I need to output the contents of a text field using MS Query Analyzer. I have tried this:</p>
<pre><code>select top 1 text from myTable
</code></pre>
<p>(where text is a <code>text</code> field)</p>
<p>and</p>
<pre><code>DECLARE @data VarChar(8000)
select top 1 @data = text from myTable
PRINT @data
</code></pre... | <p>I don't think you can use varchar(MAX) in MSSQL7, so here's something that will give you all the data (note, what I'm understanding is you just want to visually see the data, and you aren't going put it in a variable or return it).</p>
<p>So, this will print off the entire string so you can visually see what's in t... | <p><a href="http://shortfastcode.blogspot.com/2011/10/getting-around-sql-server-print-8000.html" rel="nofollow">http://shortfastcode.blogspot.com/2011/10/getting-around-sql-server-print-8000.html</a></p>
<p>Use this stored proc. THe only down side is you get a line break every 8000 charachters :(</p>
<pre><code>CREAT... | 27,102 |
<p>What is the best way to setup one Linux box to listen on its serial port for incoming connections? I've done a lot of googling but I can't find the right combination of commands to actually get them to talk!</p>
<p>My main objective is to provide a serial interface to running instances of kvm/qemu VMs. They current... | <p>The <a href="http://tldp.org/HOWTO/Serial-HOWTO.html" rel="noreferrer">Linux Serial HOWTO</a> has a lot of detailed information about serial communication in general. The more-specific <a href="http://tldp.org/HOWTO/Remote-Serial-Console-HOWTO/index.html" rel="noreferrer">Linux Remote Serial Console HOWTO</a> is wha... | <p>I assume you connect the two serial ports using a "null modem" cable.</p>
<p>Use a program like minicom to talk to remote system -- you probably need to set up the communication parameters and possibly turn off hardware flow control (if your cable doesn't have the flow-control lines connected).</p>
| 9,503 |
<p>I'm building a fairly simple PHP script that will need to send some emails with attachments. I've found these 2 libraries to do this. </p>
<p>Does either one have significant advantages over the other? Or should I just pick one at random and be done with it?</p>
| <p>I was going to say that PHPMailer is no longer developed, and Swift Mailer is. But when I googled ... </p>
<p><a href="https://github.com/PHPMailer/PHPMailer" rel="noreferrer">https://github.com/PHPMailer/PHPMailer</a></p>
<p>That suggests its being worked on again.</p>
<p>I've used PHPMailer a lot, and its alway... | <p>I've just switched to Swift today due to the problems with PHPMailer and PHP 5.3 - even the latest version - which is a shame. Swift has a very well documented integration, which makes things easier.</p>
| 39,030 |
<p>How do I create an optional parameter in a mysql stored procedure?</p>
| <p>Optional parameters are not supported in mySQL stored procedures, nor are there any current plans to add this functionality at this time. I'd recommend passing null for optional parameters.</p>
| <p>According to <a href="http://bugs.mysql.com/bug.php?id=15975" rel="nofollow noreferrer">this bug</a>, there is currently no way to create optional parameters.</p>
| 11,646 |
<p>It is mentioned fairly often that exceptions are expensive, and various methods in .NET are expensive, too.</p>
<p>What exactly constitutes an expensive method in .NET?</p>
<p>Is it the time taken for the method to process? E.G. I got the response stream of a webpage using the WebClient object (this was not async)... | <p>Expensive is a matter of degrees and context.</p>
<p>I work in image processing and I consider division expensive. In my case, any operation that ends up being performed two to 5 million times in one loop adds up. This may be the difference between 1/8 of a second and 1/32 of a second. 1/8 of a second in UI time... | <p>The answer is that you have both types of expensive operations.</p>
<p>I personally use ANTs Profiler by RedGate to mointor both the time and memory aspects of application events and the cost.</p>
| 46,236 |
<p>What, if any, is the performance difference between the following two loops?</p>
<pre><code>for (Object o: objectArrayList) {
o.DoSomething();
}
</code></pre>
<p>and </p>
<pre><code>for (int i=0; i<objectArrayList.size(); i++) {
objectArrayList.get(i).DoSomething();
}
</code></pre>
| <p>From Item 46 in <a href="https://rads.stackoverflow.com/amzn/click/com/0321356683" rel="noreferrer" rel="nofollow noreferrer">Effective Java</a> by Joshua Bloch :</p>
<blockquote>
<p>The for-each loop, introduced in
release 1.5, gets rid of the clutter
and the opportunity for error by
hiding the iterator or... | <p>It's always better to use the iterator instead of indexing. This is because iterator is most likely optimzied for the List implementation while indexed (calling get) might not be. For example LinkedList is a List but indexing through its elements will be slower than iterating using the iterator.</p>
| 32,047 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.