instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is it possible to check what version of BPL (ie Rtl70.BPL, Indy70.bpl etc) are installed on a clients computer when the program starts?</p> <p>I have had some programs crash because the BPL on there computer is different to the ones on the build machine.<br> If i have to add each BPL used into the installer on each...
<p>Unfortunately, no. If the crash is due to missing imports from the .bpl files required by your application, there is no way (short of rewriting the Delphi RTL and linker themselves) to check for those packages from within the crashing executable itself. PatrickvL's solution is probably the best for your situation.</...
<p>Sometimes Delphi adds of automatic form the line:<br> {$R ' *.res'}<br> to the files of project or packages. </p> <p>Comment (//) that line and to compile again. </p>
12,434
<p>I'm looking for a good template on server-side installation of software for a project I'm working on.</p> <p>The client-side is pretty straight-forward. The server-side installation is a little trickier. It is made up of several pieces (services, database connections, dependencies, ports that need to be unblocked, ...
<p>The most complete method that we've come up with for creating our DR documentation, involves going through a full cycle (or two) of installation, and documenting each step along the way.</p> <p>I realize this can be a bit difficult if you don't have a test (or replacement) system to use to create your documentation...
<p>Depending on the admins, automation is helpful. I've had windows admins that want a Word doc with step by step instructions and other admins that wanted a script.</p> <p>However, some helpful things to include, probably as sections</p> <ul> <li>Database changes <ul> <li>Scripts to run</li> <li>Verification that t...
15,208
<p>FYI: I am running on dotnet 3.5 SP1</p> <p>I am trying to retrieve the value of an identity column into my dataset after performing an update (using a SqlDataAdapter and SqlCommandBuilder). After performing SqlDataAdapter.Update(myDataset), I want to be able to read the auto-assigned value of <code>myDataset.tables...
<p>This is a problem that I've run into before, the bug seems to be that when you call da.Update(ds); the parameters array of the insert command gets reset to the inital list that was created form your command builder, it removes your added output parameters for the identity.</p> <p>The solution is to create a new dat...
<p>Have you looked into using LINQ instead? I understand this doesn't address your actual question, but if you are using .NET 3.5 you really ought to try using LINQ. In fact, with the advent of Code First EntityFramework, I think you could easily choose either LINQ to SQL or EF as relatively lightweight alternatives ...
16,523
<p>I get an XML file From a web service. Now I want to get one of those elements out of the file.</p> <p>I think I should go use XPath - any good starter reference?</p>
<p>Not VB specific, but try this: <a href="http://www.w3schools.com/xsl/xpath_intro.asp" rel="nofollow noreferrer">http://www.w3schools.com/xsl/xpath_intro.asp</a></p>
<p>One way would be to only extract the needed informations with an xslt file into a new xml and use this new xml as data basis for further processing</p>
10,737
<p>In OpenSCAD, I am trying to make a linear_extrude on a shape imported from an svg. The svg file contains multiple path. I would like to scale each path separately. I have tried the following code, but the whole import is considered a single shape resulting in the image below.</p> <pre><code>linear_extrude(height = 5...
<p>Lame solution: creating stepped pyramid with offset. I realized that scale will not worked for motives with holes inside. Offset seems then more appropriate than scale for my application (creation of stamps)</p> <p>It takes ages to render, but it could be enough for simple patterns. Any better solution are still wel...
<p>One option is to use <code>minkowski()</code> to combine the svg with a cone. On the positive side, it gives a rather nice result, but the downsides are:</p> <ul> <li>it's pretty slow</li> <li>it fattens the bottom rather than shrinking the top, so depending on your needs you may have to invert the image, run <code>...
1,810
<p>I want to display the results of a searchquery in a website with a title and a short description. The short description should be a small part of the page which holds the searchterm. What i want to do is: 1 strip tags in page 2 find first position of seachterm 3 from that position, going back find the beginning (if ...
<p>Even that will ultimately fail. Given the sentence "We went to Dr. Smith's office", if your search term is "office", virtually any criterion you use will give you "Smith's office" as your sentence.</p>
<p>To save others from thinking they can beat this problem - it can't be done without accepting either false positives or false negatives. To add to what James Curran said, you either declare <code>Smith</code> the start of the sentence in <code>We went to Dr. Smith's office.</code>, or you read <code>This sentence is ...
23,257
<p>As I've read somewhere it is advised to use !== and === instead.</p>
<p>"Use the strict equality operator (===) when you want to check that the two operands are of the same type and value. Use the regular equality operator (==) if you care only about the value and the type does not matter. If, for example, one operand is the number 5 and the other operand is the string "5", standard equ...
<p>Personally, in addition to the excellently valid reasons others have stated, I just like knowing that what I'm comparing is exactly what I intend. To me, the difference between the following is important, even though they both evaluate to <code>!myVar</code>:</p> <pre><code>false === myVar 'undefined' === typeof my...
28,584
<p>Our svn repository has lots of branches that are branches off of sub-trees. This works OK with svn because I can check out that sub-tree in the correct spot in my working copy. However, if I check out the same branch using git, I get a working copy with only the branch sub-tree. Is it possible to make git relocate t...
<p>If possible, fix it on the server side: Subversion doesn't copy data when branching (<code>svn copy</code>), it just hardlinks, so there's really no obvious reason to branch out only a subtree.</p> <p>If that's not feasible, you should have a look at <a href="http://help.github.com/subtree-merge/" rel="nofollow nor...
<p>I've never used svn like this, and if the silence you've gotten is any indication then it's kind of a rare practice. Could you give some rationale for doing things this way, maybe by describing what problem it solves? That way we can better judge what would be an acceptable solution.</p>
20,918
<p>I wrote a <code>while loop</code> in a function, but don't know how to stop it. When it doesn't meet its final condition, the loop just go for ever. How can I stop it?</p> <pre><code>def determine_period(universe_array): period=0 tmp=universe_array while True: tmp=apply_rules(tmp)#aplly_rules is...
<p>just indent your code correctly:</p> <pre><code>def determine_period(universe_array): period=0 tmp=universe_array while True: tmp=apply_rules(tmp)#aplly_rules is a another function period+=1 if numpy.array_equal(tmp,universe_array) is True: return period if pe...
<p>I would do it using a for loop as shown below :</p> <pre><code>def determine_period(universe_array): tmp = universe_array for period in xrange(1, 13): tmp = apply_rules(tmp) if numpy.array_equal(tmp, universe_array): return period return 0 </code></pre>
48,117
<p>I have a master page that contains an ASP.NET server side Menu control (System.Web.UI.WebControls.Menu)</p> <p>I <em>am</em> using the CSSFriendly adapters from here</p> <p><a href="http://www.asp.net/CSSAdapters/Menu.aspx" rel="noreferrer">http://www.asp.net/CSSAdapters/Menu.aspx</a></p> <p>and they do make the ...
<p>The short story is that it isn't <a href="http://forums.asp.net/p/1006669/1336527.aspx" rel="nofollow noreferrer">easily</a> accomplished. That code is added to the header by the menu during the prerender phase. </p> <p>A possible workaround might be overriding the menu's onprerender in a custom menu control and do...
<p>The short story is that it isn't <a href="http://forums.asp.net/p/1006669/1336527.aspx" rel="nofollow noreferrer">easily</a> accomplished. That code is added to the header by the menu during the prerender phase. </p> <p>A possible workaround might be overriding the menu's onprerender in a custom menu control and do...
27,365
<p>How can I determine current version of my repository to see if I need to upgrade it (svnadmin upgrade)?</p> <p>In reality I'm hosting SVN with 3rd party and I want to find out if I need to ask them to upgrade my repos or not.</p> <p>I'm asking since 1.5 server will keep repo version at 1.4, unless I miss something...
<p>Have a look at <code>&lt;REPO&gt;/db/format</code>. After upgrading to 1.5 format, my <code>format</code> file shows:</p> <pre><code>3 layout sharded 1000 </code></pre> <p>Before it used to be:</p> <pre><code>2 </code></pre>
<p>I think what you want is "svnlook youngest"</p>
35,771
<p>I know almost nothing about linq.</p> <p>I'm doing this:</p> <pre><code>var apps = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.MainWindowHandle != IntPtr.Zero select app; </code></pre> <p>Which gets me all the running processes which match that criteria....
<p>@FryHard FirstOrDefault will work but remember that it returns null if none are found. This code isn't tested but should be close to what you want:</p> <pre><code>var app = Process.GetProcesses().FirstOrDefault(p =&gt; p.ProcessName.Contains("MyAppName") &amp;&amp; p.MainWindowHandle != IntPtr.Zero); if (app == nu...
<p>Assuming that in your first example apps is an IEnumerable you could make use of the .Count and .FirstOrDefault properties to get the single item that you want to pass to SetForegroundWindow.</p> <pre><code>var apps = from app in Process.GetProcesses() where app.ProcessName.Contains( "MyAppName" ) &amp;&amp; app.Ma...
2,904
<p>We have a huge data of about 300 million records, which will get updated every 3-6 months.We need to query this data(continously, real time) to get some information.What are the options - a RDBMS(mysql) , or some other option like Hadoop.Which will be better?</p>
<p>300M records is well within the bounds of regular relational databases and live querying should be no problem if you use indexes properly.</p> <p>Hadoop sounds like overkill unless you really need highly distributed and redundant data, and it will also make it harder to find support if you run into trouble or for o...
<p>300 million records should pose no problems to a top-end RDBMS like Oracle, SQL Server, DB2. I'm not sure about mySQL, but I'm pretty sure it gets used for some pretty big databases these days.</p>
45,963
<p>When using wireframe fill mode in Direct3D, all rectangular faces display a diagonal running across due to the face being split in to two triangles. How do I eliminate this line? I also want to remove hidden surfaces. Wireframe mode doesn't do this.</p> <p>I need to display a Direct3D model in isometric wireframe v...
<p>Getting rid of the diagonals is tricky as the hardware is likely to only draw triangles and it would be difficult to determine which edge is the diagonal. Alternatively, you could apply a wireframe texture (or a shader that generates a suitable texture). That would solve the hidden line issues, but would look odd as...
<p>I think you'll need to draw those line manually, as wireframe mode is a built in mode, so I don't think you can modify that. You can get the list of vertex in your mesh, and process them into a list of lines that you need to draw. </p>
33,686
<p>I've been struggling with a problem for the past couple days and haven't found a solution.</p> <p>I have an Visual Studio solution with 2 projects, the first one is a DLL with my business objects and logic, the other project is my WinForm application, and a reference dependency on the first project.</p> <p>I initi...
<p>I think the problem you might be getting is that the assembly/class library containing your classes hasn't been loaded into memory at this stage?</p> <p>Try accessing a class in the library before instantiating the data context to see if that works.</p>
<p>I have the same problem. We have a mapping file which maps different assemblies and we get the mapping error since all assemplies are not loaded in memory. What are the different solutions to this problem?</p> <p>I have read that is is possible to reference a type in a different assembly using the AssemblyQualified...
25,203
<p>With Php when does an included file get included? Is it during a preprocessing stage or is it during script evaluation?</p> <p>Right now I have several scripts that share the same header and footer code, which do input validation and exception handling. Like this:</p> <pre><code>/* validate input */ ... /* process...
<p><a href="http://fi.php.net/include/" rel="nofollow noreferrer">PHP.net: include</a> gives a basic example:</p> <pre><code>vars.php &lt;?php $color = 'green'; $fruit = 'apple'; ?&gt; test.php &lt;?php echo "A $color $fruit"; // A include 'vars.php'; echo "A $color $fruit"; // A green apple ?&gt; </code></pre>...
<p>In the order it appears in the code.</p>
44,105
<p>I have the following code in WCF service to throw a custom fault based on certain situations. I am getting a "The creator of this fault did not specify a Reason" exception. What am I doing wrong?</p> <pre><code>//source code if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid...
<p>After some addtional research, the following modified code worked:</p> <pre><code>if(!DidItPass) { InvalidRoutingCodeFault fault = new InvalidRoutingCodeFault("Invalid Routing Code - No Approval Started"); throw new FaultException&lt;InvalidRoutingCodeFault&gt;(fault, new FaultReason("Invalid Routin...
<p>You might try this in the server config (behaviors -> serviceBehaviors -> behavior):</p> <pre><code>&lt;serviceDebug includeExceptionDetailInFaults="true" /&gt; </code></pre>
44,391
<p>The goal: Any language. The smallest function which will return whether a string is a palindrome. Here is mine in <b>Python</b>:</p> <pre><code>R=lambda s:all(a==b for a,b in zip(s,reversed(s))) </code></pre> <p>50 characters.</p> <p>The accepted answer will be the current smallest one - this will change as small...
<p>7 characters in J: Not sure if this is the best way, I'm somewhat new to J :)</p> <pre><code>p=:-:|. </code></pre> <p>explanation: |. reverses the input. -: compares. the operands are implicit.</p> <pre><code>p 'radar' 1 p 'moose' 0 </code></pre>
<p>Josh's Java snippet above will return true every time.</p>
28,275
<p>Newbie WiX question: How do I<br> 1. Copy a single-use shell script to temp along with the installer<br> e.g. </p> <pre><code> &lt;Binary Id='permissions.cmd' src='permissions.cmd'/&gt; </code></pre> <p>2. Find and run that script at the end of the install.<br> e.g. </p> <pre><code>&lt;CustomAction Id='SetFo...
<p>I found the blog post <em><a href="http://blogs.technet.com/alexshev/archive/2008/02/21/from-msi-to-wix-part-5-custom-actions.aspx" rel="nofollow noreferrer">From MSI to WiX, Part 5 - Custom actions: Introduction</a></em> helpful when I wanted to understand CustomActions in WiX.</p> <p>You can also find the definit...
<p>Most people tend to steer clear of the lockPermissions table as it is not additive, meaning it will overwrite your current permissions (from a managed environment perspective, this is bad). I would suggest you use a tool which supports <a href="https://en.wikipedia.org/wiki/Access_control_list" rel="nofollow norefe...
20,534
<p>I have a HTML page that scrolls up and down (not a lot, but it does scroll). How can I set the scroll position in the page after executing some JavaScript?</p> <p>I'm using jQuery to inject some additional HTML at the bottom of the page and I'd like to programmatically scroll to the position of that new content aft...
<p>Try using <a href="http://developer.mozilla.org/en/DOM/window.scroll" rel="nofollow noreferrer"><code>window.scroll</code></a>.</p> <blockquote> <p>Example:</p> <pre><code>// put the 100th vertical pixel at the top of the window &lt;button onClick="scroll(0, 100);"&gt;click to scroll down 100 pixels&lt;/button&g...
<p>Another way to do this, so that you have the option:</p> <p>In the HTML you are adding to the bottom of the page, you can insert a named anchor tag and then change the URL so that the page moves there (FYI: it will not refresh the page).</p> <pre><code>// add HTML like this, dynamically: // &lt;a name="moveHere" /...
25,760
<p>I have two users Bob and Alice in Oracle, both created by running the following commands as sysdba from sqlplus:</p> <pre> create user $blah identified by $password; grant resource, connect, create view to $blah; </pre> <p>I want Bob to have complete access to Alice's schema (that is, all tables), but I'm no...
<p>AFAIK you need to do the grants object one at a time.</p> <p>Typically you'd use a script to do this, something along the lines of:</p> <pre><code>SELECT 'GRANT ALL ON '||table_name||' TO BOB;' FROM ALL_TABLES WHERE OWNER = 'ALICE'; </code></pre> <p>And similar for other db objects.</p> <p>You could put a pac...
<p>There are many things to consider. When you say access, do you want to prefix the tables with the other users name? You can use public synonyms so that you can hide the original owner, if that is an issue. And then grant privs on the synonym.</p> <p>You also want to plan ahead as best you can. Later, will you w...
24,245
<p>What's the object type returned by Datepicker? Supposing I have the following:</p> <pre><code>$("#txtbox").datepicker({ onClose: function(date){ //something } }); </code></pre> <p>What is <code>date</code>? I'm interested in reading the date object from another Datepicker for comparison, someth...
<p>I just downloaded the source from <a href="http://www.kelvinluck.com/assets/jquery/datePicker/v2/demo/scripts/jquery.datePicker.js" rel="nofollow noreferrer">here</a> and noticed (ex line 600) the author is using .getTime() to compare dates, have you tried that?</p> <pre><code>if (oDate.getTime() &gt; date.getTime(...
<blockquote> <p>What is date?</p> </blockquote> <p>it's the $("#txtbox") object</p>
18,662
<p>I've seen it mentioned in many blogs around the net, but I believe it shoud be discussed here. What can we do when we have an MVC framework (I am interested in ZEND) in PHP but our host does not provide mod_rewrite? Are there any "short-cuts"? Can we transfer control in any way (so that a mapping may occur between p...
<p>Zend framework should work without <code>mod_rewrite</code>. If you can live with your URL:s looking more like "/path/to/app/index.php/controller/action". If you had mod_rewrite you could do away with the "index.php" bit, but it should work with too.</p> <p>It's all a matter of setting up the routes to accept the i...
<p>Drupal's rewrite rules translate</p> <p><a href="http://example.com/path/goes/here" rel="nofollow noreferrer">http://example.com/path/goes/here</a></p> <p>into</p> <p><a href="http://example.com/index.php?q=path/goes/here" rel="nofollow noreferrer">http://example.com/index.php?q=path/goes/here</a></p> <p>...and ...
3,462
<p>We've got some in-house applications built in MFC, with OpenGL drawing routines. They all use the same code to draw on the screen and either print the screen or save it to a JPEG file. Everything's been working fine in Windows XP, and I need to find a way to make them work on Vista.</p> <p>In three of our applica...
<p>Your question title mentions screen capture but your actual question doesn't. Please elaborate more clearly. Is the problem that you can do screen capture of three of your applications, but not the fourth one? You can use different screen capture software that can capture OpenGL/DirectX windows. Those surfaces are h...
<p>The contents of each window are directX surfaces and are only assembled by the window manager in the graphics card. You'd not be able to capture this unless you switch off the new interface (DWM) or code specifically for screen capture from the DWM. </p> <p>Wikipedia has a good description of the <a href="http://...
11,252
<p>I use to run</p> <pre><code>$s =~ s/[^[:print:]]//g; </code></pre> <p>on Perl to get rid of non printable characters. </p> <p>In Python there's no POSIX regex classes, and I can't write [:print:] having it mean what I want. I know of no way in Python to detect if a character is printable or not. </p> <p>What wou...
<p>Iterating over strings is unfortunately rather slow in Python. Regular expressions are over an order of magnitude faster for this kind of thing. You just have to build the character class yourself. The <em>unicodedata</em> module is quite helpful for this, especially the <em>unicodedata.category()</em> function. See...
<p>I used this:</p> <pre><code>import sys import unicodedata # the test string has embedded characters, \u2069 \u2068 test_string = &quot;&quot;&quot;&quot;ABC⁩.⁨ 6&quot;, &quot;}&quot;&quot;&quot; nonprintable = list((ord(c) for c in (chr(i) for i in range(sys.maxunicode)) if unicodedata.categ...
11,785
<p>Given this data:</p> <pre><code>CREATE TABLE tmpTable( fldField varchar(10) null); INSERT INTO tmpTable SELECT 'XXX' UNION ALL SELECT 'XXX' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'ZZZ' UNION ALL SELECT 'YYY' SELECT CASE WHEN fldField like 'YYY' THEN 'OTH' ELSE 'XXX' END AS newField FROM tmpTable </code></pre...
<p>Check your service pack. After upgrading my SQL 2000 box to SP4 I now get the correct values for your situation.</p> <p>I'm still getting the swapped data that I reported in my earlier post though :(</p> <p>If you do <code>SELECT @@version</code> you should get 8.00.2039. Any version number less than that and you ...
<p>You aren't specifying what you are selecting and checking the CASE against...</p> <pre><code>SELECT CASE fldField WHEN 'YYY' THEN 'OTH' ELSE 'XXX' END AS newField FROM tmpTable </code></pre>
14,239
<p>How do you get a list of files within a directory so each can be processed?</p>
<p>But <code>boost::filesystem</code> can do that: <a href="http://www.boost.org/doc/libs/1_37_0/libs/filesystem/example/simple_ls.cpp" rel="nofollow noreferrer">http://www.boost.org/doc/libs/1_37_0/libs/filesystem/example/simple_ls.cpp</a></p>
<pre><code>void getFilesList(String filePath,String extension, vector&lt;string&gt; &amp; returnFileName) { WIN32_FIND_DATA fileInfo; HANDLE hFind; String fullPath = filePath + extension; hFind = FindFirstFile(fullPath.c_str(), &amp;fileInfo); if (hFind == INVALID_HANDLE_VALUE){return;} els...
39,430
<p>When coding, what is a good rule of thumb to keep in mind with respect to performance? There are endless ways to optimize for a specific platform and compiler, but I'm looking for answers that apply equally well (or almost) across compilers and platforms.</p>
<p>A famous quote come to mind:</p> <p>"We should forget about small efficiencies, say about 97% of the time: premature optimization is the root of all evil." (Knuth, Donald. Structured Programming with go to Statements, ACM Journal Computing Surveys, Vol 6, No. 4, Dec. 1974. p.268.)</p> <p>But maybe you should not p...
<p>"premature optimization is the root of all evil" (Knuth, Donald)</p> <p>It really depends on the type of code you write and it's typical usage.</p>
40,712
<p>I'd like to create a webpage layout with the sidebar to the right and the main content flowing around the sidebar.</p> <p>Requirements:</p> <ol> <li>Content below the sidebar should occupy all of the available width</li> <li>Content below the sidebar should not wrap when it hits the left of the sidebar</li> <li>Ma...
<p>Simple floating w/ opposite source order just can't be done (w/o CSS3 draft specs). The pragmatic approach is to first build a nice layout that supports your desired source order. HTML:</p> <pre><code>&lt;div id="content" class="noJs"&gt; &lt;div id="floatSpace"&gt;&lt;/div&gt; &lt;p&gt;Lorem ipsum ....&lt;/p&g...
<p>To my knowledge, the only way of getting the sidebar where you want (without the obvious markup reordering) is to set <code>#content { position: relative; }</code> and <code>#sidebar { position: absolute; right: 0; top: 0; }</code></p> <p>Unfortunately, absolute positioning will take the sidebar out of the flowing ...
33,639
<p>Say I have a page that display search results. I search for stackoverflow and it returns 5000 results, 10 per page. Now I find myself doing this when building links on that page:</p> <pre><code>&lt;%=Html.ActionLink("Page 1", "Search", new { query=ViewData["query"], page etc..%&gt; &lt;%=Html.ActionLink("Page 2", "...
<p>I had a similar problem inside an HtmlHelper; I wanted to generate links that linked backed to the current page, with a small adjustment in parameters (think incrementing the page number). So if I had URL /Item/?sort=Name&amp;page=0, I wanted to be able to create links to the same page, but just change the page para...
<p>take a look on this, it's a good example: <a href="http://nerddinnerbook.s3.amazonaws.com/Part8.htm" rel="nofollow">http://nerddinnerbook.s3.amazonaws.com/Part8.htm</a></p>
14,841
<p>Our team is using a SecureRandom to generate a list of key pairs (the SecureRandom is passed to a KeyPairGenerator). We cannot agree on which of the following two options to use:</p> <ol> <li><p>Create a new instance every time we need to generate a key pair</p></li> <li><p>Initialize a static instance and use it ...
<p>Unlike the <code>java.util.Random</code> class, the <code>java.security.SecureRandom</code> class must produce non-deterministic output on each call.</p> <p>What that means is, in case of <code>java.util.Random</code>, if you were to recreate an instance with the same seed each time you needed a new random number, ...
<p>Why would you want to create a new instance every time? It's not like that would be <em>more</em> random. I think it would be best to initialize once and use it for all pairs.</p>
37,789
<p>We log values and we only log them once in a table. When we add values to the table we have to do a look up everytime to see if it needs to insert the value or just grab the id. We have an index on the table (not on the primary key) but there are about 350,000 rows (so it is taking 10 seconds to do 10 of these value...
<p>Just to be clear, the index is on the (presumably varchar or nvarchar) field in the table, correct? Not the PK?</p> <p>ok, after your edit: You're doing an indexed lookup on a large (n)varchar text field. Even with the index that can be pretty slow -- you're still doing 2 big string comparisons. I can't really thin...
<p>I'm not sure I have enough informaiton to answer this, but here are some thoughts none the less:</p> <ol> <li>If you are not already doing so you may be able to do the insert and the verfication all in one SQL (insert into table (values) (select lefter outer join to table where id is null)</li> <li>Are you using a ...
14,265
<p>I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have seen <a href="http://web.archive.org/web/20100208164146/http://www.spoono.com/html/tutorials/tutorial.php?id=19" rel="noreferrer">the W3C solution</a>, which doesn't even work on Firefox, and <a ...
<p><strong>Things have changed</strong> since this question was originally asked and answered. There's been a large amount of work done on getting cross-browser font embedding for body text to work using @font-face embedding.</p> <p>Paul Irish put together <a href="http://paulirish.com/2009/bulletproof-font-face-implem...
<p>And it's unlikely too -- EOT is a fairly restrictive format that is supported only by IE. Both Safari 3.1 and Firefox 3.1 (well the current alpha) and possibly Opera 9.6 support true type font (ttf) embedding, and at least Safari supports SVG fonts through the same mechanism. A list apart had a good discussion abo...
27,118
<p>Our software is built on linux and windows platforms. Depending on the preference of the developer a contribution is developed and tested on either platform and then committed to our subversion repository. It then turns out that the contribution doesn't build on the other platform, and a fix has to be made. The fix ...
<p>Teamcity handles pre-tested commit, you may be able to do something with the new build chaining features in 4.0( <a href="http://www.jetbrains.com/teamcity/features/newfeatures.html" rel="nofollow noreferrer">http://www.jetbrains.com/teamcity/features/newfeatures.html</a> ). Agents are cross platform and can be conf...
<p>We used a custom build and test rig that could remotely deploy to multiple OSes (and multiple Database products on multiple OSes). This was done as a nightly build with a rule that you fix your bugs the next morning. </p> <p>No entirely continuous then, but that's potentially a lot of work to do on a pre-commit hoo...
42,196
<p>I have a dll that must be useable from C etc, so I cant use string objects etc as a normal would, but I'm not sure on how to do this safely..</p> <pre><code>const char *GetString() { std::stringstream ss; ss &lt;&lt; "The random number is: " &lt;&lt; rand(); return ss.str().c_str(); } </code></pre> <p>...
<p>The first variant doesn't work because you're returning a pointer into a stack object, which will get destroyed. (More presisely, you return a pointer to a heap memory, whch will have been deleted().) Worse still, it may even work for some time, if nobody's overwriting the memory, making it very hard to debug.</p> ...
<p>If you declare ss as static you can avoid the problem. This could be a good solution if your program runs on a single-thread enviroment.</p>
35,907
<h2>Context:</h2> <p>A while ago, I stumbled upon this 2001 DDJ article by Alexandrescu: <a href="http://www.ddj.com/cpp/184403799" rel="noreferrer">http://www.ddj.com/cpp/184403799</a></p> <p>It's about comparing various ways to initialized a buffer to some value. Like what "memset" does for single-byte values. He ...
<p>The DDJ article acknowledges that memset is the best answer, and much faster than what he was trying to achieve:</p> <blockquote> <p>There is something sacrosanct about C's memory manipulation functions memset, memcpy, and memcmp. They are likely to be highly optimized by the compiler vendor, to the exten...
<p>The year isn't 2001 anymore. Since then, new versions of Visual Studio have appeared. I've taken the time to study the memset in those. They will use SSE for memset (if available, of course). If your old code was correct, <em>statistically</em> if will now be faster. But you might hit an unfortunate cornercase. I ex...
20,727
<p>How can I compile/run C or C++ code in a Unix console or a Mac terminal?</p>
<p>If it is a simple single-source program,</p> <pre class="lang-none prettyprint-override"><code>make foo </code></pre> <p>where the source file is <em>foo.c</em>, <em>foo.cpp</em>, etc., you don’t even need a makefile. Make has enough built-in rules to build your source file into an executable of the same name, minus...
<p>Running a .C file using the terminal is a two-step process. The first step is to type gcc in the terminal and drop the .C file to the terminal, and then press <kbd>Enter</kbd>:</p> <pre class="lang-none prettyprint-override"><code>gcc /Desktop/test.c </code></pre> <p>In the second step, run the following command:</p...
27,252
<p>If you have a sequence of block elements and you wanted to place margin in between them. </p> <p>Which do you prefer, margin-top or margin-bottom or both? Why?</p>
<p>I always use <code>margin-bottom</code>, which means there is no unnecessary space before the first element.</p>
<p>Yeah I usually use margin-bottom as well and then assign a last class to the last one in the bunch. Assuming you want a different styling on this.</p> <pre><code>.discussion .detailed.topics { margin: 20px 0 } .discussion .detailed.topics .topic { margin-bottom: 30px } .discussion .detailed.topics .topic.last ...
36,148
<p>What are my validation options with .net mvc?</p> <p>Do any of them have a nice validation summary like webforms did?</p>
<p>You can use a MVC html validation summary,see this blog</p> <p><a href="http://blog.maartenballiauw.be/post/2008/08/29/Form-validation-with-ASPNET-MVC-preview-5.aspx" rel="noreferrer">http://blog.maartenballiauw.be/post/2008/08/29/Form-validation-with-ASPNET-MVC-preview-5.aspx</a></p>
<p>xVal is the best one. We implemented in three web applications and we will use it in many more in the future(until we find a better one than this). Check the details of xVal here</p> <p><a href="http://blog.codeville.net/2009/01/10/xval-a-validation-framework-for-aspnet-mvc/" rel="nofollow noreferrer">http://blog.c...
28,963
<p>How do you reverse a string in C or C++ without requiring a separate buffer to hold the reversed string?</p>
<pre><code>#include &lt;algorithm&gt; std::reverse(str.begin(), str.end()); </code></pre> <p>This is the simplest way in C++.</p>
<p>If you don't need to store it, you can reduce the time spent like this:</p> <pre><code>void showReverse(char s[], int length) { printf("Reversed String without storing is "); //could use another variable to test for length, keeping length whole. //assumes contiguous memory for (; length &gt; 0; leng...
24,139
<p>I know this sounds like a really obvious question, but it's proving harder to figure out than I thought. I'm developing in Flash 8/ActionScript 2.0.</p> <p>I have a label component, and I'm dynamically assigning it text from an xml document. For example:</p> <pre><code>label.text = "&lt;b&gt;" + xml_node.firstChil...
<p>When you say "label component", do you mean a Flex 2 label, or a TextField?</p> <p>In the latter case, the font tag should work just fine. will set the font to 24px text for example. If it doesn't, you can use the stylesheet class to specify a font size and then assign it to the TextField.</p> <p>In the case of o...
<p>I can't say for sure but I think you probably need to set the fontSize style of the Label. </p>
24,812
<p>I've got an NSArrayController, and I'm using KVO to observe the Old/New values of it's selection method.</p> <p>This works perfectly (triggers when the selection changes, the usual) except that the items in the change dictionary are all null instead of being the old/new selected object. [arrayController selection] ...
<p><a href="http://homepage.mac.com/mmalc/CocoaExamples/controllers.html" rel="nofollow">mmalc's Cocoa bindings page</a> says:</p> <blockquote> <p>The change dictionary doesn't contain old and new values. This is not your fault, it's due to a bug in the controller. This bug will not be fixed in the forseeable future...
<p>For plain KVO (as opposed to bindings), try observing the selectedObjects property instead of the selection property. That will give you a straightforward array of objects instead of the proxy objects which are used by the Cocoa bindings system. I believe the old/new keys should accurately reflect the change in th...
35,346
<p>What's the instruction to cause a hard-break in Xcode? For example under Visual Studio I could do '_asm int 3' or 'DebugBreak()'. Under some GCC implementations it's asm("break 0") or asm("trap").</p> <p>I've tried various combos under Xcode without any luck. (inline assembler works fine so it's not a syntax issue)...
<p><a href="http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeProjectManagement/090_Running_Programs/chapter_11_section_3.html" rel="noreferrer">http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeProjectManagement/090_Running_Programs/chapter_11_section_3.html</a></p> <pre><c...
<p>There is also the following function that is available as cross platform straight Halt() alternative:</p> <pre><code>#include &lt;stdlib.h&gt; void abort(void); </code></pre> <p>We use it in our cross platform engine for the iPhone implementation in case of fatal asserts. Cross platform across Nintendo DS/Wii/XBO...
5,794
<p>When we execute <code>select count(*) from table_name</code> it returns the number of rows.</p> <p>What does <code>count(1)</code> do? What does <code>1</code> signify here? Is this the same as <code>count(*)</code> (as it gives the same result on execution)?</p>
<p>The parameter to the COUNT function is an expression that is to be evaluated for each row. The COUNT function returns the number of rows for which the expression evaluates to a non-null value. ( * is a special expression that is not evaluated, it simply returns the number of rows.)</p> <p>There are two additional m...
<p>Depending on who you ask, some people report that executing <code>select count(1) from random_table;</code> runs faster than <code>select count(*) from random_table</code>. Others claim they are exactly the same.</p> <p>This <a href="http://laurentschneider.com/wordpress/2008/08/what-is-faster-select-count-or-selec...
21,877
<p>Which search engine would you recommend for a Commerce website?</p> <p>We have millions of products in a catalog and we want it to be as quick as possible.</p> <p>We would also want to make sure that the marketing driven through the search engine will be fast and effective.</p> <p>What are your opinions?</p>
<p>This is only half the answer to your question. I've used it with Java and not .NET. Fast is said to be the better search engine. I don't know. However for Commerce Endeca is considered to be the best. I've used it with a catalog of 5Mil. products and queries are very very fast. If you use .NET or Java does not matte...
<p>Endeca is the best commercial product in my own honest opinion. We've been using it for our millions of catalogs data.</p> <p>Or you can try Lucene.NET</p>
20,563
<p>Is there a way to control the number of displayed rows in a DropDownList control? I'd like it to only display 10 rows, but it defaults to 30. This causes the list to appear higher than the control instead of below it because of its position on the page.</p>
<p>If ASP.NET renders a DropDownList control as a <code>&lt;select&gt;</code> then there is no way to control the number of rows shown when the <code>&lt;select&gt;</code> is opened, it is browser-implementation dependant.</p> <p>A quick test shows that IE 6 reveals 27 items from a 27 item list, Safari for Windows 3.2...
<p>Note: I have not tried this using code</p> <p>Add "size" attribute with "10" as value to show 10 rows in the dropdown.</p> <pre> &lt;asp:dropdownlist size="10" ...&gt; </pre> <p>Does this work? (I am guessing it,as dropdownlist is SELECT tag in html)</p>
48,304
<p>Trying to understand an fft (Fast Fourier Transform) routine I'm using (stealing)(recycling)</p> <p>Input is an array of 512 data points which are a sample waveform. Test data is generated into this array. fft transforms this array into frequency domain. Trying to understand relationship between freq, period, samp...
<p>If you ignore the imaginary part, the frequency distribution is linear across bins:</p> <p>Frequency@i = (Sampling rate/2)*(i/Nbins).</p> <p>So for your first example, assumming you had 256 bins, the largest bin corresponds to a frequency of 1000/2 * 6/256 = 11.7 Hz. Since your input was 10Hz, I'd guess that bin 5...
<p>WaveyDavey says that he's capturing sound from a mic, thru the audio hardware of his computer, BUT that his results are not zero-centered. This sounds like a problem with the hardware. It SHOULD BE zero-centered.</p> <p>When the room is quiet, the stream of values coming from the sound API should be very close to 0...
16,781
<p>I'm using SVN right now, and I've used CVS and VSS in the past. SVN is the current favourite in my books, but I've been hearing a lot about git. Of the people that have used git, what are the pros and cons from your experience?</p>
<p>I don't have a <em>lot</em> of experience with git, but:</p> <p>Pros:</p> <ul> <li>It's really quick</li> <li>Local commits rock</li> <li>Quick to start a new repository (no configuration etc)</li> <li>github is easy to use</li> </ul> <p>(I haven't really "needed" the distributed side of things yet, beyond being ...
<p>Pros:</p> <ul> <li>everything mentioned above</li> </ul> <p>Cons:</p> <ul> <li><p>strange behaviour of autocrlf in Windows</p></li> <li><p>impossibility to move/rename file or dir insode repo and kepp its commit history (<strong>git mv</strong> just removes file from repo, renames and adds it to repo again, thus ...
44,698
<p>We have a Windows Service written in C#. The service spawns a thread that does this: </p> <pre><code>private void ThreadWorkerFunction() { while(false == _stop) // stop flag set by other thread { try { openConnection(); doStuff(); closeConnection(); } catch (Exception ex) ...
<p>Dig in and find out? Stick a debugger on that bastard!</p> <p>I can see at least the following possibilities:</p> <ol> <li>the logging system hangs;</li> <li>the thread exited just fine but the service is still running because some other part has a logic error.</li> </ol> <p>And maybe, but almost certainly not, t...
<p>Have you tried using <a href="http://msdn.microsoft.com/en-us/library/system.threading.monitor.pulse.aspx" rel="nofollow noreferrer">Monitor.Pulse</a> (ensure your thread is using thread management before running this) to get the thread to do something? If that works, then you're going to have to look a bit more in...
4,965
<p>I'm designing an application which includes the need to log all incoming messages I receive from a Telnet connection. The text is largely plain though can include ANSI tags that provide text colour and formatting (16 colours, bold, underline, etc).</p> <p>I'm would like to format my logs to store the text with form...
<p>My first suggestion would be to use a drop-in logging tool like log4net, which will make formatting much more automatic.</p> <p>If you are going to go the route of two files (and I agree with Craig that a database is probably a better choice,) you can probably save yourself a lot of heartache by having one file tha...
<p>If you are catpuring logging information for future searching and anaylsis perhaps a database would be a better answer. </p> <p>As for your solution. Flat files do not scale well at all where as a database scale much better. I wouldn't split the files either, that just compounds the scalability issue. If you ha...
7,347
<p>Maybe this is an overarching question as I've seen similar bugs in Firefox and I'd like to know how to avoid coding them.</p> <p>For no apparent reason, the function keys, arrow keys (de-numlocked numpad as well), the 6 keys over the arrows, and backspace stop working. Every other key seems to work leading me to t...
<p>I doubt that it's Delphi's fault. I'm using Delphi 7 and never had this problem. I suggest you look for another culprit.</p>
<p>If this happens when in the debugger, it is possible that the message processing for a keystroke is failing to be completed. Try pressing all the Alt, shift, control, and all other such keys to see if the issue clears. </p>
21,518
<p>Are they the same thing? If not, what are the differences?</p>
<p>Adobe Shockwave was a media player (formerly by Macromedia), and can be used to run Adobe Director applications (usually in a web browser as a plugin). It has largely been superseded by Adobe Flash (also originally by Macromedia). IIRC, Flash was originally just a new fancy version of Shockwave, usually referred to ...
<p>Adding a bit: originally, the Shockwave player was a heavy-duty player intended for CD-ROM interfaces and such things, and Flash was a more light-weight player intended for web-based interfaces. Though SW is not so popular these days, this is still roughly true - feature-wise, Shockwave "supersedes" Flash in that it...
46,035
<p>I'd like to automatically change my database connection settings on a per-vhost basis, so that I don't have to edit any PHP code as it moves from staging to live and yet access different databases. This is on a single dedicated server.</p> <p>So I was wondering, can I set a PHP variable or constant in httpd.conf as...
<p>Yep...you can do this:</p> <pre><code>SetEnv DATABASE_NAME testing </code></pre> <p>and then in PHP:</p> <pre><code>$database = $_SERVER["DATABASE_NAME"]; </code></pre> <p>or</p> <pre><code>$database = getenv("DATABASE_NAME"); </code></pre>
<p>I was also looking at this type of solution. What I found is this, under Apache you can use the <code>SetEnv KeyName DataValue</code> in the http.conf and in IIS you can use Fast CGI Settings >> Edit... >> Environment Variables >> ... and add <code>KeyName, DataValue</code>. </p> <p>This in turn allows the PHP <co...
17,623
<p>Using ext/ldap I'm trying to add entries to an Active Directory. As long as I only use one single structural objectClass everything works as expected, but as soon as I try to add an entry with a second auxiliary objectClass, the server reports an error:</p> <blockquote> <p>Server is unwilling to perform; 00002040...
<p>I just found that, in order to add dynamic (per-instance) aux classes, the <a href="http://msdn.microsoft.com/en-us/library/ms676290.aspx" rel="nofollow noreferrer">forest functional level of the domain must be 2003</a>.</p>
<p>You may not have permission to set the objectClass attribute. See whether you can attach the auxiliary class after creation, through <a href="http://technet.microsoft.com/en-us/library/cc773354.aspx" rel="nofollow noreferrer">ADSI Edit</a>. If you can't, fix the permissions first (check the Properties tab in the Adv...
48,160
<p>I probably spend far too much time trying to make my visual interfaces look good, and while I'm pretty adept at finding the right match between usability and style one area I am hopeless at is making nice looking icons.</p> <p>How do you people overcome this (I'm sure common) problem? I'm thinking of things like i...
<p>Good icons are hard to design. I have tried to design my own, and have used in-house graphics designers as well. However, building a good icon set takes a lot of work, even for the graphic designer.</p> <p>I believe your best solution is to buy/find a set of icons for use in your projects.</p> <p>The silk icon set...
<p>You can always go on <a href="http://www.elance.com/p/landing/buyer.html" rel="nofollow noreferrer">Elance</a> and hire someone to make any icons/logos for you. I've done it several times and it's pretty cheap for what you're getting. There is so much competition on that site that someone will eventually come in at ...
2,845
<p>I've created a <em>very</em> simple app, which presents an easygui entrybox() and continues to loop this indefinitely as it receives user input.</p> <p>I can quit the program using the Cancel button as this returns None, but I would also like to be able to use the standard 'close' button to quit the program. (ie. t...
<p>It would require altering the easygui module, yes. I will get it modified!</p> <p>** I have sent in a e-mail to the EasyGUI creator explaning this [12:12 PM, January 23/09]</p> <p>** I just want to say that the possibility of this change happening - if at all, which I doubt - is very tiny. You see, EasyGUI is int...
<p>I don't know right now, but have you tried something like this?:</p> <pre><code>root.protocol('WM_DELETE_WINDOW', self.quit) </code></pre> <p>or </p> <pre><code>root.protocol('WM_DELETE_WINDOW', self.destroy) </code></pre> <p>I haven't tried, but google something like <code>"Tkinter protocol WM_DELETE_WINDOW"<...
48,801
<p>I got my ender 3 about a month ago, it was working fine. Tried a new brand, overture, this is when I started experiencing problems. First, I was clogging nozzles left and right, then I went back to hatchbox, and my layers are messed up... <a href="https://i.stack.imgur.com/TXuzX.jpg" rel="nofollow noreferrer"><img ...
<p>I wonder if this problem is unrelated to your material or printer, and purely a matter of slicer breakage. Have you tried printing gcode files you created before the problem appeared? If you use Cura and upgraded it, you might have hit one of the bugs where it assumes by default you have 2.85 mm filament, even thoug...
<p>Seems like in Movement without displaycement in x and y it seems to fit (neck-area). I also would check your belts. There may be a bit too much friction. Otherwise have you made some Testprints (calibration cube, boat)?</p> <p>Especially the base looks bad. But it is not a cylinder or?</p> <p>If you want, you may ...
1,458
<p>How do I download all files in a directory and all subdirectories on an HTTP server?</p>
<p>By using a command-line tool like wget rather than reinventing the wheel.</p>
<p>By using a command-line tool like wget rather than reinventing the wheel.</p>
15,070
<p>How much do using smart pointers, particularly boost::shared_ptr cost more compared to bare pointers in terms of time and memory? Is using bare pointers better for performance intensive parts of gaming/embedded systems? Would you recommend using bare pointers or smart pointers for performance intensive components? <...
<p>Dereferencing smart pointers is typically trivial, certainly for boost in release mode. All boost checks are at compile-time. (Smart pointers could in theory do smart stuff across threads). This still leaves a lot of other operations. Nicola mentioned construction, copying and destruction. This is not the complete s...
<p>Reference-counted smart pointers (the most common type) only cost more when you copy, create and delete them. This extra cost can be substantial if you are copying a lot, because most of them are thread-safe.</p> <p>If you just want an "auto-deleting" pointer, there is the much maligned auto_ptr, or the new and shi...
39,738
<p>I'm trying to change user input in wildcard form <code>("*word*")</code> to a regular expression format. To that end, I'm using the code below to strip off the <code>'*'</code> at the beginning and end of the input so that I can add the regular expression characters on either end:</p> <pre><code>string::iterator ...
<p>Try erasing them in the opposite order:</p> <pre><code>expressionBuilder.erase(iter_end); expressionBuilder.erase(iter_begin); </code></pre> <p>After erasing the first *, iter_end refers to one character past the end of the string in your example. The <a href="http://www.sgi.com/tech/stl/basic_string.html" rel="no...
<p>Minus the error handling, you could probably just do it like this:</p> <pre><code>#include &lt;iostream&gt; #include &lt;string&gt; using namespace std; string stripStar(const string&amp; s) { return string(s.begin() + 1, s.end() - 1); } int main() { cout &lt;&lt; stripStar("*word*") &lt;&lt; "\n"; } </cod...
28,611
<p>The codebase I work on is huge, and grepping it takes about 20 minutes. I'm looking for a good web-based source code search engine.. something like an intranet version of koders.com.</p> <p>The only thing I've found is Krugle Enterprise Edition, which doesn't post its prices... and if you have to ask, you can't af...
<p>20 minutes is outrageous! I'm working with a million+ line source code base these days and grepping takes a few seconds at most (I use <a href="http://petdance.com/ack/" rel="noreferrer">ack</a>). Our home directories are stored on a file server and mounted over NFS, and to speed up grepping we do that while logged ...
<p>Perhaps you should invest some time and/or money in an editor or IDE that supports symbol tagging. You only need to make one pass through the entire source tree to tag it, and thereafter the editor uses an index search or map lookup to find the symbol definition or references.</p> <p>Some examples of editors or ID...
13,192
<p>Anyone know how to detect if a television is currently connected to a PC in c#?</p> <p>Cheers</p>
<p>How is the device attached?</p> <p>Whenever a device arrival/removal happens, Windows sends a message called WM_DEVICECHANGE to all the applications running currently in the system. But to receive this message our application should handle the "Windows Process function". C# applications will not have default suppor...
<p>I suppose you are talking about monitors/TV's ?</p> <p>You can make a winform application with a big button saying 'TV CONNECTED' when the user switches to the TV :-)</p> <p>If the only connection to the PC is just the VGA connector, you are out of luck. You could always implement an infrared sensor connected to a...
32,286
<p>C# question (.net 3.5). I have a class, ImageData, that has a field ushort[,] pixels. I am dealing with proprietary image formats. The ImageData class takes a file location in the constructor, then switches on file extension to determine how to decode. In several of the image files, there is a "bit depth" field ...
<p>To boil down your problem, you want to be able to have a class that has a <strong>ushort[,] pixels</strong> field (16-bits per pixel) sometimes and a <strong>uint32[,] pixels</strong> field (32-bits per pixel) some other times. There are a couple different ways to achieve this.</p> <p>You could create replacements ...
<p>Have your decode function return an object of type Array, which is the base class of all arrays. Then people who care about the type can do "if (a is ushort[,])" and so on if they want to go through the pixels. If you do it this way, you need to allocate the array in ImageData, not the other way around.</p> <p>Al...
12,306
<ol> <li>Video podcast</li> <li>???</li> <li>Audio only mp3 player</li> </ol> <p>I'm looking for somewhere which will extract audio from video, but instead of a single file, for an on going video podcast.</p> <p>I would most like a website which would suck in the RSS and spit out an RSS (I'm thinking of something lik...
<p>You could automate this using the open source command line tool ffmpeg. Parse the RSS to get the video files, fetch them over the net if needed, then spit each one out to a command line like this:</p> <pre><code>ffmpeg -i episode1.mov -ab 128000 episode1.mp3 </code></pre> <p>The -ab switch sets the output bit rate...
<p>How to extract audio from video to MP3:</p> <p><a href="http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm" rel="nofollow noreferrer">http://www.dvdvideosoft.com/guides/dvd/extract-audio-from-video-to-mp3.htm</a></p> <p>How to Convert a Video Podcast to Audio Only:</p> <p><a href="http://w...
6,781
<p>How can i check (and additionally create) PDF-A 1b compliant PDF documents using open source tools? Does anybody know an open source tool? Thanks in advance...</p>
<p>Try with <a href="http://www.lowagie.com/iText/" rel="nofollow noreferrer">http://www.lowagie.com/iText/</a>. It can recognize the version of the loaded PDF and can create PDF as well. It is open source, but I'm not sure do they support exactly the version of the PDF you mention.</p>
<p>Or try <a href="http://www.validatepdfa.com" rel="nofollow noreferrer">www.validatepdfa.com</a> - not open source but 100% free online validator.</p>
11,614
<p>I have recently started working with Unified Communication Managed API 2.0 (UCMA) and Office Communication Server(OCS) 2007. I have a need in my app that I have to create custom presence for my users? Has anyone of you guys done this before and can point me in right direction?</p> <p>There is not much documentation...
<p>A couple options might be:</p> <ol> <li>Use the <a href="http://www.jetbrains.net/confluence/display/TCD4/Simple+Command+Runner" rel="nofollow noreferrer">Simple Command Runner</a> to exec out to something like <a href="http://technet.microsoft.com/en-us/library/bb490994.aspx" rel="nofollow noreferrer">runas</a>, s...
<p>you could use powershell remoting to pull releases from the build server. The server would be less vulnerable than if you were to use a push release like a file copy.</p> <p>I'm doing this with a custom app that logs into teamcity and downloads artifacts and then deploys using powershell locally.</p>
44,824
<p>I am trying to write a bash script for testing that takes a parameter and sends it through curl to web site. I need to url encode the value to make sure that special characters are processed properly. What is the best way to do this? </p> <p>Here is my basic script so far:</p> <pre><code>#!/bin/bash host=${1:?'...
<p>Use <code>curl --data-urlencode</code>; from <code>man curl</code>:</p> <blockquote> <p>This posts data, similar to the other <code>--data</code> options with the exception that this performs URL-encoding. To be CGI-compliant, the <code>&lt;data&gt;</code> part should begin with a name followed by a separator and a ...
<p>The following is based on Orwellophile's answer, but solves the multibyte bug mentioned in the comments by setting LC_ALL=C (a trick from vte.sh). I've written it in the form of function suitable PROMPT_COMMAND, because that's how I use it.</p> <pre><code>print_path_url() { local LC_ALL=C local string="$PWD" ...
37,918
<p>I am trying to make a basic API for my website so certain other websites that I approve of can show content from my site. I have a PHP script on my server that the other websites can access to pull content in XML format. How can I make sure that only certain websites can access this php page on my server?</p>
<p>Most APIs that need a similar sort of "authentication" opt for API keys. Just a big long string that gets passed through in the request.</p> <p>You can reinforce that by resolving the domain's IP and checking that against the incoming request. This is slow and expensive so cache IP lookups (but make sure you clean ...
<p>Allowing only specific users by IP address is pretty simple with .htaccess.</p> <p>Normally you use it to block specific IP addresses like this</p> <pre><code>Order allow, deny Deny from 192.168.0.10 Deny from 212.155. Deny from 1.2.3.4 5.6.7.8 127.0.0.1 Allow from all </code></pre> <p>But you can also use it to...
34,702
<p>I have an application that detects if there is another instance of the app running and exits if one is found. This part seems to work reliably. My app takes a command-line argument that I would like to pass to the already running instance. I have the following code so far:</p> <h2>Project1.dpr</h2> <pre><code>prog...
<p>You don't need to create a file mapping if you use WM_COPYDATA. That's the whole point of WM_COPYDATA - it does all that for you.</p> <p>To send a string</p> <pre><code>procedure IPCSendMessage(target: HWND; const message: string); var cds: TCopyDataStruct; begin cds.dwData := 0; cds.cbData := Length(messag...
<p>Why don't you use DDE? Take a look at the links returned by this search: <a href="http://www.google.com/search?q=delphi+dde" rel="nofollow noreferrer">http://www.google.com/search?q=delphi+dde</a></p>
27,179
<p>Wwhen I click the button on the popup to insert data to database, it does nothing, WHYYYYY?</p> <pre><code>&lt;cc1:ModalPopupExtender ID="ModalPopupExtender1" runat="server" BehaviorID="popup" TargetControlID="cmdTrigger" PopupControlID="pnlPopup" BackgroundCssClass="modalBackground" OkCont...
<p>Remove the OkControlId property as I think it prevents a postback from occuring.</p>
<p>Remove <code>CausesValidation="false"</code> either make it true. It will work.</p>
37,634
<p>I have a custom validation function in JavaScript in a user control on a .Net 2.0 web site which checks to see that the fee paid is not in excess of the fee amount due. </p> <p>I've placed the validator code in the <code>ascx</code> file, and I have also tried using <code>Page.ClientScript.RegisterClientScriptBlock...
<p>Try changing the argument names to <code>sender</code> and <code>args</code>. And, after you have it working, switch the call over to <code>ScriptManager.RegisterClientScriptBlock</code>, regardless of AJAX use.</p>
<p>While I would still like an answer to why my javascript wasn't being recognized, the solution I found in the meantime (and should have done in the first place) is to use an <code>Asp:CompareValidator</code> instead of an <code>Asp:CustomValidator</code>.</p>
2,380
<p>I'm porting a relatively simple console program written for Unix to the Windows platform (<a href="http://en.wikipedia.org/wiki/Visual_C++#32-bit_versions" rel="noreferrer">Visual C++ 8.0</a>). All the source files include "unistd.h", which doesn't exist. Removing it, I get complaints about misssing prototypes for ...
<p>Since we can't find a version on the Internet, let's start one here.<br> Most ports to Windows probably only need a subset of the complete Unix file.<br> Here's a starting point. Please add definitions as needed.</p> <pre><code>#ifndef _UNISTD_H #define _UNISTD_H 1 /* This is intended as a drop-in replacement f...
<p>Create your own unistd.h header and include the needed headers for function prototypes.</p>
44,428
<p>How is it possible to make prototype methods in C#.Net?</p> <p>In JavaScript, I can do the following to create a trim method for the string object:</p> <pre><code>String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); } </code></pre> <p>How can I go about doing this in C#.Net?</p>
<p>You can't dynamically add methods to existing objects or classes in .NET, except by changing the source for that class.</p> <p>You can, however, in C# 3.0, use extension methods, which <em>look</em> like new methods, but are compile-time magic.</p> <p>To do this for your code:</p> <pre><code>public static class S...
<p>You need to create an extension method, which requires .NET 3.5. The method needs to be static, in a static class. The first parameter of the method needs to be prefixed with "this" in the signature.</p> <pre><code>public static string MyMethod(this string input) { // do things } </code></pre> <p>You can then ...
2,658
<p>I am trying to come up with a best practices on project directory structure.</p> <p>my latest thought is that there should be no classes in the root directory of a project. All classes must go under one of the following directories</p> <ul> <li>UI </li> <li>BusinessObjects</li> <li>BusinessLogic</li> <li>DataAc...
<p>If you're talking about C# then I would separate your DAL, BLL, GUI to different projects instead of one project. And have one solution. This will force each code file to be inside of one of the projects. </p> <p>I've added an example:</p> <ul> <li>Solution: ProjectName <ul> <li>Project: DAL (Namespace: ProjectNa...
<p>The only files I put into root folder are <strong>Program.cs</strong> and <strong>Program.ico</strong> (if it's executable application).</p>
40,116
<p>Hi Guys could you please help me refactor this so that it is sensibly pythonic.</p> <pre><code>import sys import poplib import string import StringIO, rfc822 import datetime import logging def _dump_pop_emails(self): self.logger.info("open pop account %s with username: %s" % (self.account[0], self.account[1]))...
<p>I don't see anything significant wrong with that code -- is it behaving incorrectly, or are you just looking for general style guidelines?</p> <p>A few notes:</p> <ol> <li>Instead of <code>logger.info ("foo %s %s" % (bar, baz))</code>, use <code>"foo %s %s", bar, baz</code>. This avoids the overhead of string form...
<p>Further to my comment on John's answer</p> <p>I found out what the issue was, there were illegal characters in the name field and Subject field, which caused python to get the hiccups, as it tried to write the email as a directory, after seeing ":" and "/".</p> <p>John point number 4 doesnt work! so I left it as b...
27,764
<ol> <li>A client is going to request 1K rows of IDs from the server.</li> <li>I have to make sure we have 1K ID's with clientID = -1, if not, I have to insert 1K new ID's into the table.</li> <li>I then have to link those 1K ID's with the clientID</li> <li>return reserved 1K ID's to the client.</li> </ol> <p>Is it as...
<p>You want to add a second table that holds the available IDs, like this:</p> <p>AssignedIdsByClient:</p> <ul> <li><p>AssignedId int identity</p></li> <li><p>ClientId int - the customer you gave this ID range to</p></li> </ul> <p>But when you need 1,000 ID's, don't insert 1,000 records into here: instead, take this...
<p>Yes, you could wrap these all within a single transaction, and other clients will not be able to see them until you commit.</p>
36,565
<p>There should be something akin to <code>\w</code> that can match any code-point in Letters or Marks category (not just the ASCII ones), and hopefully have filters like [[P*]] for punctuation, etc.</p>
<h2>Situation for ES 6</h2> <p>The ECMAScript language specification, edition 6 (also commonly known as ES2015), includes Unicode-aware regular expressions. Support must be enabled with the <code>u</code> modifier on the regex. See <a href="https://mathiasbynens.be/notes/es6-unicode-regex" rel="nofollow noreferrer"><em...
<p>You can also use:</p> <pre><code>function myFunction() { var str = "xq234"; var allowChars = "^[a-zA-ZÀ-ÿ]+$"; var res = str.match(allowChars); if(!str.match(allowChars)){ res="true"; } else { res="false"; } document.getElementById("demo").innerHTML = res; </code></pre>
35,503
<p>Is there any way to have a binary compiled from an ActionScript 3 project print stuff to <em>stdout</em> when executed?</p> <p>From what I've gathered, people have been going around this limitation by writing hacks that rely on local socket connections and AIR apps that write to files in the local filesystem, but t...
<p>With AIR on Linux, it is easy to write to stdout, since the process can see its own file descriptors as files in /dev.</p> <p>For stdout, open <code>/dev/fd/1</code> or <code>/dev/stdout</code> as a <code>FileStream</code>, then write to that.</p> <p>Example:</p> <pre><code>var stdout : FileStream = new FileStrea...
<p>If you are using a debug Flash Player, you can have the Flash Player log trace messages to a file on your system.</p> <p>If you want real time messages, then you could tail the file.</p> <p>More info:</p> <p><a href="http://blog.flexexamples.com/2007/08/26/debugging-flex-applications-with-mmcfg-and-flashlogtxt/" ...
5,958
<p>I just read up on a performance of LINQ, and there is a HUGE amount to be gained by using Compiled LINQ.</p> <p>Now, why won't I always use compiled LINQ?</p>
<p>Short answer: when it's only going to happen once in a long time.</p> <p><a href="http://blogs.msdn.com/ricom/archive/2008/01/14/performance-quiz-13-linq-to-sql-compiled-query-cost-solution.aspx" rel="nofollow noreferrer">Long Answer</a>.</p>
<p>You should use it when some linq query is executing most of the time. Those can be converted to compiled lynq. Performance will be improved as execution path of query will be set at compile time. I used it in my project and performance went up a notched.</p>
2,962
<p>I am using axis 2 webservice client.</p> <p>The first https call to the webservice throws a exception with the message: "Message did not contain a valid Security Element".</p> <p>I think that the problem could be the security mode: maybe it has to be message level security. In this case, how can I configure it in ...
<p>If you don't mind using EXT-GWT, a much prettier fully compliant GWT UI toolkit then this might be more what your looking for. </p> <p><a href="http://extjs.com/examples/layouts/accordionlayout.html" rel="nofollow noreferrer">The Example</a>. </p> <p>GXT as it is also called can do lots of good things for a GUI.</...
<p>I took the TabPanel source code and modified it so it drew the tabs to look like Outlook.</p>
34,146
<p>I'm compiling a simple .c in visual c++ with Compile as C Code (/TC) and i get this compiler error </p> <blockquote> <p>error C2143: syntax error : missing ';' before 'type'</p> </blockquote> <p>on a line that calls for a simple struct </p> <pre><code> struct foo test; </code></pre> <p>same goes for using the ...
<p>I forgot that in C you have to declare all your variables before any code.</p>
<p>How is your structure type defined? There are two ways to do it:</p> <pre><code>// This will define a typedef for S1, in both C and in C++ typedef struct { int data; int text; } S1; // This will define a typedef for S2 ONLY in C++, will create error in C. struct S2 { int data; int text; }; </...
5,579
<p>I'm running Hudson as a windows service through Tomcat, with no slaves involved. The last build step in the job is a batch file that invokes some Java code. The code uses PostgreSQL's command line tool psql (via Runtime.exec()) to create a database on the local machine and eventually run some tests against it.</p> ...
<p>Do you read the output of the process ? If it produces more output than the OS buffers can handle, you need to read it...</p> <p>Also, some processes wait until input has completed. Try to call process.getInputStream().close() after starting the process.</p> <p>Maybe this article is also interesting. It's called "...
<p>There is a possibility that the program is waiting on some user input. If the service is not configured to accept user input, it will appear to be hanging.</p> <p>YOu can try by configuring the service to allow USER INPUT(GUI) -- that might help.</p> <p>Also, you could run Sysinternals ProcessExplorer and ProcessM...
16,687
<p>I have a page which spawns a popup browser window. I have a JavaScript variable in the parent browser window and I would like to pass it to the popped-up browser window.</p> <p>Is there a way to do this? I know this can be done across frames in the same browser window but I'm not sure if it can be done across brows...
<p>Provided the windows are from the same security domain, and you have a reference to the other window, yes.</p> <p>Javascript's open() method returns a reference to the window created (or existing window if it reuses an existing one). Each window created in such a way gets a property applied to it "window.opener" po...
<p>The window.open() function will also allow this if you have a reference to the window created, provided it is on the same domain. If the variable is used server side you should be using a $_SESSION variable (assuming you are using PHP).</p>
11,288
<p>I'm using Crystal Reports in vs2008, so I'm using datasets with procedures to get the data from the db, my escenario is the following: </p> <p>In the same Crystal Report, I have to show two reports, basically using the sames datasets, and the same database, but they are different queries (have grouping and summing ...
<p>You should be able to insert a "sub report" in Crystal on your primary report. You can pass parameters from the main report to the sub report and utilize a whole different command in the sub report. I'm not sure the exact keyboard sequence to insert a sub report in VS2008, but in CR 2008, it's as simple as using t...
<p>Based on my own experiences, I have to agree with Greg - a subreport is probably the easiest-to-maintain solution to your problem. In the case of VS2008, the steps to follow are:<p></p> <ol> <li>Go to the Crystal Reports -> Insert -> Subreport menu option.</li> <li>Click where you want to place the subreport on the...
42,272
<p>I’m looking for a Perl ORM library that has support for reverse engineering of the database schema. All I’ve found so far is <a href="http://perlorm.sourceforge.net/" rel="nofollow noreferrer">http://perlorm.sourceforge.net/</a> and it appears to have no reverse engineering support.</p>
<p>There is a <a href="http://www.perlfoundation.org/perl5/index.cgi?recommended_database_modules" rel="noreferrer">list of recommended ORM modules at the P5P wiki</a>.</p> <p><a href="http://search.cpan.org/dist/Rose-DB-Object" rel="noreferrer">Rose::DB::Object</a> and <a href="http://search.cpan.org/dist/DBIx-Class"...
<p>There are three commonly used ORMs in Perl, <a href="http://search.cpan.org/dist/Class-DBI/" rel="nofollow noreferrer">Class:DBI</a>, <a href="http://search.cpan.org/dist/DBIx-Class/" rel="nofollow noreferrer">DBIx::Class</a> and <a href="http://search.cpan.org/dist/Rose-DB-Object/" rel="nofollow noreferrer">Rose::D...
47,371
<p>I am trying to create a mechanism with moving parts, and would like to see how it works (whether it even works) before printing it.</p> <p>For example, there's a servo with a bracket, and I would like to see how far can the bracket move before colliding with other objects.</p> <p><a href="https://i.stack.imgur.com...
<p>freeCad has a draft rotate function in <strong>DRAFT workbench</strong>:</p> <ol> <li>Select an object;</li> <li>Press the Draft Rotate button, then;</li> <li>Click to set the rotating point and rotate. </li> </ol> <p>You will get used to that after a few trails.</p> <p>There is a <a href="https://www.freecadweb....
<p>I would also like to take a look at the A2plus Workbench (Freecad Addon). There you can define constraints which can help with this problem. As far as I know, parts cannot be moved with the mouse pointer, but angle parameters can be entered.</p> <p><a href="https://freecadweb.org/wiki/A2plus_Workbench" rel="nofollo...
1,059
<p>Some development skills, like refactoring operations, feel like they have an almost unlimited pontential for learning - only the fool will say he's finished learning that.</p> <p>Other skills are bound to specific tools, and being good developers we learn new tools most of the time.</p> <p>But some skills are rela...
<p>It's the soft skills around being a better developer in a team than the nuts and bolts of actually being able to make an application that (more or less) meets the spec and compiles and makes the user/tester not shout too much. </p> <ol> <li>when to defensively write extensible code because you know that it will sav...
<p>Working with only the logical structure of my code and ignoring physical file locations as much as possible.</p>
47,290
<p>The following XHTML code is not working:</p> <pre><code>&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt; &lt;head&gt; &lt;meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /&gt; ...
<p>The problem seams to be the ending of the file...</p> <ul> <li>If I name the file <a href="http://www.tasix.ch/Greter/test2.html" rel="nofollow noreferrer">test2.html</a> everything works.</li> <li>If I name the file <a href="http://www.tasix.ch/Greter/test2.xhtml" rel="nofollow noreferrer">test2.xhtml</a> I get th...
<p>Well, what is dojo.js doing at line 319?</p>
7,097
<p>Every so often when I'm debugging, I get this message in nice brown text on an ASP.NET error page:</p> <blockquote> <p><em>Access to the path "c:\windows\microsoft.net\framework\(version)\Temporary ASP.NET Files\(blah)" is denied.</em></p> </blockquote> <p>I've never been able to figure out what cau...
<p>It was my understanding this can be caused by anti-virus running on the machine and intermittently locking the files.</p>
<p>This could also happen when the IIS user doesn't have permissions into the \Temporary ASP.NET Files directory</p>
22,985
<p>When writing manual SQL its pretty easy to estimate the size and shape of data returned by a query. I'm increasingly finding it hard to do this with LINQ to SQL queries. Sometimes I find WAY more data than I was expecting - which can really slow down a remote client that is accessing a database directly.</p> <p>I'd...
<p>Looks like you can grab the SqlConnection of your DataContext and turn on statistics.</p> <p>One of the statistics is "bytes returned".</p> <p><a href="http://msdn.microsoft.com/en-us/library/7h2ahss8(VS.80).aspx" rel="nofollow noreferrer">MSDN Reference Link</a></p>
<p>I found no way to grab the SqlConnection of the DataContext, so i created the SqlConnection manually:</p> <pre><code>SqlConnection sqlConnection = new SqlConnection("your_connection_string"); // enable statistics cn.StatisticsEnabled = true; // create your DataContext with the SqlConnection NorthWindDataContext nw...
12,179
<p>I had a class with some common error handling code, and I wanted to pass in the method and arguments to call, but I couldn't quite come up with the syntax. What I want to do is roughly this:</p> <pre><code>private void InvokeHelper(Delegate method, params object[] args) { bool retry = false; do { try ...
<p>First off, your signature is </p> <pre><code>private void InvokeHelper(Delegate method, params object[] args) </code></pre> <p>Yet you're making the mistake that you have to group your args into an array to call this method:</p> <pre><code>InvokeHelper(foo.MethodA, new object[] { a, b, c}); </code></pre> <p>The ...
<p>Here's a re-write, following Will's advice to use Action:</p> <pre><code> private void InvokeHelper(Action method) { bool retry = false; do { try { method(); retry = false; } catch (MyException ex) ...
45,542
<p>I have a system that creates an order and that order can be billed to a house account, sent Cash on Delivery (COD), or charged to a credit card. I've created the following tables:</p> <p>ORDERS<br/> order_id<br/> billingoption_id</p> <p>BILLINGOPTIONS<br/> billingoption_id<br/></p> <p>I'm unsure of how the next ...
<p>You can do it either way: a big honking <code>billingoptions</code> table that has fields that encompasses all of the types, with NULLs for fields that don't apply to a given type, or a bunch of baby tables that "star off" of a parent <code>billingoptions</code> table. Both have their advantages and disadvantages.</...
<p>Focus on things. Actual things. Try to describe things simply, directly, and in natural language first.</p> <p>Then, when you ask for design guidance, you can provide definitions. In some cases, the act of writing definitions will make the design crystalize.</p> <p><strong>Orders</strong> are things. What are ...
40,207
<p>Is it possible to create patch installers for web deployment installers generated in VS2005?</p> <p>I have a situation in which it is undesirable to perform a complete uninstall/reinstall of a web site, but in which periodic bug fixes and minor upgrades are made.</p> <p>I've tried following the instructions in var...
<p>We deploy using Subversion. </p> <p><a href="http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx" rel="nofollow noreferrer">http://blog.lavablast.com/post/2008/02/I2c-for-one2c-welcome-our-new-revision-control-overlords!.aspx</a></p>
<p>The WIX (Windows Installer XML) documentation has a section on Patch Building using a Patch Creation Properties (PCP) authoring file for creating a delta patch file.</p>
19,639
<p>We have a bunch of VB6 applications that access two different database servers (both 32-bit windows 2003, one SQL Server 2000, one SQL Server 2005). About every ten minutes or so, we are getting a few errors:</p> <blockquote> <p>[Microsoft][ODBC SQL Server Driver]Timeout expired [Microsoft][ODBC SQL Server Driver][D...
<p>Take a look at this Microsoft Knowledge Base article.</p> <p><a href="http://support.microsoft.com/kb/945977" rel="nofollow noreferrer">Some problems occur after installing Windows Server 2003 SP2</a></p> <p>I would also suggest that you switch to an OLE DB provider. In my experience, it's faster than ODBC and mo...
<p>Are you using non-default instances? Or do you have internal firewalls?</p> <p>We changed to "server.fqdn.tld\instance,port" to avoid this exact (IIRC) intermittent connection issue from clients behind internal firewalls.</p> <p>Only SQL connections were affected.</p>
49,633
<p>I have some REST web services implemented in WCF. I wish to make these services return "Bad Request" when the xml contains invalid elements.</p> <p>The xml serialization is being handled by XmlSerializer. By default XmlSerializer ignores unknown elements. I know it is possible to hook XmlSerializer.UnknownElement a...
<p><em>"I know it is possible to hook XmlSerializer.UnknownElement and throw an exception from this handler, but because this is in WCF I have no control over serialization"</em></p> <p>Its actually possible to do this...</p> <p>In a WCF project that I worked on, we did something similar using the IDispatchMessageFor...
<p>Maybe you can return your own type implementing IXmlSerializable and thorw the exception you want in the ReadXml and WriteXml methods...</p>
18,987
<p>This <a href="https://stackoverflow.com/questions/11782/file-uploads-via-web-services">question and answer</a> shows how to send a file as a byte array through an XML web service. How much overhead is generated by using this method for file transfer? I assume the data looks something like this:</p> <pre><code>&lt;...
<p>Typically a byte array is sent as a <code>base64</code> encoded string, not as individual bytes in tags. </p> <p><a href="http://en.wikipedia.org/wiki/Base64" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Base64</a></p> <p>The <code>base64</code> encoded version is about <strong>137%</strong> of the size ...
<p>I use this method for some internal corporate webservices, and I haven't noticed any major slow-downs (but that doesn't mean it's not there). </p> <p>You could probably use any of the numerous network traffic analysis tools to measure the size of the data, and make a judgment call based off that.</p>
3,294
<p>once you have a commit that contains a submodule object, you pretty much cannot get git-svn to commit past it.</p> <p>Any ideas, workarounds, anything that is not "don't use submodules with git-svn"?</p> <p>So far the answer seems to be a big NO.</p> <p>Is there any way to at least allow existing git commits cont...
<p>You'll need to replace the submodules with the <code>svn:externals</code> property to play nice with Subversion.</p> <pre><code>svn propset svn:externals [...] </code></pre> <p>I don't think there's any other way round it.</p>
<p>If you have an access to the SVN server you may install <a href="http://subgit.com" rel="nofollow">SubGit</a> into it. It will create a linked Git repository, such that any push to the Git repository will be translated to the SVN and vice versa. The translation is concurrent-safe, so you may consider this pair of re...
33,494
<p>I'm currently building a project and I would like to make use of some simple javascript - I know some people have it disabled to prevent XSS and other things. Should I...</p> <p>a) Use the simple javascript, those users with it disabled are missing out</p> <p>b) Don't use the simple javascript, users with it enabl...
<p>Degrade gracefully - make sure the site works without JavaScript, then add bells and whistles for those with JavaScript enabled.</p>
<p>As said before, it depends on your target audience.</p> <p>If I'm part of it, you want to make sure that your site works (if not ideally) on my phone, and that it gives me reason to turn Javascript on when I surf there with it off. Nobody expects full functionality with Javascript disabled, and anybody who uses th...
43,801
<p>I want an expression that will fail when it encounters words such as "boon.ini" and "http". The goal would be to take this expression and be able to construct for any set of keywords.</p>
<pre><code>^(?:(?!boon\.ini|http).)*$\r?\n? </code></pre> <p>(taken from <a href="http://www.regexbuddy.com" rel="noreferrer">RegexBuddy</a>'s library) will match any line that does not contain boon.ini and/or http. Is that what you wanted?</p>
<p>I used this (based on Tim Pietzcker answer) to exclude non-production subdomain URLs for Google Analytics profile filters:</p> <pre><code>^\w+-*\w*\.(?!(?:alpha(123)*\.|beta(123)*\.|preprod\.)domain\.com).*$ </code></pre> <p>You can see the context here: <a href="http://technicaldebt.com/?p=1496" rel="nofollow">Re...
14,231
<p>I'm working on updating a classic ASP web page used by a number of sub-sites maintained at the company I work for.</p> <p>The purpose of the page is to notify the user that they are leaving "our" site and going to another site. It's basically a disclaimer, but due to resource limitations and time limitations I can'...
<p>This is what I recommend for HTML sanitizing -</p> <p>HTML Whitelist is the latest in the "cool little Python Web service thrown up on App Engine" by my good colleague DeWitt Clinton.</p> <p>It does one thing, and it does it well. You can pass the service HTML and it will return a sanitized version.</p> <p><a hre...
<p>You could add logic to continue page to ensure that it is only called by a page on one of your sites either based on url or IP address. You could also pass a time and hashed code through for added security.</p>
28,619