instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have two PHP scripts, both using the same session by calling <code>session_name('MySessID')</code>.</p> <p>When the first script calls the second script using curl, the second script hangs when <code>session_start()</code> is called.</p> <p>Why would this happend?</p>
<p>I don't totally understand why this happens, but I got it solved.</p> <p>This <a href="http://bugs.php.net/bug.php?id=44134" rel="noreferrer">bug</a> describes the same problem I'm having. I have a scripts posting to another script, <em>both using the same session</em>, which apparently stalls PHP.</p> <p>So, befo...
<p>I got bitten by this as well. I fixed it thanks to the info provided in stackoverflow.</p> <p>I had two pages, both had "session_start()" at the top and the first was calling the second with curl so I could POST variables to the second script after validation. The webserver was hanging until I added "session_write_...
31,514
<p>I am working on a form, which I would like to validation features like <a href="http://ui-patterns.com/pattern/InputFeedback" rel="nofollow noreferrer">This</a>. Should this all be done on clientside? or server side? I am aware of using some of MS ajax controld, however, at what point do I display the message at the...
<p><strong>You <em>should</em> validate at both ends.</strong></p> <ul> <li><p>Client side to make sure feedback is immediate so users can complete it fast (a bonus for them) and you save server resources (bonus for you).</p></li> <li><p>Server side to make sure that any user-agents not using JS can check the incoming...
<p>validation on the client-side and provide feedback when they click the submit button</p> <p>but since you cannot trust client-side validation, also validation on the server side and display feedback on postback if everything is not correct</p> <p>but since you cannot trust the calling code, also validate in the da...
34,727
<p>How should I determine what to use for a listening socket's backlog parameter? Is it a problem to simply specify a very large number?</p>
<p>There's a very long answer to this in the <a href="http://tangentsoft.net/wskfaq/advanced.html#backlog" rel="noreferrer">Winsock Programmer's FAQ</a>. It details the standard setting, and the dynamic backlog feature added in a hotfix to NT 4.0.</p>
<p>From the <a href="http://msdn.microsoft.com/en-us/library/ms739168(VS.85).aspx" rel="nofollow noreferrer">docs</a>:</p> <blockquote> <p>A value for the backlog of SOMAXCONN is a special constant that instructs the underlying service provider responsible for socket s to set the length of the queue of pending conne...
14,019
<p>Being fairly new to JavaScript, I'm unable to discern when to use each of these.</p> <p>Can anyone help clarify this for me?</p>
<p>If your situation requires the use of a regular expression, use the <code>search()</code> method, otherwise; the <code>indexOf()</code> method is more performant.</p>
<p>Without a <a href="http://www.w3schools.com/js/js_regexp.asp" rel="nofollow">regex</a>, there is no practical difference between <a href="http://www.w3schools.com/jsref/jsref_indexof.asp" rel="nofollow">indexOf</a> and <a href="http://www.w3schools.com/jsref/jsref_search.asp" rel="nofollow">search</a>.</p> <p>The b...
46,125
<p>I've moved from TFS to SVN (TortoiseSVN) with my current company. I really miss the "Shelve" feature of TFS. I've read various articles on how to "Shelve" with SVN, but I've read nothing that gives a very simple experience to "shelve" work.</p> <p>Ideally, I'd like extra items added to the TortoiseSVN context menu ...
<p>I don't believe that SVN has this feature built into the server product. I also don't believe anything like this emulated in any clients that I have used, including TortoiseSVN.</p> <p>To get around this problem, I have resorted to using a DVCS such as <a href="http://git.or.cz/" rel="nofollow noreferrer">Git</a> o...
<h2>Support Feature</h2> <p>SVN supports for shelves is <strong>experimental</strong> means, it doesn't promise backward compatibility for future releases, either its disabled by default.</p> <p>it has been <a href="https://subversion.apache.org/docs/release-notes/1.10.html#shelving" rel="nofollow noreferrer">started w...
2,994
<p>It is advisable to use tables in HTML pages (now that we have CSS)?</p> <p>What are the applications of tables? What features/abilities does tables have that are not in CSS?</p> <h1>Related Questions</h1> <ul> <li><a href="https://stackoverflow.com/questions/30251/tables-instead-of-divs">Tables instead of DIVs</a></...
<p>No - not at all. But use tables for tabular data. Just don't use them for general layouting.</p> <p>But if you display tabular data, like results or maybe even a form, go ahead and use tables!</p>
<p>I am going to assume that your question is actually - <em>"Should I avoid using HTML tables for layout purposes?"</em>. The answer is: No. In fact, tables are specifically meant to be used to control layout. The drawback for using tables to control the layout of an entire page is that the source file rapidly beco...
10,810
<p>I have a JLabel (actually, it is a JXLabel).</p> <p>I have put an icon and text on it.</p> <p><code>&lt;icon&gt;&lt;text&gt;</code></p> <p>Now I wand to add some spacing on the left side of the component, like this:</p> <p><code>&lt;space&gt;&lt;icon&gt;&lt;text&gt;</code></p> <p>I DON'T accept suggestion to mo...
<p>I have found the solution!</p> <pre><code>setBorder(new EmptyBorder(0,10,0,0)); </code></pre> <p>Thanks everyone!</p>
<p>You dont need to modify the preferredSize of the JLabel, you can use the <a href="http://java.sun.com/javase/6/docs/api/java/awt/GridBagLayout.html" rel="nofollow noreferrer">GridBagLayout</a> Manager to specify separations between components, you only have to use the GridBagLayout in the container and add the JXLab...
18,997
<p>I believe there is a discussion on this very topic somewhere on the net but I lost the url and I am unable to find it via googling.</p> <p>What I might try right now would be:</p> <pre><code>ISessionFactoryHolder factoryHolder = ActiveRecordMediator&lt;EntityClass&gt;.GetSessionFactoryHolder(); ISession session = ...
<p>This works for me (stored procedure with params and dynamic result table):</p> <pre><code>// get Connection System.Data.IDbConnection con = ActiveRecordMediator.GetSessionFactoryHolder() .GetSessionFactory(typeof(Autocomplete)) ...
<pre><code>public ArrayList DevolverCamposDeObjetoSTP(T Objeto, List&lt;Consulta&gt; Consultas, string StoredProcedureName) { ArrayList results; try { var queryString = @"EXEC " + StoredProcedureName; foreach (var consulta in Consultas) { s...
22,820
<p>Using MAPI functions from within managed code is officially unsupported. Apparently, MAPI uses its own memory management and it crashes and burns within managed code (see <a href="http://blogs.msdn.com/pcreehan/archive/2007/05/04/what-does-unsupported-mean.aspx" rel="noreferrer">here</a> and <a href="http://blogs.ms...
<p>Have a separate helper EXE that takes command-line params (or pipe to its StandardInput) that does what is required and call that from your main app. This keeps the MAPI stuff outside of your main app's process space. OK, you're still mixing MAPI and .NET but in a very short-lived process. The assumption is that MAP...
<p>For someone experienced with MAPI, it would take them less time to crank out the code to do exactly what you want from unmanaged code (read: plain C++) than typing this post and reading the response (no offense).</p> <p>You're lucky the functionality you need is limited. All you need is a simple C++ utility to take...
2,648
<p>I've got a c# assembly which I'm invoking via COM from a Delphi (win32 native) application.</p> <p>This works on all the machines I've tested it on, except one.</p> <p>The problem is that the Delphi application gets "Class not registered" when trying to create the COM object.</p> <p>Now, when I look in the regist...
<p>The GUID in AssemblyInfo becomes the "Type-Library" GUID and usually is not what you'd be looking for. I'm going to assume you're trying to access a class, and you need to define a Guid attribute and ComVisible for the class. For example:</p> <pre><code>[Guid("00001111-2222-3333-4444-555566667777"), ComVisible(tr...
<p>Maybe you have an old version of the assembly somewhere? Maybe in the GAC? Regasm is probably picking that up and using it.</p>
17,780
<p>I was wondering if there is any way to escape a CDATA end token (<code>]]&gt;</code>) within a CDATA section in an xml document. Or, more generally, if there is some escape sequence for using within a CDATA (but if it exists, I guess it'd probably only make sense to escape begin or end tokens, anyway). </p> <p>Basi...
<p>Clearly, this question is purely academic. Fortunately, it has a very definite answer.</p> <p>You cannot escape a CDATA end sequence. Production rule 20 of the XML <a href="http://www.w3.org/TR/REC-xml/#sec-cdata-sect" rel="noreferrer">specification</a> is quite clear:</p> <pre><code>[20] CData ::= (Cha...
<p>See this structure:</p> <pre><code>&lt;![CDATA[ &lt;![CDATA[ &lt;div&gt;Hello World&lt;/div&gt; ]]]]&gt;&lt;![CDATA[&gt; ]]&gt; </code></pre> <p>For the inner CDATA tag(s) you must close with <code>]]]]&gt;&lt;![CDATA[&gt;</code> instead of <code>]]&gt;</code>. Simple as that.</p>
27,622
<p>Is there any difference between a binary semaphore and mutex or are they essentially the same?</p>
<p>They are <strong>NOT</strong> the same thing. They are used for different purposes!<br> While both types of semaphores have a full/empty state and use the same API, their usage is very different. </p> <p><strong>Mutual Exclusion Semaphores</strong><br> Mutual Exclusion semaphores are used to protect shared resour...
<p>Almost all of the above said it right. Let me also try my bit to clarify if somebody still has a doubt.</p> <ul> <li>Mutex -> used for serialization</li> <li>Semaphore-> synchronization.</li> </ul> <p>Purpose of both are different however, same functionality could be achieved through both of them with careful prog...
8,831
<p>I have an EAR file that contains two WARs, war1.war and war2.war. My application.xml file looks like this:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;application version="5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http:...
<p>In Glassfish 3.0.1 you can define the default web application in the administration console: "Configuration\Virtual Servers\server\Default Web Module". The drop-down box contains all deployed war modules.</p> <p>The default web module is then accessible from <a href="http://localhost:8080/" rel="noreferrer">http://...
<p><code>http://localhost:8080//</code> should still be a valid URL that is equivalent to <code>http://localhost:8080/</code></p> <p>I'd experiment with leaving the context-root of war1 blank (though I'm not sure if that's allowed). Or changing it to <code>&lt;context-root&gt;.&lt;/context-root&gt;</code>.</p> <p>Oth...
15,514
<p>I would like to know what is the difference between initializing a static member inline as in:</p> <pre><code>class Foo { private static Bar bar_ = new Bar(); } </code></pre> <p>or initializing it inside the static constructor as in:</p> <pre><code>class Foo { static Foo() { bar_ = new Bar(); ...
<p>If you have a static constructor in your type, it alters type initialization due to the <a href="http://pobox.com/~skeet/csharp/beforefieldinit.html" rel="noreferrer">beforefieldinit</a> flag no longer being applied.</p> <p>It also affects initialization order - variable initializers are all executed before the sta...
<p>Twilight zone answer: There is a difference in <strong>order of execution</strong> between inline initializers and ctor assignment... when you mix in instance and static members and inheritance to boot.</p> <pre><code>For static members, static initializers Static ctors (execute bottom up) Base static initializer ...
26,874
<p>I know how to fill an std::vector with non-trivial initial values, e.g. sequence numbers:</p> <pre><code>void IndexArray( unsigned int length, std::vector&lt;unsigned int&gt;&amp; v ) { v.resize(length); for ( unsigned int i = 0; i &lt; length; ++i ) { v[i] = i; } } </code></pre> <p>But thi...
<p>You can use the generate algorithm, for a more general way of filling up containers:</p> <pre><code>#include &lt;iostream&gt; #include &lt;algorithm&gt; #include &lt;vector&gt; struct c_unique { int current; c_unique() {current=0;} int operator()() {return ++current;} } UniqueNumber; int main () { vec...
<p>If you have a C style array you can use std:copy, e.g.,</p> <pre><code>int c_array[] = {3,4,5}; const int* pbegin = &amp;c_array[0]; const size_t c_array_size = sizeof(c_array) / sizeof(c_array[0]); const int* pend = pbegin + c_array_size; std::vector&lt;int&gt; v; v.reserve(c_array_size); std::copy(pbegin, pend...
25,461
<p>Do you have any experience of designing a Real Shared-Nothing Architecture? Would you have some readings to recommend me?</p>
<p><a href="https://rads.stackoverflow.com/amzn/click/com/0596102356" rel="nofollow noreferrer" rel="nofollow noreferrer">Building Scalable Web Sites</a> by <a href="http://flickr.com" rel="nofollow noreferrer">Flickr</a> architect <a href="http://www.iamcal.com/" rel="nofollow noreferrer">Cal Henderson</a> is pretty m...
<p>I think that <a href="http://www.sitepoint.com/blogs/2004/07/01/the-j2ee-guy-still-doesnt-get-php/" rel="nofollow noreferrer">The J2EE guy still doesn’t get PHP</a> is (still) worth a read.</p>
3,981
<p>How do you post data to an iframe?</p>
<p>Depends what you mean by "post data". You can use the HTML <code>target=""</code> attribute on a <code>&lt;form /&gt;</code> tag, so it could be as simple as:</p> <pre><code>&lt;form action="do_stuff.aspx" method="post" target="my_iframe"&gt; &lt;input type="submit" value="Do Stuff!"&gt; &lt;/form&gt; &lt;!-- wh...
<p>If you want to change inputs in an iframe then submit the form from that iframe, do this</p> <pre><code>... var el = document.getElementById('targetFrame'); var doc, frame_win = getIframeWindow(el); // getIframeWindow is defined below if (frame_win) { doc = (window.contentDocument || window.document); } if (do...
20,339
<p>For example:</p> <p>script.js:</p> <pre><code>function functionFromScriptJS() { alert('inside functionFromScriptJS'); } </code></pre> <p>iframe.html:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;script language="Javascript" src="script.js"&gt;&lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;iframe&gt; &lt;b...
<p>Iframes do not support inline content. you must use the src attribute to reference a different file. The inner text of the <code>&lt;iframe&gt;</code> tag will be displayed to browsers that do not support iframes.</p> <p>Example:</p> <pre><code>&lt;iframe src="someFile.html" width="100%" height="300px"&gt; &lt;p...
<p>The best solution here I think would be not to use an iframe (although not formally deprecated, it does not appear in the XHTML 1.1 spec) and to use an AJAX get to grab the page and load it into a <code>&lt;div&gt;</code></p> <p>Then javascript functions will work as normal!</p>
44,152
<p>How do you trace/profile your .NET applications? The MSDN online help mentions Visual Studio Team (which I do not possess) and there is the Windows Performance Toolkit. But, are there other solutions you can recommend? Preferably (of course) a solution that works without changing the code (manually) and that can be ...
<p>See also <a href="https://stackoverflow.com/questions/49912/best-dotnet-memory-and-performance-profiler">this question</a>. JetBrains dotTrace is the best .NET profiler I have found (and I have tried pretty much every one there is), because it is the only one that has low enough overhead to handle a processor-intens...
<p>I like dotTrace3.1 It has worked really well for me.</p>
12,015
<p>In .NET there are two version numbers available when building a project, File Version and Assembly Version. How are you using these numbers? Keeping them the same? Auto-incrementing one, but manually changing the other?</p> <p>Also what about the <code>AssemblyInformationalVersion</code> attribute?</p> <p>I'd fo...
<p>In solutions with multiple projects, one thing I've found very helpful is to have all the AssemblyInfo files point to a single project that governs the versioning. So my AssemblyInfos have a line:</p> <pre><code>[assembly: AssemblyVersion(Foo.StaticVersion.Bar)] </code></pre> <p>I have a project with a single file...
<p>I keep them the same. But then, I don't have multifile assemblies, which is when the AssemblyVersion number becomes important. I use Microsoft-style date encoding for my build numbers, rather than auto-incrementing (I don't find the number of times that something has been built to be all that important).</p>
3,556
<p>All I'm trying to do is display a separator (I've tried images &amp; stylesheets) <strong>between</strong> the primary navigation menu items in Sharepoint. Here is what I want it to look like:</p> <pre><code>Home | Menu1 | Menu2 | Menu3 </code></pre> <p>When I attempt to use the StaticTopSeparatorImageUrl (using ...
<p>I prefer to inherit from the MossMenu that the SharePoint team released and customise the menu to producte <em>exactly</em> the html I want.</p> <p><a href="http://blogs.msdn.com/sharepoint/archive/2006/12/02/customizing-the-wss-3-0-moss-2007-menu-control.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/sharep...
<p>The actual splitter or separator can be customised by overriding the background image that is set to the top right (no repeating) in the topNavItem in Core.css</p> <p>Just change the image being referenced there.</p>
39,051
<p>[edit] So I used one of the javascript tooltips suggested below. I got the tips to show when you stop and hide if you move. The only problem is it works when I do this:</p> <pre><code>document.onmousemove = (function() { var onmousestop = function() { Tip('Click to search here'); document.getE...
<p>A bit late to be answering this, but this will be helpful for those in need.</p> <p>I needed this function to be able to detect when the mouse stopped moving for a certain time to hide an HTML/JS player controller when hovering over a video. This is the revised code for the tooltip:</p> <pre><code>document.getElem...
<pre><code>document.onmousemove = (function() { if($('balloon').visible) { //mouse is moving again }....//your code follows </code></pre> <p>Using Prototype.js syntax you can determine that the mouse has moved once the balloon is visible.</p>
21,114
<p>Update: Now that it's 2016 I'd use PowerShell for this unless there's a really compelling backwards-compatible reason for it, particularly because of the regional settings issue with using <code>date</code>. See @npocmaka's <a href="https://stackoverflow.com/a/19799236/8479">https://stackoverflow.com/a/19799236/8479...
<p>See <em><a href="http://www.tech-recipes.com/rx/956/windows-batch-file-bat-to-get-current-date-in-mmddyyyy-format/" rel="noreferrer">Windows Batch File (.bat) to get current date in MMDDYYYY format</a></em>:</p> <pre><code>@echo off For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (set mydate=%%c-%%a-%%b) For /f...
<p>Given a known locality, for reference in functional form. The <code>ECHOTIMESTAMP</code> call shows how to get the timestamp into a variable (<code>DTS</code> in this example.)</p> <pre><code>@ECHO off CALL :ECHOTIMESTAMP GOTO END :TIMESTAMP SETLOCAL EnableDelayedExpansion SET DATESTAMP=!DATE:~10,4!-!DATE:~4...
24,842
<p>A table row is generated using an asp:Repeater:</p> <pre><code>&lt;asp:repeater ID="announcementsRepeater" OnItemDataBound="announcementsRepeater_ItemDataBound" runat="Server"&gt; &lt;itemtemplate&gt; &lt;tr id="announcementRow" class="announcementItem" runat="server"&gt;...&lt;/tr&gt; &lt;/itemtemplate...
<pre><code> HtmlControl htmlRow = (HtmlControl)row; htmlRow.Attributes["class"] = htmlRow.Attributes["class"] + " announcementItemUnread"; </code></pre>
<p>Cast it to HtmlTableRow</p> <pre><code>HtmlTableRow row = (HtmlTableRow)e.Item.FindControl("announcementRow"); </code></pre>
22,172
<p>Please share you experiences regarding how you localized your WPF applications to support multiple languages and any resources that helped you in it?</p> <p>Thanks for your feedbacks.</p>
<p>For our WPF application, all of our strings are localized as resources in a <code>ResourceDictionary</code> that we put in a .xaml file named after the language (like en-US.xaml, ja-JP.xaml, etc).</p> <p>For example, somewhere in the application a button might look like this:</p> <pre><code>&lt;Button Content="{St...
<p>Sorry if it is vague (above question),basically it about how you implemented it in your application and what you felt was the best way.It is basically to understand scenarios.</p>
21,411
<p>I am translating SQL Server SQL Statements into their ANSI generic equivalent at present, and am stuck with a recursive statement using a WITH statement.</p> <p>For the sake of concentrating on the issue, I'll simplify the issue as follows</p> <p>If I have two tables</p> <ol> <li><p><strong>ReportingUnit</strong>...
<p>I'm tolerably certain that no recursive statements were available in SQL-92; the earliest version where that was supported was SQL-99.</p> <p>Consequently, you are stuck with not using SQL-92. Why do you think SQL-92 is desirable? Is it as a base level of SQL functionality, or is there some other reason?</p> <p>...
<p>There is no SQL-92 solution for recursive queries.</p> <p>The best option is to use one of the solutions for encoding hierarchical relationships so that you can query all descendants or ancestors, using standard SQL.</p> <p>See a brief description here: "<a href="https://stackoverflow.com/questions/192220/what-is-...
40,401
<p>I know PHP scripts don't actually compile until they are run. However, say I want to create a small simple program and compile it to a binary without requiring the PHP binary. How could I do this?</p> <p>I've seen a few IDE's out there that would do this, but either they are all for windows or the Linux versions do...
<p>Check out <a href="https://github.com/pbiggar/phc" rel="nofollow noreferrer">phc: the PHP compiler</a></p> <p>If you just want to run it like a script, you may not need to compile it per se, but just run it via the command line. <a href="http://www.php.net/features.commandline" rel="nofollow noreferrer">Read runnin...
<p>Have a look at Facebook's <a href="http://github.com/facebook/hiphop-php#readme" rel="nofollow noreferrer">Hiphop-PHP</a>. It's able to convert PHP code into C++ then compile it with g++. Apparently, they've even gotten it to successfully compile entire WordPress installations.</p>
7,065
<p>What is the difference between <a href="https://3dprinting.stackexchange.com/questions/tagged/post-production" class="post-tag" title="show questions tagged &#39;post-production&#39;" rel="tag">post-production</a> and <a href="https://3dprinting.stackexchange.com/questions/tagged/post-processing" class="post-tag" ti...
<p>These are <strong>NOT</strong> the same in a manufacturing, which 3D printing is primarily considered a part of.</p> <p>Post-Processing typically refers to additional steps that must/can be done to produce the nominally desired part. These steps can include deburr, grind, and other additive/subtractive processing o...
<p>Post Processing VS Post Production <strong><a href="http://fixthephoto.com/blog/retouch-tips/editing-retouching-post-processing-post-production-difference.html" rel="nofollow noreferrer">These terms are absolute synonyms. At the same time they can be interchangeable.</a></strong></p> <hr> <p>In digital video, phot...
48
<p>How do I add an empty directory (that contains no files) to a Git repository?</p>
<p>Another way to make a directory stay (almost) empty (in the repository) is to create a <code>.gitignore</code> file inside that directory that contains these four lines:</p> <pre><code># Ignore everything in this directory * # Except this file !.gitignore </code></pre> <p>Then you don't have to get the order right...
<p>Just add a <code>readme</code> or a <code>.gitignore</code> file and then delete it, but not from terminal, from the GitHub website. That will give an empty repository.</p>
14,137
<p>I have set up Synergy on Unix systems with no problems, however when I set up a Synergy server on a Windows Server 2003 box using I get an error message that the mouse cursor is locked when trying to move to the client system. I use a Microsoft Natural keyboard in case that matters (seems Scroll Lock might be invol...
<p>Paul: The Scroll-lock key is the "lock the mouse to this screen and don't let it leave" key. you can change it off by adding this in the options section of the ~/.synergy.conf or /etc/synergy.conf</p> <p>keystroke(f12) = lockCursorToScreen(toggle)</p>
<p>I run the Synergy server on my Mac and the client on both a Vista machine and a GNU/Linux (Gentoo) box. On the Vista box I notice that when the screen is locked I am unable to unlock it with the shared (Mac) keyboard. But with Gentoo, this works quite seamlessly. I am not sure what the solution is though and it'd be...
29,454
<p>How secure are php Sessions? I am planning to use the native PHP sessions to authenticate users. Can users modify session data like they can $_POST and $_GET data?</p>
<p>Data only goes into a session when you as the developer have the user put it into the session via the code you write. Therefore, sessions are as secure as the data you allow into them, and how you trust and use that data. Further, sessions are based on a sessionID that the client uses to identify the session user. I...
<p>PHP sessions are as secure as the session cookie given to the user. All the data in the session is stored server-side, so users can't arbitrarily modify them except through whatever functionality your site provides. However, PHP session cookies are a common target for cross-site scripting (XSS) and cross-site requ...
27,076
<p>I maintain an application which, during the course of two years, has constantly required new hardware to be even usable, due to the amount of new users / new data inserted. However, justifying the investiment is sometimes very hard to do.</p> <p>I started to wonder - how can I establish the maximum number of users ...
<p>You can use this performance algorithm:</p> <p><a href="http://i.msdn.microsoft.com/cc500561.fig02_L(en-us).gif" rel="nofollow noreferrer">http://i.msdn.microsoft.com/cc500561.fig02_L(en-us).gif</a></p> <blockquote> <p><strong>R</strong> Response time. The total time from the user requesting a page (by clicking a li...
<p>We use HP's <a href="http://en.wikipedia.org/wiki/LoadRunner" rel="nofollow noreferrer">LoadRunner</a>. But it's not cheap, and you still have to create scripts, test cases.</p>
22,362
<p>Is it possible to assign a global hotkey to a specific feature in an Adobe AIR app, i.e. the app feature responds to the hotkey whether the app is active or not (it must be running of course, but only in the system tray).</p>
<p>I don't this it's possible with Adobe AIR itself. The only method I can think of:</p> <ol> <li>Install 3rd party hotkey application (like <a href="http://www.autohotkey.com/" rel="nofollow noreferrer">AutoHotkey</a> or <a href="http://sourceforge.net/projects/hotkeybind/" rel="nofollow noreferrer">HotKeyBind</a>)</l...
<p>SWFKit creates a wrapper around your flash/flex movie, and allows access to system DLLs and other goodies, but unfortunately it would export as an .exe, so windows only and no AIR.</p> <p>ASFAIK, there is no support for it by using AIR alone.</p>
18,541
<p><code>mkdir("/people/jason", 0700, TRUE);</code></p> <p>TRUE = Recursive in PHP 5 and the server is running 5.2.5 but I get:</p> <pre><code>Warning: mkdir() expects at most 2 parameters, 3 given in /home/net1003/public_html/admin/_createPage.inc on line 5 </code></pre>
<p>are you running this particular script through the command line interface instead? it's possible that version of PHP 4, whereas the mod_php version is 5.</p>
<p>That is all of my code.</p> <p>I want to create a directory on the web server after a user is added to the MySQL database. Each user gets their own directory with a default index.php page and I am trying to do this programatically rather than manually. </p>
26,721
<p>Is there a standard when it comes to implementing keyboard shortcuts / accelerator keys for web applications. Example: Navigating through a list of items presented in a grid Are their guidelines on how to implement this? Google has one for GMail in the "labs" section. </p> <p>Also would it make business sense in i...
<p>I have used a number of web sites and web applications that define their own keyboard shortcuts. They are usually poorly documented and offer little value over conventional mouse-based use.</p> <p>As Galwegian mentions, you should be careful of interfering with accessibility options, especially if you want to comp...
<p>From an accessibility point of view, keyboard shorts are dangerous as they may interfere with the pre-programmed shortcuts of software like screen readers used by visually impaired users.</p> <p>For this reason, I either avoid their use, or ensure that you can turn off this feature.</p> <p>Good luck!</p>
38,421
<p>How do you trigger a javascript function using actionscript in flash?</p> <p>The goal is to trigger jQuery functionality from a flash movie</p>
<p>Take a look at the <a href="http://livedocs.adobe.com/flash/9.0/ActionScriptLangRefV3/flash/external/ExternalInterface.html" rel="noreferrer">ExternalInterface</a>-Class. <br> From the AS3-Language Reference:</p> <blockquote> <p>The ExternalInterface class is the External API, an application programming inter...
<p>As Jochen said ExternalInterface is the way to go and I can confirm that it works with AS2.</p> <p>If you plan to trigger navigation or anything that affects the area where the flash sits don't do it directly from the function you call from flash. Flash expects a return value from the function it calls and if the f...
20,972
<p>I have the following autorun.inf</p> <pre><code>[Autorun] action="Blah, Inc." open=marketing.exe icon=blah.ico label="Blah, Inc." </code></pre> <p>On Vista, the autorun dialog shows "Publisher not specified". How do I specify a publisher?</p>
<p>Bogdan is right: You need to sign your executable. You can use <em>SignTool</em> from Microsoft for this. Taken from the <a href="http://msdn.microsoft.com/en-us/library/aa387764.aspx" rel="nofollow noreferrer">MSDN</a>:</p> <blockquote> <p><em>SignTool tool is a command-line tool that digitally signs files, veri...
<p>You specify the publisher by signing your executable file, not by writing it in the autorun.inf file.</p> <p>How to do it...beats me, I'm a Java developer. Maybe someone else can tell you how.</p>
33,825
<p>How can i stop the host machine entering <code>standby</code> mode while my application is running?</p> <p>Is there any <code>win32 api</code> call to do this?</p>
<p>There are two APIs, depending on what version of Windows.</p> <p>XP,2000, 2003:</p> <p><a href="http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/aa373247(VS.85).aspx</a></p> <p>Respond to PBT_APMQUERYSUSPEND.</p> <p>Vista, 2008:</p> <p><a hre...
<p>This article <a href="http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907" rel="nofollow noreferrer">http://www.codeguru.com/cpp/w-p/system/messagehandling/article.php/c6907</a> provides a demo of how to do this from C++ (thought he article is framed as if you want to do it from Java, and provid...
7,992
<p>We have a question with regards to XML-sig and need detail about the optional elements as well as some of the canonicalization and transform stuff. We're writing a spec for a very small XML-syntax payload that will go into the metadata of media files and it needs to by cryptographically signed. Rather than re-inve...
<p>Within your overridden ProcessCmdKey how are you determining which key has been pressed?</p> <p>The value of keyData (the second parameter) will change dependant on the key pressed and any modifier keys, so, for example, pressing the left arrow will return code 37, shift-left will return 65573, ctrl-left 131109 and...
<p>I upvoted <a href="https://stackoverflow.com/questions/4850/c-and-arrow-keys/5026#5026">Tokabi's answer</a>, but for comparing keys there is some additional advice on <a href="https://stackoverflow.com/questions/1369312/c-keys-enumeration-confused-keys-alt-or-keys-rbutton-keys-shiftkey-keys-alt/2033796#2033796">Stac...
2,684
<p>On occasion, my local Rails app loses its connection to MySQL. I get some error that the connection failed, but if I just refresh the page, it works fine. This has never happpened in my STAGE or PROD environments (I deploy to Ubuntu), so it has not been that big a deal.<br> Does this happen to anybody else? Is ther...
<p>Look like the best solution to this is to install the platform specific mysql driver. <br><code>sudo gem install mysql</code></p>
<p>Look like the best solution to this is to install the platform specific mysql driver. <br><code>sudo gem install mysql</code></p>
24,003
<p>I am trying to reach methods and properties of ObjectFrame through vb.net. But when I declared this as </p> <pre><code>Dim objOLEObject As ObjectFrame </code></pre> <p>and then trying to instantiate it as </p> <pre><code>ObjOLEObject = New ObjectFrame </code></pre> <p>it shows error like:</p> <p>"<strong>429: R...
<p>Make sure the dll has been registered using regsvr32. Verify by looking in the registry for the CLSID.</p> <p>Make sure all dependant dll's are available.</p> <p>I believe this is a class not registered error.</p>
<p>Adding to what Josh is saying, have you checked that all the dependency files are present?</p> <p>This thread might help.<br> <a href="http://social.msdn.microsoft.com/Forums/en-US/vbgeneral/thread/88a6ea68-f476-4231-822f-27fabe59f458/" rel="nofollow noreferrer">http://social.msdn.microsoft.com/Forums/en-US/vbgener...
47,241
<p>I'm attempting to display a "LargeIcon" view in a listview control, however the images I specify are blurry. This is what I have so far: <a href="http://img220.imageshack.us/img220/1005/blurryiconsql3.jpg" rel="nofollow noreferrer">alt text http://img220.imageshack.us/img220/1005/blurryiconsql3.jpg</a></p> <p>The ....
<p>When adding a .PNG Icon format size the editor tends to pick the first entry size in that file, so it picks up the 16x16 entry and it's stretching that out. That's why you see the 16x16 in the properties there. As suggested, the support for PNG is poor, I'm often found myself rolling over to another format as well...
<p>Be sure to set the ImageList size to 48x48 px <strong>BEFORE</strong> you add the images. </p> <p>If the ImageList is set to 32x32 and you add a 48x48 image, the icon is resized to 32x32. When you change the ImageList to 48x48 afterwards, the image is just resized again, thus losing quality and going blurry.</p> <...
13,674
<p>I have an ASP.NET 2.0 application that is working fine in our local environment. When published to a test server, we're getting intermittent errors on the server.</p> <p>Here's the most common:</p> <p>Padding is invalid and cannot be removed. Description: An unhandled exception occurred during the execution of th...
<p>The error is because your appdomain was recycled/restarted. When that happens the application and the machine key is set to auto, it changes. That affects the decryption of the info in the url of the resources urls (.axd). Setting up a fixed machine key will prevent it from ever happening again.</p> <p>Please check...
<p>Ben,</p> <p>For your first problem, I found this that seems to be a bit more to the point of what you are seeing in that the problem is sporadically occurring. You should be able to find a full explanation of this at <a href="http://www.codeproject.com/KB/security/Cryptor.aspx#aes" rel="nofollow noreferrer">http:/...
39,923
<p>I have two running processes in Windows, and each process has a pipe to the other.</p> <p>I want to serialize a complicated class and transmit it from one process to the other. I already have the serialization procedure worked out, and I understand that the pipes are sending binary streams. How should I go about se...
<p>Here is the tutorial for <code>boost::serialization</code>. I could imagine it would work fine sending the data over the pipe and deserializing on the other side: <a href="http://www.boost.org/doc/libs/1_37_0/libs/serialization/doc/tutorial.html" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_37_0/libs/se...
<p>You can use boost::asio::windows::stream_handle to organize iostream like io, and do it asynchronously.</p>
45,280
<p>As the title says, how can I find the current operating system in python?</p>
<p>I usually use <a href="https://docs.python.org/3/library/sys.html#sys.platform" rel="noreferrer"><code>sys.platform</code></a> to get the platform. <code>sys.platform</code> will distinguish between linux, other unixes, and OS X, while <code>os.name</code> is &quot;<code>posix</code>&quot; for all of them.</p> <p>Fo...
<p><a href="https://docs.python.org/library/os.html" rel="noreferrer">https://docs.python.org/library/os.html</a></p> <p>To complement Greg's post, if you're on a posix system, which includes MacOS, Linux, Unix, etc. you can use os.uname() to get a better feel for what kind of system it is.</p>
13,562
<p>Can anyone please help me to get all the domains in Active Directory. I have tried many times, but all the programs are listing only the current working domain. </p> <p>How can I do this?</p>
<pre><code>Domain domain = Domain.GetDomain(new DirectoryContext(DirectoryContextType.Domain, "yourDomain", "username", "password")); Forest forest = domain.Forest; DomainCollection domains = forest.Domains; </code></pre> <p>The above uses the System.DirectoryServices.ActiveDirectory namespace. It'll give you a dom...
<p>You could also use System.DirectoryServices.ActiveDirectory.Forest.GetCurrentForest().Domains</p> <pre><code>var domains = Forest.GetCurrentForest().Domains.Cast&lt;Domain&gt;(); foreach (var domain in domains) { Console.WriteLine(domain.Name); } </code></pre>
41,898
<pre><code>DECLARE @p_date DATETIME SET @p_date = CONVERT( DATETIME, '14 AUG 2008 10:45:30',?) SELECT * FROM table1 WHERE column_datetime = @p_date </code></pre> <p>I need to compare date time like:</p> <pre><code>@p_date=14 AUG 2008 10:45:30 column_datetime=14 AUG 2008 10:45:30 </code></pre> <p>How ...
<p>The question is unclear, but it looks like you are trying to do the equality match that isn't returning the rows you expect, so I'm guessing that the problem is that the milliseconds are being problematic. There are several approaches here:</p> <ol> <li>format both values (as varchar etc) using CONVERT : expensive ...
<p>I don't quite understand your problem, but <a href="http://msdn.microsoft.com/en-us/library/ms189794.aspx" rel="nofollow noreferrer">DateDiff</a> can be used to compare dates.</p>
34,757
<p>Up until now I've been able to get away with using the default routing that came with ASP.NET MVC. Unfortunately, now that I'm branching out into more complex routes, I'm struggling to wrap my head around how to get this to work.</p> <p>A simple example I'm trying to get is to have the path /User/{UserID}/Items to...
<p>Going by the MVC Preview 4 code I have in front of me the overload for Html.ActionLink() you are using is this one:</p> <pre><code>public string ActionLink(string linkText, string actionName, object values); </code></pre> <p>Note how the second parameter is the <em>actionName</em> not the <em>routeName</em>.</p> ...
<p>Firstly start with looking at what URL it generates and checking it with <a href="http://haacked.com/archive/2008/03/13/url-routing-debugger.aspx" rel="nofollow noreferrer">Phil Haack</a>'s route debug library. It will clear lots of things up.</p> <p>If you're having a bunch of routes you might want to consider nam...
14,465
<p>Can anybody recommend a good method for determining the Rect of some wrapped text on an iPhone? I've tried all the built-in methods for NSString in the 2.1 SDK to no avail. The size methods never return sizes that allow me to completely fit wrapped text in my custom view.</p> <p>I'm drawing some user customizable...
<p>NSString's sizeWithFont:constrainedToSize: method might be useful:</p> <pre><code>CGSize sizeForText = [theText sizeWithFont:theFont constrainedToSize:CGSizeMake(myMaxWidth, 9999)]; </code></pre> <p>You say you've tried all the size methods, but based on your description, it sounds like what you're looking for.</p...
<p>Since you know your view size, call NSString's sizeWithFont:forWidth:lineBreakMode:, starting with your minimum font size, the width of your view, and UILineBreakModeWordWrap. Then increase the font size until the returned size is as tall as your view.</p> <p>If you want to set a maximum font size, you could also ...
21,678
<p>I'm generating compiled getter methods at runtime for a given member. Right now, my code just assumes that the result of the getter method is a string (worked good for testing). However, I'd like to make this work with a custom converter class I've written, see below, "ConverterBase" reference that I've added.</p>...
<p>Can you illustrate what (if it was regular C#) you want the expression to evaluate? I can write the expression easily enough - I just don't fully understand the question...</p> <p>(edit re comment) - in that case, it'll be something like:</p> <pre><code> ConverterBase typeConverter = new ConverterBase(); va...
<p>You need to wrap the object in an ExpressionConstant, e.g. by using Expression.Constant. Here's an example:</p> <pre><code>class MyConverter { public string MyToString(int x) { return x.ToString(); } } static void Main() { MyConverter c = new MyConverter(); ParameterExpression p = Expr...
41,461
<p>I have the following two files and would like the second to extend the first:</p> <ol> <li>wwwroot\site\application.cfc</li> <li>wwwroot\site\dir\application.cfc</li> </ol> <p>However, when I go to declare the component for the second file, I'm not sure what to put in the extends attribute. <strong>My problem is ...
<p>Sean Corfield has <a href="http://corfield.org/blog/index.cfm/do/blog.entry/entry/Extending_Your_Root_Applicationcfc" rel="noreferrer">a blog entry explaining how to extend a root Application.cfc</a>.</p> <p>Below is the relevant information copied from that entry.</p> <hr> <p>Here's your root CFC /Application.cf...
<p>Edward, et-al, I referred to your comment in the post below. See <a href="https://gregoryalexander.com/blog/2021/1/30/Extending-Applicationcfcs-using-mappings-and-proxies" rel="nofollow noreferrer">https://gregoryalexander.com/blog/2021/1/30/Extending-Applicationcfcs-using-mappings-and-proxies</a></p> <p>You absolut...
39,564
<p>MS SQL has a convenient workaround for concatenating a column value from multiple rows into one value:</p> <pre><code>SELECT col1 FROM table1 WHERE col2 = 'x' ORDER by col3 FOR XML path('') </code></pre> <p>and that returns a nice recordset:</p> <pre><code>XML_F52E2B61-18A1-11d1-B105-00805F49916B ...
<p>That should do:</p> <pre><code>select( SELECT col1 FROM table1 WHERE col2 = 'x' ORDER by col3 FOR XML path('') ) as myName </code></pre> <p>Not pretty but should give the result that you need</p>
<pre><code>DECLARE @XmlData XML; SET @XmlData = ( SELECT * FROM [dbo].[TABLE1] FOR XML PATH('ChildNodeDetailsResponse') ,ROOT('ParentNode') ) SELECT @XmlData AS Result </code></pre>
39,209
<p>There are two directories with source trees. What is the best software to reveal changes in them. The should be not only file names but also some file-comparison viewer. It could be better if it is free tool.</p>
<p><a href="http://www.winmerge.org/" rel="nofollow noreferrer">WinMerge</a>, While not quite up to Beyond Compare, it's close and it's open-source.</p>
<p>I've used <a href="http://www.grigsoft.com/download-windiff.htm" rel="nofollow noreferrer">windiff</a> for quick checks. it's not incredibly sophisticated, but it does the job. </p>
25,085
<p>I'm new to printing resin miniatures for Dungeons &amp; Dragons and most of my prints are successful, i.e. one or more miniatures print as expected.</p> <p>However when I have multiple minis on the build plate the one in the middle works okay but the ones on the edges don't adhere to the build plate.</p> <p>Should...
<p>You can definitely print full build plates of minis. You just need to find correct settings. If nothing sticks to the build plate - then you should increase bottom exposure time. Also check if the build plate is even. You can also sand your build plate a little bit to make adhesion better. Additionally, print with l...
<p>I regularly print multiple models on the build plate of an Elegoo Saturn. If your built plate is level and your tank is firmly fastened down you should have no problems.</p> <p>What I have found is the my slicer (Chitubox) will sometimes corrupt the base layer if I print multiple models. With me this usually causes ...
1,646
<p>I am working in Vista 64 bit system.</p> <p>I have a 3rdPartyUsbDriver.sys and 3rdPartyUsbDriver.inf files.</p> <p>I have made the neccesary changes to the vendor &amp; product IDs in the inf file, to work with my custom hardware. This installs and works in 'Unsigned Driver Test mode' just fine.</p> <p>I now want...
<p>Kuler is pretty nice. I also like <a href="http://www.degraeve.com/color-palette/" rel="nofollow noreferrer">http://www.degraeve.com/color-palette/</a> for just creating a color scheme based on an image, and <a href="http://www.colourlovers.com/" rel="nofollow noreferrer">http://www.colourlovers.com/</a> for pickin...
<p>Color scheme from logo or any image: online tool where you can upload image/logo and it gives you out a suggested color scheme that matches your logo/image.</p> <p>Here is the link <a href="http://www.pictaculous.com/" rel="nofollow noreferrer">http://www.pictaculous.com/</a></p>
38,847
<p>I am using the following html page:</p> <pre><code>&lt;html&gt; &lt;head&gt; &lt;title&gt;AJAX Example&lt;/title&gt; &lt;meta http-equiv="Content-Type" content="text/html"; charset="iso-8859-1"&gt; &lt;/head&gt; &lt;script language="JavaScript" src="ajaxlib.js"&gt;&lt;/script&gt; &lt;!--define the ajax javasc...
<p>For starters, your <code>getEmployee()</code> function should <code>return false;</code> to prevent the default action on the <code>&lt;a&gt;</code>. The little boxes thing seems to imply that the character sets aren't matching up. Make sure that the HTML page and the PHP page both use the same character set. I'd...
<p>I suggest getting Firefox + tamper data add-on.. You'll be able to see if your browser is downloading the javascript, and also view the ajax request + data to see what's going on. Also checkout the error console for javascript errors. I would start there.</p>
38,726
<p>In following code, I want to extend the behaviour of a class by deriving/subclassing it, and make use of an event of the base class:</p> <pre><code>public class A { public event EventHandler SomeEvent; public void someMethod() { if(SomeEvent != null) SomeEvent(this, someArgs); } } public c...
<p>The standard practice here is to have a protected virtual method OnSomeEvent on your base class, then call that method in derived classes. Also, for threading reasons you will want to keep a reference to the handler before checking null and calling it.</p> <p>For an explanation of the why read <a href="https://stac...
<p>Wrap it with a protected virtual On... method:</p> <pre><code>public class BaseClass { public event EventHandler&lt;MyArgs&gt; SomeEvent; protected virtual void OnSomeEvent() { if(SomeEvent!= null) SomeEvent(this, new MyArgs(...) ); } } </code></pre> <p>Then override this in a ...
31,636
<p>How can I allow others to create Java, .NET, Ruby, PHP, Perl web user interface components that interact with each other?</p> <p>For example, one web ui component written in .NET selects a customer, and the other web user interface components are written in Java, Ruby or PHP are able to refresh showing information ...
<p>Look up something called WebServices, SOAP and XML-RPC. Should get you well on your way.</p>
<p>Use web services to wrap common code / libraries that you want to share across the interfaces. All the listed platforms have decent support for webservices.</p>
11,948
<p>How can I test sending email from my application without flooding my inbox? </p> <p>Is there a way to tell IIS/ASP.NET how to deliver email to a local folder for inspection?</p>
<p>Yes there is a way.</p> <blockquote> <p>You can alter web.config like this so that when you send email it will instead be created as an .EML file in c:\LocalDir.</p> </blockquote> <pre><code> &lt;configuration&gt; &lt;system.net&gt; &lt;mailSettings&gt; &lt;smtp deliveryMet...
<p>Configure rules in your email client to move the messages based on the subject/sender's email address?</p>
21,452
<p>I need advice regarding subselect performance in MySQL. For a reason that I can't change, I am not able to use JOIN to create quesry filter, I can only add another AND clause in WHERE.</p> <p>What is the peformance of:</p> <pre><code>select tasks.* from tasks where some criteria and task.project_id not in (se...
<p>I believe that the second is more efficient as it requires only one select, but to be sure, you should EXPLAIN each query and check the results.</p> <pre><code>EXPLAIN select tasks.* from tasks where some criteria and task.project_id not in (select id from project where project.is_template = 1); EXPLAIN selec...
<p>I think the first may scale better:</p> <p>When you do a join, internally mysql makes a sort of temporary table consisting of the two tables joined according to the join conditions specified. You aren't giving a join condition, so it'll create a temp table with all tasks listed against all projects. I'm fairly sure...
44,319
<p>I have many instances of an application installed on an IIS 6.0, Windows Server 2003 box under the same application pool. They share many of the same assemblies and can not be joined in to a single application. </p> <p>I recently added a new instance of the application and obtained a System.OutOfMemoryException whe...
<p>Putting something in the GAC only changes the physical location of the DLL (and security settings), it doesn't change what's loaded into memory.</p> <p>Most people tend to think of the GAC as "where Microsoft puts their stuff". I haven't seen many applications created by "everybody else" that can justify using the...
<p>Putting a shared assembly into the GAC saves drive space, eg. if you have 20 asp applications that use the same dll. It might be the case that you load fewer copies of teh same dll into memory as well, I'm not sure. That said, OutOfMemoryErrors are more likely to be caused by loading extremely large obejects into m...
29,855
<p>I am using C# and trying to read a <code>CSV</code> by using this connection string;</p> <blockquote> <pre><code>Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\Documents and Settings\rajesh.yadava\Desktop\orcad;Extended Properties="Text;HDR=YES;IMEX=1;FMT=Delimited" </code></pre> </blockquote> <p>This works for ...
<p>Is the <a href="http://filehelpers.sourceforge.net/" rel="nofollow noreferrer">filehelpers</a> library an option?</p>
<p>Here's a few links from the net discussing this issue:</p> <ul> <li><a href="http://weblogs.asp.net/fmarguerie/archive/2003/10/01/29964.aspx" rel="nofollow noreferrer">Manipulating CSV Files</a></li> <li><a href="http://www.connectionstrings.com/?carrier=textfile" rel="nofollow noreferrer">ConnectionStrings.com</a>...
41,817
<p>can anyome help me find an elegant design for splitting, traversing and tracking objects.</p> <p>The diagram below shows an object with an initial size of 100 which is spilt into two (50, 75) then one of the child objects (75) is subsequently split into three (25, 25 ,25).</p> <p>My question is can anyone think of...
<p>Homework?</p> <pre><code>set RootObject to the current object. while the parent of RootObject is not undefined, set RootObject to its parent. Finally, return RootObject. </code></pre>
<p>Why you have difficulty in locating the root? go from parent to parent until parent is not set.</p> <p>BTW Are you talking about B+ trees? They auto balance using blocks of children that get split when a threshold is exceeded look at this image in wikipedia <a href="https://web.archive.org/web/20100305054914/http:/...
38,242
<p>When creating a new C++ header/source file, what information do you add to the top? For example, do you add the date, your name, a description of the file, etc.? Do you use a structured format for this information?</p> <p>e.g.</p> <pre><code>// Foo.cpp - Implementation of the Foo class // Date: 2008-25-11 // Cre...
<p>Information about who created a file and when and who edited it and when is all in source control. If your team has good practices around check-in comments, then you'll know the reasons for each change too. No need for comments for that stuff.</p> <p>I think it's 100% legit - wise, even - to put a comment block, ...
<p>i generally only add any "comment info" when... i don't think i'll remember or its not obvious what something is doing or when i release the source code and i actually want others to be able to use/learn from it.</p>
41,217
<p>Is it possible to convert an existing WPF Application to SilverLight automatically/with minimal effort?</p>
<p>Not really. I have found some articles regarding the <a href="http://msdn.microsoft.com/en-us/magazine/cc895632.aspx" rel="noreferrer">multi-targeting</a> option for <a href="http://blogs.msdn.com/dphill/archive/2008/08/31/hello-prism-2-0.aspx" rel="noreferrer">WPF and Silverlight</a> at the same time. At this momen...
<p>Here is a thread about this: <a href="http://silverlight.net/forums/t/3898.aspx" rel="nofollow noreferrer">http://silverlight.net/forums/t/3898.aspx</a></p>
26,068
<p>I installed Ruby and Ruby on Rails yesterday on Vista 32bit using the directions on this site: <a href="http://rubyonrails.org/down" rel="nofollow noreferrer">http://rubyonrails.org/down</a></p> <p>So I downloaded the installer, then Gems, then I downloaded rails with Gems.</p> <p>Now I can't use the Gem or Ruby com...
<p>To set up the environment variables, do this</p> <ol> <li>Fire up the start menu</li> <li><strong>Right-Click</strong> on <code>Computer</code> and select <code>Properties</code></li> <li>Click <code>Advanced system settings</code> in the left-hand bar, and confirm the UAC prompt</li> <li>Select the <code>Advanced<...
<p>Add your ruby bin directory to your PATH environment variable, go to Control Panel -> System -> Advanced system settings, then go to the Advanced tab, Environment Variables, then edit your PATH variable and append the path to the ruby binaries install i.e. <strong>;C:\ruby\bin</strong></p>
21,843
<p>I think title should be good enough.</p>
<p>Tags should be used when you want to mark a milestone. The milestone could be as small as a daily build.</p> <p>Branches should be used when you want to make changes independently from another branch/trunk.</p>
<p>Branching should also be used for major milestones, such as a releases. This depends on your <a href="http://www.google.com/search?hl=en&amp;q=branching+strategy" rel="nofollow noreferrer">branching strategy</a> though.</p>
17,368
<p>I'm perplexed. At CodeRage today, Marco Cantu said that CharInSet was slow and I should try a Case statement instead. I did so in my parser and then checked with AQTime what the speedup was. I found the Case statement to be much slower.</p> <p>4,894,539 executions of:</p> <blockquote> <p>while not CharInSet (P^,...
<p>AQTime is an instrumenting profiler. Instrumenting profilers often aren't suitable for measuring code time, particularly in microbenchmarks like yours, because the cost of the instrumentation often outweighs the cost of the thing being measured. Instrumenting profilers, on the other hand, excel at profiling memory a...
<p>As I know call takes same amount of processor operations as jump does if they are both using short pointers. With long pointers may be different. Call in assembler does not use stack by default. If there is enough free registers used register. So stack operations take zero time too. It is just registers which is ver...
43,153
<p>I want to use Lucene (in particular, Lucene.NET) to search for email address domains.</p> <p>E.g. I want to search for "@gmail.com" to find all emails sent to a gmail address.</p> <p>Running a Lucene query for "*@gmail.com" results in an error, asterisks cannot be at the start of queries. Running a query for "@gma...
<p>No one gave a satisfactory answer, so we started poking around Lucene documentation and discovered we can accomplish this using custom Analyzers and Tokenizers.</p> <p>The answer is this: create a WhitespaceAndAtSymbolTokenizer and a WhitespaceAndAtSymbolAnalyzer, then recreate your index using this analyzer. Once ...
<p>You could a separate field that indexes the email address reversed: Index 'foo@gmail.com' as 'moc.liamg@oof' Which enables you to do a query for "moc.liamg@*" </p>
3,952
<p>I'm using libcurl in a Win32 C++ application.</p> <p>I have the curllib.vcproj project added to my solution and set my other projects to depend on it.</p> <p>How do I build it with SSL support enabled?</p>
<p>Well, since this post failed badly, I had to dig into the matter myself. </p> <p><strong><em>Also check out the other answers and comments for additional info regarding other versions etc.</em></strong></p> <p><strong>EDIT: Since I posted this Q there seems to be ready-built binaries made available from the curl h...
<p>i did "do_nt.bat" for windows 7 rc7100 don't forget "nmake -f ms\nt.mak install" to copy the headers correctly</p> <p>thanks this did help a lot</p>
24,025
<p>I want to maintain a list of global messages that will be displayed to all users of a web app. I want each user to be able to mark these messages as read individually. I've created 2 tables; <code>messages (id, body)</code> and <code>messages_read (user_id, message_id)</code>.</p> <p>Can you provide an sql statemen...
<p>Well, you could use</p> <pre><code>SELECT id FROM messages m WHERE m.id NOT IN( SELECT message_id FROM messages_read WHERE user_id = ?) </code></pre> <p>Where ? is passed in by your app.</p>
<p>Something like:</p> <pre><code>SELECT id, body FROM messages LEFT JOIN (SELECT message_id FROM messages_read WHERE user_id = ?) ON id=message_id WHERE message_id IS NULL </code></pre> <p>Slightly tricky and I'm not sure how the performance will scale up, but it should work.</p>
10,230
<p>There is a rich scripting model for Microsoft Office, but not so with Apple iWork, and specifically the word processor Pages. While there are some AppleScript hooks, it looks like the best approach is to manipulate the underlying XML data.</p> <p>This turns out to be pretty ugly because (for example) page breaks ar...
<p>In order for two applications (separate processes) to exchange events, they must agree on how these events are communicated. There are many different ways of doing this, and exactly which method to use may depend on architecture and context. The general term for this kind of information exchange between processes is...
<p>What's the nature of that OnEmailSent event from that third party application? I mean, how do you know the application is triggering such an event?</p> <p>If <em>you</em> are planning on doing interprocess communication, the first question you should ask yourself is: Is it really necessary?</p> <p>Without question...
3,848
<p>I'm using a table to design the layout of my web page. I want the table to fill the page even if it doesn't contain much content. Here's the CSS I'm using:</p> <pre class="lang-css prettyprint-override"><code>html, body { height: 100%; margin: 0; padding: 0; } #container { min-height: 100%; wi...
<p>Just use the <code>height</code> property instead of the <code>min-height</code> property when setting <code>#container</code>. Once the data gets too big, the table will automatically grow.</p>
<p>You can handle this in Javascript/JQuery.</p> <pre><code>window_height = $(window).height(); $('#container').css('min-height', window_height); </code></pre>
11,544
<p>I am trying to embed multiple external websites into one web page. Using an IFRAME works ok, but once you get past 10 embedded iframes, the memory fottprint starts to get too big.</p> <p>So I was thinking, is it possible via ajax/javascript, to re-use the same iframe to load the collection of websites one after en...
<p>You are trying to use a hammer to put screws in the wall. Maybe some will go, but it won't be pretty. Your best option would be either a screen scraper or web services in order to retrieve the data from the external sites. Perhaps include more details about the situation such as, are the external sites your own. Do ...
<p>If you are concerned about bandwidth on your server, could you do the screen scraping (basically pull down the html through an http request) and then store that in the .net cache? Even if you stored the html for each site in the cache for 15 minutes, you would only be pulling that information down 4 times an hour. ...
30,702
<p>I'm developing a client/server application in .Net 3.5 using WCF. Basically, a long running client service (on several machines) establish a duplex connection to the server over a netTcpBinding. The server then uses the callback contract of the client to perform certain on-demand oparations, to which the client resp...
<p>I have experienced flakiness in long running sessions (minutes-hours). I can't be sure that it's WCF, I'm pretty sure its network level. </p> <p>I am thinking of doing away with duplex altogether. It is a real nuisance trying to manage the state of the connection.</p> <p>I am thinking of hosting a service endpo...
<p>I've had some similar problems, and to me it seems that these long-running calls are more or less unsupported.</p> <p>WCF seems to be designed to be used for short running calls. Services, which get called, do some small stuff, and be finished.</p> <p>I refactored my applications into smaller items of work. So ins...
25,018
<p>Ok, this has got to be a super simple problem. I just can't seem to find the answer anywhere. First - I'm not a web developer of any kind, I'm an old school c programmer - so don't flame me for what's probably something quite trivial :)</p> <p>I need to write a small proof-of-concept web app using ASP.NET. My fi...
<p>Your best bet is to use 'Publish website' from the Visual Studio Solution Explorer.</p> <p><a href="https://stackoverflow.com/users/2424/chris-lively">Chris Lively</a> adds: </p> <blockquote> <p>Just a minor add: Publish Website can be found by Right Clicking on the project name. The command will be named ...
<p>I would recommend the solution of <a href="https://stackoverflow.com/users/5640/rich-b">Rich B</a>. And something else... DLLs are in a folder called "bin". Not at the root of the folder.</p>
38,045
<p>This is likely going to be an easy answer and I'm just missing something, but here goes...If I have a Type, (that is, an actual System.Type...not an instance) how do I tell if it inherits from another specific base type?</p>
<p>Use the <a href="http://msdn.microsoft.com/en-us/library/system.type.issubclassof.aspx" rel="noreferrer">IsSubclassOf</a> method of the <a href="http://msdn.microsoft.com/en-us/library/system.type_members.aspx" rel="noreferrer">System.Type</a> class.</p>
<p>EDIT: Note that the above solution will fail if the base type you are looking for is an interface. The following solution will work for any type of inheritance, be it class or interface.</p> <pre><code>// Returns true if "type" inherits from "baseType" public static bool Inherits(Type type, Type baseType) { re...
15,717
<p>How does one import CSV files via Excel VBA in a set, in groups or in multiple individual files, rather than one at a time?</p>
<p>I am a bit puzzled in that most versions of Excel will open .csv files with out any problems.</p> <pre><code>strPath = "C:\Docs\" strFile = Dir(strPath &amp; "*.csv") Do While strFile &lt;&gt; "" Workbooks.Open Filename:=strPath &amp; strFile ActiveWorkbook.SaveAs Filename:=strPath &amp; Mid(strFile, 1, In...
<p>You could write a simple console application to parse a batch of csv files and save them to excel files.<br /> Not the easiest solution but it could be an option.</p>
28,300
<p>When opening Adobe Acrobat Pro, whether it be through <strong>Applescript</strong> or finder, the introductory dialog is shown. Is there a way to not show this dialog without already having checked the "Don't Show Again" option when opening a document using <strong>Applescript</strong>? </p> <p>Photoshop and Illu...
<p>Copy any applicable preferences files in ~/Library/Preferences from a machine that you have checked "Don't show again" on.</p>
<p>If it's not in the dictionary, probably not.</p>
3,031
<p>I'm still learning RegEx at the moment, but for the time being could someone help me out with this? I have a few special requirements for formatting the string:</p> <ol> <li>No directories. JUST the file name.</li> <li>File name needs to be all lowercase.</li> <li>Whitespaces need to be replaced with underscores....
<p>If you're in a super-quick hurry, you can usually find acceptable regular expressions in the library at <a href="http://regexlib.com/" rel="nofollow noreferrer">http://regexlib.com/</a>. Edit to say: <a href="http://regexlib.com/REDetails.aspx?regexp_id=1934" rel="nofollow noreferrer">Here's one that might work for...
<p>If you're taking a string path from the user (eg. by reading the .value of a file upload field), you can't actually be sure what the path separator character is. It might be a backslash (Windows), forward slash (Linux, OS X, BSD etc.) or something else entirely on old or obscure OSs. Splitting the path on either for...
15,893
<p>How do I get my project's runtime dependencies copied into the <code>target/lib</code> folder? </p> <p>As it is right now, after <code>mvn clean install</code> the <code>target</code> folder contains only my project's jar, but none of the runtime dependencies.</p>
<p>This works for me:</p> <pre class="lang-xml prettyprint-override"><code>&lt;project&gt; ... &lt;profiles&gt; &lt;profile&gt; &lt;id&gt;qa&lt;/id&gt; &lt;build&gt; &lt;plugins&gt; &lt;plugin&gt; &lt;artifactId&gt;maven-dependency-plugin&lt;/artifactId&gt; ...
<p>If you're having problems related to dependencies not appearing in the WEB-INF/lib file when running on a Tomcat server in Eclipse, take a look at this:</p> <p><a href="https://stackoverflow.com/questions/4777026/classnotfoundexception-dispatcherservlet-when-launching-tomcat-maven-dependencie">ClassNotFoundExceptio...
12,314
<p>I've decided to add auto-update functionality to one of my applications and was looking for any existing solutions that compare the current running version with the latest version that is then downloaded from the web.</p> <p>I know <a href="http://sparkle.andymatuschak.org/" rel="noreferrer">Sparkle</a> on Mac OSX ...
<p>I just stumpled accross <a href="http://winsparkle.org/" rel="noreferrer">WinSparkle</a> which is an early stage but looks very promising.</p>
<p>In general no, windows maps things like DLLs (either your own or MFC) in such a way that you can't replace a running program. The msi installer checks the VERSIONINFO and doesn't overwrite installed files that have the same (or newer version) but you would have to quit the runnign instance.</p>
31,528
<p>I'm using markdown to edit this question right now. In some <a href="http://en.wikipedia.org/wiki/Wikipedia:How_to_edit_a_page#Wiki_markup" rel="noreferrer">wikis</a> I used wiki markup. Are they the same thing? Are they related? Please explain. If I want to implement one or the other in a web project (like stackove...
<ul> <li><a href="http://en.wikipedia.org/wiki/Markup_language" rel="noreferrer">Markup</a> is a generic term for a language that describes a document's formatting</li> <li><a href="http://en.wikipedia.org/wiki/Markdown" rel="noreferrer">Markdown</a> is a specific markup library: <a href="http://daringfireball.net/proj...
<p>Markup is a general term for content formatting - such as HTML - but markdown is a library that generates HTML markup. Take a look at <a href="http://daringfireball.net/projects/markdown/" rel="noreferrer">Markdown</a>.</p>
4,382
<p>I was recently considering using GoogleData for a hobby project to store my service's old data, (say 24+hours old), while I keep the fresh data on my servers (hobby project==cheap home server).</p> <p>However I haven't really heard of anyone using GoogleData, so I was wondering about what other's experiences have b...
<p>I did use GoogleData to store data frokm one of my project called TaskList. I use google spreadsheet specifically. It's quite hard to start with, but from google's sample, you can pretty sure knows what to do next. I did that in C#. Here's the sample apps and sdk for <a href="http://code.google.com/p/google-gdata/do...
<p>So, I guess nobody uses google data apparently.</p> <p>It does seem nice to store data you can't afford to host yourself though. Thus I think I'll still give it a try.</p>
18,272
<p>My program works already, I have Perl (GUI Window) where I can input data, data passed to the webpage (using to Tomcat server, JSP) and then <strong>saved</strong> it to oracle database. What I want is to make search parameter (webapp) that <strong>retrieve/extract</strong> data from the Oracle database using Perl C...
<p>Yes you can by using <a href="http://search.cpan.org/dist/DBI/" rel="nofollow noreferrer">DBI</a> and <a href="http://search.cpan.org/dist/DBD-Oracle/" rel="nofollow noreferrer">DBD::Oracle</a> modules.</p> <p>However there are some gotchas with Oracle. I remember a few fun and games with Oracle 8 so these may no ...
<p>Any specific reason for the mix in technologies? Why not use a servlet/JSP?</p> <p>If you must use Perl, then you need to choose what web-server will run your Perl script.</p> <p>Normally, this would be Apache using <a href="http://perl.apache.org/" rel="nofollow noreferrer">mod_perl</a>.</p> <p>But if you only i...
38,617
<p>We recently had a security audit and it exposed several weaknesses in the systems that are in place here. One of the tasks that resulted from it is that we need to update our partner credentials system make it more secure. </p> <p>The "old" way of doing things was to generate a (bad) password, give it to the part...
<h3>Password Generation</h3> <p>As far as encoding a password for transmission, the only encoding that will truly add security is encryption. Using Base-64 or hexadecimal isn't for security, but just to be able to include it in a text format like XML.</p> <p>Entropy is used to measure password quality. So, choosing e...
<p>I'm unclear why transmitting the passwords over SSL -- via HTTPS -- is being considered "insecure" by your audit team. So when you ask for two things, it seems the second -- ensuring that the passwords are being transmitted in a secure way -- is already being handled just fine.</p> <p>As for the first, we'd have t...
12,879
<p>I believe the simplest way to request data from a server in XML format is to have a PHP/JSP/ASP.net page which actually generates XML based on HTTP GET params, and to somehow call/load this page from Flex.</p> <p>How exactly can this be achieved using the Flex library classes?</p>
<p>I'd like to add that you can also use <a href="http://livedocs.adobe.com/flex/201/langref/mx/rpc/http/mxml/HTTPService.html" rel="nofollow noreferrer">mx:HTTPService</a>. If you specify the returnFormat attribute, you would get an XML document as opposed to simple text: </p> <pre><code>&lt;mx:HTTPService resultForm...
<p>Never mind, found it: <a href="http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html" rel="nofollow noreferrer">http://livedocs.adobe.com/flex/3/langref/flash/net/URLLoader.html</a></p>
22,345
<p>I'm pretty new to regular expressions. I have a requirement to replace spaces in a piece of multi-line text. The replacement rules are these:</p> <ul> <li>Replace all spaces at start-of-line with a non-breaking space (<code>&amp;nbsp;</code>).</li> <li>Replace any instance of repeated spaces (more than one space to...
<p>I'd guess that it would be easier to find each space and replace it. To do that, use "look-ahead" and "look-behind" groups.</p> <p>Or, find a space (<code>\x20</code>) that is either lead by or followed by any single whitespace (<code>\s</code>); but, only replace the space.</p> <pre><code>$str = "asdasd asdasd a...
<p>You can use PHP's <code>/e</code> modifier to <em>execute</em> some code in the replacement, like this:</p> <pre><code>$str = preg_replace('/( {2,}|^ )/em', 'str_repeat("&amp;nbsp;", strlen("\1"))', $str); </code></pre> <p>I've changed the regular expression to capture the spaces. The <code>/m</code> modifer puts ...
25,513
<p>Someone told me it's more efficient to use <code>StringBuffer</code> to concatenate strings in Java than to use the <code>+</code> operator for <code>String</code>s. What happens under the hood when you do that? What does <code>StringBuffer</code> do differently?</p>
<p>It's better to use StringBuilder (it's an unsynchronized version; when do you build strings in parallel?) these days, in almost every case, but here's what happens:</p> <p>When you use + with two strings, it compiles code like this:</p> <pre><code>String third = first + second; </code></pre> <p>To something like ...
<p>Because Strings are imutable in Java, every time you concanate a String, new object is created in memory. SpringBuffer use the same object in memory.</p>
9,136
<p>I'm building a simple Todo List application where I want to be able to have multiple lists floating around my desktop that I can label and manage tasks in.</p> <p>The relevant UIElements in my app are:</p> <p>Window1 (Window) TodoList (User Control) TodoStackCard (User Control)</p> <p>Window1 looks like this:</p> <p...
<p>You have to call DoDragDrop to initialize the Drag And Drop framework. Jaime Rodriguez provides a guide to Drag and Drop <a href="https://web.archive.org/web/20160113133757/http://blogs.msdn.com:80/b/jaimer/archive/2007/07/12/drag-drop-in-wpf-explained-end-to-end.aspx" rel="nofollow noreferrer">here</a></p>
<p>Just as an FYI, there's a big difference to "dragging controls" around, and doing what Explorer does, which is Drag and Drop, specifically with files. That's what you'll want to look up, how to do drag and drop from a WPF app to something else. You'll need something that creates a Data Object (IDataObject) or whatev...
19,149
<p>How do I learn where the source file for a given Python module is installed? Is the method different on Windows than on Linux?</p> <p>I'm trying to look for the source of the <code>datetime</code> module in particular, but I'm interested in a more general answer as well.</p>
<p>For a pure python module you can find the source by looking at <code>themodule.__file__</code>. The datetime module, however, is written in C, and therefore <code>datetime.__file__</code> points to a .so file (there is no <code>datetime.__file__</code> on Windows), and therefore, you can't see the source.</p> <p>If ...
<p>as written above in python just use help(module) ie</p> <p>import fractions</p> <p>help(fractions)</p> <p>if your module, in the example fractions, is installed then it will tell you location and info about it, if its not installed it says module not available</p> <p>if its not available it doesn't come by defau...
33,903
<pre><code>public Int64 ReturnDifferenceA() { User[] arrayList; Int64 firstTicks; IList&lt;User&gt; userList; Int64 secondTicks; System.Diagnostics.Stopwatch watch; userList = Enumerable .Range(0, 1000) .Select(currentItem =&gt; new User()).ToList(); arrayList = userList.ToAr...
<p>You are running in a high level language with a runtime environment that does a lot of caching and performance optimizations, this is common. Sometimes it is called warming up the virtual machine, or warming up the server (when it is a production application). </p> <p>If something is going to be done repeatedly, t...
<p>You say you don't get that doing it 3 times, the 2nd and 3rd times are relatively close. It seems to me that it's only the first time thru the loop that things are slow.</p>
38,974
<p>What is appropriate way to integrate SpringSecurity with Capcha ? </p> <p>I have following use case : When user will tries to login, if we he failed to login N times, captcha will be displayed, so authentication will be using three parameters : username, password, captcha. But Spring Security doesn't support built ...
<p>As an alternative to using JCaptcha, if you'd like to use the <a href="http://recaptcha.net/" rel="nofollow noreferrer">reCAPTCHA Service</a> on your site, then check out the free Section 4.4 (<a href="http://www.manning.com/wheeler/SIP_Wheeler_MEAP_ch4.pdf" rel="nofollow noreferrer">direct PDF link</a>) of the new ...
<p><a href="http://code.google.com/p/kaptcha/wiki/HowToUse" rel="nofollow noreferrer">Kaptcha</a> is easy to use.</p>
26,730
<p>Profiling LINQ queries and their execution plans is especially important due to the crazy SQL that can sometimes be created. </p> <p>I often find that I need to track a specific query and have a hard time finding in query analyzer. I often do this on a database which has a lot of running transactions (sometimes pro...
<p>Messing with the where clause is maybe not the best thing to do since it can and will affect the execution plans for your queries.</p> <p>Do something funky with projection into anonymous classes instead - use a unique static column name or something that will not affect the execution plan. (That way you can leave ...
<p>You can have your datacontext log out the raw SQL, which you could then search for in the profiler to examine performance.</p> <pre><code>using System.Diagnostics.Debugger; yourDataContext.Log = new DebuggerWriter(); </code></pre> <p>All of your SQL queries will be displayed in the debugger output window now.</p>...
40,823
<p>I've been developing modules for DNN since version 2 and back then I was able to easily able to run my module as I developed it on my environment and still easily deploy my module as a DLL. When version 4 came out and used the web site solution (rather than the Web Application solution). It seems like there was som...
<p>I have a few detailed blog postings about this on my blog site, <a href="http://www.mitchelsellers.com" rel="nofollow noreferrer">mitchelsellers.com</a>.</p> <p>I personally use the WAP development model and I do NOT check the DNN solution, or any core files into source control, as I do NOT modify the core for any ...
<p>I would suggest Mitchel book if you are needing some reference material - Professional Dotnetnuke Module Programming by Wrox <a href="https://rads.stackoverflow.com/amzn/click/com/0470171162" rel="nofollow noreferrer" rel="nofollow noreferrer" title="Module Programming">Module Programming - Michel Sellers</a></p>
11,266
<p>I'm trying to test the functionality of a web app by scripting a login sequence in Python, but I'm having some troubles.</p> <p>Here's what I need to do:</p> <ol> <li>Do a POST with a few parameters and headers.</li> <li>Follow a redirect</li> <li>Retrieve the HTML body.</li> </ol> <p>Now, I'm relatively new to p...
<p>Focus on <code>urllib2</code> for this, it works quite well. Don't mess with <code>httplib</code>, it's not the top-level API.</p> <p>What you're noting is that <code>urllib2</code> doesn't follow the redirect.</p> <p>You need to fold in an instance of <code>HTTPRedirectHandler</code> that will catch and follow t...
<p>Besides the fact that you may be missing a cookie, there might be some field(s) in the form that you are not POSTing to the webserver. The best way would be to capture the actual POST from a web browser. You can use <a href="https://addons.mozilla.org/en-US/firefox/addon/3829" rel="nofollow noreferrer">LiveHTTPHeade...
38,752
<p>We have a system where we want to prevent the same credit card number being registered for two different accounts. As we don't store the credit card number internally - just the last four digits and expiration date - we cannot simply compare credit card numbers and expiration dates.</p> <p>Our current idea is to st...
<p>People are over thinking the design of this, I think. Use a salted, highly secure (e.g. "computationally expensive") hash like sha-256, with a per-record unique salt.</p> <p>You should do a low-cost, high accuracy check first, then do the high-cost definitive check only if that check hits.</p> <p>Step 1:</p> <p>L...
<p>Yes, comparing hashes should work fine in this case.</p>
12,877
<p>I recently installed the Eclipse Metrics Plugin and have exported the data for one of our projects.</p> <p>It's all very good having these nice graphs but I'd really like to understand more in depth what they all mean. The definitions of the metrics only go so far to telling you what it really means.</p> <p>Does a...
<p>I don't think that code metrics (sometimes referred to as <a href="http://en.wikipedia.org/wiki/Software_metric" rel="nofollow noreferrer">software metrics</a>) provide valuable data in terms of where you can improve.</p> <p>With code metrics it is sort of nice to see how much code you write in an hour etc., but be...
<p>In my opinion metrics are an excellent way to find pain points in your codebase. They are very useful also to show your manager why you should spend time improving it.</p> <p>This is a post I wrote about it: <a href="http://blog.jorgef.net/2011/12/metrics-in-brownfield-applications.html" rel="nofollow">http://blog....
18,818
<p>Is there a 7-Zip command-line switch that prevents the filenames from echoing to the screen as they are added to the archive?</p>
<p>Not built in, but if you add </p> <pre><code>&lt;7z command here&gt; 2&gt;&amp;1 NUL </code></pre> <p>to the end of your command-line, it will redirect all the output into the null device and stops it echoing to the screen. This is the MS-DOS equivalent of</p> <pre><code>2&gt;&amp;1 /dev/null </code></pre> <p>in...
<p>AFAIK, there is not a switch for that, but you could hide the output redirecting it to a file, for example (DOS batch):</p> <pre><code>7z.exe ... normal parameters &gt; DumpFile.txt </code></pre> <p>This way all the output ends in DumpFile.txt and not on the screen.</p>
11,925
<p>I need to model a system where by there will be a team who will consist of users who perform roles in the team and have skills assigned to them.</p> <p><em>i.e. a team A 5 members, one performs the team leader role, all perform the reply to email role, but some have an extra skill to answer the phone</em></p> <p>I...
<p>I Googled this, so take it with a grain of salt. I found this <a href="http://www.riehle.org/computer-science/research/1997/ubilab-tr-1997-1-1.pdf" rel="nofollow noreferrer">paper</a> on Role Modeling and Objects. On page 30 there is a Role Pattern. Hopefully this is not a wild goose chase for you. Here is the s...
<p>In your example I would have at least TeamMember BaseClass and 2 interfaces (iEmail and iPhone). Any new Roles will inherit from the TeamMember class, and depending on what it can do, implements the appropriate interfaces... In short, roles would be implemented as a class that inherits from TeamMember, and skills wo...
24,440