instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have the follow Linq query ... which executes correctly:</p> <pre><code>from t in Tasks where LookupTaskStarted(t.TaskId) == true select new { t.TaskId, t.Number, Started = LookupTaskStarted(t.TaskId) } </code></pre> <p>Is there anyway to create this as a property on the Linq-To-Sql class? Or do ...
<p>I don't have the answer to your question, but I have a refactoring suggestion. Instead of calling LookupTaskStarted() twice, you can record the value with a <code>let</code> clause:</p> <pre><code>from t in Tasks let started = LookupTaskStarted(t.TaskId) where started select new { T.TaskId, t.Number, St...
<p>All linq-sql classes are created as partial. You could extend and add this property. </p>
49,572
<p>what is the difference in using a standard </p> <pre><code>type sl: TStringList </code></pre> <p>compared to using a generic TList</p> <pre><code>type sl: TList&lt;string&gt; </code></pre> <p>?</p> <p>As far as I can see, both behave exactly the same.</p> <p>Is it just another way of doing the same thin...
<ul> <li>TStringList is a descendant of TStrings.</li> <li>TStringList knows how to sort itself alphabetically.</li> <li>TStringList has an Objects property.</li> <li>TStringList doesn't make your code incompatible with all previous versions of Delphi.</li> <li>TStringList can be used as a published property. (A bug pr...
<p>TStringList has been used for far too long and has many advantages, all mentioned by Rob Kennedy.</p> <p>The only real disadvantage of using it as a pair of a string and an object is the necessity of casting object to the actual type expected and stored in this list (when reading) and as far as I know Embarcadero d...
35,317
<p>I'm trying to ensure a script remains running on a development server. It collates stats and provides a web service so it's supposed to persist, yet a few times a day, it dies off for unknown reasons. When we notice we just launch it again, but it's a pain in the rear and some users don't have permission (or the kno...
<p>I have used a simple script with cron to make sure that the program is running. If it is not, then it will start it up. This may not be the perfect solution you are looking for, but it is simple and works rather well.</p> <pre class="lang-sh prettyprint-override"><code>#!/bin/bash #make-run.sh #make sure a proces...
<p>I think a better solution is if you test the function, too. For example, if you had to test an apache, it is not enough only to test, if "apache" processes on the systems exist.</p> <p>If you want to test if apache OK is, then try to download a simple web page, and test if your unique code is in the output.</p> <p...
38,258
<p>In firefox when you add an onclick event handler to a method an event object is automatically passed to that method. This allows, among other things, the ability to detect which specific element was clicked. For example</p> <pre><code>document.body.onclick = handleClick; function handleClick(e) { // this works...
<p>Here is how would I do it in case I cannot use jQuery</p> <pre><code>document.body.onclick = handleClick; function handleClick(e) { //If "e" is undefined use the global "event" variable e = e || event; var target = e.srcElement || e.target; alert(target.className); } </code></pre> <p>And here is ...
<p>I think IE uses a variable called <code>event</code>. See if that works?</p>
39,746
<p>Is there a keyboard shortcut for pasting the content of the clipboard into a command prompt window on Windows XP (instead of using the right mouse button)?</p> <p>The typical <kbd>Shift</kbd>+<kbd>Insert</kbd> does not seem to work here.</p>
<p>Yes.. but awkward. <a href="https://learn.microsoft.com/en-gb/archive/blogs/adioltean/useful-copypaste-trick-in-cmd-exe" rel="nofollow noreferrer">Link</a></p> <p><kbd>alt</kbd> + <kbd>Space</kbd>, <kbd>e</kbd>, <kbd>k</kbd> &lt;-- for copy and<br> <kbd>alt</kbd> + <kbd>Space</kbd>, <kbd>e</kbd>, <kbd>p</kbd> &lt;-...
<p>Under VISTA Command prompt: Click on the System Icon Select Defaults from the Menu On the Options tab in the Options group I have "Quick Edit Mode", "Insert Mode", and "Auto Complete" selected I think that "Quick Edit Mode" is what makes it work.</p> <p>To paste whatever is in the Clipboard at the insertion point: ...
16,004
<p>Are there any good methods for getting ASP.NET 2.0 to validate under the XHTML 1.0 Strict (or Transitional) DTD? I'm interested to hear some ideas before I hack up the core of the HTTP response.</p> <p>One major problem is the form tag itself, this is the output I got from W3C when I tried to validate:</p> <pre><...
<p>ASP.NET 2.0 and above can indeed output Strict (or Transitional) XHTML. This will resolve your 'there is no attribute "name"' validation error, amongst other things. To set this up, update your Web.config file with something like:</p> <pre><code>&lt;system.web&gt; ... other configuration goes here ... &lt;x...
<p>Its possible to change the output of ASP.NET controls using techniques like the <a href="http://www.asp.net/CssAdapters/" rel="nofollow noreferrer">CSS Adapters</a>. Although I wouldn't personally recommend you use these out of the box, it might give you some hints on a good solution.</p> <p>I generally avoid using...
18,812
<p>Since we cannot setup Eclipse's RSE to use at the tool for remote editing, I have installed <a href="http://www.cis.upenn.edu/~bcpierce/unison/docs.html" rel="nofollow noreferrer">Unison</a>. But how can I get Eclipse to automatically run unison on every file save? Is there an eclipse plugin available for this?</p> ...
<p>Depending on the importance, I would write a simple plugin to handle this. </p> <p>EDIT: All you <em>really</em> need to do is this:</p> <p>1) Create the plugin from the templates with the RCP\PDE Eclipse install<br> 2) Add the following code to your activator...<br></p> <pre><code>@Override public void start( fi...
<p>Depending on the importance, I would write a simple plugin to handle this. </p> <p>EDIT: All you <em>really</em> need to do is this:</p> <p>1) Create the plugin from the templates with the RCP\PDE Eclipse install<br> 2) Add the following code to your activator...<br></p> <pre><code>@Override public void start( fi...
25,946
<p>I'm trying to get IKVM to build (see <a href="https://stackoverflow.com/questions/71599/how-to-get-ikvm-to-build-in-visual-studio-2008">this question</a>) but now have encountered a problem not having to do with IKVM so I'm opening up a new question:</p> <p>When running nant on the IKVM directory with the Visual St...
<p>OK here is the answer I ended up finding: rather than being on the Path, the directory with windows.h (in my case, C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include) needed to be set in the Include environment variable.</p>
<p>By the way, create environment variable %LIB%, meaning the same - path to all SDKs lib directories</p>
10,633
<p>Is there a quick way to join paths like the Join-Path function in Powershell? For example, I have two parts of a path "C:\foo" and a subdirectory "bar". Join-Path will join these and take care of the backslash delimiters. Is there a built-in method for this in .NET, or do I need to handle this myself?</p>
<p>This is your friend: <a href="http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.io.path.combine.aspx</a></p>
<p><em>Path.Combine</em> is the way to go.</p>
11,944
<p>I am trying to use Zend_Db_Select to write a select query that looks somewhat like this:</p> <pre><code>SELECT * FROM bar WHERE a = 1 AND (b = 2 OR b = 3) </code></pre> <p>However, when using a combination of where() and orWhere(), it seems impossible to use condition grouping like the above.</p> <p>Are there any...
<p>From <a href="http://framework.zend.com/manual/en/zend.db.select.html#zend.db.select.building.where" rel="nofollow noreferrer">the manual</a> (Example 11.61. Example of parenthesizing Boolean expressions)</p> <pre><code> // Build this query: // SELECT product_id, product_name, price // FROM "products" // WHER...
<p>The above reference is great, but what if you are playing with strings?</p> <p>Here would is the above example with strings...</p> <pre><code>// Build this query: // SELECT product_id, product_name, price // FROM "products" // WHERE (product_name = 'Bananas' OR product_name = 'Apples') // AND (price = 10...
10,642
<p>As many of you probably know, online banks nowadays have a security system whereby you are asked some personal questions before you even enter your password. Once you have answered them, you can choose for the bank to "remember this computer" so that in the future you can login by only entering your password.</p> ...
<p>In fact they most probably use cookies. An alternative for them would be to use "<a href="http://www.bestflashanimationsite.com/tutorials/4/" rel="noreferrer">flash cookies</a>" (officially called "<a href="http://www.adobe.com/support/flash/action_scripts/local_shared_object/" rel="noreferrer">Local Shared Objects<...
<p>MAC address is possible.</p> <p>IP to physical location mapping is also a possibility.</p> <p>User agents and other HTTP headers are quiet unique to each of the machines too.</p> <p>I'm thinking about those websites that prevents you from using an accelerating download managers. There must be a way.</p>
5,299
<p>I know that a float isn't appropriate to store currency values because of rounding errors. Is there a standard way to represent money in C++? </p> <p>I've looked in the boost library and found nothing about it. In java, it seems that BigInteger is the way but I couldn't find an equivalent in C++. I could write my o...
<p>Having dealt with this in actual financial systems, I can tell you you probably want to use a number with at least 6 decimal places of precision (assuming USD). Hopefully since you're talking about currency values you won't go way out of whack here. There are proposals for adding decimal types to C++, but I don't kn...
<p>Our financial institution uses "double". Since we're a "fixed income" shop, we have lots of nasty complicated algorithms that use double anyway. The trick is to be sure that your end-user presentation does not overstep the precision of double. For example, when we have a list of trades with a total in trillions of d...
17,959
<p>Is there any way to get numbers on how many people are reading an RSS feed? My understanding of the way feed readers work (e.g. Google Reader) is that they check the feed periodically, cache it, and serve the cached copy to whoever asks for it until it's refreshed - which would imply that there's no way to get relia...
<p><a href="http://www.feedburner.com/fb/a/home" rel="nofollow noreferrer">Feedburner</a> provides that info, you can delegate your feed to that service. I don't really know how it works under the covers (as you said, the feed should be checked periodically...) to be reliable.</p>
<p>Feedburner works rather nicely. They do all the stats for <a href="http://perlbuzz.com/" rel="nofollow noreferrer">Perlbuzz</a>, for example. Plus you get these little widgets that you can put on the page (the yellow box on Perlbuzz that gives the count of current readers).</p> <p>You can track the logs yourself,...
24,739
<p>And I'm not meaning Bits Per Minute, but Business Process Management. </p> <p>At first though BPM was overestimated, because the technology is somehow easy to address, but I've learned the value of BPM suites is in involving the non-technical, the business experts into the software design. </p> <p>I know, the user...
<p>I spent a couple years in the Content Management/Information Management circle using both FileNet and IBM BPM products. I would have to say I am incredibly unimpressed, and here is why:</p> <p>1) BPM is one of those things I have not ever seen implemented intuitively. By that I mean (similar to what you say in yo...
<p>I see BPM as being something orthogonal to a traditional IT unit that "keeps the computers running" as BPM is where we try to improve how things are done by adding this technology or changing a process accordingly. I find it rather fascinating in a few ways.</p> <p>Another interesting part of it for me is that thi...
26,327
<p>I have a folder checked out using TortoiseSVN. If I copy a newer version of a file over the existing versioned file, TortoiseSVN correctly identifies that the file is modified. However when I do a "diff with previous version", it reports "no differences".</p> <p>If I use WinMerge I can see that the files ARE diffe...
<p>Diff with previous is a different command than looking what changed in your workingcopy. </p> <p>Previous is defined to be the version before the version you have in your workingcopy:</p> <pre><code> A revision argument can be one of: NUMBER revision number ...
<p>Did the filename change in any way? </p> <p>We had one case where someone copied a newer revision edited outside the working directory to the working directory. TortiseSVN marked the file has changed, but couldn't diff it. Turns out the original working copy was named "configfile.txt" and he renamed his "ConfigFile...
39,240
<p>I've seen this done in Borland's <a href="https://en.wikipedia.org/wiki/Turbo_C++" rel="noreferrer">Turbo C++</a> environment, but I'm not sure how to go about it for a C# application I'm working on. Are there best practices or gotchas to look out for?</p>
<p>Some sample code:</p> <pre><code> public partial class Form1 : Form { public Form1() { InitializeComponent(); this.AllowDrop = true; this.DragEnter += new DragEventHandler(Form1_DragEnter); this.DragDrop += new DragEventHandler(Form1_DragDrop); } void Form1_DragEnter(object sen...
<p>You can implement Drag&amp;Drop in WinForms and WPF. </p> <ul> <li>WinForm (Drag from app window)</li> </ul> <p>You should add mousemove event:</p> <pre><code>private void YourElementControl_MouseMove(object sender, MouseEventArgs e) { ... if (e.Button == MouseButtons.Left) { ...
9,412
<p>I have used a jQuery multiple file upload control [ MultiFile from fyneworks <a href="http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview" rel="nofollow noreferrer">http://www.fyneworks.com/jquery/multiple-file-upload/#tab-Overview</a> ] to collect some filenames but can't work out how to upload them ...
<p>(I have answered this question myself, I just had problems finding the answer via goole or SO and it seems useful ...)</p> <p>This code works for what I need, thanks to Suprotim Agarwal <a href="http://www.dotnetcurry.com/ShowArticle.aspx?ID=68" rel="noreferrer">http://www.dotnetcurry.com/ShowArticle.aspx?ID=68</a>...
<p>HttpFileCollection uploads = HttpContext.Current.Request.Files;</p> <p>for (int i = 0; i &lt; uploads.Count; i++) {</p> <pre><code> HttpPostedFile upload = (HttpPostedFile)uploads[i]; </code></pre>
47,434
<p>I'm trying to call a function after I load some XML into Actionscript, and I'm just wondering how I call that function. Example:</p> <pre><code>//Function Declarations function parentFunction() { function callMe() { textField.text = "lawl"; } } </code></pre> <p>Now, <strong>how do I call the "call...
<p>Are you forced to declare callMe inside of parentFunction? I assume so because otherwise you would just do</p> <p>function parent() { } function callMe() { }</p> <p>To be clear, a function can't own another function unless you provide some scope for that function to live in.</p> <p>So in JavaScript, you would ...
<p>I'm an idiot. I forgot the whole "a function can't own another function" thing, so I figured out another way to do it. Thanks!</p>
6,175
<p>I need to create a repeatable process for deploying SQL Server Reporting Services reports. I am not in favor of using Visual Studio and or Business Development Studio to do this. The rs.exe method of scripting deployments also seems rather clunky. Does anyone have a very elegant way that they have been able to de...
<p>We use rs.exe, once we developed the script we have not needed to touch it anymore, it just works.</p> <p>Here is the source (I slightly modified it by hand to remove sensitive data without a chance to test it, hope I did not brake anything), it deploys reports and associated images from subdirectories for various ...
<p>I know you say that you're not in favor of the Business Development Studio to do this, but I've found the built-in tools to be very reliable and easy to use.</p>
11,436
<p>I mean 100+ MB big; such text files can push the envelope of editors.</p> <p>I need to look through a large XML file, but cannot if the editor is buggy.</p> <p>Any suggestions?</p>
<p>Free read-only viewers:</p> <ul> <li><a href="https://web.archive.org/web/20140908181354fw_/http://swiftgear.com/ltfviewer/features.html" rel="noreferrer"><strong>Large Text File Viewer</strong></a> (Windows) – Fully customizable theming (colors, fonts, word wrap, tab size). Supports horizontal and vertical split vi...
<h1>Tips and tricks</h1> <h2>less</h2> <p>Why are you using <em>editors</em> to just <em>look</em> at a (large) file?</p> <p>Under *nix or <a href="http://en.wikipedia.org/wiki/Cygwin" rel="noreferrer">Cygwin</a>, just use <a href="http://linux.die.net/man/1/less" rel="noreferrer">less</a>. (There is a famous saying – ...
19,295
<p>So, I've been looking at <a href="http://hadoop.apache.org/" rel="noreferrer">Hadoop</a> with keen interest, and to be honest I'm fascinated, things don't get much cooler.</p> <p>My only minor issue is I'm a C# developer and it's in Java.</p> <p>It's not that I don't understand the Java as much as I'm looking for ...
<p>Have you looked at using <a href="http://wiki.apache.org/hadoop/HadoopStreaming" rel="noreferrer">Hadoop's streaming?</a></p> <p>I use it in python all the time :-).</p> <p>I'm starting to see that the heterogeneous approach is often the best and it looks like other folks are doing the same.</p> <p>If you look at...
<p>There's a pretty cute MapReduce implementation for .NET at: <a href="http://mapsharp.codeplex.com/" rel="nofollow noreferrer">http://mapsharp.codeplex.com/</a></p>
44,067
<p>In our environment we have a Lib folder which contains various third party assemblies referenced by our projects. For example, Enterprise Libary and Elmah.</p> <p>Sometimes a dev doesn't do a get latest on that folder. When the dev then loads a project which can't find the assembly in the expected folder, Visual ...
<p>Here's how we guard against that at my company. (Your mileage will vary!)</p> <p>Any non-system (or otherwise non-GAC) references come from our dev server, which every developer has mapped to their W: drive. We have a common DLL directory, with subdirectories by client (or vendor), and further subdirectories as app...
<p>Yes, this is ABSOLUTELY INSANE and is really painful. Here is another option for you: 1. Remove assemblies from GAC, as other posts suggested. 2. Have your dependency resolution system deliver assemblies to your BIN folder. This is where all your solution assemblies would also be compiled to. 3. Set all the refere...
28,467
<p>If I download a .gem file to a folder in my computer, can I install it later using <code>gem install</code>?</p>
<p>Yup, when you do <code>gem install</code>, it will search the current directory first, so if your .gem file is there, it will pick it up. I found it on the <a href="https://guides.rubygems.org/command-reference/#gem-install" rel="noreferrer">gem reference</a>, which you may find handy as well:</p> <blockquote> <p...
<p>Well, it's this my DRY installation:</p> <ol> <li>Look into a computer with already installed gems needed in the cache directory (by default: <code>[Ruby Installation version]/lib/ruby/gems/[Ruby version]/cache</code>)</li> <li>Copy all "<code>*.gems</code> files" to a computer without gems in own gem cache place (...
27,109
<p>Environment is VS2008, .Net 3.5</p> <p>The following C# code (note the specified encoding of UTF8)</p> <pre><code>XmlWriterSettings settings = new XmlWriterSettings (); StringBuilder sb = new StringBuilder(); settings.Encoding = System.Text.Encoding.UTF8; settings.Indent = false; settings.NewLineChars = "\n"; s...
<p>I suspect it's because it's writing to a StringBuilder, which is inherently UTF-16. An alternative to get round this is to create a class derived from StringWriter, but which overrides the Encoding property.</p> <p>I believe I've got one in <a href="http://pobox.com/~skeet/csharp/miscutil" rel="noreferrer">MiscUtil...
<p>A .Net String is encoded in Unicode (UTF-16). I expect this is the source of your encoding problems because you're writing to a StringBuilder.</p>
48,613
<p>I'm doing some really simple math and saving the result to a MS SQL2008 DB.</p> <p>I'm <em>averaging</em> out the some numbers, which are byte values between 1&lt;->5. I wish to record probably 2 decimal places only. I don't care about rounding for the 2nd decimal place (eg. a 1.155 == 1.5 or 1.6 .. i'm not too pha...
<p>What you need is the DECIMAL datatype:</p> <pre><code>declare @val decimal(10,2) select @val = 10.155 select @val </code></pre> <p>When you input values, you can either rely on the built in rounding, or explicitly decide which rounding you want:</p> <pre><code>select val = round(10.155, 2, 0) -- rounded select va...
<p>Decimal - it is the simplest, however any of mentined will do the job</p>
44,203
<p>What is a good strategy for sniffing/tracing function calls between a Flex application and a ColdFusion-based backend running on ColdFusion server? I understand they use AMF protocol.</p> <p>I'm used to using <a href="http://www.fiddlertool.com/fiddler/" rel="noreferrer">Fiddler</a> to sniff transactions between HT...
<p>Wireshark: sniffing the glue that holds the internet together</p> <p><a href="http://www.wireshark.org/" rel="nofollow noreferrer">http://www.wireshark.org/</a></p>
<p>ditto for wireshark (the artist formerly known as Ethereal). you can sniff at every protocol layer, and stitch together traffic streams.</p>
12,102
<p>I'm having problems when printing small parts over big areas.</p> <p>I'm currently printing quite big casing (~180&nbsp;mm x 100&nbsp;mm), which has hexagonal holes on the corners. On the first layer the printer prints, in order:</p> <ul> <li>Supports inside the holes, </li> <li>Borders around the holes</li> <li>B...
<p>it seems like retraction issue</p> <p>i would say you should experiment with </p> <ul> <li>retraction length - so it would retract more</li> <li>extra extrusion after retraction - so the printer could put some material before it will start your next hole :)</li> </ul> <p>unfortunately there is no good guide how m...
<p>Set <code>retraction_min_travel</code> to 0. The default value is 1.5 and skips retraction when moving less than 1.5 mm. This leads to serious oozing whenever your print has small travel, which seems likely between the hole walls and the supports inside the holes.</p> <p>Also, the "custom start gcode" in Cura's End...
1,291
<p>just a quick question:</p> <p>I am a CS undergrad and have only had experience with the Eclipse, and Net Beans IDEs. I have recently acquired a Macbook and was wanting to recompile a recent school project in Xcode just to test it out. Right after the line where I declare a new instance of an ArrayList: </p> <pre...
<p>Java support in Xcode is obsolete and unmaintained; it's the only bit of Xcode that still uses the "old" build system inherited from Project Builder. Even Apple suggests using Eclipse instead. For Java, both Eclipse and NetBeans work quite well on the Mac; if you want to try native Mac programming, use Objective-C...
<p>Generics are introduced in Java 5, so you can't use generics with -source 1.3 option.</p>
13,519
<p>If I want to send mail not via SMTP, but rather via sendmail, is there a library for python that encapsulates this process?</p> <p>Better yet, is there a good library that abstracts the whole 'sendmail -versus- smtp' choice?</p> <p>I'll be running this script on a bunch of unix hosts, only some of which are listen...
<p>Header injection isn't a factor in how you send the mail, it's a factor in how you construct the mail. Check the <a href="https://docs.python.org/2/library/email.html" rel="noreferrer">email</a> package, construct the mail with that, serialise it, and send it to <code>/usr/sbin/sendmail</code> using the <a href="ht...
<p>The easiest answer is the smtplib, you can find docs on it <a href="http://docs.python.org/lib/SMTP-example.html" rel="nofollow noreferrer">here</a>. </p> <p>All you need to do is configure your local sendmail to accept connection from localhost, which it probably already does by default. Sure, you're still using ...
9,948
<p>Are there any libraries, (third party is fine) that can help do network auto-discovery using SNMP and .NET?</p> <p>If not, have you ever rolled your own?</p>
<p>I've recently come across <a href="http://sharpsnmplib.codeplex.com" rel="nofollow noreferrer">Sharp SNMP Suite</a> which I think does what you're asking for. I say "think" as I've not actually used it myself yet! I've just started looking into SNMP for the first time for a forthcoming project.</p>
<p>It's a little old topic but may still be useful for someones. I use to work with <a href="http://www.oidview.com/mibbrowser.html" rel="nofollow">SNMP</a> from Oidview, they have a trial as well.</p>
15,710
<p>How can you suppress the <code>Terminated</code> message that comes up after you kill a process in a bash script?</p> <p>I tried <code>set +bm</code>, but that doesn't work.</p> <p>I know another solution involves calling <code>exec 2&gt; /dev/null</code>, but is that reliable? How do I reset it back so that I can...
<p>In order to silence the message, you must be redirecting <code>stderr</code> <strong>at the time the message is generated</strong>. Because the <a href="http://ss64.com/bash/kill.html" rel="noreferrer"><code>kill</code></a> command sends a signal and doesn't wait for the target process to respond, redirecting <code>...
<p>Simple:</p> <pre class="lang-sh prettyprint-override"><code>{ kill $! } 2&gt;/dev/null </code></pre> <p>Advantage? can use any signal</p> <p>ex:</p> <pre class="lang-sh prettyprint-override"><code>{ kill -9 $PID } 2&gt;/dev/null </code></pre>
10,721
<p>I'm trying to call an Antlr task in my Ant build.xml as follows:</p> <pre><code>&lt;path id="classpath.build"&gt; &lt;fileset dir="${dir.lib.build}" includes="**/*.jar" /&gt; &lt;/path&gt; ... &lt;target name="generate-lexer" depends="init"&gt; &lt;antlr target="${file.antlr.lexer}"&gt; &lt;classpath refi...
<p>The current Antlr-task jar is available at <a href="http://www.antlr.org/share/1169924912745/antlr3-task.zip" rel="nofollow noreferrer">http://www.antlr.org/share/1169924912745/antlr3-task.zip</a></p> <p>It can be found on the <a href="http://antlr.org" rel="nofollow noreferrer">antlr.org</a> website under the "Fil...
<p>On Ubuntu this should make it available:</p> <p><code>sudo apt-get install ant-optional</code></p>
4,512
<p>At work here, we have a box serving XML feeds to business partners. Requests for our feeds are customized by specifying query string parameters and values. Some of these parameters are required, but many are not.</p> <p>For example, we've require all requests to specify a GUID to identify the partner, and a request...
<p>You should leave optional query parameters in the Query string. There is no "rule" in REST that says there cannot be a query string. Actually, it's quite the opposite. The query string should be used to alter the view of the representation you are transferring back to the client. </p> <p>Stick to "Entities with Rep...
<p>Parameters with values? One option is the query string. Using it is not inherently non-restful. Another option is to use the semi-colon, <a href="http://www.w3.org/DesignIssues/MatrixURIs.html" rel="nofollow noreferrer">Tim Berners-Lee talks about them</a> and they might just fit the bill, allowing the URL to mak...
20,348
<p>We have a program that produces several SWF files, some CSS and XML files, all of which need to be deployed for the thing to work.</p> <p>Is there a program or technique out there for wrapping all these files together into a single SWF file?</p>
<p>If you use the Flex compiler (<code>mxmlc</code> or FlexBuilder) you can embed SWF files and create them at runtime, more or less like you would create any display object:</p> <pre><code>package { public class Assets { [Embed(source="another.swf")] public var another : Class; } } </code></pre> <p>...
<p>I think you can just drag them into the library of your main swf and make references to them. At least the other SWFs you can, not sure about the CSS and XML.</p>
9,391
<p>How can I find out which node in a tree list the context menu has been activated? For instance right-clicking a node and selecting an option from the menu. </p> <p>I can't use the TreeViews' <code>SelectedNode</code> property because the node is only been right-clicked and not selected.</p>
<p>You can add a mouse click event to the TreeView, then select the correct node using GetNodeAt given the mouse coordinates provided by the MouseEventArgs.</p> <pre><code>void treeView1MouseUp(object sender, MouseEventArgs e) { if(e.Button == MouseButtons.Right) { // Select the clicked node tr...
<p>If you want the context menu to be dependent on the selected item you're best move I think is to use Jonesinator's code to select the clicked item. Your context menu content can then be dependent on the selected item.</p> <p>Selecting the item first as opposed to just using it for the context menu gives a few advan...
2,465
<p>What's the best cross platform Java Swing browser component at least able to play nicely in a swing interface (lightweight component ?) and able to run on MacOSX and Windows ?</p> <p>Things like : <a href="http://code.google.com/p/flying-saucer//" rel="noreferrer">FlyingSaucer</a>, <a href="https://jdic.dev.java.ne...
<p>i belive this could help:</p> <p><a href="http://djproject.sourceforge.net/ns/index.html" rel="noreferrer">http://djproject.sourceforge.net/ns/index.html</a></p>
<p>Highweight browser based <a href="http://code.google.com/p/jbrowser/" rel="nofollow">http://code.google.com/p/jbrowser/</a>. It use Canvas component.</p>
17,584
<p>I'm developing a WinForms application (.Net 3.5, no WPF) where I want to be able to display foreign key lookups in a databound DataGridView. </p> <p>An example of the sort of relationship is that I have a table of OrderLines. Orderlines have a foreign key relationship to Products and Products in turn have a foreig...
<p>I think the problem you're having is that when you are binding to a grid, it is not enough to support INotifyPropertyChanged, but you have to fire the ListChanged events in your <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.ibindinglist.aspx" rel="nofollow noreferrer">IBindingList</a> implem...
<p>Here's a good "How Do I" video that demonstrates data binding:</p> <p><a href="http://windowsclient.net/learn/video.aspx?v=52579" rel="nofollow noreferrer">http://windowsclient.net/learn/video.aspx?v=52579</a></p>
4,933
<p>My shared host did not provide git, so I built and installed it into ~/bin. When I ran it, I got the following error on most commands, although they were successful. </p> <blockquote> <p><code>stdin: is not a tty</code></p> </blockquote> <p>I can solve that problem by adding: </p> <blockquote> <p><code>defa...
<p>Thanks, Chu - you put me on the right path. </p> <p>just using: <code>set :scm_command, "~/bin/git"</code><br> still gave me errors, since my local git is not in that place.</p> <p>However, the following seems to work, and to solve my issues:<br> <code>set :scm_command, "~/bin/git"<br> set :local_scm_command, "/u...
<p>The ~/.ssh/environment file is not executed by a shell. It's a hardcoded environment file. If you want to set the path this way, you'll need to hardcode it instead of appending to $PATH. The other answers are possibly more correct, but setting ~/.ssh/environment correctly is a reliable fallback if all else fails.</p...
35,357
<p>What's the easiest way to profile a PHP script?</p> <p>I'd love tacking something on that shows me a dump of all function calls and how long they took but I'm also OK with putting something around specific functions.</p> <p>I tried experimenting with the <a href="http://php.net/microtime" rel="noreferrer">microtim...
<p>You want <a href="http://www.xdebug.org/" rel="noreferrer">xdebug</a> I think. Install it on the server, turn it on, pump the output through <a href="http://kcachegrind.sourceforge.net/html/Home.html" rel="noreferrer">kcachegrind</a> (for linux) or <a href="http://sourceforge.net/projects/wincachegrind/" rel="norefe...
<p>XDebug is not stable and it's not always available for particular php version. For example on some servers I still run php-5.1.6, -- it's what comes with RedHat RHEL5 (and btw still receives updates for all important issues), and recent XDebug does not even compile with this php. So I ended up with switching to <a h...
4,142
<p>I'm having a little trouble figuring out exactly how const applies in a specific case. Here's the code I have:</p> <pre><code>struct Widget { Widget():x(0), y(0), z(0){} int x, y, z; }; struct WidgetHolder //Just a simple struct to hold four Widgets. { WidgetHolder(Widget a, Widget b, Widget c, Widget...
<p>This compiles because although the WidgetHolder is a const object, this const-ness does not automatically apply to objects pointed to (referenced by) the WidgetHolder. Think of it at a machine level - if the WidgetHolder object itself were held in read-only memory, you could still write to things that were pointed t...
<p>EDIT: he deleted his answer, making me look a bit foolish :)</p> <p>The answer by Flame is dangerously wrong. His WidgetHolder takes a reference to a value object in the constructor. As soon as the constructor returns, that passed-by-value object will be destroyed and so you'll hold a reference to a destroyed objec...
8,155
<p>Using Java, I need to encode a Map&lt;String, String&gt; of name value pairs to store into a String, and be able to decode it again. These will be stored in a database column, and will probably usually be short and simple, so the common case should produce a simple nice looking line, but shouldn't corrupt the data...
<p>As @Uri says, additional context would be good. I think your primary concerns are less about the particular encoding scheme, as rolling your own for most encodings is pretty easy for a simple <code>Map&lt;String, String&gt;</code>.</p> <p>An interesting question is: what will this intermediate string encoding be us...
<p>Some additional context for the question would help.</p> <p>If you're going to be encoding and decoding at the entire-map granularity, why not just use XML?</p>
48,331
<p>I'm wrapping up a <code>Javascript</code> widget in a <code>Wicket</code> component. I want to let the JS side talk to the component. What I've got so far:</p> <p>Component in question goes like</p> <pre><code>talker = new GridAjaxBehavior(); this.add(talker); </code></pre> <p>in constructor</p> <p>and the...
<p>Spit back some XML for what? Presumably to update the model or the view, yes?</p> <p>The strength of Wicket is that you don't have to worry about the rendered HTML. In Model-View-Controller terms, you set up the Controller to correctly modify the Model, and Wicket takes care of the View.</p> <p>The separation is ...
<p>I don't really know what Wicket is or what it does, but there is a minor bug in your code (as it appears).</p> <p>This:</p> <p><code>"var MyGridTalker = new talker(" + this.talker.getCallbackUrl();</code></p> <p>You seem to be missing your end parens:</p> <p><code>"var MyGridTalker = new talker(" + this.talker.g...
26,836
<p>One of the main hacks for converting RAMPS 1.4 boards to use with 24 V, as stated in <a href="https://reprap.org/wiki/RAMPS_24v" rel="nofollow noreferrer">RAMPS 24V</a>, is replacing the polyfuses, principally <code>F2</code> (MF-R1100), with wire and using an inline (car blade or wire) fuse on the heatbed wire (or ...
<p>Without knowing the exact part numbers used for F1 and F2 it is impossible to say whether the fuses need to be replaced or not. However, based on the manufacturer provided schematic and BOM we can make a pretty good guess.</p> <p>Looking at the PDF you linked, it states that F1 is rated for 16V. Looking at the <a h...
<p>I found that at least the following two RAMPS 1.6 derived boards are 24 V capable without modifications:</p> <ul> <li>Bigtreetech RAMPS 1.6 Plus (see the PCB layout picture in <a href="https://www.roboter-bausatz.de/3080/ramps-1.6-plus-3d-drucker-steuerung" rel="nofollow noreferrer">this offer</a>)</li> <li>King Pri...
1,414
<p>I have this workspace downloaded off the web and I try running it on a tomcat server from a fresh installation of Eclipse Ganymede. This particular project came with its own workspace. </p> <p>When I select Tomcat v6.0 I get a message </p> <blockquote> <p>Cannot create a server using the selected type</p> </bloc...
<p>I had a similar problem, but my solution is a little simpler. The problem was causesd by renaming the original folder that was referenced by the server definition.</p> <p>Go to Window/Preferences/Server/Runtime Environments, remove the broken reference. Then, click 'Add' to create a new reference, select the appr...
<p>What version of Eclipse? Europa? Ganymede?</p> <p>What do you mean by workspace? An Eclipse workspace is not something you deploy, it holds your projects.</p> <p>You will need to generate a WAR file (or the folder of files that would comprise the WAR file), a project would typically include an ANT or Maven build s...
11,953
<p>The application de-serializes a stream into dynamically allocated objects and then keeps base type pointers in a linked list (i.e. abstract factory). It's too slow. Profiling says all the time is spent in <code>operator new</code>.</p> <p>Notes: The application already uses a custom memory allocator that does poo...
<p>The only way is to reduce the number of memory allocations. Have you used a profiler that will tell you exactly what is doing the allocation? Are you possibly doing some string manipulation?<br> If all the time is spent allocating the objects the factory is creating, you may need to go to a pool. </p>
<p>I'll assume that most allocations relate to the list of objects you're talking about. If you're actually allocating a bunch of other objects as part of the parsing that's too slow, then you need more information to optimize.</p> <ul> <li><p>I don't know anything about the RogueWave collections, but if their linked ...
37,616
<p>I have UIWebView within a UIScrollView. Then as I scroll, the web view displays first two pages correctly but does draws only half of the third the page. If I tap on the web view it draws the content or if I call <code>-[UIWebView reload]</code> in <code>-scrollViewDidEndDecelerating</code>, it shows the content. </...
<p>UIWebViews cannot be loaded concurrently. You must load one, wait til it finishes, then load the next, and so on.</p> <p>You can do this on a timer, or wait until when the scrolled UIWebView has the focus before loading the data.</p>
<p>All UIViews have a size limit of 1024x1024 pixels. This is stated at the end of the Overview section of the UIView documentation.</p> <p>If your web view must have more than 1024px of content, you will have to take it out of the parent scroll view and let it manage scrolling on its own.</p>
33,531
<p>Many database systems don't allow comments or descriptions of tables and fields, so how do you go about documenting the purpose of a table/field apart from the obvious of having good naming conventions?</p> <p>(Let's assume for now that "excellent" table and field names are not enough to document the full meaning o...
<p>MySQL <a href="http://dev.mysql.com/doc/refman/5.0/en/create-table.html" rel="noreferrer">allows</a> comments on tables and rows. PostgreSQL <a href="http://www.postgresql.org/docs/7.4/interactive/sql-comment.html" rel="noreferrer">does</a> as well. From other answers, Oracle and MSSQL have comments too.</p> <p>For...
<p>Since we use Rational Software Architect, we use its data discovery features to document our databases and then annotate them from there.</p>
22,549
<p>I am using the dojo.io.iframe.send method to send a file to my server. I want to provide a way that the user can cancel the send once it is in progress, in case it is taking too long or the user realizes she sent the wrong file.</p> <p>I can't figure a way to do this. I could use a timeout to terminate the send if ...
<p>For security reasons JavaScript cannot even access the file you are sending up. All file uploads are done using a form and handled by the browser directly. To my best knowledge there is no direct interface to monitor the progress of upload, nor the way to affect it (e.g., cancel it).</p> <p>Navigating away may help...
<p>What a friend did was simply reloading the webpage when the cancel button was preseed (I think by calling document.location.refresh function). There IS also a way of monitoring the progress o an upload (having a progress bar), but it's server dependent (in the case I saw, it was an apache module, then you would poll...
37,238
<p>C++ is mostly a superset of C, but not always. In particular, while enumeration values in both C and C++ implicitly convert into int, the reverse isn't true: only in C do ints convert back into enumeration values. Thus, bitflags defined via enumeration declarations don't work correctly. Hence, this is OK in C, but n...
<p>Why not just cast the result back to a Foo?</p> <pre><code>Foo x = Foo(Foo_First | Foo_Second); </code></pre> <p>EDIT: I didn't understand the scope of your problem when I first answered this question. The above will work for doing a few spot fixes. For what you want to do, you will need to define a | operator tha...
<p>Either leave the result as an int or static_cast:</p> <pre><code>Foo x = static_cast&lt;Foo&gt;(Foo_First | Foo_Second); // not an error in C++ </code></pre>
24,332
<p>I once knew a website where the user could generate the little W3C valid CSS tags which looked much nicer than the too large W3C official ones. It was also possible to fill the icons with whatever content and color for other stuff.</p> <p>I've lost the bookmark and wasn't able to google it, can you post it and mayb...
<p>You probably mean <a href="http://antipixel.com/blog/archives/2002/10/22/steal_these_buttons.html" rel="noreferrer">antipixel's icons</a> and <a href="http://www.lucazappa.com/brilliantMaker/buttonImage.php" rel="noreferrer">LucaZappa's Brilliant Button Maker</a>.</p> <p><a href="http://img353.imageshack.us/img353/...
<p>Be careful though, W3C is strict about their logo usage (as is any company):<br> <a href="http://www.w3.org/Consortium/Legal/logo-usage-20000308" rel="nofollow noreferrer">W3C Logo and Icon Usage</a></p>
47,286
<p>If your data change after the application is deployed, how do you keep the database up to date? </p> <p>I mean, you can add or remove table, thats a simple task. Altering an existing table can be trivial too. But if you change the structure often, how do you keep that under a control?</p> <p>I used to keep a table...
<p>Personally I use a very similar process to what you have listed, I can see your argument about changing, but VERY rarely do I make a change, then change it back to the old way on a production site. In testing, yes, that happens, but in terms of an actual production site, I don't see it as a big deal.</p> <p>Keepin...
<p>Use a tool like RedGate's SQLCompare or xSQL Object from xSQL Software to generate your diff/delta T-SQL scripts on the fly.</p> <p>You can even integrate it as part of your build process if you like.</p> <p>For different customers with different databases, you simply have different reference databases for them th...
29,811
<p>I would like to distribute my .NET programs without the .NET framework. Is it possible to compile a .NET program to machine code?</p>
<p>Yes, you can precompile using Ngen.exe, however this does not remove the CLR dependence.</p> <p>You must still ship the IL assemblies as well, the only benefit of Ngen is that your application can start without invoking the JIT, so you get a real fast startup time. </p> <p>According to CLR Via C#:</p> <blockquote...
<p>I'd always thought it would be cool to compile c# to machine code directly without the CLR dependency though....</p>
17,011
<p>Since I'm not a huge fan of any of the current solutions for managing the resources and knowledge that I have, I was thinking about making my own solution, which will involve custom code as well as possible integration of FOSS solutions. I would start development on my local machine, but if I like it, how difficult ...
<p>In theory, nothing, beyond just the process of moving stuff to the new machine. You can set up your own servers, on your own ports (port 80 for example).</p> <p>You can even create your own fake domain at home, with just a tweak to the /etc/hosts files (or the equivalent on Windows).</p> <p>Now, if you're developi...
<p>You didn't hard code any paths to "localhost" did you? If so, that should be the first thing to strip out. Either use relative paths, or have a configurable <strong>{AppPath}</strong> variable of some kind that you only need ever change once.</p> <p>By the way, what language/framework are you using? it would help...
19,213
<p>The system default polygon fill mode in current device context is <code>ALTERNATE</code> (as I've learned from the Petzold book on Windows programming) and this one is used in <a href="http://msdn.microsoft.com/en-us/library/ms533274(VS.85).aspx" rel="nofollow noreferrer"><code>Polygon</code></a> Win32 function unle...
<p>I don't know the answer off the top of my head, but you could try finding out by retrieving the fill mode before and after the call. If it's not different, it's either not been changed, or was changed then changed back.</p>
<p>I looked at the reference source and FillPolygon without a fill mode simply calls FillPolygon with a fill mode of alternate.</p> <p>FillPolygone with a fill mode calls a method named GdipFillPolygonI, but I can't find anything about that method.</p>
7,454
<p>We are working with Tomcat + Axis2 + POJO for web service implementation, and we encountered some issues with POJO and Axis2 that are a showstopper for us. It seems that Axis2 and POJO implementation of SOAP parsing ignores the names of the XML elements and just assign values to the arguments according to the order ...
<p>Straight from Axis2 Web site, <a href="http://ws.apache.org/axis2/1_4_1/jaxws-guide.html" rel="nofollow noreferrer">this</a> is a tutorial covering Axis2 and Jax-Ws. You get the above error probably because the axis2-jaxws-1.3.jar is missing. Check your classpath.</p> <p>You can of course use CXF with Tomcat and my...
<p>As well as CXF, another good option would be <a href="http://tuscany.apache.org" rel="nofollow noreferrer">Apache Tuscany</a> - makes turning POJOs into services extremely easy.</p>
44,134
<p>I just got hold of a PDA (Samsung Omnia i900) with an embedded motion sensor (accelerometer) and would like to code something that would exploit this feature. Any pointers?</p>
<p>You might want to take a look at the Samsung Accelerometer API for Windows Mobile devices <a href="http://innovator.samsungmobile.com/cms/cnts/knowledge.detail.view.do?platformId=2&amp;cntsId=4600" rel="nofollow noreferrer">http://innovator.samsungmobile.com/cms/cnts/knowledge.detail.view.do?platformId=2&amp;cntsId=...
<p>Just a suggestion. Maybe you could design a game where you have small balls that can be brought to the centre of a maze by tilting the PDA at different angles.</p>
31,536
<p>We are designing a new database and I would like some input in where to put stuff like default values. There are 3 scenarios: </p> <p>1: New values, created_date field. Should the column have a default value when you do an insert? </p> <p>2: Updated values, updated_date fiels. I've been thinkin about implementing ...
<p>My best practices:</p> <ul> <li><p>For created/last updated dates, it depends on if you are going to use them as part of your business logic -- if they are for auditing only, use a timestamp on the database. If there is any chance you may want to expose them as business properties, they should be assigned in code....
<p>Constraints must go in the database at a minimum. If you have to replicate them in code (or infer them from the database) to provide a better user experience, so be it.</p> <p>The database must be consistent. I have wasted so much time tracking down issues that are the result of "invalid data". </p> <p>These are s...
46,546
<p>A plastic gear of an older DVD player broke. I always read about being 3D printing a "repair revolution". So I looked for a template to give to some printing service, but I found none (and nothing close to it).</p> <p>Could you please explain me, what steps a layman should take to get the gear piece replaced using ...
<p>If you have the remaining pieces of the gear and enough remains to determine certain measurements, one can either engineer the gear using a number of gear modeling designs, or one can take measurements directly from the parts and engineer a raw design.</p> <p>If the gear you have is not particularly peculiar, it is...
<p>The only 'layman's' option is to find an existing design which solves your problem. If you are lucky, and the product you have has a common failure mode, someone else might have a) solved the same problem already, and b) posted their design online.</p> <p>Sites such as <a href="http://www.thingiverse.com/search?q=d...
529
<p>I have this:</p> <pre><code>template &lt;typename T&gt; class myList { ... class myIterator { ... T&amp; operator*(); } } ... template&lt;typename T&gt; T&amp; myList&lt;T&gt;::myIterator::operator*() { ... } </code></pre> <p>That is giving me the following error: "expected init...
<p>How about some semicolons and publics:</p> <pre><code>template &lt;typename T&gt; class myList { public: class myIterator { public: T&amp; operator*(); }; }; </code></pre>
<p>Compiles Fine:<br> If you want to post code it should be as simple as passable, BUT it should still be compilable. If you cut stuff out will nilly then you will probably remove the real error that you want fixed and the people here are real good at finding problems if you show people the code.</p> <p>In this situat...
47,513
<p>I use a byte to store some flag like <code>10101010</code>, and I would like to know how to verify that a specific bit is at <code>1</code> or <code>0</code>.</p>
<p>Here's a function that can be used to test any <code>bit</code>:</p> <pre><code>bool is_bit_set(unsigned value, unsigned bitindex) { return (value &amp; (1 &lt;&lt; bitindex)) != 0; } </code></pre> <p><strong>Explanation</strong>:</p> <p>The <a href="https://learn.sparkfun.com/tutorials/binary#bitwise-operators"...
<p>Use a bitwise (not logical!) AND to compare the value against a bitmask.</p> <pre><code>if (var &amp; 0x08) { /* The fourth bit is set */ } </code></pre>
15,457
<p>We have an existing add-in that we publish to users via click once. We would now like to use this as a vehicle to publish some of our existing C# methods directly into Excel so that the users can call them as a UDF.</p> <p>For example - I have an assembly called MyAssembly, that has a class called MyClass with a pu...
<p>I solved this quite comprehensively by using ExcelDna, an open source XLL implementation which is very simple to use, and pretty much avoids the whole COM debacle all together. So far it has matched our requirements perfectly...</p> <p><a href="http://groups.google.com/group/exceldna" rel="nofollow noreferrer">http...
<p>you have not been very verbose about what you want to do. What do you mean with "users can call them"? </p> <p>If you mean that add-in methods should be exposed to VBA you can find two articles on that here:</p> <ul> <li><a href="http://blogs.msdn.com/andreww/archive/2008/08/13/comaddins-race-condition.aspx" rel="...
47,353
<p>I have a Java SOAP data service which sits on top of a Sybase database which, for reasons out of my control, has unreliable performance. The database is part of a vendor package which has been modified by an internal team and most of the issues are caused by slow response times at certain times of the day. </p> <p>...
<p>I have seen this issue a few times, normally with a vendor database. </p> <p>If this is on Windows, you could create a Windows service as an intermediary between the SOAP service and the database. Then put a message queue (either MSMQ or a JMS implementation such as MQ Series) between the SOAP service and Windows s...
<p>How about caching the responses from the web service (either on the client invoking the WS request, or by setting up a proxy web service in between)?</p>
37,366
<p>i have a few classes that i am trying to move to using generics</p> <p>Class1: Curve</p> <p>this class has the following code:</p> <pre><code>public class Curve : IEnumerable IEnumerator IEnumerable.GetEnumerator() { return GetEnumerator(); // Calls non-interface method } public RTRatePointE...
<p>You didn't specify the type being returned from the enumerator. but I'm going to guess based on the names it's RTRatePoint and CurvePoint. I would change the code to be the following </p> <pre><code>class Curve: IEnumerable&lt;RTRatePoint&gt; { IEnumerator&lt;RTRatePoint&gt; IEnumerable&lt;RTRatePoint&gt;.GetEn...
<p><code>IEnumerable&lt;T&gt; and IEnumerator&lt;T&gt;</code></p> <p>gah, it swallowed my code</p>
42,733
<p>I've been asked to create a fairly straightforward website for a friend. Essentially a user will log in, fill in a set of information, and submit it. This data will then need to written to a database (and read from/presented at a future point).</p> <p>I'm not really a web developer (I do mostly Java/C++), but about...
<p>Assuming that the website you're going to be building is hosted on a WAMP stack, then I'd say continue to use that; otherwise, you may wanna stick with Windows/IIS/PHP/MySQL or SQL Server. I always try to make sure my development environment mirrors production as much as possible.</p> <p>Secondly, if the user is si...
<p>Using this as an opportunity to try out Ruby on Rails isn't bad. From you wording I assume that you have complete control on the environment. As an experience developer, it shouldn't be that difficult. The convention over configuration approach also simplifies the development.</p> <p>I am afraid that I am not helpi...
30,203
<p>As compared to say:</p> <pre><code>REPLICATE(@padchar, @len - LEN(@str)) + @str </code></pre>
<p>This is simply an inefficient use of SQL, no matter how you do it. </p> <p>perhaps something like </p> <pre><code>right('XXXXXXXXXXXX'+ rtrim(@str), @n) </code></pre> <p>where X is your padding character and @n is the number of characters in the resulting string (assuming you need the padding because you are deal...
<p>Here is how I would normally pad a varchar</p> <pre><code>WHILE Len(@String) &lt; 8 BEGIN SELECT @String = '0' + @String END </code></pre>
14,822
<p>How should I manage tables that refer to site 'events'. i.e. certain activities a user has done on a website that I use for tracking. I want to be able to do all kinds of datamining and correlation between different activities of users and what they have done.</p> <p>Today alone I added 107,000 rows to my SiteEvent...
<p>You said two things that are in conflict with each other.</p> <ol> <li>I want to be able to do all kinds of datamining and correlation between different activities of users and what they have done.</li> <li>I want to ensure my db file doesnt keep growing.</li> </ol> <p>I am also a big fan of data mining, but you n...
<p>Re-thinking the problem might be just what the doctor ordered. Can 100k records per day really be that useful? Seems like information overload to me. Maybe start by reducing the granularity of your usage tracking?</p>
28,314
<p>The title is kind of obscure. What I want to know is if this is possible:</p> <pre><code>string typeName = &lt;read type name from somwhere&gt;; Type myType = Type.GetType(typeName); MyGenericClass&lt;myType&gt; myGenericClass = new MyGenericClass&lt;myType&gt;(); </code></pre> <p>Obviously, MyGenericClass is des...
<p>You can't do this without reflection. However, you <em>can</em> do it with reflection. Here's a complete example:</p> <pre><code>using System; using System.Reflection; public class Generic&lt;T&gt; { public Generic() { Console.WriteLine("T={0}", typeof(T)); } } class Test { static void Mai...
<p>If you know what types will be passed you can do this without reflection. A switch statement would work. Obviously, this would only work in a limited number of cases, but it'll be much faster than reflection.</p> <pre><code>public class Type1 { } public class Type2 { } public class Generic&lt;T&gt; { } public cl...
33,366
<p>I have an animation that I'm displaying using a UIImageView:</p> <pre><code>imageView.animationImages = myImages; imageView.animationDuration = 3; [imageView startAnimating]; </code></pre> <p>I know I can stop it using stopAnimating, but what I want is to be able to pause it. The reason is that when you call stop,...
<p>Hmmm...since no one seems to know I guess it's not possible. </p> <p>I went ahead and wrote my own <code>UIView</code>, with a <code>UIImageView</code> <code>subview</code>, that uses an <code>NSTimer</code> to switch between images. The advantage of this is that I can pause and resume the timer at my leisure, and ...
<p>Maybe you can take a screenshot of the last animated image and display that?</p>
31,568
<p>How do you get all the classes in a namespace through reflection in C#?</p>
<p>Following code prints names of classes in specified <code>namespace</code> defined in current assembly.<br> As other guys pointed out, a namespace can be scattered between different modules, so you need to get a list of assemblies first.</p> <pre><code>string nspace = "..."; var q = from t in Assembly.GetExecuting...
<p>Quite simple</p> <pre><code>Type[] types = Assembly.Load(new AssemblyName("mynamespace.folder")).GetTypes(); foreach (var item in types) { } </code></pre>
10,510
<p>I have a RichTextBox where I need to update the Text property frequently, but when I do so the RichTextBox "blinks" annoyingly as it refreshes all throughout a method call.</p> <p>I was hoping to find an easy way to temporarily suppress the screen refresh until my method is done, but the only thing I've found on th...
<p>I asked the original question, and the answer that worked best for me was BoltBait's use of SendMessage() with WM_SETREDRAW. It seems to have fewer side effects than the use of the WndProc method, and in my application performs twice as fast as LockWindowUpdate. </p> <p>Within my extended RichTextBox class, I just ...
<p>Try this out:</p> <pre><code>myRichTextBox.SuspendLayout(); DoStuff(); myRichTextBox.ResumeLayout(); </code></pre>
23,383
<p>I've created an assembly and referenced it in my Reporting Services report. I've tested the report locally (works), and I then uploaded the report to a report server (doesn't work).</p> <p>Here is the error that is thrown by the custom code I've written.</p> <blockquote> <p>System.Security.SecurityException: R...
<p>This is how I was able to solve the issue:</p> <ul> <li>strongly sign the custom assembly in question</li> <li><p>modify the rssrvpolicy.config file to add permissions for the assembly</p> <pre><code> &lt;CodeGroup class="UnionCodeGroup" version="1...
<p>Run your service in administrator mode</p>
5,236
<p>How do I query an Oracle database to display the names of all tables in it?</p>
<pre><code>SELECT owner, table_name FROM dba_tables </code></pre> <p>This is assuming that you have access to the <code>DBA_TABLES</code> data dictionary view. If you do not have those privileges but need them, you can request that the DBA explicitly grants you privileges on that table, or, that the DBA grants you ...
<pre><code>select * from all_all_tables </code></pre> <p>this additional 'all' at the beginning gives extra 3 columns which are:</p> <pre><code>OBJECT_ID_TYPE TABLE_TYPE_OWNER TABLE_TYPE </code></pre>
25,209
<p>I do the following in command line:</p> <p>1) wget <a href="ftp://mirrors.kernel.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2" rel="nofollow noreferrer">ftp://mirrors.kernel.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2</a></p> <p>2) tar -jxf gcc-3.4.6.tar.bz2</p> <p>3) cd gcc-3.4.6</p> <p>4) cd libstdc++-v3</p> <p>5) ./c...
<ol> <li>wget <a href="ftp://mirrors.kernel.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2" rel="nofollow noreferrer">ftp://mirrors.kernel.org/gnu/gcc/gcc-3.4.6/gcc-3.4.6.tar.bz2</a></li> <li>tar -jxf gcc-3.4.6.tar.bz2</li> <li>cd gcc-3.4.6</li> <li>./configure</li> <li>make</li> <li>make install</li> </ol>
<p>Why are you cd:ing down into libstdc++-v3? I thought the correct way was to just run "make" from the directory you ran configure from.</p>
26,567
<p>I have 2 objects, both from different Model classes, and want to show a form containing some fields from each one. How can I do this?</p>
<p>The way I do it is by creating two <code>ModelForm</code> classes that use the <code>fields</code> Meta attribute to specify which <a href="http://docs.djangoproject.com/en/dev/topics/forms/modelforms/?from=olddocs#using-a-subset-of-fields-on-the-form" rel="noreferrer">subset of fields</a> to use to display in the f...
<p>I've never tried this but you could have two ModelForm classes defined in your code and then make a new plain <code>Form</code> class that in its <code>__init__</code> created a copy of each <code>ModelForm</code> and copied the fields into itself.</p> <p>Something like:</p> <pre><code>class DualForm(forms.Form): ...
47,576
<p>I'm using the <code>mechanize</code> module to execute some web queries from Python. I want my program to be error-resilient and handle all kinds of errors (wrong URLs, 403/404 responsese) gracefully. However, I can't find in mechanize's documentation the errors / exceptions it throws for various errors.</p> <p>I j...
<pre><code>$ perl -0777 -ne'print qq($1) if /__all__ = \[(.*?)\]/s' __init__.py | grep Error 'BrowserStateError', 'ContentTooShortError', 'FormNotFoundError', 'GopherError', 'HTTPDefaultErrorHandler', 'HTTPError', 'HTTPErrorProcessor', 'LinkNotFoundError', 'LoadError', 'ParseError', 'RobotExclusionError', 'URLError',...
<p>I found this in their docs:</p> <blockquote> <p>One final thing to note is that there are some catch-all bare except: statements in the module, which are there to handle unexpected bad input without crashing your program. If this happens, it's a bug in mechanize, so please mail me the warning text.</p...
18,314
<p>I am interested in making a Google Talk client using Python and would like to use the Twisted libraries Words module. I have looked at the examples, but they don't work with the current implementation of Google Talk.</p> <p>Has anybody had any luck with this? Would you mind documenting a brief tutorial?</p> <p>A...
<p>wokkel is the future of twisted words. <a href="http://metajack.im/" rel="noreferrer">metajack</a> wrote a really nice <a href="http://metajack.im/2008/09/25/an-xmpp-echo-bot-with-twisted-and-wokkel/" rel="noreferrer">blog post</a> on getting started.</p> <p>If you want a nice, functional sample project to start w...
<p>As the Twisted libs seem to be out of date, you have two choices: Implement your own XMPP-handler or look for another library.</p> <p>I would suggest working with the raw XML; XMPP is not that complicated and you are bound to learn something.</p>
28,121
<p>Do the clients need something else than a proper jdk and javafx compliant browser to visit javafx applets?</p>
<p>This will give you a list of all MAC addresses on your computer. It will work with all versions of Windows as well:</p> <pre><code>void getdMacAddresses(std::vector&lt;std::string&gt; &amp;vMacAddresses;) { vMacAddresses.clear(); IP_ADAPTER_INFO AdapterInfo[32]; // Allocate information for up to 32 N...
<p>You can use WMI on both XP and Vista, there are a number of examples online. e.g: <a href="http://www.thescarms.com/dotnet/WMI.aspx" rel="nofollow noreferrer">Use Windows Management Instrumentation (WMI) to get a MAC Address</a></p>
27,359
<p>I wrote a program in C with Ubuntu Linux and now I need to port it over to a UNIX machine (or what I believe to be a UNIX box). It compiles fine on my Ubuntu with GCC but when I try to compile it with GCC on the UNIX box, it gives this error:</p> <pre><code>a.c: In function `goUpDir': a.c:44: parse error before `c...
<p>If you are compiling pure C, variables must be declared on the beggining of the functions. I mention this because most people compile their C programs using C++ compilers, which offers then some resources not normally available to pure C compilers, the most common example being the // comment lines.</p>
<p>What UNIX is it? AIX, Ultrix, Minix, Xenix? </p> <p>GCC has a "--version" flag:</p> <pre><code>gcc --version </code></pre>
18,737
<p>This is the HTML:</p> <pre><code>&lt;div id="testBlue"&gt; &lt;span&gt;hello&lt;/span&gt; &lt;span id="testGreen" class="testGreen"&gt;hello2&lt;/span&gt; &lt;/div&gt; </code></pre> <p>If I have set in CSS:</p> <pre><code>#testBlue span { color:Blue; } .testGreen, #testGreen { color:Green; } </code></...
<p>In CSS, selectors with higher specificity override selectors that are more general.</p> <p>In your example you defined a style for a <strong>span inside a div with id = "testBlue"</strong>. This selector is <strong>more specific</strong> than the simple selector for the class or id <strong>testGreen</strong>, so it...
<p>You could use selector </p> <pre><code>#testBlue * { color:Blue; } </code></pre>
38,208
<p>What happened to OCX's? Are they no longer possible to create with the latest tools?</p> <p>I need to create an ActiveX control that I can place in Word, PowerPoint and Excel documents. If I use VS.NET, I can only create a UserControl DLL with COM Interop, but I don't think I can add that using the "More Controls" ...
<p>Yes, you can still create them. But you can't create an OCX with a .NET language. Need to be unmanaged C++ (or VB). The DLLs with COM interop you can create in C# or VB.NET are just .NET objects that are invoked via CCW.</p>
<p>Use a C++ or VB compiler which can target native code + ActiveX.</p>
47,490
<p>I want to convert a number that is in <a href="https://en.wikipedia.org/wiki/Netscape_Portable_Runtime#Time" rel="nofollow noreferrer">PRTime</a> format (a 64-bit integer representing the number of microseconds since midnight (00:00:00) 1 January 1970 Coordinated Universal Time (UTC)) to a <code>DateTime</code>.</p>...
<pre><code>Dim prTimeInMillis As UInt64 prTimeInMillis = prTime/1000 Dim prDateTime As New DateTime(1970, 1, 1) prDateTime = prDateTime.AddMilliseconds(prTimeInMillis) </code></pre>
<p>DateTime has a constructor that takes Ticks (which are 100 nanoseconds).</p> <p>So take your prTime, multiply it by 10 and add it to the number of ticks representing the Epoch time and you have your conversion.</p> <pre><code>private static DateTime epoch = new DateTime(1970, 1, 1); private static DateTime ConvertP...
8,060
<p>List Comprehension is a very useful code mechanism that is found in several languages, such as Haskell, Python, and Ruby (just to name a few off the top of my head). I'm familiar with the construct.</p> <p>I find myself working on an Open Office Spreadsheet and I need to do something fairly common: I want to count ...
<p>CountIf can count values equal to one chosen. Unfortunately it seems that there is no good candidate for such function. Alternatively you can use additional column with If to display 1 or 0 if the value fits in range or not accordingly:</p> <pre><code>=If(AND({list_cell}&gt;=MinVal; {list_cell}&lt;=MaxVal); 1; 0) <...
<p>Assuming:</p> <ul> <li>your range is A1:A10</li> <li>your lower bound is at B1</li> <li>your upper bound is at B2</li> </ul> <p>then what you want can be achieved by:</p> <pre><code>=COUNTIFS(A1:A10, &quot;&gt;&quot; &amp; B1, A1:A10, &quot;&lt;&quot; &amp; B2) </code></pre> <p>(you might need to change commas into ...
21,917
<p>What's the best way to allow a user to browse for a file in C#?</p>
<pre><code>using (OpenFileDialog dlg = new OpenFileDialog()) { dlg.Title = "Select a file"; if (dlg.ShowDialog()== DialogResult.OK) { //do something with dlg.FileName } } </code></pre>
<p>I would say use the standard "Open File" dialog box (<a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.openfiledialog.aspx" rel="nofollow noreferrer">OpenFileDialog</a>), this makes it less intimidating for new users and helps with a consistant UI.</p>
5,088
<p>I'm in javascript, running this in the console </p> <pre><code>d = new Date(); d.setMonth(1); d.setFullYear(2009); d.setDate(15); d.toString(); </code></pre> <p>outputs this:</p> <pre><code>"Sun Mar 15 2009 18:05:46 GMT-0400 (EDT)" </code></pre> <p>Why would this be...
<p>That's because when you initialize a new Date, it comes with today's date, so today is Oct 30 2008, then you set the month to February, so there is no February 30, so set first the day, then the month, and then the year:</p> <pre><code>d = new Date(); d.setDate(15); d.setMonth(1); d.setFullYear(...
<p>After a bunch of testing in FF3 on XP with Firebug, here are the things I can tell you</p> <ul> <li>Calling Date.setDate() <em>after</em> calling Date.setMonth() will generate this odd behavior.</li> <li>Date.setMonth() forces the timezone to be CST (or, some non DST-aware zone)</li> <li>Date.setDate() forces the t...
31,390
<p>I'm trying to print large objects (around 1 meter squared) with polycarbonate pellets. The problem is sometimes the print cracks. It is not due to delamination as it is a shear crack across multiple layers. I know the ideal scenario is to have a heated enclosure but I cannot do that due to the size. Any suggestions?...
<p>Printing polycarbonate requires a high end 3D printer that is suitable for the task.</p> <p>From <a href="https://www.simplify3d.com/support/materials-guide/polycarbonate/" rel="nofollow noreferrer">Simplify3d support</a> we learn that:</p> <blockquote> <p>... requires very high temperatures for printing and will <s...
<p>Sounds like your problem is cooling, which would be mitigated by an enclosure to eliminate draughts and hold a higher air temperature.</p> <p>I made an enclosure using parts-on-hand and some printed PLA joiners. It doesn't have to be fancy or expensive to work well.</p> <p>Details are at <a href="https://3dprinting...
2,057
<p>I have a C# application that's utilizes MYSQL. I'm at a beta release point and need an installation package that includes my application, along with MYSQL. So basically, I need to install MYSQL and perform a restore from within my .NET install package.</p> <p>Any help would be greatly appreciated.</p>
<p>This question is very similar to <a href="https://stackoverflow.com/questions/49378/deploy-mysql-server-db-with-net-application">another question</a>. However, the answers don't really help.</p> <p>You can <a href="http://www.simple-talk.com/dotnet/visual-studio/visual-studio-setup---projects-and-custom-actions/" ...
<p>Have a look at using Visual Studio's package and deployment tool. It should automatically bring in the MySQL dependencies if you connect natively (MySQL .NET components) rather than an ODBC connection. In any case it allows you to add other software to an installation program that can be automatically unpacked if yo...
49,338
<p>Ok where I work we have a fairly substantial number of systems written over the last couple of decades that we maintain. </p> <p>The systems are diverse in that multiple operating systems (Linux, Solaris, Windows), Multiple Databases (Several Versions of oracle, sybase and mysql), and even multiple languages (C, C+...
<p>Integrating disparate systems is my day job.</p> <p>If I were you, I would go to great effort to avoid accessing System A's data from directly within System B. <strong>Updating</strong> System A's database from System B is extremely unwise. It is exactly the opposite of good practice to make your business logic s...
<p>It seems you are looking for opinions, so I will provide mine.</p> <p>I agree with the other developers that writing an API for all the different systems is excessive. You would likely get it done faster and have much more control over it if you just take the other suggestion of creating a single database.</p>
16,203
<p>I have a .bat and inside the .bat i would like to execute a special code if there's some modification inside the svn repository (for example, compile).</p>
<p>For Win 2000 and later, this would assign the last output row from the svn status commmand to the svnOut variable and then test if the variable contains anything:</p> <pre><code>@echo off set svnOut= set svnDir=C:Your\path\to\svn\dir\to\check for /F "tokens=*" %%I in ('svn status %svnDir%') do set svnOut=%%I if "%...
<p>This version is based on @tooony's but checks the server for updates instead of the client.</p> <pre><code>@echo off set svnOut= rem Check svn server status of current working directory repository and see if first or second token is an * for /F "tokens=1" %%I in ('svn status --show-updates') do if "%%I"=="*" set s...
20,109
<p>I have a this aspx-code: (sample)</p> <pre><code>&lt;asp:DropDownList runat="server" ID="ddList1"&gt;&lt;/asp:DropDownList&gt; </code></pre> <p>With this codebehind:</p> <pre><code>List&lt;System.Web.UI.WebControls.ListItem&gt; colors = new List&lt;System.Web.UI.WebControls.ListItem&gt;(); colors.Add(new ListI...
<p>Because DataBind method binds values only if DataValueField property is set. If you set DataValueField property to "Value" before calling DataBind, your values will appear on the markup.</p> <p>UPDATE: You will also need to set DataTextField property to "Text". It is because data binding and adding items manually d...
<p>"If you are building ListItems, you have no need to use DataBind() in the first place."</p> <p>Adding directly to the dropdownlist is the easy way (and given the example code the right one) but lets say you have an unordered datasource and you want the list items sorted.</p> <p>One way of achieving this would be t...
16,081
<p>How to create a WCF application without using the svcutil.exe tool?</p>
<p>What version of Visual Studio are you using?</p> <p>VS2008 incorporates the functionality of the svcutil tool. To generate the proxy, click on the Solution Explorer and select 'Add Service Reference', you can then enter the URL of the server, give the namespace a name and off you go.</p> <p>You may want to expand...
<p>The svcutil.exe tool (and the equivalent functionality in VS2008) are normally used like this: -</p> <p>You point it at a service description (a WSDL document) and it generates client-side code and config to help you make a client that can communicate with the services described in the WSDL. The tools can do other...
38,706
<p>Is anyone successfully using the latest 64-bit Ganymede release of Eclipse on Windows XP or Vista 64-bit?</p> <p>Currently I run the normal Eclipse 3.4 distribution on a 32bit JDK and launch &amp; compile my apps with a 64bit JDK. Our previous experience has been that the 64bit Eclipse distro is unstable for us, so...
<p>I'm using Eclipse with a 64bit VM. However I have to use Java 1.5, because with Java 1.6, even 1.6.0_10ea, Eclipse crashed when changing the .classpath-file. On Linux I had the same problems and could only get the 64bit Eclipse to work with 64bit Java 1.5.</p> <p>The problem seems to be with the just in time compil...
<p>I've been successfully using it on Vista x64 for some light Java work. Nothing too involved and no extra plugins, but basic Java coding has been working without any issues. I'm using the 3.4M7 build but it looks like the <a href="http://download.eclipse.org/eclipse/downloads/drops/R-3.4-200806172000/index.php" rel...
2,804
<p>I need to be able to GZip compress a file in an Excel VBA function. Specifically I need to be able to use the 'deflate' algorithm.</p> <p>Is there a way to do this without having to exec a command line application? With no dependency on external tools the code will be more robust.</p> <p>Ideally the code would mak...
<p>VBA (which is really a dialect of VB6) is slow for these kind of applications. I remember I once implemented Shannon-Fano algorithm on VB6 and on C, the C version was about 10 times faster, even after being turned into a DLLMain and called from there rather than on a command-line executable.</p> <p>There are lots of...
<p>If you want to implement the algorithm in VBA, you would need to (in VBA) save the spreadsheet and then use VB's I/O functions to open the file, deflate it, and save it again. For all intents and purposes it's identical to writing an ordinary VB application that works on a file. You might need to put the VBA macro i...
20,278
<p>Say I have an ASMX web service, MyService. The service has a method, MyMethod. I could execute MyMethod on the server side as follows:</p> <pre><code>MyService service = new MyService(); service.MyMethod(); </code></pre> <p>I need to do similar, with service and method not known until runtime. </p> <p>I'm assu...
<p>I'm not sure if this would be the best way to go about it. The most obvious way to me, would be to make an HTTP Request, and call the webservice using an actual HTTP GET or POST. Using your method, I'm not entirely sure how you'd set up the data you are sending to the web service. I've added some sample code in VB....
<p>@Kibbee: I need to avoid the HTTP performance hit. It won't be a remote call, so all of that added overhead <em>should</em> be unnecessary.</p> <p>@Daren: I definitely agree with that design philosophy. The issue here is that I'm not going to be in control of the service or its underlying business logic.</p> <...
8,775
<p>On top of my head, especially for C/Linux developer:</p> <ul> <li><a href="http://petdance.com/ack/" rel="nofollow noreferrer">ack</a></li> <li><a href="http://git.fishsoup.net/cgit/git-bz/plain/git-bz" rel="nofollow noreferrer">git-bz</a></li> <li><a href="http://schlueters.de/colorgcc.html" rel="nofollow noreferr...
<p>I don't use it that often, but the <strong>tool with the highest ratio of awesomeness to being little known</strong> has to be <a href="http://www.graphviz.org/pdf/dotguide.pdf" rel="nofollow noreferrer">dot</a>, which is the tool for drawing directed graphs that is part of the <a href="http://www.graphviz.org" rel=...
<pre><code>- ANT - Mylyn - TortoiseSVN - firebug (think console too!) - TextMate </code></pre>
49,323
<p>I want to convert an XML document containing many elements within a node (around 150) into another XML document with a slightly different schema but mostly with the same element names. Now do I have to manually map each element/node between the 2 documents. For that I will have to hardcode 150 lines of mapping and e...
<p>Use an <a href="http://www.w3schools.com/xsl/xsl_transformation.asp" rel="noreferrer">XSLT transform</a> instead. You can use the built-in .NET <a href="http://msdn.microsoft.com/en-us/library/system.xml.xsl.xslcompiledtransform.aspx" rel="noreferrer">XslCompiledTransform</a> to do the transformation. Saves you from...
<p>Use an XSLT transformation to translate your old xml document into the new format. </p>
29,632
<p>Using C#, when a user types a text in a normal textbox, how can you see the Hebrew equivalent of that text?</p> <p>I want to use this feature on a data entry form, when the secretary puts in the customer name using English characters to have it converted automatically in another textbox to the hebrew representation...
<p>I didn't even know there was such a thing as <a href="http://en.wikipedia.org/wiki/Hebraization_of_English" rel="nofollow noreferrer">Hebraization</a> &mdash; thanks for asking this question :-)</p> <p>This functionality is not provided by the .NET Framework, so I'm afraid you'd have to build it yourself. You'd hav...
<p>You would be able to solve this problem using the IPA (International Phonetic Alphabet) in the middle. So, for example you can get the IPA from an english name through an API translator and then making an IPA to hebrew translation through this table: <a href="https://en.wikipedia.org/wiki/Help:IPA/Hebrew" rel="nofol...
44,280
<p>At work we have two competing theories for salts. The products I work on use something like a user name or phone number to salt the hash. Essentially something that is different for each user but is readily available to us. The other product randomly generates a salt for each user and changes each time the user c...
<p>The answer here is to ask yourself what you're really trying to protect from? If someone has access to your database, then they have access to the encrypted salts, and they probably have access to your code as well. With all that could they decrypt the encrypted salts? If so then the encryption is pretty much use...
<p>Really, it depends on from what type of attack you're trying to protect your data.</p> <p>The purpose of a unique salt for each password is to prevent a dictionary attack against the entire password database.</p> <p>Encrypting the unique salt for each password would make it more difficult to crack an individual pa...
26,229
<p>Two table:</p> <pre><code>StoreInfo: UserId uniqueidentifier StoreNo nvarchar UserName nvarchar Password nvarchar UserInfo: UserId uniqueidentifier UserName nvarchar Password nvarchar </code></pre> <p>the UserId on StoreInfo is currently null. How do i update StoreInfo's UserId with UserInfo's UserId based on Sto...
<p>The update would look like this</p> <pre><code>update storeinfo set userid = u.userid from userinfo u inner join storeinfo s on (s.username = u.username and s.password = u.password) where userid is null </code></pre>
<pre><code>UPDATE StoreInfo set UserId = ui.UserId from StoreInfo si inner join UserInfo ui on ui.UserName = si.UserName and ui.Password = si.Password where si.UserId is null </code></pre> <p>This will update all rows in the table where UserId is not set. Build out the where clause if you only want to upd...
30,851
<p>We could also include IFrames as well.</p>
<p>With standard frames/frameset:</p> <ol> <li>Bookmarking can be difficult to accomplish.</li> <li>The Back button can be broken.</li> <li>Arrival from search engines could be into an inner frame.</li> <li>Printing won't work the same across browsers.</li> <li>Scrollbars could be in non-standard/unexpected places.</l...
<p>I'd like to rephrase your question: what are the advantages of using Html frames for templating? A detailed read about the subject:</p> <p><a href="http://www.yourhtmlsource.com/frames/goodorbad.html" rel="nofollow noreferrer">http://www.yourhtmlsource.com/frames/goodorbad.html</a></p> <blockquote> <p><strong>Qu...
19,121
<p>I wanted to grep for java process and then find the max heap memory used. I tried this</p> <pre><code>def ex =['sh','-c','ps -aef | grep Xmx'] String str = ex.execute().text </code></pre> <p>while <code>str</code> has something like <em>java -Xmx1024M /kv/classes/bebo/ -Xms512M</em> How do I extract the value <em...
<p>Here's a groovy version that doesn't need the grep (or the sed :) :</p> <pre><code>("ps -aef".execute().text =~ /.*-Xmx([0-9]+M).*/).each { full, match -&gt; println match } </code></pre>
<p>In Java:</p> <pre><code>String ResultString = null; Pattern regex = Pattern.compile("-Xmx(\\d+M)"); Matcher regexMatcher = regex.matcher(str); if (regexMatcher.find()) { ResultString = regexMatcher.group(1); } </code></pre>
37,268