instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I've been running the built-in <a href="http://ant.apache.org/" rel="nofollow noreferrer">Ant</a> from the command line on a Macintosh (10.5.5) and have run into some trouble with the <strong>Mail</strong> task. Running the Mail task produces the following message:</p> <pre><code>[mail] Failed to initialise MIME ma...
<p>Here's what I ended up doing to resolve the problem:</p> <ol> <li>Downloaded the latest version of Ant from <a href="http://ant.apache.org/" rel="nofollow noreferrer">http://ant.apache.org/</a></li> <li>The "built-in" Ant is installed in /usr/share/ant; I didn't want to overwrite that version so I extracted the new...
<p>I also got this working a slightly different way:</p> <ol> <li>Created directory <code>~/.ant/lib</code>.</li> <li>Downloaded <a href="http://java.sun.com/products/javamail/downloads/index.html" rel="nofollow noreferrer">JavaMail API</a> and copied the jars into that directory.</li> <li>Downloaded <a href="http://j...
29,502
<p>In an application where users can belong to multiple groups, I'm currently storing their groups in a column called <code>groups</code> as a binary. Every four bytes is a 32 bit integer which is the <code>GroupID</code>. However, this means that to enumerate all the users in a group I have to programatically select a...
<p>You have a many-to-many relationship between users and groups. This calls for a separate table to combine users with groups:</p> <pre><code>User: (UserId[PrimaryKey], UserName etc.) Group: (GroupId[PrimaryKey], GroupName etc.) UserInGroup: (UserId[ForeignKey], GroupId[ForeignKey]) </code></pre> <p>To find all user...
<p>I would make 3 tables. users, groups and usersgroups which is used as cross-reference table to link users and groups. In usersgroups table I would add userId and groupId columns and make them as primary key. BTW. What naming conventions there are to name those xref tables?</p>
11,706
<p>I am printing ABS on an Ender 3 printer at a temperature of 240 °C on the nozzle and 110 °C on the bed. I am getting the following result:</p> <p><a href="https://i.stack.imgur.com/FnLuQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/FnLuQ.jpg" alt="enter image description here" /></a></p> <p>Is ...
<p>I think that your bed is too hot because the bubbling is only on the bottom layer, if it was through out the entire print, I would say that it is your nozzle temp and you should do a temp tower, but because that isn't the case try lowering your bed temp</p>
<p>I had a similiar issue. First 2 to 4 layers looked god, than a trouble zone with 5 to 10 layers, and after that good again. In my case the z-layer screws were not tight. During moving up I lost some steps due to the lose screws ...</p>
1,940
<p>When developing a desktop application in .NET, is it possible to not require the .NET Framework? Is developing software in .NET a preferred way to develop desktop applications? What is the most used programming language that software companies use to develop desktop applications?</p> <p>Is the requirement of the ...
<p>You can still develop applications for the windows desktop using C/C++, eliminating the requirement to the .NET framework, but you'll need to make sure the necessary libraries are already on the system or installed.</p> <p>The nice thing about the .NET framework is that Windows XP SP2 and Vista has the 3.0 framewor...
<p>It is possible not to require the .NET Framework; there are some companies that sell (for thousands of dollars, mind you) solutions that will allow you to do this. These are complete hacks, however, and not supported by Microsoft.</p> <p>How you develop desktop applications (ie, using .NET or not) depends on your r...
3,236
<p>I'd like to write a script/batch that will bunch up my daily IIS logs and zip them up by month.</p> <p>ex080801.log which is in the format of ex<em>yymmdd</em>.log</p> <p>ex080801.log - ex080831.log gets zipped up and the log files deleted.</p> <p>The reason we do this is because on a heavy site a log file for on...
<p>You'll need a command line tool to zip up the files. I recommend <a href="http://www.7-zip.org/download.html" rel="noreferrer">7-Zip</a> which is free and easy to use. The self-contained command line version (7za.exe) is the most portable choice.</p> <p>Here's a two-line batch file that would zip the log files and ...
<p>Regex will do the trick... create a perl/python/php script to do the job for you..<br> I'm pretty sure windows batch file can't do regex.</p>
4,914
<p>How can I set the cookies in my <code>PHP apps</code> as <code>HttpOnly cookies</code>?</p>
<ul> <li>For <strong>your cookies</strong>, see this answer.</li> <li>For <strong>PHP's own session cookie</strong> (<code>PHPSESSID</code>, by default), see <a href="https://stackoverflow.com/a/8726269/1820">@richie's answer</a></li> </ul> <p>The <a href="http://php.net/manual/en/function.setcookie.php" rel="noreferre...
<p>A more elegant solution since <strong>PHP >=7.0</strong> </p> <pre><code>session_start(['cookie_lifetime' =&gt; 43200,'cookie_secure' =&gt; true,'cookie_httponly' =&gt; true]); </code></pre> <p><a href="https://www.php.net/manual/en/function.session-start.php" rel="nofollow noreferrer">session_start</a></p> <p><a...
5,747
<p>What's the difference between using a define statement and an enum statement in C/C++ (and is there any difference when using them with either C or C++)?</p> <p>For example, when should one use</p> <pre><code>enum {BUFFER = 1234}; </code></pre> <p>over</p> <pre><code>#define BUFFER 1234 </code></pre>
<p><code>enum</code> defines a syntactical element.</p> <p><code>#define</code> is a pre-preprocessor directive, executed <em>before</em> the compiler sees the code, and therefore is not a language element of C itself.</p> <p>Generally enums are preferred as they are type-safe and more easily discoverable. Defines a...
<p>There is little difference. The C Standard says that enumerations have integral type and that enumeration constants are of type int, so both may be freely intermixed with other integral types, without errors. (If, on the other hand, such intermixing were disallowed without explicit casts, judicious use of enumeratio...
16,568
<p>Is it possible to do Web form without using server control or set runat attribute on html control? How do you call the code behind function?</p>
<p>You can't call codebehind functions without a runat="server" tag at a minimum. If you created a Web Service instead, you could create a pure html/javascript page that interacted with the server through AJAX. These are your only two options to use ASP.Net as far as I know.</p>
<p>You can use a HTTPHandler for barebones ASP.NET.</p> <p>You won't have a markup file, you'll just have a class that runs and exposes you to HttpContext for writing out to the HTTP stream.</p> <p><a href="http://msdn.microsoft.com/en-us/library/f3ff8w4a(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.c...
34,028
<p>Let's say I wanted to make a python script interface with a site like Twitter.</p> <p>What would I use to do that? I'm used to using curl/wget from bash, but Python seems to be much nicer to use. What's the equivalent?</p> <p>(This isn't Python run from a webserver, but run locally via the command line)</p>
<p>For something like Twitter, you'll save yourself a ton of time by not reinventing the wheel. Try a library like <a href="http://code.google.com/p/python-twitter/" rel="nofollow noreferrer">python-twitter</a>. This way, you can write your script, or even a full fledged application, that interfaces with Twitter, and y...
<p>If you're used to dealing with cURL, consider <a href="http://pycurl.sourceforge.net/" rel="nofollow noreferrer">PycURL</a>.</p>
36,203
<p>In Visual Basic 6, when I attempt to access <em>Project > References</em>, it throws an error:</p> <blockquote> <p>Error accessing system registry</p> </blockquote> <p>I am:</p> <ul> <li>Logged in as the local computer administrator </li> <li>running Windows XP Professional and </li> <li>I can execute <code>reg...
<p>Depending on the Windows OS you have (I have Windows 7 Enterprise), you might want to try giving administrator rights to the REGTLIB.EXE (located in C:\Windws). Right click on the REGTLIB.EXE file. Select Properties from the pop-up menu. Then select the Compatiblity tab. On the Compatiblity tab, check/select the Run...
<p>Have you tried <a href="http://www.tek-tips.com/viewthread.cfm?qid=729496&amp;page=6" rel="nofollow noreferrer">this?</a> Basically, it seems that it is a crystal reports issue. Hope that helps.</p>
12,999
<p>I have a datagridview assigned a datasource to it. now how to add a new row to that grid and remove a row from it?</p>
<p>One way to do this is as follows:</p> <p><strong>Step #1</strong> Setup the Data Adapter, Data Grid etc:</p> <pre><code>// the data grid DataGridView dataGrid; // create a new data table DataTable table = new DataTable(); // create the data adapter SqlDataAdapter dataAdapter = new SqlDataAdapter(strSQL, strDSN);...
<p>I believe you'll have to get the Table collection item and retrieve the Row collection item from that. Then you can loop through the rows or however you want to remove the row.</p> <p>You do this after binding it, of course.</p>
14,497
<p>In bash the ampersand (&amp;) can be used to run a command in the background and return interactive control to the user before the command has finished running. Is there an equivalent method of doing this in Powershell?</p> <p>Example of usage in bash:</p> <pre><code> sleep 30 &amp; </code></pre>
<p>As long as the command is an executable or a file that has an associated executable, use <strong>Start-Process</strong> (available from v2):</p> <pre><code>Start-Process -NoNewWindow ping google.com </code></pre> <p>You can also add this as a function in your profile:</p> <pre><code>function bg() {Start-Process -...
<p>I've used the solution described here <a href="http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!130.entry" rel="nofollow noreferrer">http://jtruher.spaces.live.com/blog/cns!7143DA6E51A2628D!130.entry</a> successfully in PowerShell v1.0. It definitely will be easier in PowerShell v2.0.</p>
22,448
<p>So yeah, I'm a Java guy in this crazy iPhone world. When it comes to memory management I stiill don't have a very good idea of what I'm doing. </p> <p>I have an app that uses a navigation controller, and when it's time to go on to the next view I have code that looks like this:</p> <pre><code>UIViewController *myC...
<p>The problem is (most likely) you're releasing your viewController <em>before</em> the Navigation Controller has a chance to claim ownership. There are two ways around this:</p> <ul> <li><code>-release</code> your controller <em>after</em> pushing it to the Nav Controller</li> <li><code>-autorelease</code> your cont...
<p>The problem is (most likely) you're releasing your viewController <em>before</em> the Navigation Controller has a chance to claim ownership. There are two ways around this:</p> <ul> <li><code>-release</code> your controller <em>after</em> pushing it to the Nav Controller</li> <li><code>-autorelease</code> your cont...
31,264
<p>How do I determine the (local-) path for the "Program Files" directory on a remote computer? There does not appear to any version of SHGetFolderPath (or related function) that takes the name of a remote computer as a parameter.</p> <p>I guess I could try to query HKLM\Software\Microsoft\Windows\CurrentVersion\Progr...
<p>Those are all slightly different, and generally have an acceptable usage.</p> <ul> <li><code>var.</code><a href="http://msdn.microsoft.com/en-us/library/system.object.tostring.aspx" rel="noreferrer"><code>ToString</code></a><code>()</code> is going to give you the string representation of an object, regardless of w...
<p>At one time, I remember seeing the MSDN library state to use CStr() because it was faster. I do not know if this is true though.</p>
6,204
<p>For example: <code>man(1)</code>, <code>find(3)</code>, <code>updatedb(2)</code>? </p> <p>What do the numbers in parentheses (Brit. "brackets") mean?</p>
<p>It's the section that the man page for the command is assigned to.</p> <p>These are split as</p> <ol> <li>General commands</li> <li>System calls</li> <li>C library functions</li> <li>Special files (usually devices, those found in /dev) and drivers</li> <li>File formats and conventions</li> <li>Games and screensavers...
<p><a href="http://en.wikipedia.org/wiki/Man_page#Manual_sections" rel="nofollow noreferrer">Wikipedia</a> details about Manual Sections:</p> <ol> <li>General commands</li> <li>System calls</li> <li>Library functions, covering in particular the C standard library</li> <li>Special files (usually devices, those found in...
8,846
<p>Ok, I am importing and parsing csv files in a C# app. I started out doing a simple ReadLine() and splitting on commas but it turns out some of the text fields have commas in them. So I started to roll my own splitting function. Fortunately, it was only a few minutes before the "Hey stupid, someone's probably alrea...
<p>I have used this <a href="http://www.codeproject.com/KB/database/CsvReader.aspx" rel="nofollow noreferrer">CsvReader</a>, works very well.</p>
<p>You can split on commas but massage the data by searching for pairs of fields that begin with and end with double-quotes and then recombine them.</p> <p>You can manually walk the lines looking for commas while setting a quoteFound boolean on and off as you encounter double-quotes and ignore any commas encountered w...
33,250
<p>I've run into a problem where I'm getting two printouts of my /etc/motd file on Gentoo Linux. sshd is doing one of the printouts, and I can toggle that by configuring /etc/ssh/sshd_config, but I can't find out who's printing the second copy. I can't disable sshd from printing out the motd due to an audit requireme...
<p>Looks like the answer was in the /etc/pam.d/login and /etc/pam.d/system-login files. I had to comment out the pam_motd.so lines.</p>
<p>It is probably being done from the shell itself. Check the global profile and bashrc to see if this might be the case.</p>
23,177
<p>I just found myself creating a class called "InstructionBuilderFactoryMapFactory". That's 4 "pattern suffixes" on one class. It immediately reminded me of this:</p> <p><a href="http://www.jroller.com/landers/entry/the_design_pattern_facade_pattern" rel="nofollow noreferrer">http://www.jroller.com/landers/entry/th...
<p>A good tip is: Your class public API (and that includes it's name) should reveal intention, not implementation. I (as a client) don't care whether you implemented the builder pattern or the factory pattern.</p> <p>Not only the class name looks bad, it also tells nothing about what it does. It's name is based on its...
<p>I've been thinking the same thing. In my case, the abundance of factories is caused by "build for testability". For example, I have a constructor like this:</p> <pre><code>ParserBuilderFactoryImpl(ParserFactory psF) { ... } </code></pre> <p>Here I have a parser - the ultimate class that I need. The parser is buil...
16,582
<p>Which of the WCF Service Protocols work well with Java?</p> <p>Do the TCP Service Bindings work with java remoting (either Corba, EJB, JMS, etc.)?</p> <p>What about the WebServices exposed as Service EndPoints. Have these been tested against the common Java WebServices stack for interoperability?</p>
<p>You will need to use one of the HTTP bindings. The TCP binding requires WCF to be on both sides.</p>
<p>WCF has been tested with Sun's Java WEbservices stack and Apache's Axis for interoperability.</p> <p>So, I'd say it's pretty good.</p> <p>Can you elaborate on "OR DOES TCP WORK AS WELL" ?</p> <p>thank you,</p>
13,263
<p>Our product has the requirement of exporting its native format (essentially an XML file) to Excel for viewing/editing. However, what this entails is having a dependency on Excel (or Office) itself for our product build - something that we do not want. </p> <p>What we have done is export the data from our native for...
<p>Excel versions, both 2007 and several previous, have native XML formats. 2007, obviously, is XML by default, and earlier versions have the ability to save as XML. <a href="https://stackoverflow.com/questions/174446/how-to-automate-converting-excel-xls-files-to-excel-xml-fromat">This SO question</a> deals with the is...
<p>If you are working in Java, Checkout the POI project from APACHE. <a href="http://poi.apache.org/" rel="nofollow noreferrer">http://poi.apache.org/</a></p> <p>Simple, nice, complete, powerful.</p>
35,219
<p>I have a MSSQL2005 DB with about 140 tables. I want to create either an accessible diagram or a printable API type document with the table structure. Is there a program that offers this kind of db visualization?</p> <p>I find the diagramming built into SQL Server to be very clunky and very inaccessible for my DB ...
<p>Take a look at <a href="http://www.red-gate.com/products/SQL_Doc/index.htm" rel="nofollow noreferrer">SQL Doc</a>.</p>
<p>I always used Visio for this type of thing.</p>
23,445
<p>I've created a series of radio button controls in C#. <code>(radCompany, radProperty etc.)</code><br> I've set their group name to be the same (282_Type) so they function as a list of radio buttons. </p> <p>How do I retrieve the name <code>(like: ct100$m$dfgadjkfasdghasdkjfg$282_Type)</code> in c# so I can use thi...
<p>You need to reference the <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.control.clientid.aspx" rel="nofollow noreferrer">ClientID</a> of the control; this is the id in the final html.</p> <p>Of course, another approach might be to use some other attribute (such as the css etc), and use <a href="htt...
<p>You want the UniqueID attribute:</p> <blockquote> <ul> <li><p><strong>UniqueID</strong> — The hierarchically-qualified unique identifier assigned to a control by the ASP.NET page framework.</p> </li> <li><p><strong>ClientID</strong> — A unique identifier assigned to a control by the ASP.NET page framework and render...
30,070
<p>I have written a C# Windows Forms application to merge the files and folders from a remote folder on one machine ("source" folder is a mapped drive - "Z:\folder") with another remote folder on a different machine ("destination" folder is a UNC path to a shared folder - "\\computername\sharedfolder"). I have Full per...
<p><a href="http://blogs.msdn.com/vancem/archive/2008/08/13/net-framework-3-5-sp1-allows-managed-code-to-be-launched-from-a-network-share.aspx" rel="noreferrer">.NET 3.5 SP1 allows running applications off a network share</a>. Previous versions did not allow it.</p>
<p>You need to enable FullTrust permissions for the application. .NET applications that run on a network share are given Local Intranet security permissions and thus run in a sandbox.</p> <p>Here is a batch file that I wrote for one of our testing apps that runs off the network. It should get you up and running with m...
46,976
<p>Does cygwin allow a statically compiled binary? This would prevent the need for cygwin1.dll being on the PATH of target machines.</p>
<p>Nope, it's currently not possible to statically link against cygwin1.dll; if your application does not use unix emulation (i.e. pure win32) you can pass -mno-cygwin to the compiler.</p> <p>See also the FAQ:<br> <a href="http://cygwin.com/faq/faq.html#faq.programming.win32-no-cygwin" rel="noreferrer">http://cygwin.c...
<p>For Cygwin with mingw32 installed, your command line would be of the form</p> <pre><code>x86_64-w64-mingw32-gcc.exe main.c -o main.exe </code></pre> <p>This bypasses the need for cygwin1.dll altogether.</p>
44,271
<p>Where can I download the JSSE and JCE source code for the latest release of Java? The source build available at <a href="https://jdk6.dev.java.net/" rel="noreferrer">https://jdk6.dev.java.net/</a> does not include the javax.crypto (JCE) packages nor the com.sun.net.ssl.internal (JSSE) packages.</p> <p>Not being ab...
<p>there: <a href="http://openjdk.java.net/groups/security/" rel="noreferrer">openjdk javax.net</a> in the security group </p> <pre><code>src/share/classes/javax/net src/share/classes/com/sun/net/ssl src/share/classes/sun/security/ssl src/share/classes/sun/net/www/protocol/https </code></pre> <p>also on this page:</p...
<p>Put <a href="http://www.kpdus.com/jad.html" rel="nofollow noreferrer">Jad</a> on your system path. Install <a href="http://jadclipse.sourceforge.net/" rel="nofollow noreferrer">JadClipse</a> plugin for Eclipse. Use the force, read the decompiled source. :-)</p>
11,256
<p>Suppose you want to make an async request in JavaScript, but you want to pass some state along to the callback method. Is the following an appropriate use of closures in JavaScript?</p> <pre><code>function getSomethingAsync(someState, callback) { var req = abc.createRequestObject(someParams); req.invoke(mak...
<p>I don't see any immediate problems with this - closures are powerful for numerous reasons, one of which is removing the need to use global variables for state maintenance.</p> <p>That said, the only thing you need to be wary of with regards to closures is memory leaks that typically occur in IE, but those are usual...
<p>its better (nicer) to use anonymous functions:</p> <pre><code>function getSomethingAsync (someState, callback) { req.invoke (function (data) { var result = processDataUsingState (data, someState); callback (result); }); } </code></pre>
31,289
<p>I'm kind of interested in getting some feedback about this technique I picked up from somewhere.</p> <p>I use this when a function can either succeed or fail, but you'd like to get more information about why it failed. A standard way to do this same thing would be with exception handling, but I often find it a bit ...
<p>I agree with the others who have stated that this is a little on the WTFy side. If it's clearly documented functionality, then it's less of an issue, but I think it'd be safer to take an alternate route of returning 0 for success and integers for error codes. If you don't like that idea or the idea of a global last ...
<p>In my opinion, you should use this technique only if failure is a "normal part of operation" of your method / function. For example, it's as probable that a call suceeds as that it fails. If failure is a exceptional event, then you should use exception handling so your program can terminate as early and gracefully a...
9,818
<p>This is a total newbie question, so thanks in advance. I'm trying to get my head around the difference between divs and spans, and when and how to use them.</p> <p>Say for instance, I want to have an image left justified, and I want the text to flow around the image on the right, while maintaining justification. If...
<p>A SPAN tag is not intended to be a container for other tags. This is especially useful when combined with classes.</p> <p>Use divs for defining sections of a page, and spans to enclose and style text or classes of text. </p> <p><a href="http://www.learnwebdesignonline.com/htmlcourse/span-div.htm" rel="noreferrer">...
<p>Divs and spans are kind like wildcard tags that have no semantic meaning. You can use them to group or identify elements when no other tag is appropriate (like tables, lists or headings). Their differences are:</p> <p><strong>div</strong> </p> <ul> <li>it's a block level element </li> <li><p>default display prop...
47,954
<p>I'm experimenting with creating an add-in for Infopath 2007. The documentation is very skimpy. What I'm trying to determine is what kind of actions an add-in can take while designing a form. Most of the discussion and samples are for when the user is filling out the form. Can I, for example, add a new field to the f...
<p>What are you hoping to end up with at the end? The body, the subject, the sender, an attachment? You should spend some time with <a href="http://www.faqs.org/rfcs/rfc2822.html" rel="noreferrer">RFC2822</a> to understand the format of the mail, but here's the simplest rules for well formed email:</p> <pre><code>HE...
<p>yeah, ive been able to write a basic parser, based off that rfc and some other basic tutorials. but its the multipart mime nested boundaries that keep messing me up.</p> <p>i found out that MMS (not SMS) messages sent from my phone are just standard emails, so i have a system that reads the incoming email, checks t...
3,398
<p>I'm working on a system that includes a large number of reports, generated using <a href="http://jasperforge.org/plugins/project/project_home.php?group_id=102" rel="noreferrer">JasperReports</a>. One of the newer features is that you can define styles for reports.</p> <p>From the available docs I believe there is s...
<p>Use <a href="http://jasperreports.sourceforge.net/sample.reference/templates/#templates" rel="nofollow noreferrer">JasperReport templates</a>. A JasperReports template is one that ends in <code>.jrtx</code>, and may look similar to this (<code>styles.jrtx</code>):</p> <pre><code>&lt;?xml version=&quot;1.0&quot;?&gt;...
<p>You can also avoid specifying the actual file name in the <code>&lt;template&gt;</code> element by using a parameter passed into your report at runtime</p> <p><code>&lt;parameter name="TEMPLATE_FILE" isForPrompting="false" class="java.lang.String"/&gt;</code></p> <p><code>&lt;template&gt;&lt;![CDATA[$P{TEMPLATE_F...
23,892
<p>I am aware of several "clear" filaments for a ABS or PLA printer. They, however, have a cloudy or frosted glass appearance. I do not believe this is possible to eliminate but I believe it can be reduced.</p> <p>Are there effective ways to make a print have a more transparent appearance?</p>
<p>It depends on a lot of factors, type of plastic, whether the parts need to be strong, can you use a vase print, etc. Here's a few thoughts.</p> <p>PLA - The brand of PLA makes a big difference, some can be printed very clear, some can't. Most of the transparent PLAs I've used print much more clear at around 240°C...
<p>Use Taulman t-glase and after a light sanding with really fine paper (optional really, but go for it if you can), spray it with polyurethane varnish or something similar. Check out the article <a href="http://3dprint.com/29292/taulman-hacks-clear-t-glase-3d-printing-material/">here</a>.</p>
92
<p>How to hide controller name in Url?</p> <p>I use the ASP.NET MVC.</p> <p>The original url is: <a href="http://www.sample.com/Users.mvc/UserDetail/9615" rel="nofollow noreferrer">http://www.sample.com/Users.mvc/UserDetail/9615</a></p> <p>The "Users" is controller name, the "UserDetail" is action name, and the "96...
<p>The idea is the same. You do just the thing you did to the action. However, your problem arises from the fact that IIS is probably not mapping www.xyz.com/1234 to ASP.NET runtime. To do so in IIS7, enable integrated mode and in IIS6, add a wildcard mapping in handler map that maps everything to ASP.NET.</p> <p>To a...
<p>MVC recognizes the difference between &quot;{UserID}&quot; and &quot;{id}&quot; so if you are going to have a route with only &quot;{UserID}&quot; in the Url you need to place it first in the list other wise it never gets hit. And make sure the default includes &quot;id&quot; since it will continually loop over &quo...
49,829
<p>I have a problem with the following code:</p> <pre><code>for(i = 0;(i - 1)&lt; n;i++) { char* b; sprintf(b, "%d", i); } </code></pre> <p>It compiles fine but when I run it it give me the infamous "0XC0000005 Access Violation" error. I have tried setting b to NULL, "", "0", 0 and a bunch of other stuff but then I g...
<p><code>sprintf</code> writes data into an existing buffer, which you pass into it as the first parameter. Currently you're not specifying a value for b at all, which means (IIRC in C) the value could be anything. If you set it to NULL or 0, <code>sprintf</code> is going to try to write into memory starting at address...
<p>Thank you very much! Since I needed a char* I rewrote the code to:</p> <pre><code>for(i = 0;(i - 1)&lt; n;i++) { char* b; char a[100]; b = a; sprintf(b, "%d", i); } </code></pre> <p>and it works like a charm. I can finally now get on with my life! Once again thank you very very much!</p>
45,288
<p>I am developing an online exam using JSP/Servlets which is nearing completion. I'm planning to add timer function for the entire exam that shows elapsed time in minutes. How do I implement this with a fool-proof technique to implement this, because using javascript would mean that the user can turn off the feature i...
<p>Record the time that the user started and finished on the server. The user will have to press a button to indicate that they've started the exam, which can trigger the server to stamp the start time; when the final answer is submitted, the server can record the total time taken.</p>
<p>You can make javascript a requirement in the user's browser, and use javascript+AJAX - every minute, get the updated time from the server or make sure the times are synchronised.</p>
42,418
<p>One of the guys I work with needs a custom control that would work like a multiline ddl since such a thing does not exist as far as we have been able to discover</p> <p>does anyone have any ideas or have created such a thing before<br> we have a couple ideas but they involve to much database usage </p> <p>We pref...
<p>From <a href="http://bytes.com/forum/thread16212.html" rel="noreferrer">this thread</a>, there are different ways to do this:</p> <pre><code>double r = 5.1234; System.out.println(r); // r is 5.1234 int decimalPlaces = 2; BigDecimal bd = new BigDecimal(r); // setScale is immutable bd = bd.setScale(decimalPlaces, B...
<p>There are two approaches in the standard library. One is to use java.text.DecimalFormat. The other more cryptic methods (String.format, PrintStream.printf, etc) based around java.util.Formatter should keep C programmers happy(ish).</p>
7,333
<p>I'm new to C# and .Net in general so this may be a naive thing to ask. But anyway, consider this C# code:</p> <pre><code>class A { public int Data {get; set;} } class B { public A Aval {get; set;} } </code></pre> <p>The B.Aval property above is returning a reference to its internal A object. As a former C...
<p>You're absolutely right - you should only return objects from properties where either the object is immutable, or you're happy for the caller to modify it to whatever extent they can. A classic example of this is returning collections - often it's much better to return a read-only wrapper round a collection than to ...
<p>This isn't encapsulation - it's an act of abstraction through object composition or aggregation depending on how the internal object lifetimes are created/managed. </p> <p>In composition patterns it is perfectly acceptable to access composite state e.g. the instance of A in the instance of B.</p> <blockquote> <...
35,410
<p>Opening an Infopath form with parameter can be done like this:</p> <pre><code>System.Diagnostics.Process.Start(PathToInfopath + "infopath.exe", "Template.xsn /InputParameters Id=123"); </code></pre> <p>But that requires I know the path to Infopath.exe which changes with each version of Office. Is there a way to s...
<p>Play around with System.Diagnostics.ProcessStartInfo which allows you to specify a file you wish to open and also allows you to specify arguments.</p> <p>You can then use Process.Start(ProcessStartInfo) to kick off the process. The framework will determine which application to run based on the file specified in the...
<p>Try using browser based form and querystring instead</p>
10,726
<p>I have a web app which queries a Lucene index and it works just fine in a W2K3 server in my network. Now I got my azure code so I wanted to test the service uploading the app. In order to do that I had to install Vista (I did it in a Virtual machine) cause the Azure SDK won't install on an XP box.</p> <p>I created...
<p>Ok, in case somebody is facing the same issues, this is the correct answer which I got from the Azure forum:</p> <blockquote> <p>This is because of the trust policy for the Windows Azure CTP. The enviroment variablies TEMP and TMP are avaliable and set up appropiately. However, System.IO.Path.GetTempPath...
<p>Haven't done this but isn't it possible to have a desktop version of the Live Operating Environment? This would seem a good start for troubleshooting.</p>
42,444
<p>Is there a way to call an EJB that is served through WebSphere (iiop://host:port/ejbName) from a vanilla JRE (like Sun). A lot of people have been telling me that this type of architecture relies in a homogenous environment. Thoughts?</p>
<p>Yes, this is possible. You have to create something called a thin client. It has limitations on JNDI lookups due to not being part of the container environment, so fully qualified names have to be used.</p> <p>Just search for "thin client ibm ejb" on google. Unfortunately, I don't have the link to the appropriat...
<p>Yes, this is possible. You have to create something called a thin client. It has limitations on JNDI lookups due to not being part of the container environment, so fully qualified names have to be used.</p> <p>Just search for "thin client ibm ejb" on google. Unfortunately, I don't have the link to the appropriat...
17,216
<p>[This is for PC/Visual C++ specifically (although any other answers would be quite illuminating :))]</p> <p>How can you tell if a pointer comes from an object in the stack? For example:</p> <pre><code>int g_n = 0; void F() { int *pA = &amp;s_n; ASSERT_IS_POINTER_ON_STACK(pA); int i = 0; int *pB = ...
<p>Whatever you do, it'll be extremely platform-specific and non-portable. Assuming you're ok with that, read on. If a pointer points somewhere in the stack, it will lie between the current stack pointer <code>%esp</code> and the top of the stack.</p> <p>One way to get the top of the stack is to read it in at the be...
<p>Yes I am aware this is extremely unportable, but this is for an internal app to mimic other hardware's facilities for doing this. Seems the Thread Execution Block might be the way to go.</p>
43,926
<p>Rails has an awesome way of looking up column names and expected datatypes from the DB, alleviating a lot of programming.</p> <p>I'm trying to build something like this in C#.NET, because we have large tables that are ever changing. I'll be adding parameters like so:</p> <pre><code>SqlParameter param = new SqlPara...
<p>why not just let ADO.NET detect it automatically:</p> <pre><code>SqlParameter param = new SqlParameter("parametername", value); </code></pre> <p>'course, you don't actually need Direction, either:</p> <pre><code>comm.Parameters.Add(new SqlParameter("parametername",value)); </code></pre> <p>I'm kind of a fan of d...
<p>For our project we query the <code>INFORMATION_SCHEMA</code> tables before we build our SQL statements. If you stick the value in <code>DATA_TYPE</code> from <code>INFORMATION_SCHEMA.COLUMNS</code> into an <code>Enum.Parse</code> that should give you the correct value.</p>
34,422
<p>I'm aware I can add maven repositories for fetching dependencies in ~/.m2/settings.xml. But is it possible to add a repository using command line, something like:</p> <pre><code>mvn install -Dmaven.repository=http://example.com/maven2 </code></pre> <p>The reason I want to do this is because I'm using a continuous ...
<p>You can do this but you're probably better off doing it in the POM as others have said.</p> <p>On the command line you can specify a property for the local repository, and another repository for the remote repositories. The remote repository will have all default settings though</p> <p>The example below specifies ...
<p>I am using <code>xmlstarlet</code> to achieve this. Tested for Maven 3 on CentOS 7, Maven 2 was not tested yet.</p> <pre class="lang-bash prettyprint-override"><code>XML_FULLPATH=&quot;$HOME/.m2/settings.xml&quot; MIRROR_ID='example' MIRROR_MIRROROF='*' MIRROR_NAME='Example Mirror' MIRROR_URL='http://example.com/mav...
9,645
<p>Is there a simple way to remove a leading zero (as in 01 becoming 1)?</p>
<p>You can use the <a href="http://php.net/ltrim" rel="noreferrer"><code>ltrim</code></a> function:</p> <pre><code>ltrim($str,"0"); </code></pre>
<p>Just multiply by 1</p> <pre><code>echo "01"*1 </code></pre>
42,867
<p>If I am trying to determine the read speed of a drive, I can code a routine to write files to a filesystem and then read those files back. Unfortunately, this doesn't give an accurate read speed because Windows does disk read caching. </p> <p>Is there a way to flush the disk read cache of a drive in C# / .Net (or p...
<p>Constantin: Thanks! That link has a command-line EXE which does the testing I was looking for. </p> <p>I also found a link off that page to a more interesting article (in Word and PDF) on this page: <a href="http://research.microsoft.com/research/pubs/view.aspx?type=Technical%20Report&amp;id=841" rel="noreferrer">S...
<p>I found <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=3127219&amp;SiteID=1" rel="nofollow noreferrer">this</a> article and it seems that this is a complicated program because you also have to flush other caches.</p>
14,884
<p>I've enjoyed using the iTunes Store but I'm curious on what it was developed on (PHP &amp; MySQL, Something Custom?). </p>
<p><a href="http://developer.apple.com/tools/webobjects/" rel="nofollow noreferrer">WebObjects</a>. It comes with XCode these days, but used to cost over $50 000! Not sure about the database backend. I seem to recall reading that it was Oracle, but I don't have a source and may have just accidentally made that up.</p>
<p>I think whatever answer you get will be 99% speculation. I would bet that if someone really did work for Apple and did have the facts they wouldn't be allowed to share them.</p>
43,800
<p>I added the following to my web.config to redirect the user to the login page if they aren't authenticated, but going to the URL does cause a redirect?</p> <pre><code> &lt;location path="user/add"&gt; &lt;system.web&gt; &lt;authorization&gt; &lt;deny users="?" /&gt; &lt;/authorization&gt; ...
<p>Do you have the "Authorize" attribute on that Action or Controller?</p>
<p>For one of my applications I have the following in the same node as <code>&lt;authentication&gt;</code>: </p> <pre><code>&lt;authorization&gt; &lt;deny users="?"/&gt; &lt;/authorization&gt; </code></pre> <p>But this covers the entire application...</p>
42,067
<p>I have a git repository which tracks an svn repository. I cloned it using <code>--stdlayout</code>.</p> <p>I created a new local branch via <code>git checkout -b foobar</code></p> <p>Now I want this branch to end up in <code>…/branches/foobar</code> in the svn repository.</p> <p>How do I go about that?</p> <p>(s...
<p>I know this question has been answered a while ago, but after reading it, I it might help adding examples of the specific git svn branch command and relate it to a typical workflow.</p> <p>Like kch answered, use <code>git svn branch</code>. Here is a full example, (note the <code>-n</code> for dry-run to test):</p>...
<p>@kch I just (7 December 2008) compiled the v1.6.1-rc1 tag of git and it does contain the git svn branch command and the documentation for it. So the v1.6.1 release of git should (hopefully) contain this command.</p>
33,402
<p>Using .NET 2.0 with WinForms, I'd like to create a custom, multi-columned menu (similiar to the word 2007 look&amp;feel, but without the ribbon).</p> <p>My approach was creating a control, and using a left/right docked toolstrip, I have constructed a similar look&amp;feel of a menu. However, there are a few shortco...
<ul> <li>unless you are in the business of providing .net components, you should be looking to buy it off the shelf. Its a lot of work getting such a control right - There are already vendors providing this kind of UI. e.g. <a href="http://www.componentone.com/SuperProducts/RibbonWinForms/" rel="nofollow noreferrer">Co...
<ul> <li>unless you are in the business of providing .net components, you should be looking to buy it off the shelf. Its a lot of work getting such a control right - There are already vendors providing this kind of UI. e.g. <a href="http://www.componentone.com/SuperProducts/RibbonWinForms/" rel="nofollow noreferrer">Co...
9,659
<p>Oracle FAQ defines temp table space as follows:</p> <blockquote> <p>Temporary tablespaces are used to manage space for database sort operations and for storing global temporary tables. For example, if you join two large tables, and Oracle cannot do the sort in memory, space will be allocated in a temp...
<p>I'm not sure exactly what information you have to hand already, but using the following query will point out which program/user/sessions etc are currently using your temp space.</p> <pre><code>SELECT b.TABLESPACE , b.segfile# , b.segblk# , ROUND ( ( ( b.blocks * p.VALUE ) / 1024 / 1024 ), 2...
<p>One rule of thumb is that almost any query that takes more than a second probably uses some TEMP space, and these are not the just ones involving ORDER BYs but also:</p> <ol> <li>GROUP BYs (SORT GROUPBY before 10.2 and HASH GROUPBY from 10.2 onwards)</li> <li>HASH JOINs or MERGE JOINs</li> <li>Global Temp Tables (o...
21,061
<p>Can jQuery ajax made browser request a new location in redirect header send by server?</p>
<p>You should parse the code and use Javascript to set the document.location</p> <pre><code>$.get('page.php', { GETvar : 'redirectUrl' }, function(data, textString){ if (textString == "succes") { //Succes! document.location = data; } else{ // failure } }); </code></pre> <p>If you PHP script returns a valid url...
<p>Haven't tried jQuery, and a quick peek at the doc doesn't really tell me what a redirect response is handled as. But in Prototype JS any response code other than 2xx "Success" is a onFailure event, thus a redirect is a failure. You could probably parse the response (somehow) in the error block to see what code it is...
42,199
<p>How do I search the whole classpath for an annotated class?</p> <p>I'm doing a library and I want to allow the users to annotate their classes, so when the Web application starts I need to scan the whole classpath for certain annotation.</p> <p>I'm thinking about something like the new functionality for Java EE 5 We...
<p>Use <a href="http://static.springsource.org/spring/docs/2.5.x/api/org/springframework/context/annotation/ClassPathScanningCandidateComponentProvider.html" rel="noreferrer">org.springframework.context.annotation.ClassPathScanningCandidateComponentProvider</a> </p> <p>API</p> <blockquote> <p>A component provider t...
<p>Google <a href="http://code.google.com/p/reflections/" rel="nofollow">Reflections</a> seems to be much faster than Spring. Found this feature request that adresses this difference: <a href="http://www.opensaga.org/jira/browse/OS-738" rel="nofollow">http://www.opensaga.org/jira/browse/OS-738</a></p> <p>This is a rea...
32,368
<p>I'm new to 3D printing and I recently got my first 3D printer, an Ender 3 Pro by Creality.</p> <p>I've tried to find information about the type of nozzles should I look for. I'm trying to find stainless steel nozzles but there are so many models (M7, M8, etc.) and I have no idea what nozzle type I should get.</p> ...
<p>The Ender 3 takes an M6 thread (metric 6&nbsp;mm diameter). Measurement of stock nozzle shown. </p> <p>Most sellers will list compatible printers Ender 2, Ender 3, Ender 4, CR-10, CR-10S, CR-10 Mini, CR-10-S4, CR-10-S5, CR-8, CR-7. Will Also Fit Any Other MK10 Heater Blocks. </p> <p>I recently bought some titanium...
<p>There is no such thing as a single MK10 hotend design. The Chinese aftermarket has mingled the designations.</p> <p>If it has a <a href="https://groups.google.com/forum/m/#!topic/wanhao-printer-3d/TEdslEknny4" rel="nofollow noreferrer">MK10 like Makerbot</a> hotend, then the nozzles you are looking for are M7 threa...
1,082
<p>What's a good algorithm for calculating frames per second in a game? I want to show it as a number in the corner of the screen. If I just look at how long it took to render the last frame the number changes too fast.</p> <p>Bonus points if your answer updates each frame and doesn't converge differently when the fra...
<p>You need a smoothed average, the easiest way is to take the current answer (the time to draw the last frame) and combine it with the previous answer.</p> <pre><code>// eg. float smoothing = 0.9; // larger=more smoothing measurement = (measurement * smoothing) + (current * (1.0-smoothing)) </code></pre> <p>By adjus...
<p>store a start time and increment your framecounter once per loop? every few seconds you could just print framecount/(Now - starttime) and then reinitialize them.</p> <p>edit: oops. double-ninja'ed</p>
11,283
<p>XmlElement.Attributes.Remove* methods are working fine for arbitrary attributes resulting in the removed attributes being removed from XmlDocument.OuterXml property. Xmlns attribute however is different. Here is an example:</p> <pre><code>XmlDocument doc = new XmlDocument(); doc.InnerXml = @"&lt;Element1 attr1=""va...
<p>.NET DOM API doesn't support modifying element's namespace which is what you are essentially trying to do. So, in order to solve your problem you have to construct a new document one way or another. You can use the same .NET DOM API and create a new element without specifying its namespace. Alternatively, you can cr...
<p>Yes, because its an ELEMENT name, you can't explicitly remove it. Using XmlTextWriter's WriteStartElement and WirteStartAttribute, and replacing the attribute with empty spaces will likely to get the job done. </p> <p>I'm checking it out now. will update.</p>
10,206
<p>I'm a beginner with SQL and am working on one of my first databases. I am trying to create a very cut-down shopping cart and am currently working on getting the database together before I start coding the site.</p> <p>One of the things I am struggling with is how to structure the products portion of the database. I...
<p>Ayende Rahien (of RhinoMocks) has recently been doing a series on building a shopping cart, starting here: <a href="http://ayende.com/Blog/archive/2008/12/07/designing-a-shopping-cart.aspx" rel="nofollow noreferrer">http://ayende.com/Blog/archive/2008/12/07/designing-a-shopping-cart.aspx</a>. It does use a class dia...
<p>I would probably create a package table with the package id and price for the package and then have an intermediate (cross reference) table between the package and products with package IDs (as a FK to the package table) and corresponding product IDs (as FK to the product table).</p>
47,107
<p>Is there any way to parse a string in the format HH:MM into a Date (or other) object using the standard libraries?</p> <p>I know that I can parse something like "9/17/2008 10:30" into a Date object using</p> <pre><code>var date:Date = new Date(Date.parse("9/17/2008 10:30"); </code></pre> <p>But I want to parse ju...
<p>If you have to use the exact format you specified, then you need to parse it yourself.</p> <p>Here is a simple example (not tested):</p> <pre><code>var str:String = "9/17/2008 10:30" var items:Array = str.split(" "); var dateElements:Array = items[0].split("/"); var timeElements:Array = items[1].split(":"); var ...
<p>Have you considered prepending "01/01/2000 " to the time string and then applying Date?</p> <p>Alternately there's probably a tokenizer that will take the input and split it up at the : giving you an array of strings you can convert to integers. A tokenizer isn't hard to write, either, and can be fun if one doesn'...
11,073
<p>I'm using MS Access to create a database with over 5000 contacts. These contacts are separated up into which employee the contact belongs to, and then again into categories for easy searching. What I want to do is create a button that will open up a query in table form (simple), then have check boxes so an employee ...
<p>I have just created the following <strong>working</strong> example in MS Access 97.</p> <p>A sample table (I tested the code with valid e-mail addresses):</p> <p>ID Name Email</p> <p>1 Rics rics@stack.com</p> <p>2 Kate kate@stack.com</p> <p>3 X x@stack.com</p> <p>A form with one button. The ...
<p>I think you're going to need to learn some VBA coding to get this done. This <a href="http://www.functionx.com/vbaccess/" rel="nofollow noreferrer">tutorial</a> might be useful.</p> <p>Heres a way to <a href="http://www.febooti.com/products/command-line-email/online-help/send-email-ms-access.html" rel="nofollow no...
44,081
<p>I have a sequential workflow with a number of Activities. One of these activities needs to access my paid S3 account. It works fine, but to be cautious, I would like to make sure it can handle unexpected situations, such as 'Host not found' or some timeout, etc.</p> <p>So .. i would normally put the code inside a T...
<p>Take a look at the <a href="http://msdn.microsoft.com/en-us/library/system.workflow.componentmodel.faulthandleractivity.aspx" rel="nofollow noreferrer"><code>FaultHandlerActivity</code></a>, which is used to handle an Exception of the type specified by the <code>FaultType</code> property. Some links about error hand...
<p>You might also want to have a look at this blog article on a custom Retry activity: <a href="http://www.pluralsight.com/community/blogs/matt/archive/2007/11/28/49315.aspx" rel="nofollow noreferrer">http://www.pluralsight.com/community/blogs/matt/archive/2007/11/28/49315.aspx</a></p> <p>Looks like it is just what yo...
35,304
<p>Word wrap is one of the must-have features in a modern text editor.</p> <p>How word wrap be handled? What is the best algorithm for word-wrap?</p> <p>If text is several million lines, how can I make word-wrap very fast?</p> <p>Why do I need the solution? Because my projects must draw text with various zoom level ...
<p>Here is a word-wrap algorithm I've written in C#. It should be fairly easy to translate into other languages (except perhaps for <code>IndexOfAny</code>).</p> <pre class="lang-cs prettyprint-override"><code>static char[] splitChars = new char[] { ' ', '-', '\t' }; private static string WordWrap(string str, int wid...
<p>@ICR, thanks for sharing the C# example.</p> <p>I did not succeed using it, but I came up with another solution. If there is any interest in this, please feel free to use this: <em><a href="https://web.archive.org/web/20160403050733/http://johan.andersson.net/2010/11/03/wordwrap-function-in-c/" rel="nofollow norefe...
3,819
<p>I'm looking to implement httpOnly in my legacy ASP classic sites. Anyone knows how to do it?</p>
<pre><code>Response.AddHeader "Set-Cookie", "mycookie=yo; HttpOnly" </code></pre> <p>Other options like <code>expires</code>, <code>path</code> and <code>secure</code> can be also added in this way. I don't know of any magical way to change your whole cookies collection, but I could be wrong about that.</p>
<p>HttpOnly does very little to improve the security of web applications. For one thing, it only works in IE (Firefox "supports" it, but still discloses cookies to Javascript in some situations). For another thing, it only prevents a "drive-by" attack against your application; it does nothing to keep a cross-site scrip...
7,900
<p>Are there any utilities or browser plugins that let you easily switch the version of the Flash player that is being used?</p>
<p>For Firefox 3.x on Window XP, Ubutntu Linux, and Mac OS X (Tiger and Leopard), <a href="http://www.sephiroth.it/firefox/flash_switcher/" rel="nofollow noreferrer">Flash Switcher</a> works well.</p>
<p>Found the following: <a href="http://www.google.be/search?q=firefox%20switch%20flash%20version" rel="nofollow noreferrer">http://www.google.be/search?q=firefox%20switch%20flash%20version</a></p> <p><a href="http://www.sephiroth.it/weblog/archives/2006/10/flash_switcher_for_firefox.php" rel="nofollow noreferrer">htt...
9,884
<p>Help !!!</p> <p>I have just spent about 10 minutes looking for a way to do a search and replace over all the files in Delphi 2006 project. </p> <p>Please can you tell how to do it </p>
<p>I would use Grep Search from <a href="http://www.gexperts.org/" rel="noreferrer">GExperts</a> for this</p>
<p>To search all the files in your project you can use:</p> <p><kbd>Ctrl</kbd> + <kbd>Shift</kbd> + <kbd>F</kbd></p>
32,284
<p>I'm really sick of this problem. Google searches always seem to suggest "delete all bpls for the package", "delete all dcus". Sometimes this just-does-not-work. Hopefully I can get some other ideas here.</p> <p>I have a package written in-house, which had been installed without issue a few months ago. Having made a...
<p>I managed to solve this, following the below procedure</p> <ol> <li>Create a new package</li> <li>One by one, add the components to the package, compile &amp; install, until it failed.</li> <li>Investigate the unit causing the failure.</li> </ol> <p>As it turns out, the unit in question had a class constant array,...
<p>For me, in D2010 disabling the compiler option "Emit runtime type information" did the trick.</p>
18,511
<p>For those agile practitioners out there...</p> <p>How do you manage changes to a database schema during a project? My assumption is that in an agile project the schema of any database involved will change and be refactored just as happens with the codebase.</p> <p>Is this assumption correct? If so, do you have any...
<p><a href="http://www.agiledata.org/" rel="noreferrer">AgileData.org</a> is an excellent resource -- much more than I cram into a single response -- on Agile Database development. In particular, you might be interested in <a href="http://www.agiledata.org/essays/bestPractices.html" rel="noreferrer">Agile Data Best Pr...
<p>Take a look at <a href="http://wiki.rubyonrails.org/rails/pages/understandingmigrations" rel="nofollow noreferrer">Ruby on rails migrations</a>. Doesn't matter if you don't use Rails, as the idea has been copied to other framework already.</p>
43,307
<p>My first magnetic bed mat for my Ender 3 Pro is cracking underneath. On the top side there is a bubble in the middle which prevents any viable print. The layers are probably separating.</p> <p>I am new to printing but have read many articles on hiccups to expect, fixes etc. I do understand these magnetic mats can b...
<p>My personal technique for removing prints (particularly larger prints) is not to flex the mat at all. Instead, I wait until it's cool and then work the spatula under an edge and move it under the model to basically peel it from the mat.</p> <p>Smaller prints usually pop right off if I start with this technique from...
<p>My personal technique for removing prints (particularly larger prints) is not to flex the mat at all. Instead, I wait until it's cool and then work the spatula under an edge and move it under the model to basically peel it from the mat.</p> <p>Smaller prints usually pop right off if I start with this technique from...
1,534
<p>For .net 3.5 SP1, Microsoft have the new client profile which installs only a subset of .net 3.5 SP1 on to Windows XP user's machines.</p> <p>I'm aware of how to make my assemblies client-profile ready. And I've read the articles on how to implement an installer for <a href="http://msdn.microsoft.com/en-us/library/...
<p>Microsoft has now shipped the Client Profile Configuration Designer (Beta).</p> <p>This designer lets you edit the XML files with some limitations, this isn't a 'Google beta' by any means.</p> <p><a href="http://windowsclient.net/wpf/wpf35/wpf-35sp1-client-profile-config-overview.aspx" rel="nofollow noreferrer">In...
<p>Can you clarify: Are you trying to write an installer for your app, which depends on the Client-Profile, or are you trying to write a custom installer <em>for</em> the client-profile?</p> <p>I haven't used it personally, but if it's anything like the dotnetfx 1 and 2 msi's, you basically have to just invoke it's ex...
3,482
<p>I've got an application that needs quite a bit of data (1000s of records) to do appropriate testing. The only way I've found to get a decent set of testable, sensible data is to use a <strong>subset of my production DB</strong>. I've converted this to YAML fixtures in the normal `test/fixtures' location.</p> <p>T...
<p>Magic numbers in tests aren't an anti-pattern. Your tests need to be so dead-simple that you don't need to <em>test</em> them. This means you'll have some magic numbers. This means that your tests will break when you change small bits of functionality. This is good.</p> <p>Fixtures have <a href="http://www.floe...
<p>The first thing I'd say is: what are you testing in that example? If it's an ordinary AR has_many association, then I wouldn't bother writing a test for it. All you're doing is testing that AR works.</p> <p>A better example might be if you had a very complicated query or if there was other processing involved in ge...
28,212
<p>Faulty endstop caused the printer (a traditional cartesian FDM) to try to move over the maximum axis limit at top, the noise has been atrocious, I don't see damages (apparently) but I'm wondering if this could have damaged something or the motors aren't strong enough to do any serious physical damage to mechanics of...
<p>It's highly unlikely this crash caused any physical or electrical damage to your printer. Printers are designed to be able to withstand an occasional crash as typically, no Axis Maximum endstops are installed. The 'atrocious' noise you describe hearing is the sound of the stepper motor having lost (or, in this case,...
<p>The noise you heard was likely caused by the extruder keeping turning, resulting in the belt stretching enough to jump a tooth or more. I guess it was like &quot;TRRRRR&quot;.</p> <p>If the belt tension is properly set (not too tight), no damage can be caused. In fact, the belt should be loose enough so that such a ...
2,085
<p>I'm finding that hitting the "Refresh" button on my browser will temporarily screw up the ViewState for controls inside an UpdatePanel.</p> <p>Here's my situation : I made a custom WebControl that stores values in the ViewState. I put this control inside an UpdatePanel. When I hit the "refresh" button on my brows...
<p>I just re-read your question and realised I missed something... </p> <p><strong>You are hitting the <em>browsers</em> refresh button!</strong></p> <p>Is this a problem? <strong>YES!</strong></p> <p>What happens when you hit the refresh button on the browser? It refreshes the current page. If there was a postback,...
<p>Your ViewState is not being saved. The SaveViewState override is for saving OBJECTS, not for putting stuff into the ViewState bag. The ViewState bag is already beyond the point of mnarking stuff dirty and changes you make will not be persisted. You need to create an object array to load/view the ViewState informatio...
46,140
<p>I want to display an error message on my asp.net application. This message is a warning message, this is the way I did it:</p> <pre class="lang-js prettyprint-override"><code>CmdCalcInvoke.Attributes[&quot;onclick&quot;] = &quot;return confirm('Are you sure you want to calculate the certification? WARNING: If the qu...
<p>you can if you dont use the default alert boxes. Try using a javascript modal window which is just normal div markup that you can control the styling of. Look at blockui for jquery (there are loads of others)</p>
<p>You can try something like: <a href="http://weblogs.asp.net/johnkatsiotis/archive/2008/09/14/asp-net-messagebox-server-and-client.aspx" rel="nofollow noreferrer">http://weblogs.asp.net/johnkatsiotis/archive/2008/09/14/asp-net-messagebox-server-and-client.aspx</a></p>
11,687
<p><img src="https://i.stack.imgur.com/DibJS.jpg" alt="Visual Studio folder structure"></p> <p>I need some advice as to how I easily can separate test runs for unit tests and integration test in Visual Studio. Often, or always, I structure the solution as presented in the above picture: separate projects for unit test...
<p>I actually found kind of a solution for this on my own by using keyboard command bound to a macro. The macro was recorded from the menu Tools>Macros>Record TemporaryMacro. While recording I selected my [Tests] folder and ran ReSharpers UnitTest.ContextRun. This resulted in the following macro, </p> <pre><code>Sub T...
<p>This is a bit of fiddly solution, but you could configure some <a href="http://blogs.msdn.com/saraford/archive/2008/04/24/did-you-know-you-can-run-external-tools-within-visual-studio-201.aspx" rel="nofollow noreferrer">external tools</a> for each of group of tests you want to run. I'm not sure if you'll be able to l...
3,484
<p>I'm writing an application where the user will create an appointment, and instantly get an email confirming their appointment. I'd also like to send an email the day of their appointment, to remind them to actually show up.</p> <p>I'm in ASP.NET (2.0) on MS SQL . The immediate email is no problem, but I'm not sur...
<p>Choice #1 would be the best option, create a table of emails to send, and update the table as you send each email. It's also best not to delete the entry but mark it as sent, you never know when you'll have a problem oneday and want to resend out emails, I've seen this happen many times in similar setups.</p>
<p>Your option 2 certainly seems like something you are inventing. I know that <em>my</em> mail system won't hold messages for future delivery if you were to send me something like that.</p> <p>I don't think you're missing anything obvious. You will need something that runs the day of the appointment to send emails. W...
41,713
<p>I'd like to rollback a change I made recently in TFS. In Subversion, this was pretty straightforward. However, it seems to be an incredible headache in TFS:</p> <h3>Option 1: Get Prior Version</h3> <ol> <li>Manually get prior version of each file</li> <li>Check out for edit</li> <li>Fail - the checkout (in VS2008) ...
<ol> <li>Download and install <a href="http://www.microsoft.com/download/en/details.aspx?displaylang=en&amp;id=15836" rel="noreferrer">Team Foundation Power Tools</a>. </li> <li>Open up the Visual Studio command prompt</li> <li>Navigate to the directory on the file system that TFS is mapped to. If you don't do this you...
<p>The solution above is for TFS2008. TFS2010 has built-in rollback feature. see <a href="http://www.edsquared.com/2010/02/02/Rollback+Or+Undo+A+Changeset+In+TFS+2010+Version+Control.aspx" rel="nofollow">this</a> article for details.</p>
5,256
<p>I have a list of error codes I need to reference, kinda like this:</p> <pre><code>Code / Error Message A01 = whatever error U01 = another error U02 = yet another error type </code></pre> <p>I get the Code returned to me via a web service call and I need to display or get the readable error. So I need a func...
<p>Use a Dictionary, (in C#, but the concept and classes are the same):</p> <pre><code>// Initialize this once, and store it in the ASP.NET Cache. Dictionary&lt;String,String&gt; errorCodes = new Dictionary&lt;String,String&gt;(); errorCodes.Add("A01", "Whatever Error"); errorCodes.Add("U01", "Another Error"); // A...
<p>You would use a dictionary. A dictionary uses a hashmap internally for performance, so it is good in that regard. Also, because you want this to go as quickly as possible by the sounds of it, I would statically initialize it in its own class instead of, for example, in an XML file or slimier. You would probably want...
39,390
<p>Please consider the following:</p> <pre><code>&lt;td style="width: 500px;"&gt; &lt;div style="width: 400px;"&gt;SomeContent&lt;/div&gt; &lt;/td&gt; </code></pre> <p>For some reason, the column that contains a div will not expand to 500px as the style suggests.</p> <p>Do you know how to get the td to honor the...
<p>In theory, you can use the min-width and max-width styles. In practice, some popular browsers ignore these styles. In this case you have explicitly declared a width of 400, so it should always equal 400 unless acted upon by a child growing or a parent shrinking. You could runat-"server" and programatically determi...
<p>is there a width on the table and other tds within the table? Also, have you got a doc type going on?</p> <p>However, that said, here's your solution:</p> <pre><code>&lt;td style="width: 500px"&gt; &lt;div style="padding: 0 50px"&gt;SomeContent&lt;/div&gt; &lt;/td&gt; </code></pre> <p>Setting your padding appro...
33,895
<p>I am developing a HTML form designer that needs to generate static HTML and show this to the user. I keep writing ugly code like this:</p> <pre><code>public string GetCheckboxHtml() { return ("&amp;lt;input type="checkbox" name="somename" /&amp;gt;"); } </code></pre> <p>Isn't there a set of strongly typed clas...
<p>Well, if you download the <a href="http://www.codeplex.com/aspnet/Wiki/View.aspx?title=MVC&amp;referringTitle=Home" rel="nofollow noreferrer">ASP.NET MVC</a> DLL's (which you can use in <em>any</em> type of project... including Console apps)... then you can use the many HTML helpers they have.</p>
<p>HtmlTextWriter contains goodies like "WriteStartTag" and "WriteEndTag", which can be used to create properly formed HTML fairly easily.</p> <p>You essentially pass the tagname and attributes to the HtmlTextWriter, and it generates the proper HTML, and will close it properly with WriteEndTag.</p> <p>You can also us...
34,502
<p>Does anyone know of any good tutorials on ADO.NET Entity Framework?</p> <p>There are a few useful links here at <a href="https://stackoverflow.com/questions/42826/where-to-start-with-entity-framework">Stack OverFlow</a>, and I've found one tutorial at <a href="http://dotnet-architecture-jdo.blogspot.com/2008/08/ado...
<p>Microsoft offers <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=355c80e9-fde0-4812-98b5-8a03f5874e96&amp;displaylang=en" rel="noreferrer">.NET 3.5 Enhancements Training Kit</a> it contains documentation and sample code for ADO.NET EF</p>
<p>Sample application from <a href="http://msdn.microsoft.com/en-us/library/bb399296.aspx" rel="nofollow noreferrer">MSDN</a></p> <p>And some inside information from <a href="http://blogs.msdn.com/adonet/" rel="nofollow noreferrer">ADO.NET Team Blog</a></p>
8,747
<p>I just wonder a bit whether or not GDI+ is still a technology worth using, especially in a .net sense.</p> <p>Granted, GDI+ is still THE technology to handle Images in Windows, but it is also unmanaged code (obviously). Now, after discovering that GDI+ is actually not supported on ASP.net¹, I just wonder: Is it act...
<p>It's still a technology worth using. There are lots of Windows Forms and unmanaged apps around that use GDI+ that either won't be upgraded, or that will be upgraded, but that don't need more advanced rendering capabilities. GDI+ is a good bolt-on solution for older applications, and for new applications written in W...
<blockquote> <p>Blockquote there are plenty of other graphics libraries out there, faster and/or higher quality / fewer system dependencies...</p> </blockquote> <p>Could u list some of them libraries that could be used instead of GDI+ with C++ ?</p>
4,279
<p>I'm sure this has been asked before, but I can't find it. </p> <p>What are the benefits/limitations of using a browser-based interface for a stand-alone application vs. using a normal GUI framework?</p> <p>I'm working on a Python program currently implement with wxPython for the GUI. The application is simply user...
<p>The obvious advantages to browser-based:</p> <ul> <li>you can present the same UI regardless of platform</li> <li>you can upgrade the application easily, and all users have the same version of the app running</li> <li>you know the environment that your application will be running in (the server hardware/OS) which ma...
<p>Browsers can be accessed anywhere with internet and you deploy it on the server. The desktop app has to be deployed to their computers and each computer somehow has its own uniqueness even with same OS and same version. This could bring you lots of hassles. Go for web.</p>
31,876
<p>I have a bash shell script that loops through all child directories (but not files) of a certain directory. The problem is that some of the directory names contain spaces. </p> <p>Here are the contents of my test directory:</p> <pre><code>$ls -F test Baltimore/ Cherry Hill/ Edison/ New York City/ Philadelphi...
<p>First, don't do it that way. The best approach is to use <code>find -exec</code> properly:</p> <pre><code># this is safe find test -type d -exec echo '{}' + </code></pre> <p>The other safe approach is to use NUL-terminated list, though this requires that your find support <code>-print0</code>:</p> <pre><code># th...
<p>Just had a simple variant problem... Convert files of typed .flv to .mp3 (yawn).</p> <pre><code>for file in read `find . *.flv`; do ffmpeg -i ${file} -acodec copy ${file}.mp3;done </code></pre> <p>recursively find all the Macintosh user flash files and turn them into audio (copy, no transcode) ... it's like the wh...
38,599
<p>Suppose I have a database table with two fields, "foo" and "bar". Neither of them are unique, but each of them are indexed. However, rather than being indexed together, they each have a separate index.</p> <p>Now suppose I perform a query such as <code>SELECT * FROM sometable WHERE foo='hello' AND bar='world';</c...
<p>Oracle will almost certainly use the most selective index to drive the query, and you can check that with the explain plan.</p> <p>Furthermore, Oracle can combine the use of both indexes in a couple of ways -- it can convert btree indexes to bitmaps and perform a bitmap ANd operation on them, or it can perform a ha...
<p>You can provide hints as to which index to use. I'm not familiar with Oracle, but in Mysql you can use USE|IGNORE|FORCE_INDEX (see <a href="http://dev.mysql.com/doc/refman/5.1/en/index-hints.html" rel="nofollow noreferrer">here</a> for more details). For best performance though you should use a combined index.</p>
17,968
<p>If I have a DrawingVisual in WPF with Opacity=0, is that enough for it not to be drawn? We have hundreds of DrawingVisuals on a Canvas, and are currently setting Opacity=0 on the visuals that are not to be displayed, and I wanted to make sure there is no rendering performance hit for rendering a DrawingVisual with O...
<p>The best way to check would be to instead set the <a href="http://msdn.microsoft.com/en-us/library/system.windows.uielement.visibility.aspx" rel="nofollow noreferrer">Visibility</a> to Visibility.Colapsed, and see if there's any drawing performance differences. </p> <p>Visibility.Colapsed ensures that the element i...
<p>Why not simply remove the visual from the visual children list? When it needs to be visible you add it back.</p>
36,135
<p>My goal is to implements different image classification methods to show how they function and the advantages and disadvantages behind such methods. The ones I want to try and implement using Java include; </p> <p>Minimum distance classifier</p> <p>k-nearest neighbour classifier.</p> <p>I was wondering what can be...
<p>Although not entirely sure this is what you are looking for (sorry, your question is a bit unclear), if what you want is a library / system to help you with the <em>classification</em> part of the work, then you may want to look at Weka (<a href="http://www.cs.waikato.ac.nz/ml/weka/" rel="nofollow noreferrer">http:/...
<p>You can also use RapidMiner with IMMI (IMage MIning) extension:</p> <p><a href="http://www.burgsys.com/mumi-image-mining-community.php" rel="nofollow">http://www.burgsys.com/mumi-image-mining-community.php</a></p> <p>For image classification you can use for example global feature extraction and then use some class...
42,498
<p>We have an existing classic ASP intranet consisting of hundreds of pages. Its directory structure looks like this...</p> <pre><code>/root app_1 app_2 ... img js style </code></pre> <p>Obviously app_1 and so on have better names in the actual directory structure.</p> <p>Even though the many...
<p>One solution would be to use IIS Manager to configure the website (created for your ASP.NET app by Visual Studio) and add a virtual directory for each of the common folders so that (by the 'virtual' nature of the virtual directory) they will 'appear' to be in the same root folder as your ASP.NET app.</p> <pre><code...
<p>Can't you run the asp.net site as a Virtual Directory?</p> <pre><code>www.site.com/dotnetapp/ </code></pre> <p>Where dotnetapp is a virtual directory completely separate?</p>
18,992
<p>This isn't exactly a programming question but it is related.</p> <p>I had read a fascinating article a while ago about a teacher who explained how he taught base 2 notation to first grade children, without even "teaching" them anything but making them discover both the problem and the solutions by asking relevant q...
<p>He's using the Socratic method, so a search yields <a href="http://www.garlikov.com/Soc_Meth.html" rel="nofollow noreferrer">Teaching by Asking Instead of by Telling</a> by Rick Garlikov.</p> <p>From the text:</p> <blockquote> <p>The experiment was to see whether I could teach these students binary arithmetic [...
<p>One method from my study class social competence: paradox intervention.</p> <p>Claim you can count up to 1024 just with your ten fingers. They won't believe you, but you can. Each finger stands for one digit. If your finger is out, it stands for 1, otherwise for 0. All ten fingers out will represent 1023.</p> <p>Y...
43,272
<p>In sql server does it make a difference if I define a varchar column to be of length 32 or 128?</p>
<p>A <a href="http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx" rel="noreferrer">varchar</a> is a variable character field. This means it can hold text data to a certain length. A varchar(32) can only hold 32 characters, whereas a varchar(128) can hold 128 characters. If I tried to input "12345" into a var...
<p>There should be no noticeable difference as the backend will only store the amount of data you insert into that column. It's not padded out to the full size of the field like it is with a char column.</p> <p>Edit: For more info, this <a href="http://msdn.microsoft.com/en-us/library/aa258242(SQL.80).aspx" rel="nofol...
21,366
<p>I have a web reference for our report server embedded in our application. The server that the reports live on could change though, and I'd like to be able to change it "on the fly" if necessary.</p> <p>I know I've done this before, but can't seem to remember how. Thanks for your help.</p> <p>I've manually driven a...
<p>In the properties window change the "behavior" to Dynamic.</p> <p>See: <a href="http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/XML/wsdldynamicurl.aspx</a></p>
<p>If you mean a VS2005 "Web Reference", then the generated proxy classes have a URL property that is the SOAP endpoint url of that service. You can change this property and have your subsequent http communications be made to that new endpoint.</p> <p>Edit: Ah, thanks bcaff86. I didn't know you could do that simply...
2,716
<p>Does anyone know of a graphing library for simple transformation of a point from one coordinate system to another coordinate system which is rotated by a angle and some point transformation and just for 2d? And any graphing tool for plotting and verifying the same visually?</p>
<p>double[3][3]</p>
<p><a href="http://www.gdal.org/" rel="nofollow noreferrer">GDAL</a> includes pretty much every graphic transform you could ask for, and while it is big and hence takes some time to get used to, it is a great framework to move forward with.</p>
21,369
<p>I need to have multiple forms in the same webpage, all of them POSTing to itself and then performing different actions depending on the type of form.</p> <p>What's the best way to achieve this?</p> <p>To be more specific, the page shows the details of an event, with a form to subscribe (a drop-down box) and anothe...
<p>A few ideas for you:</p> <ol> <li><p>A hidden field in each form</p> <p><code>&lt;input type="hidden" name="formname" value="firstForm" /&gt;</code></p></li> <li><p>Or setting the action url to include a querystring</p> <p><code>&lt;form action="mypage.php?formtype=firstForm" ...&gt;</code></p></li> <li><p>Named ...
<p>You could just have a hidden input for each form containing a formid. Then, when the page processes, you can tell which form was submitted.</p> <p>Or am I misunderstanding your question?</p>
23,805
<p>I need to match a string like "one. two. three. four. five. six. seven. eight. nine. ten. eleven" into groups of four sentences. I need a regular expression to break the string into a group after every fourth period. Something like: </p> <pre><code> string regex = @"(.*.\s){4}"; System.Text.RegularExpressi...
<p><code>.</code> in a regex means "any character"</p> <p>so in your regex, you have used <code>.*.</code> which will match a word (this is equivalent to <code>.+</code>)</p> <p>You were probably looking for <code>[^.]\*[.]</code> - a series of characters that are not "<code>.</code>"s followed by a "<code>.</code>"....
<p>In this case it would seem that regex is a bit of overkill. I would recommend using String.split and then breaking up the resulting array of strings. It should be far simpler and far more reliable than trying to make a regex do what you're trying to do.</p> <p>Something like this might be a bit easier to read and...
30,381
<p>I want to do something like the following in spring:</p> <pre><code>&lt;beans&gt; ... &lt;bean id="bean1" ... /&gt; &lt;bean id="bean2"&gt; &lt;property name="propName" value="bean1.foo" /&gt; ... </code></pre> <p>I would think that this would access the getFoo() method of bean1 and call the se...
<p>What I understood:</p> <ol> <li>You have a bean (bean1) with a property called "foo"</li> <li>You have another bean (bean2) with a property named "propName", wich also has to have the same "foo" that in bean1.</li> </ol> <p>why not doing this:</p> <pre><code>&lt;beans&gt; ... &lt;bean id="foo" class="foopackage.f...
<p>I think you have to inject bean1, then get <code>foo</code> manually because of a timing issue. When does the framework resolve the value of the target bean?</p> <p>You could create a pointer bean and configure that.</p> <pre><code>class SpringRef { private String targetProperty; private Object targetBean; ...
17,245
<p>I'm likely to need to print some parts from TPU (Shore 95A or harder) in the near future. I have everything I need to do a direct drive conversion using the original extruder on a bracket above the hot end -- but for most of my printing (PLA and PETG), this setup isn't required or even optimal, because of the extra...
<p>With some engineering, you could consider creating a tool dock version where you can easily screw off the Bowden driven hotend and screw on the direct driven hotend. You'll only need to have an extension stepper cable to connect the direct drive stepper and pluggable hotend heater and thermistor connections.</p> <p>...
<p>It depends on the level of automation you are willing to implement.</p> <p>The Bowden extruder, including the motor, from the Ender 3 which I think you have (but in general, any Bowden extruder) does not need to be moved at all, since it's not on the printing head. You just need to disconnect the Bowden from the hot...
1,996
<p>Let's say I have two existing tables, "dogs" and "cats":</p> <pre><code> dog_name | owner ---------+------ Sparky | Bob Rover | Bob Snoopy | Chuck Odie | Jon cat_name | owner ---------+------ Garfield | Jon Muffy | Sam Stupid | Bob </code></pre> <p>How do I write a query with this output...
<pre><code>select owner, sum(num_dogs), sum(num_cats) from (select owner, 1 as num_dogs, 0 as num_cats from dogs union select owner, 0 as num_dogs, 1 as num_cats from cats) group by owner </code></pre>
<p>I started with Cade Roux's excellent answer, but changed the WITH...AS () to use a table variable, as I am ended up using the results from a similar query for further aggregate functions.</p> <pre><code>-- Table variable declaration DECLARE @RainingCatsDogs TABLE ( Owner nvarchar(255), num_cats int, num...
41,275
<p>Is it possible to modify a registry value (whether string or DWORD) via a .bat/.cmd script?</p>
<p>@Franci Penov - modify <strong>is</strong> possible in the sense of <strong>overwrite</strong> with <code>/f</code>, eg </p> <pre><code>reg add "HKCU\Software\etc\etc" /f /v "value" /t REG_SZ /d "Yes" </code></pre>
<p>See <a href="http://www.chaminade.org/MIS/Articles/RegistryEdit.htm" rel="nofollow noreferrer">http://www.chaminade.org/MIS/Articles/RegistryEdit.htm</a></p>
15,811
<p>I am unable to build my Web Application (not Web Site) in our build environement. We use DMAKE in our build environment (this unfortunately is non negotiable, therefore using MSBUILD is not permitted ) and when invoking the asp.net precompiler through</p> <p>C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_comp...
<p>We had the same problem on our web application: <strong>error ASPPARSE: Could not load type '...'</strong></p> <p>The problem was that we had the file on disk (on the project folder) but it wasn't included in our application project (in the .csproj file). We solved the problem by including the file in the project...
<p>I received the same problem. </p> <p>I fixed it by copying my webapp's DLL from the OBJ/DEBUG folder to the BIN folder.</p>
39,976
<p>In my code attached below, I'm trying to upload a file via ASP.NET. I am dynamically creating the FileUpload control so that means it's not in my ViewState which (I think) means I can't use the control for uploading files unless I use the old fashioned multipat/form-data way which I don't want to do. I need to be ...
<p>You can use Request.Files</p> <p>It contains the uploaded files as HttpPostedFile objects.</p> <pre><code>foreach(HttpPostedFile file in Request.Files) file.SaveAs(...); </code></pre>
<p>The problem is that the FileUpload control has locked off the FileName parameter from being set programmatically. The reason for this is to protect the user from some malicious script deciding that it wants to upload system files to the server instead of what the user wants.</p> <p>You will not be able to use the F...
49,143
<p>I'm finally getting the hang of RSpec after spending a couple of hours over the weekend. Now I'm stuck trying to figure out how to assert that parameters are indeed passed into the controller. I'm following the <a href="http://blog.8thlight.com/articles/2008/04/20/bowled-over-by-rubycocoa" rel="nofollow noreferrer">...
<p>RubyCocoa is not supported at all on the iPhone. There is no bridge support library, and I do not believe there is any ruby interpreter on the phone.</p> <p>You might be able to get it working in the simulator, it will not stop you from using OS X only libraries if you really try, but that still will not make it wo...
<p>Howdy! Though I'm not familiar with how Ruby/Cocoa wraps foreign method calls- or with Objective C for that matter- the first place that would seem likely to disconnect under test is passing in a Ruby mock to the natively implemented controller. In the bowling tutorial, the ruby controller proxy is exposes its inter...
35,146
<p>I'm doing a basic homework assignment which looks like this:</p> <pre><code> While input &lt;&gt; -1 input = CDbl(InputBox("Enter numbers to add, enter -1 to stop")) values = values + input End While </code></pre> <p>It works fine until I press 'cancel' on the input box. Then the string inp...
<p>Try using Double.TryParse</p> <pre><code>Dim value as Double = Nothing If Double.TryParse(InputBox("Enter numbers..."), value) Then values = values + value End If </code></pre> <p>My syntax may be a bit off, but you should get the idea</p>
<p>You'd also get an error if they entered anything other than a double or a value too big to be stored in a double.</p> <p>The suggestions made should be enough though, you essentially want to validate the user input before you attempt to cast it.</p>
38,343
<h2>Question</h2> <p>I'm sure many of you have been faced by the challenge of localizing a database backend to an application. If you've not then I'd be pretty confident in saying that the odds of you having to do so in the future is quite large. I'm talking anout storing multiple translations of texts (and the same c...
<p>I think you can stick with XML which allows for a cleaner design. I would go further and take advantage of the <code>xml:lang</code> attribute which <a href="http://www.opentag.com/xfaq_lang.htm" rel="nofollow noreferrer">is designed for this usage</a> :</p> <pre><code>&lt;l10n&gt; &lt;text xml:lang="sv-SE"&gt;De...
<p>I like the XML approach, because the separate-table-solution would NOT return a result if e.g. there is no swedish translation (cultureID = 1) unless you do an outer join. But nevertheless you can NOT fall back to English. With the XML approach you simply can fall back to English. Any news on the XML approach in a p...
32,271
<p>I recently signed up to shared web hosting with godaddy using Linux and PHP 5. I want to work with multiple RSS feeds. I previously had this all functioning under Apache, however, the host supplied the PEAR installation. Now I have to do this myself and I am in unfamiliar territory.I installed PEAR PHP and managed...
<p>You can always just create some subfolder in your project and extract any PEAR libraries directly there, it's just plain php scripts. You will have to add that folder (and subfolders) to your include path so everything will be accessible. It is considered as a bad practice because you will have to manually update PE...
<p>Your PEAR (or other libraries) classes can be anywhere. You just need to set correct include paths where script will search for required code. If you can't access php.ini, you can get include paths by using <code>get_include_path()</code> function and set them using <code>set_include_path();</code></p>
43,151