instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I have a solution with many projects. One project contain few custom components. One of these components is used to display a title on an image. We can change the color of the background and many other things.</p> <p>The problem is IF I decide to change the default color of the background of the component or change...
<p>This is most likely due to <strong><a href="http://msdn.microsoft.com/en-us/library/z6609kte.aspx" rel="nofollow noreferrer">references</a></strong>.</p> <p>Your other projects probably <strong><a href="http://msdn.microsoft.com/en-us/library/ms169644.aspx" rel="nofollow noreferrer">copy in a reference</a></strong>...
<p>My guess is that the designer is smart and remembers the settings for the component as you have it in the designer and thus sees it as the default.</p>
11,135
<p>For explanation imagine a simple address. Written in a HTML paragraph with line breaks it would like this:</p> <pre><code>Street: Example Street 1 City: Vienna Zip Code: 1010 Country: Austria </code></pre> <p>Most of the time that's completely okay, but sometimes I have to achieve the following output:</p> <pre><...
<p>I think you've taken "tables are bad" concept to the extreme. </p> <ul> <li>Tables used purely for layout (when other element would be more semantic) are bad.</li> <li>Tables for tabular data are good. They were intended for that purpose!</li> </ul> <p>What you've got fits very nicely into concept of rows and colu...
<p>No need for tables (not that tables would be really inappropriate in this setting). I do this kind of thing all the time. </p> <pre><code>&lt;div class=DetailsRow&gt; &lt;div class=DetailsLabel&gt;Street&lt;/div&gt; &lt;div class=DetailsContent&gt;123 Main Street&lt;/div&gt; &lt;/div&gt; &lt;div class=DetailsRo...
23,814
<p>I want to practice my skills away from a keyboard (i.e. pen and paper) and I'm after simple practice questions like Fizz Buzz, Print the first N primes.</p> <p>What are your favourite simple programming questions?</p>
<p>I've been working on <a href="http://projecteuler.net/" rel="noreferrer">http://projecteuler.net/</a></p>
<p>Towers of Hannoi is great for practice on recursion.</p> <p>I'd also do a search on sample programming interview questions. </p>
4,982
<p>Reading <a href="http://www.codinghorror.com/blog/archives/001167.html" rel="noreferrer">this blog post about HttpOnly cookies</a> made me start thinking, is it possible for an HttpOnly cookie to be obtained through any form of XSS? Jeff mentions that it "raises the bar considerably" but makes it sound like it doesn...
<p>First, as some others mentioned, XSS <strong>can</strong> allow other payloads, not just cookie stealing. </p> <p>But, <em>is</em> there anyway to steal httpOnly cookies, with XSS? (ignoring the question of httpOnly support?).... The answer is: Yes.<br> A subset of XSS is known as <a href="http://www.owasp.org/ind...
<p>Packet sniffing can read the cookies transmitted over http. But it may not fall under the XSS. </p>
28,235
<p>Say I have:</p> <pre><code>void Render(void(*Call)()) { D3dDevice-&gt;BeginScene(); Call(); D3dDevice-&gt;EndScene(); D3dDevice-&gt;Present(0,0,0,0); } </code></pre> <p>This is fine as long as the function I want to use to render is a function or a <code>static</code> member function:</p> <pre><co...
<p>There are a lot of ways to skin this cat, including templates. My favorite is <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/function.html" rel="nofollow noreferrer">Boost.function</a> as I've found it to be the most flexible in the long run. Also read up on <a href="http://www.boost.org/doc/libs/1_36_0/li...
<p>You can declare a function pointer to a member function of class T using:</p> <pre><code>typedef void (T::*FUNCTIONPOINTERTYPE)(args..) FUNCTIONPOINTERTYPE function; </code></pre> <p>And invoke it as:</p> <pre><code>T* t; FUNCTIONPOINTERTYPE function; (t-&gt;*function)(args..); </code></pre> <p>Extrapolating thi...
8,540
<p>Using the standard win32 api, what's the best way to detect more than one user is logged on? I have an upgrade to our software product that can't be run when more than one user is logged in. (I know this is something to be avoided because of its annoyance factor, but the product is very complicated. You'll have t...
<p>In order to have more than one user logged in at once, Terminal Services or Fast User Switching must be enabled. Since Fast User Switching is implemented using Terminal Services, you first need to find out if the OS has it enabled. You can use <a href="http://msdn.microsoft.com/en-us/library/ms724451.aspx" rel="nore...
<p>This might be a roundabout way, but run down the process list and see who the process owners are.</p>
48,131
<p>My database contains three tables called <code>Object_Table</code>, <code>Data_Table</code> and <code>Link_Table</code>. The link table just contains two columns, the identity of an object record and an identity of a data record.</p> <p>I want to copy the data from <code>DATA_TABLE</code> where it is linked to one ...
<p>In one <em>statement</em>: No.</p> <p>In one <em>transaction</em>: Yes</p> <pre><code>BEGIN TRANSACTION DECLARE @DataID int; INSERT INTO DataTable (Column1 ...) VALUES (....); SELECT @DataID = scope_identity(); INSERT INTO LinkTable VALUES (@ObjectID, @DataID); COMMIT </code></pre> <p>The good news is...
<p>//if you want to insert the same as first table</p> <pre><code>$qry = "INSERT INTO table (one, two, three) VALUES('$one','$two','$three')"; $result = @mysql_query($qry); $qry2 = "INSERT INTO table2 (one,two, three) VVALUES('$one','$two','$three')"; $result = @mysql_query($qry2); </code></pre> <hr> <p>//or if y...
21,107
<p>I remember reading somewhere that you can provide your own icons without having them pass them through the automatic gloss effect when compiling an iphone app, but I can't remember how to do it, and not sure where it was in the docs. Anyone here remembers?</p> <p>thanks!</p>
<p>Add the "UIPrerenderedIcon" to your info.plist file, change it to be a boolean and make it true. (In 2.0 of the iPhone OS you could also leave it as a string and use YES or NO, but that no longer works in 2.1.)</p>
<p>Stephen is correct. The exact syntax that works in 2.1 is:</p> <pre><code> &lt;key&gt;UIPrerenderedIcon&lt;/key&gt; &lt;true/&gt; </code></pre>
29,253
<p>I'm looking for suggestions on how to inject runtime dependencies into JPA entities retrieved from Hibernate. My problem is essentially this:</p> <p>I have a number of different subclasses of a Transaction object. Each Transaction subclass has different behavior when it is executed, and requires a different set of ...
<p>I use guice for transactions, but I use the AOP to carry them out. I have almost no boilerplate, at the expense of a little "magic". As long as your intercepted class is "in the club," it works really well.</p> <pre><code>class BusinessLogic { @Inject public EntityManager em; @Transactional publc void ...
<p>Check: <a href="http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Interceptor.html" rel="nofollow noreferrer">http://www.hibernate.org/hib_docs/v3/api/org/hibernate/Interceptor.html</a></p> <p>Configure your hibernate to use an Intercetor. The method</p> <pre><code>public Object instantiate(String entityName,...
48,708
<p>Many (most?) sites aiming for accessibility and standards compliance use unordered lists for their navigation. Does this make the site more accessible or does it just provide useful elements for styling?</p> <p>I don't mind them, and I have been using unordered lists in this way. It's just that, when I remove the s...
<p>The best markup for your site's navigation would the HTML tag(s) that best represent what your navigation is. This is where rubber meets the road for HTML semantics.</p> <p>Is your navigation a list that doesn't have any logical ordering? If so then <code>&lt;UL&gt;</code> would be a good choice. Is your navigat...
<p>I think this is done for document structure. I've used either UL or div tags; though I've always found more success with UL.</p> <p>Regards,<br> Frank</p>
39,988
<p>What's the best way to implement a URL interpreter / dispatcher, such as found in <a href="http://docs.djangoproject.com/en/dev/topics/http/urls/?from=olddocs" rel="nofollow noreferrer">Django</a> and RoR, in PHP?</p> <p>It should be able to interpret a query string as follows:</p> <ul> <li><code>/users/show/4</co...
<p>If appropriate, you can use one that already exists in an MVC framework.</p> <p>Check out projects such as -- in no particular order -- Zend Framework, CakePHP, Symfony, Code Ignitor, Kohana, Solar and Akelos.</p>
<p>I'm doing a PHP framework that does just what you are describing - taking what Django is doing, and bringing it to PHP, and here's how I'm solving this at the moment:</p> <p>To get the nice and clean RESTful URLs that Django have (<a href="http://example.com/do/this/and/that/" rel="nofollow noreferrer">http://examp...
24,597
<p>I posted a <a href="https://stackoverflow.com/questions/214233/how-scalable-is-linq">similar question</a> on how scalable linq is. There were so many different views on what scalability actually meant in some recent conversations, so it has sparked me to ask this question as well. What does scalability mean to you?<...
<p>I look at scalability from two perspectives:</p> <p><strong>Scaling Up</strong></p> <p>If I add more RAM to the box that something is running on, how much additional performance and capacity do I gain? If one application I have can handle 300 more connections and runs 15% faster when I add 2 GB of RAM to my server...
<p>These days and specially for webapps, but in some cases also for enterprise apps, the horizontal scalability is what you want to have, </p> <p>Can I handle more (traffic, data, processing) by adding more commodity hardware ? even using "cloud servers" amazon ec2, google app engine and similar ? </p>
26,339
<p>My goal is to have a speaker inside a PLA casing to produce a nice hearable sound from a submersible item.</p> <p>I intended to produce that sound from a Piezo buzzer stuck on a membrane held tight in hollow place between two pieces, but the result is unsatisfactory as the sound gets muffled to inaudible levels.</p>...
<p>In space, no one can hear you scream. That's because there's no air to be vibrated, which is part of the definition of sound.</p> <p>In the case of your model, the described diaphragm will generate sound because it is surrounded by air. The vibrations in the air will transfer (and reflect) from the PLA shell you've ...
<p>I did a lot of experimentation in this a couple years ago. The limitation on the sound is the amount of energy you can apply to the plastic, and the ability of the plastic to respond (move to) that energy. I ended up using epoxy to fasten a transducer directly to the plastic wall, and while the sound quality was n...
1,757
<p>I've developed a program that extensively uses wxPython - the wxWindow port for python. </p> <p>Even though it is as mature library it is still very primitive and very programming oriented. Which is time consuming and not flexible at all.</p> <p>I would love to see if there is something like Flex/Action Script whe...
<p><a href="http://wiki.python.org/moin/PyQt" rel="nofollow noreferrer">PyQt</a> with <a href="http://doc.trolltech.com/4.4/stylesheet.html" rel="nofollow noreferrer">Qt style sheets</a> might be a good fit. Naturally, you'd need to re-write quite a bit of your GUI layer for the toolkit change.</p>
<p>You could try XUL, the language the Firefox GUI uses. It's XML styled with CSS and scripted with Javascript.</p> <p><a href="http://www.mozilla.org/projects/xul/" rel="nofollow noreferrer">http://www.mozilla.org/projects/xul/</a><br> <a href="http://en.wikipedia.org/wiki/XUL" rel="nofollow noreferrer">http://en.wi...
18,169
<p>I have a couple applications that I would like to be able to add scheduled tasks from within them. I've been Googling for how to add tasks in both XP and Vista. Apparently, Vista has a new Task Scheduler that is very different from the one in XP.</p> <p>Does anybody know if there is a single API to tackle both of t...
<p>I think you could use the <a href="https://learn.microsoft.com/en-gb/windows/win32/taskschd/task-scheduler-2-0-interfaces" rel="nofollow noreferrer">Task Scheduler COM interface</a>.</p> <p>Also check out <a href="https://www.codeproject.com/Articles/2407/A-New-Task-Scheduler-Class-Library-for-NET" rel="nofollow no...
<p>If I recall correctly, the initial release of Vista used the same API as XP. </p> <p>Server 2008 is supposed to have a much improved scheduler. That would seem to indicate that the API has changed. </p> <p>I mention 2008 because SP1 for Vista brought much of the code in line with Server 2008. </p> <p>Good luc...
17,464
<p>As the title says, whats the difference between</p> <pre><code>MyFunction = function() { } </code></pre> <p>and</p> <pre><code>function MyFunction() { } </code></pre> <p>Nothing?</p> <p><strong>Duplicate:</strong> <a href="https://stackoverflow.com/questions/336859/javascript-var-functionname-function-vs-func...
<p>The first form is actually a variable with an <strong>anonymous function</strong> assigned to it, the second is a <strong>declared function</strong>. </p> <p>They're <em>almost</em> interchangeable, but have some differences: debuggers have a harder time with anons (because they lack a name) and the JS engine can d...
<p>There's one subtle difference on Firefox, when you're declaring a window <code>load</code> event handler. Declaring the following in a script tag only works on Firefox:</p> <pre><code>function onload() { alert(42); } </code></pre> <p>You have to do it like this for IE, Opera, Safari or Chrome:</p> <pre><code>...
49,085
<p>I am currently running into a problem when trying to import an Oracle 9i SQL script into my local Oracle 10g Express database. I am trying to import the <a href="http://en.wikipedia.org/wiki/Data_Definition_Language" rel="nofollow noreferrer">DDL</a> from the 9i database to the 10g express database. I keep getting "...
<p>Make sure you're exporting and importing with the same version of exp and imp and also make sure that that version corresponds to the lower version of both databases, in your case: 9i.</p> <p>Maybe, you should explicitely state the path to imp and exp like /path/to/oracle/bin/exp .</p> <p>Hope this helps Rene</p>
<p>I successfully imported an Oracle 9 export (created with the 'exp' utility) into an Oracle 10 database (using the 'imp' utility) thismorning. It worked perfectly.</p> <p>Can you give more information? e.g. output of the set of commands that you run, an example of the file or any more details?</p>
48,709
<p>I am building a menu in HTML/CSS/JS and I need a way to prevent the text in the menu from being highlighted when double-clicked on. I need a way to pass the id's of several divs into a function and have highlighting turned off within them. </p> <p>So when the user accidentally (or on purpose) double clicks on the m...
<p>In (Mozilla, Firefox, Camino, Safari, Google Chrome) you can use this:</p> <pre><code>div.noSelect { -moz-user-select: none; /* mozilla browsers */ -khtml-user-select: none; /* webkit browsers */ } </code></pre> <p>For IE there is no CSS option, but you can capture the ondragstart event, and return false;</p> <p...
<p>Hope this is what you are looking for.</p> <pre><code>&lt;script type=&quot;text/javascript&quot;&gt; function clearSelection() { var sel; if (document.selection &amp;&amp; document.selection.empty) { document.selection.empty(); } else if (window.getSelection) { sel = window.getSelection();...
16,841
<p>I'm brand new to Erlang. How do you do modulo (get the remainder of a division)? It's % in most C-like languages, but that designates a comment in Erlang.</p> <p>Several people answered with rem, which in most cases is fine. But I'm revisiting this because now I need to use negative numbers and rem gives you the re...
<p>In Erlang, <code>5 rem 3.</code> gives <code>2</code>, and <code>-5 rem 3.</code> gives <code>-2</code>. If I understand your question, you would want <code>-5 rem 3.</code> to give 1 instead, since <code>-5 = -2 * 3 + 1.</code></p> <p>Does this do what you want?</p> <pre><code>mod(X,Y) when X &gt; 0 -&gt; X rem ...
<p>Erlang remainder not works with negative numbers, so you have to write your own function for negative parameters.</p>
46,000
<p>I am all about using ASP.NET MVC, but one of the areas that I hope gets improved on is Client-Side Validation.</p> <p>I know the most recent version (Preview 5) has a lot of new features for Validation, but they all seem to be after the page has been posted.</p> <p>I have seen an interesting article by <a href="ht...
<p><em>"Obviously you'll still need to validate your input on the server side for the small percentage of users who disable javascript."</em></p> <p>Just an update to this comment. Server-side validation has nothing to do with users that run with JavaScript disabled. Instead, it is needed for security reasons, and to ...
<p>LiveValidation is another helpful javascript library that can help out. See an example (with ASP.NET MVC) here:</p> <p><a href="http://blog.codeville.net/2008/09/08/thoughts-on-validation-in-aspnet-mvc-applications/" rel="nofollow noreferrer">http://blog.codeville.net/2008/09/08/thoughts-on-validation-in-aspnet-mv...
18,464
<p>We are look at providing a method for our non-technical users to edit XML and pass it to our existing XML input functionality. I remembered InfoPath saved its data as XML, and took another look at it. It's great the way it allows you to define a form based on an XSD (XML Schema), and then allow the user to edit XM...
<p>You can host the form on to a Sharepoint. InfoPath Forms Services is a server technology built on Microsoft Windows SharePoint Services 3.0 as an ASP.NET version 2.0 application. It enables users to fill out Microsoft Office InfoPath 2007 forms by using a Web browser instead of, or in addition to, the Office InfoPat...
<p>A very customizable way is to provide a WPF UI which databinds to the XML. It shouldn't take a lot of effort to come up with an XML designer in WPF. </p> <p>Of course this assumes that you have the resources/people to do it.</p> <p><a href="http://blogs.msdn.com/wpfsdk/archive/2008/11/25/a-datagrid-sample-using-xm...
39,585
<p>I have some experience making multiplayer <strong>turn-based</strong> games using sockets, but I've never attempted a realtime action game. What kind of extra issues would I have to deal with? Do I need to keep a history of player actions in case lagged players do something in the past? Do I really need to use UDP p...
<ul> <li>'client server' or 'peer to peer' or something in between: which computer has authority over which game actions. </li> </ul> <p>With turn based games, normally it's very easy to just say 'the server has ultimate authority and we're done'. With real time games, often that design is a great place to start, bu...
<p>TCP is fine if your run on a LAN. But if you want to play online, you must use UDP and implement your own TCP-like layer: it's necessary to pass throw NAT routers.</p> <p>You need to choose between Peer-to-peer or Client-Server communication. In Client-Server model, synchronisation and state of the world are easier...
11,580
<p>Normalization leads to many essential and desirable characteristics, including aesthetic pleasure. Besides it is also theoretically "correct". In this context, denormalization is applied as a compromise, a correction to achieve performance. Is there any reason other than performance that a database could be denormal...
<p>The two most common reasons to denormalize are:</p> <ol> <li>Performance</li> <li>Ignorance</li> </ol> <p>The former should be verified with profiling, while the latter should be corrected with a rolled-up newspaper ;-)</p> <p>I would say a better mantra would be "normalize for correctness, denormalize for speed ...
<p>Simplicity? Not sure if Steven is gonna swat me with his newspaper, but where I hang, sometimes the denormalized tables help the reporting/readonly guys get their jobs done without bugging the database/developers all the time...</p>
37,453
<p>How do I change the style (color) of a div such as the following? </p> <pre><code>"&lt;div id=foo class="ed" style="display: &lt;%= ((foo.isTrue) ? string.Empty : "none") %&gt;"&gt; &lt;%= ((foo.isTrue) ? foo.Name: "false foo") %&gt;"` </code></pre>
<p>If you want to alter the color of the div with client side code (javascript) running in the browser, you do something like the following:</p> <pre><code>&lt;script&gt; var fooElement = document.getElementById("foo"); fooElement.style.color = "red"; //to change the font color &lt;/script&gt; </code></pre>
<p>That code fragment doesn't say much - if the code is server-side why don't you change e.g. the class of the HTML element there?</p>
13,441
<p>Is it possible to use overlapped I/O with an anonymous pipe? CreatePipe() does not have any way of specifying FILE_FLAG_OVERLAPPED, so I assume ReadFile() will block, even if I supply an OVERLAPPED-structure. </p>
<p>Here is an implementation for an anonymous pipe function with the possibility to specify FILE_FLAG_OVERLAPPED:</p> <pre><code>/******************************************************************************\ * This is a part of the Microsoft Source Code Samples. * Copyright 1995 - 1997 Microsoft Corpora...
<p>No. As explained <a href="http://msdn.microsoft.com/en-us/library/aa365141%28VS.85%29.aspx" rel="noreferrer">here</a>, anonymous pipes do not support asynchronous I/O. You need to use a named pipe. There's example code to do this on MSDN <a href="http://msdn.microsoft.com/en-us/library/aa365603%28VS.85%29.aspx" rel=...
8,556
<p><br /> I need to send MMS thought a C# application. I have already found 2 interesting components: <a href="http://www.winwap.com" rel="nofollow noreferrer">http://www.winwap.com</a><br /> <a href="http://www.nowsms.com" rel="nofollow noreferrer">http://www.nowsms.com</a></p> <p>Does anyone have experience with oth...
<p>Typically I have always done this using a 3rd party aggregator. The messages are compiled into SMIL, which is the description language for the MMS messages. These are then sent on to the aggregator who will then send them through the MMS gateway of the Network Operator. They are typically charged on a per message...
<p>You could use Twilio to accomplish this. You can <a href="https://www.twilio.com/docs/quickstart/csharp/sms/sending-via-rest" rel="nofollow">dive into the docs</a> for specific implementation details but using the <a href="https://www.twilio.com/docs/csharp/install" rel="nofollow">C# helper library</a> the code to s...
7,769
<p>I want to combine two structures with differing fields names.</p> <p>For example, starting with:</p> <pre><code>A.field1 = 1; A.field2 = 'a'; B.field3 = 2; B.field4 = 'b'; </code></pre> <p>I would like to have:</p> <pre><code>C.field1 = 1; C.field2 = 'a'; C.field3 = 2; C.field4 = 'b'; </code></pre> <p>Is there...
<p>Without collisions, you can do </p> <pre><code>M = [fieldnames(A)' fieldnames(B)'; struct2cell(A)' struct2cell(B)']; C=struct(M{:}); </code></pre> <p>And this is reasonably efficient. However, <code>struct</code> errors on duplicate fieldnames, and pre-checking for them using <code>unique</code> kills performance ...
<p>In C, a struct can have another struct as one of it's members. While this isn't exactly the same as what you're asking, you could end up either with a situation where one struct contains another, or one struct contains two structs, both of which hold parts of the info that you wanted.</p> <p>psuedocode: i don't re...
5,956
<p>I'm trying to get an object element from my webpage using getElementById (ultimately so I can replace it with a dynamically created object element) but it is returning <code>null</code> in IE6.</p> <p>In the following code, the <code>byId()</code> function returns <code>null</code> in IE but an <code>[object HTMLOb...
<p>This is because of the way IE treats &lt;object&gt; nodes vis-a-vis the DOM.</p> <p>Since you're dynamically replacing anyway I recommend you instead create a &lt;div&gt; where you need it and change the innerHTML to be the HTML for the object you require.</p>
<p>In IE6, it may not work. For refer: <a href="https://msdn.microsoft.com/en-us/library/ie/ms536437%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396" rel="nofollow">https://msdn.microsoft.com/en-us/library/ie/ms536437%28v=vs.85%29.aspx?f=255&amp;MSPPError=-2147217396</a><a href="http://note.taable.com" rel="nofollow"...
43,400
<p>Is there a fool-proof way to pull out all the risks involved in a project? And does it differ depending on the type of projects your working on (ie: website, client/server...)?</p>
<p>"Does [risk] differ depending on the type of projects [you're] working on?"</p> <p>Yes, absolutely. There are several universal risks for software projects (lack of managerial commitment, poor communication, etc.), but risk "profiles" differ with context. The risks of a videogame project, say, are very different th...
<p>I liked very much this article: <a href="http://www.cigital.com/papers/download/bsi3-risk.pdf" rel="nofollow noreferrer">Risk Analysis in Software Design</a>(PDF), take a look to it, gives a good overview about Risk Analysis, but I think that there is no fool-proof way , it really depends on your environment...</p>...
32,000
<p>I am looking for a (simple) text editor that can handle text in different encodings in the same document.</p> <p>I need to develop some sites with mixed Japanese and English text and the editors I have now (on an English Windows system) are unable to display the Japanese text. Jedit files don't display the Japanese...
<p>Notepad++ is highly recommended.</p>
<p>EditPad Pro ... is recommended for u</p> <p>cheers ;)</p>
26,684
<p>PHP (among others) will execute the deepest function first, working its way out. For example,</p> <pre><code>$text = strtoupper(str_replace('_', ' ', file_get_contents('file.txt'))); </code></pre> <p>I'm doing something very similar to the above example for a template parser. It looks for the tags</p> <pre><code>...
<p>I'm not sure I understand the nesting in your example, as the example doesn't demonstrate a purpose behind nesting. Your example input could very easily be</p> <pre><code>'This is my test {@a} {@b} string.' </code></pre> <p>And using arrays in str_replace would handle this very simply and quickly.</p> <pre><code...
<p>At least in the given example, I don't understand why the @b token would be nested in the @a token. The two don't seem to have any need for each other. Are you trying to do something like this in Perl?</p> <pre><code>$a = "b"; $b = "Hello World!"; print $$a; </code></pre> <p>output would then be "Hello World"</...
31,339
<p>I need to integrate a email client in my current python web app. Anything available?</p> <p>L.E.: I'm building my app on top of CherryPy</p>
<p>For others who might find this thread, check out <a href="http://www.mailpile.is/" rel="nofollow">Mailpile</a>. I haven't used it yet, it is a python-based mail client, and I am sure it could be modified to work as a webmail app as well.</p>
<p>You can build one, using <a href="http://docs.python.org/library/email.html" rel="nofollow noreferrer">email</a> for generating and parsing mail, <a href="http://docs.python.org/library/imaplib.html#module-imaplib" rel="nofollow noreferrer">imaplib</a> for reading (and managing) incoming mail from your mail server, ...
29,231
<p>I have a web page where the user select a Company and with that I keep the Company name in memory though a Session but when I go to the next page the Session only last like 5 minutes? Any reason why and how I can fix this, I did extend the Session state in the Web.config but that did not work.</p> <p>Example: Sessi...
<p>from your comment I see that you think your site is in a load-balancing server farm. </p> <p>in this case you need to store your session in db or avoid using it: you cannot be sure that the same server will serve the same user each time he does a postback, and if the user goes from server "A" to server "B" in two d...
<p>could there be some antivirus on the server that's causing the web app to reset itself every 5 minutes, with the ASP.NET runtime thinking either the binaries or the web.config has changed? that is also possible.</p>
32,209
<p>Please suggest some good resources to start writing Java Web services.</p>
<p>The standard way in Java to write a web service is to use Apache Axis.</p> <p>If you are generating a web service client, then you need the WSDL (.xsd, .wsdl, etc) of the foreign web service, and then you can use wsdl2java (or preferably, the ANT task provided by axis-ant) to simply generate the code to do the comm...
<p>Check out <a href="http://oreilly.com/catalog/9781565924833/" rel="nofollow noreferrer" title="Java Enterprise in a nutshell">Java Enterprise in a nutshell</a> it has a good section on web services, describing both the J2EE framework specification and also the Apache Axis implementation. Bear in mind that, while it ...
14,574
<p>In a html page we use the head tag to add reference to our external .js files .. we can also include script tags in the body .. But how do we include our external .js file in a web user control?</p> <p>After little googling I got this. It works but is this the only way?</p> <pre><code>ScriptManager.RegisterStartup...
<p>You can also use</p> <pre><code>Page.ClientScript.RegisterClientScriptInclude("key", "path/to/script.js"); </code></pre> <p>That's the way I always do it anyway</p>
<blockquote> <p>Yes this works too .. but why does all the script gets dumped in the body and not in the head??</p> </blockquote> <p>There's a potential workaround for that <a href="http://www.codeproject.com/KB/aspnet/scriptregister.aspx" rel="nofollow noreferrer">here</a></p>
35,423
<p>In our code we used to have something like this:</p> <pre><code> *(controller-&gt;bigstruct) = ( struct bigstruct ){ 0 }; </code></pre> <p>This used to work great, and then we upgraded versions of GCC and suddenly started seeing stack overflows. Looking at the assembly, the old GCC code (2.x) was basically doing...
<p>memset is the way to go. You do not have many alternatives.</p> <p>Do something like:</p> <pre><code>#define InitStruct(var, type) type var; memset(&amp;var, 0, sizeof(type)) </code></pre> <p>So that you only have to:</p> <pre><code>InitStruct(st, BigStruct); </code></pre> <p>And then use st as usual... </p> <...
<p>hmm - first of all making an init function and setting each member explicitly IS THE RIGHT THING - it,s the way constructors in OO languages work.</p> <p>and second - does anyone know a hardware that implements non IEEE floating point numbers ? - perhaps Commodore 64 or somethig ;-)</p>
21,371
<p>Sometimes coloring a logfile or other gives a good overview when looking for <em>stuff</em> and <em>behaviors</em></p> <p>I just saw that grep have a coloring feature</p> <pre><code>grep -C 99999 --color &lt;regexp&gt; &lt;filename&gt; </code></pre> <p>What other methods are there?</p>
<p>For searching source code, I use <a href="http://petdance.com/ack/" rel="noreferrer">ack</a>. It's got a lot of options that make sense for searching code (such as automatically ignoring SCM directories).</p>
<p>We use <a href="http://www.baremetalsoft.com/baretail/" rel="nofollow noreferrer">baretail</a>, now if they added color to their <a href="http://www.baremetalsoft.com/baregrep/index.php" rel="nofollow noreferrer">baregrep</a>, that would be nice.</p>
16,754
<p>I keep having a recurring problem with my ender 3 pro. The bowden tube keeps popping off here (pictured)</p> <p><a href="https://i.stack.imgur.com/hWvUQ.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/hWvUQ.jpg" alt="enter image description here" /></a></p> <p>I've read elsewhere online where peo...
<p>If the fitting is remaining attached to the PTFE tubing, that would indicate that the threaded end of the fitting is pulling out of the drive assembly. This implies that the internal threads of the drive assembly have stripped out. This is not unusual for a plastic drive assembly.</p> <p>The best solution is to repl...
<p>If the fitting is remaining attached to the PTFE tubing, that would indicate that the threaded end of the fitting is pulling out of the drive assembly. This implies that the internal threads of the drive assembly have stripped out. This is not unusual for a plastic drive assembly.</p> <p>The best solution is to repl...
1,818
<p>OK, so I'm trying to teach myself the CakePHP framework, and I'm trying to knock up a simple demo app for myself.</p> <p>I have the controllers, views and models all set up and working, but I want to do something slightly more than the basic online help shows.</p> <p>I have a guitars_controller.php file as follows...
<p>These actions are model agnostic so can be put in your app/app_controller.php file</p> <pre><code>&lt;?php class AppController extends Controller { function index() { $this-&gt;set(Inflector::variable($this-&gt;name), $this-&gt;{$this-&gt;modelClass}-&gt;findAll()); $this-&gt;pageTitle = 'All '....
<pre><code>$this-&gt;pageTitle = $this-&gt;Guitar-&gt;Name; </code></pre> <p>It should go in the View though, I don't PHP, or cakePHP, but thats something a view should do, not the controller.</p>
23,408
<p>I've got a Repeater that lists all the <code>web.sitemap</code> child pages on an ASP.NET page. Its <code>DataSource</code> is a <code>SiteMapNodeCollection</code>. But, I don't want my registration form page to show up there.</p> <pre><code>Dim Children As SiteMapNodeCollection = SiteMap.CurrentNode.ChildNodes ...
<p>Your shouldn't need CType</p> <pre><code>Dim children = _ From n In SiteMap.CurrentNode.ChildNodes.Cast(Of SiteMapNode)() _ Where n.Url &lt;&gt; "/Registration.aspx" _ Select n </code></pre>
<p>I got it to work with code below:</p> <pre><code>Dim children = From n In SiteMap.CurrentNode.ChildNodes _ Where CType(n, SiteMapNode).Url &lt;&gt; "/Registration.aspx" _ Select n RepeaterSubordinatePages.DataSource = children </code></pre> <p>Is there a better way where I don't have ...
3,334
<p>I have the function</p> <pre><code>sublist(_,[_],_) :- !. sublist(X,[Y|T],Z) :- R is X - Y, sublist(X,T,[R|Z]). </code></pre> <p>an example call is <code>sublist(2,[1,2,3],Z)</code>. At the end of execution it just gives me 'yes', but i'd like to see the contents of Z.</p> <p>I know it's something sim...
<p>I'm also going to assume that sublist/3 is supposed to subtract a number from all items in the list.</p> <p>The reason you're not getting any result for Z is because you're building the list on the way into the recursion. Which means that when the stopping predicate succeeds, Prolog works it's way back out of the r...
<p>You don't really specify what <code>sublist/3</code> is supposed to do but maybe you mean this:</p> <pre><code>sublist(_, [], []) :- !. sublist(X, [Y | T], [R | Z]) :- R is X - Y, sublist(X, T, Z). </code></pre> <p>Usage example:</p> <pre><code>?- sublist(2, [1, 2, 3], Z). Z = [1, 0, -1]. </code></pre> ...
49,494
<p>I just don't know that, is there any technical reason for that? Is it more difficult to implement a compiler for a language with weak typing? What is it?</p>
<p><strong>The premises behind the question are a bit dodgy</strong>. It is not true that interpreted languages are mostly ducktyped. It is not true that compiled languages mostly have strong typing. The <strong>type system is a property of a language</strong>. <strong>Compiled versus interpreted is a property of a...
<p>A guess:</p> <p>In a compiled language, one system (the compiler) gets to see all the code required to do strong typing. Interpreters generally only see a tiny bit of the program at a time, and so can't do that sort of cross checking.</p> <p>But this isn't a hard and fast rule - it would be quite possible to make...
49,302
<p>Based on the response to this question: <a href="https://stackoverflow.com/questions/333889/in-c-why-have-header-files-and-cpp-files">Why does C++ have header files and CPP</a></p> <p>I have seen the responses and understand the answers - so why didn't this catch on? C# Java?</p>
<p>Because it's a quick, dirty and inelegant solution to the problem of interface vs. implementation.</p> <p>It relies entirely on the C Preprocessor, which is about the bluntest tool in the drawer.</p> <p>Other solutions avoid the following problems:</p> <ul> <li>Two files where one will do</li> <li>Duplicate symbo...
<p>Most other languages aren't nearly as obtuse and difficult to parse and compile as C++, so there the "performance optimization" of separating header and implementation is not so important.</p>
43,291
<p>Earlier today I was hunting down a very weird bug... I finally traced it down to what seems to be causing the problem.</p> <p>The original report can be found here: <a href="https://stackoverflow.com/questions/262017/weird-behaviour-when-running-clickonce-deployed-version-of-wpf-application">original question</a></...
<p>Having a property open a database connection and run a query is not a good pattern. </p> <p>A better approach would be to query a set of objects from LINQ to SQL and bind those to the WPF control instead.</p>
<p>I agree with Damien, why dont you execute the DB call asynchronously? That way the UI stays responsive and you can handle DB errors in the background gracefully without the user knowing...</p>
33,009
<p>I basically need to highlight a particular word in a block of text. For example, pretend I wanted to highlight the word &quot;dolor&quot; in this text:</p> <pre class="lang-html prettyprint-override"><code>&lt;p&gt; Lorem ipsum dolor sit amet, consectetuer adipiscing elit. &lt;/p&gt; &lt;p&gt; Quisque bibend...
<p><del>Try <a href="http://johannburkard.de/blog/programming/javascript/highlight-javascript-text-higlighting-jquery-plugin.html" rel="nofollow noreferrer">highlight: JavaScript text highlighting jQuery plugin</a>.</del> <strong>Warning: The source code available on this page contains a cryptocurrency mining script, e...
<p>Is it possible to get this above example:</p> <pre><code>jQuery.fn.highlight = function (str, className) { var regex = new RegExp(str, "g"); return this.each(function () { this.innerHTML = this.innerHTML.replace( regex, "&lt;span class=\"" + className + "\"&gt;" + str + ...
14,527
<p>Suppose I use the [RemoteClass] tag to endow a custom Flex class with serialization intelligence. </p> <p>What happens when I need to change my object (add a new field, remove a field, rename a field, etc)?</p> <p>Is there a design pattern for handling this in an elegant way?</p>
<p>Your best bet is to do code generation against your backend classes to generation ActionScript counterparts for them. If you generate a base class with all of your object properties and then create a subclass for it which is never modified, you can still add custom code while regenerating only the parts of your cla...
<p>Adding or removing generally works. </p> <p>You'll get runtime warnings in your trace about properties either being missing or not found, but any data that is transferred and has a place to go will still get there. You need to keep this in mind while developing as not all your fields might have valid data.</p> <p...
15,039
<p>Is it possible to use a CHECK constraint to prevent any date that falls on a Sunday? I don't want to use a trigger.</p>
<p>Yes, a check constraint can check that the day of the week is not Sunday. Here's an example:</p> <pre><code>create table date_test (entry_date date); alter table date_test add constraint day_is_not_sunday check ( to_char(entry_date,'DAY','NLS_DATE_LANGUAGE = ENGLISH') not like 'SUNDAY%'); </code></pre> <p...
<p>Not sure about the actual constraint, but you can use the function:</p> <pre><code>TO_CHAR(sysdate, 'D'); </code></pre> <p>to get the day of the week as an integer, then do a small check on it </p>
23,836
<p>I'm fairly new to Visual Studio and am wondering how best to plan for translation in a new project I'm starting. I need to provide English, German and French.</p> <p>I have used Eclipse a lot in the past and there I just developed a new app and when it was complete I could just start a wizard to externalise strings...
<p>It depends on the technology you use: Win32/MFC, .NET, ...</p> <p>For MFC apps, this <a href="http://www.codeproject.com/KB/string/stringtable.aspx" rel="nofollow noreferrer">CodeProject article</a> of mine might be helpful to retrieve strings from resources (the String Table). And <a href="http://www.codeproject.c...
<p>I can thoroughly recommend reading <a href="http://www.amazon.co.uk/NET-Internationalization-Developers-Guide-Building/dp/0321341384/ref=sr_1_1?ie=UTF8&amp;s=books&amp;qid=1224053397&amp;sr=8-1" rel="nofollow noreferrer">.Net Internationalization</a> by Guy Smith-Ferrier.</p> <p>It covers the application globalisati...
24,942
<p>Usually, I need to retrieve data from a table in some range; for example, a separate page for each search result. In MySQL I use LIMIT keyword but in DB2 I don't know. Now I use this query for retrieve range of data.</p> <pre><code>SELECT * FROM( SELECT SMALLINT(RANK() OVER(ORDER BY NAME DESC)) AS RUNNI...
<p>My requirement have been added into DB2 9.7.2 already.</p> <p>DB2 9.7.2 adds new syntax for limit query result as illustrate below:</p> <pre><code>SELECT * FROM TABLE LIMIT 5 OFFSET 20 </code></pre> <p>the database will retrieve result from row no. 21 - 25 </p>
<p>It's simple, to make a pagination just follow the syntax.</p> <pre><code>LIMIT (pageSize) OFFSET ((currentPage) * (pageSize)) </code></pre>
33,336
<p>I want to know how to set a Publishing page content through the code (MOSS 2007).<br> This is how I've created the page:</p> <pre><code>PublishingPage page = publishingWeb.GetPublishingPages().Add("MyPage.aspx", pageLayout); SPFile pageFile = page.ListItem.File; page.Title = "My Page"; page.Upda...
<p>I don't know if it's <strong>ok</strong> to answer my own question, but after reflecting Sharepoint's codebehind I was able to find a way to set the page's content:</p> <pre><code>string content = "Welcome to &lt;strong&gt;My Page&lt;/strong&gt;"; page.ListItem[FieldId.PublishingPageContent] = content; </code></pre...
<p>Personally I think you might be going about it the wrong way.</p> <p>Why not instead wrap your code in a feature, that could even contain the physical aspx file, having the page content is optional though. </p> <p>You could then add the page to the standard pages document libary that comes with SharePoint when the...
41,963
<p>I am currently using Rails 2.1.0 and want to upgrade to Rails 2.1.1. After issuing the following command </p> <pre><code>gem update rails </code></pre> <p>I suppose that I need to change this line </p> <pre><code>RAILS_GEM_VERSION = '2.1.0' unless defined? RAILS_GEM_VERSION </code></pre> <p>in environment.rb</p>...
<p>You'll also need to go into your application directory and run the following command:</p> <p>rake rails:update</p> <p>Then run your tests and make sure everything works.</p>
<p>As far as I know, that right there defines what version of rails your application as a whole will use. I know for a project I'm in right now I had to override that to 2.1.1 to work on my VM because I had installed the latest, and had not specified the 2.1.0 as required by the project.</p> <p>The biggest thing you h...
22,314
<p>I have been trying to find an easy way to parse a search query and convert it to an SQL query for my DB. </p> <p>I have found two solutions:</p> <ol> <li><em><a href="https://lucene.apache.org/" rel="nofollow noreferrer">Lucene</a></em>: Powerful Java-based search engine, contains a query parser but it isn't very ...
<p>What exactly do you have in mind? I've used Lucene for text-searching, but where it excels is building an index and searching that <em>instead</em> of hitting the database at all.</p> <p>I recently set up an system where I index a table in Lucene by concatenating all the columns (separated by spaces) into one fiel...
<p>String [] array;</p> <pre><code>int checkWord(String searchWord) { for(int i = 0; i &lt; array.length; i++) { if(searchWord.equals(array[i])) return i; } return 0; } </code></pre>
3,480
<p>I would like to use my laptop as a web development (PHP, Python, etc.) machine, but I'm hesitant to do this unless I can ensure that it can not be accessed by the outside world.</p> <p>I'm guessing that something more than a firewall is necessary, such as configurations to the Apache configuration files, but I'm no...
<p>You need to configure the server daemon to only bind to localhost using the Listen directive like this:</p> <pre><code>Listen 127.0.0.1 </code></pre> <p>An alternative is to configure access control for the main server like this</p> <pre><code>&lt;Directory "/var/www/localhost/htdocs"&gt; AllowOverride None Deny ...
<p>Put a router between you and the internet, and don't forward any ports to your laptop. That way anyone trying to access the laptop hits the router and can't get any further.</p> <p>You can forward ports to your main machine (or just put the main machine in the DMZ) if you need it to be available to incoming connect...
14,242
<p>Has anyone done this? Basically, I want to use the html by keeping basic tags such as h1, h2, em, etc; clean all non http addresses in the img and a tags; and HTMLEncode every other tag. </p> <p>I'm stuck at the HTML Encoding part. I know to remove a node you do a "node.ParentNode.RemoveChild(node);" where node ...
<p>You would need to remove the node representing the element you don't want. The encoded HTML would then need to be re-added as a text node.</p> <p>If you don't want to process the children of the elements that you want to throw away, you should be able to just use OuterHtml ... something like this might work:</p> <...
<p>The answer above pretty much covers it. There's one thing to add, though.</p> <p>You don't want to change a particular node, but all of them, so the code above will probably be a method, wrapped in an if statement ( to make sure it's a tag you want to HtmlEncode ). More to the point, since Agility Pack doesn't ex...
14,989
<p>I am attempting to read a large XML document and I wanted to do it in chunks vs <code>XmlDocument</code>'s way of reading the entire file into memory. I know I can use <code>XmlTextReader</code> to do this but I was wondering if anyone has used SAX for .NET? I know Java developers swear by it and I was wondering if ...
<p>If you're talking about <a href="http://saxdotnet.sourceforge.net/" rel="noreferrer">SAX for .NET</a>, the project doesn't appear to be maintained. The last release was more than 2 years ago. Maybe they got it perfect on the last release, but I wouldn't bet on it. The author, Karl Waclawek, seems to have disappea...
<p>I believe there are no benefits using SAX at least due two reasons:</p> <ol> <li>SAX is a "push" model while XmlReader is a pull parser that has <a href="http://msdn.microsoft.com/en-us/library/sbw89de7(VS.71).aspx" rel="noreferrer">a number of benefits</a>.</li> <li>Being dependent on a 3rd-party library rather th...
15,561
<p>Given two date ranges, what is the simplest or most efficient way to determine whether the two date ranges overlap?</p> <p>As an example, suppose we have ranges denoted by DateTime variables <code>StartDate1</code> to <code>EndDate1</code> <em>and</em> <code>StartDate2</code> to <code>EndDate2</code>.</p>
<p><strong>(StartA &lt;= EndB) and (EndA &gt;= StartB)</strong></p> <p><em>Proof:</em><br /> Let ConditionA Mean that DateRange A Completely After DateRange B</p> <pre><code>_ |---- DateRange A ------| |---Date Range B -----| _ </code></pre> <p>(True if <code>StartA &gt...
<p>Here is a generic method that can be usefull locally.</p> <pre><code> // Takes a list and returns all records that have overlapping time ranges. public static IEnumerable&lt;T&gt; GetOverlappedTimes&lt;T&gt;(IEnumerable&lt;T&gt; list, Func&lt;T, bool&gt; filter, Func&lt;T,DateTime&gt; start, Func&lt;T, DateT...
42,225
<p>I've looked into and considered many JavaScript unit tests and testing tools, but have been unable to find a suitable option to remain fully TDD compliant. So, is there a JavaScript unit test tool that is fully TDD compliant?</p>
<h2><a href="http://karma-runner.github.io" rel="nofollow noreferrer">Karma</a> or <a href="http://angular.github.io/protractor/#/" rel="nofollow noreferrer">Protractor</a></h2> <p>Karma is a JavaScript test-runner built with Node.js and meant for unit testing.</p> <p>The Protractor is for end-to-end testing and uses S...
<p><a href="http://mochikit.com/" rel="nofollow noreferrer">MochiKit</a> has a testing framework called SimpleTest that seems to have caught on. Here's a <a href="http://blog.leosoto.com/2008/10/interesting-open-source-surprises.html" rel="nofollow noreferrer">blog post from the original author</a>.</p>
38,581
<p>I have a 3D printed object that I'd like to print on. Adhesive stickers are an option, but as the surface is rounded it's difficult to get a good film to stick well. </p> <p>Is there any system to print on a 3D object (e.g. ink jet). I need at least 300dpi. Black in the first instance, but color would be nice for f...
<p>Rather than post a series of links for various services and vendors, consider to use as a search term "hydrographic film at home" to find results to suit your purpose. The first search results I found excluded "at home" and indicated it was not suited for home/hobbyist use, but the modification resulted in vendors s...
<p>There are printer types that can print images into the material as it's being printed. SLA and SLS type printers are capable of this but I believe Polyjet printers are the best suited.</p> <p>At 300 dpi though you might be pushing the edge of what is capable. to get that fine of detail your best option may be to loo...
582
<p>The following code works great in IE, but not in FF or Safari. I can't for the life of me work out why. The code is <em>supposed</em> to disable radio buttons if you select the &quot;Disable 2 radio buttons&quot; option. It should enable the radio buttons if you select the &quot;Enable both radio buttons&quot; op...
<p>To get FF to mimic IE's behavior when using the keyboard, you can use the keyup event on the select box. In your example (I am not a fan of attaching event handlers this way, but that's another topic), it would be like this:</p> <pre><code>&lt;select name="user" id="selUser" onchange="javascript:SetLocationOptions(...
<p>Why not grab one of the AJAX scripting libraries, they abstract away a lot of the cross browser DOM scripting black magic and make life a hell of a lot easier.</p>
2,819
<p>At my day job we have load balanced web servers which talk to load balanced app servers via web services (and lately WCF). At any given time, we have 4-6 different teams that have the ability to add new web sites or services or consume existing services. We probably have about 20-30 different web applications and co...
<p>The easiest way is to look through the logs, but if that doesn't include the referrer than you may also want to monitor what is going out from your web to the app server. You can use tools like Wireshark or Microsoft Network Monitor to see this traffic.</p> <p>The other "solution" and I use this loosely is to bind...
<p>You need a service registry (UDDI??)... If you had a means to catalog these services and their consumers, it would make this job of dependency discovery a lot easier. That is not an easy solution, though. It takes time and documentation to get a catalog in place.</p> <p>I think the quickest solution would be to que...
6,641
<p>I'm fairly new to MVC coming from a php background where I designed by view and created pages when I needed something like say a login form. I'd have a file called login. This only sucked when I needed a new login form to login a different type of user. Say an admin. I'd then have to create a new page called log...
<p>I use one controller per "area of concern".. That's sort of arbitrary, and generally is a slightly larger category, based in the domain model, that includes multiple objects. </p> <p>In other words, lets say in your domain model you have security as one of your areas of concern. It might involve many views, and man...
<p>Controllers are more like a section of code from where invocations are triggered. In a well encapsulated code, the methods that modify the model are present close to the model (in the same domain object). The invocation point is however is seperated (not part of the same domain object). </p> <p>Some frameworks like...
22,384
<p>Is there any way to automatically wrap comments at the 80-column boundary as you type them? ..or failing that, any way to display a faint line at the coulmn 80 boundary to make wrapping them manually a little easier?</p> <p>Several other IDEs I use have one or other of those functions and it makes writing comments ...
<p>Take a look at the question here: <a href="https://stackoverflow.com/questions/100420/hidden-features-of-visual-studio-2005-2008">Hidden Features of Visual Studio (2005-2010)?</a></p> <p>It shows how to do that:</p> <p>"Under "HKEY_CURRENT_USER\Software\Microsoft\VisualStudio\8.0\Text Editor" Create a String calle...
<p>By the way, in addition to the rightmost guide as per comments above, I also set lower contrast guides for columns 4, 8, 12, 16 etc. This really helps with code readability.</p>
16,799
<p>Does iPhone support XML-RPC, Is their any open source framework which I can use?</p>
<p>Checkout the source for the wordpress app. They might be using XML-RPC. :)</p> <p><a href="http://iphone.wordpress.org/" rel="nofollow noreferrer">http://iphone.wordpress.org/</a></p>
<p><a href="https://stackoverflow.com/questions/147062/does-iphone-support-xml-rpc#147071">"Airsource Ltd"</a> is really <em>really</em> <em>incredibly</em> wrong about that document. That document is specific to Mac OS X and <em>NOT</em> the iPhone. In fact (almost) all Apple iPhone documentation is hidden away behind...
17,706
<p>My scheduled reports in SQL server won't run. I checked the logs and found the job that was failing. The error message in the log was:</p> <blockquote> <p>'EXECUTE AS LOGIN' failed for the requested login 'NT AUTHORITY\NETWORK SERVICE'. The step failed. </p> </blockquote> <p>I'm using SQL authentication for t...
<p>I found the answer here: <a href="http://www.themssforum.com/SVCS/Unable-execute/" rel="nofollow noreferrer">http://www.themssforum.com/SVCS/Unable-execute/</a></p> <p>Apperently there was something wrong with the login for 'NT AUTHORITY\NETWORK SERVICE' and it wouldn't run the jobs it owned properly. Anyone unders...
<p>Can you check the permissions for your Network Service account? Specifically make sure they have the "Act as part of the OS" permission. If I'm reading the error message correctly, it looks like the NT AUTHORITY\NETWORK SERVICE account failed to execute as a logged on user. It doesn't look like it ever got to the ...
3,537
<p>Ignoring payload size, what is relative difference in latency between an in-proc call (say in C++ or Java), a socket call to a process on the same machine, and a socket call to a process on another machine? This can be expressed as a minimum latency in ns/ms or in terms of relative orders of magnitude. </p> <p>I'm ...
<p>That is a good idea... not precise, but it gives the rough ratios:</p> <p>method call -- ~100s ns synchronized method call -- ~1000s ns reflective method call -- low ~10,000s ns</p> <p>machine loopback -- ~30,000-150,000 ns</p> <p>local sub-network -- 1-2 ms</p> <p>internet -- 30-100 ms</p>
<p>does pinging your local machine and pinging a remote machine give you any sense of relationship? A method call would of course be the other measurement. </p>
43,568
<p>I installed Mono on my iMac last night and I immidiately had a change of heart! I don't think Mono is ready for prime time. </p> <p>The Mono website says to run the following script to uninstall:</p> <pre><code>#!/bin/sh -x #This script removes Mono from an OS X System. It must be run as root rm -r /Library/Frame...
<p>The above script simply deletes everything related to Mono on your system -- and since the developers wrote it, I'm sure they didn't miss anything :) Unlike some other operating systems made by software companies that rhyme with "Macrosoft", uninstalling software in OS X is as simple as deleting the files, 99% of th...
<p>I just deleted the mono.frameworks folder. I got tired of answering "yes" billions of times...</p>
10,054
<p>Let me clear what is state information of a project:</p> <ul> <li><p>Any information that have to remembered or written and then retrieved when one resume its work on a project (for example, on the next morning when arrives at work, or at the evening when start to work on the side project).</p></li> <li><p>For exam...
<p>try Notepad.exe, one log document per project. Or use Word. Or a wiki, Or whatever.</p> <p>the key is not to find fancy software, the key is the self-discipline to keep the log up to date!</p>
<p>If you need to share the information, a Wiki works really well for this "tribal knowledge" type information you are looking to remember.</p> <p>If it's just for yourself, then the other answers given here work really well.</p>
33,321
<p>Lets say that I have 10,000 regexes and one string and I want to find out if the string matches any of them and get all the matches. The trivial way to do it would be to just query the string one by one against all regexes. Is there a faster,more efficient way to do it? </p> <p>EDIT: I have tried substituting it wi...
<p>We had to do this on a product I worked on once. The answer was to compile all your regexes together into a <a href="http://en.wikipedia.org/wiki/Deterministic_finite_automaton" rel="noreferrer">Deterministic Finite State Machine</a> (also known as a deterministic finite automaton or <strong>DFA</strong>). The DFA...
<p>Try combining them into one big regex?</p>
23,451
<p>Can anybody suggest programming examples that illustrate recursive functions? There are the usual old horses such as <strong><em>Fibonacci series</em></strong> and <strong><em>Towers of Hanoi</em></strong>, but anything besides them would be fun.</p>
<p><a href="http://everything2.com/index.pl?node_id=477013" rel="noreferrer">This illustration</a> is in English, rather than an actual programming language, but is useful for explaining the process in a non-technical way:</p> <pre> A child couldn't sleep, so her mother told a story about a little frog, who couldn't...
<p>Translate a spreadsheet column index to a column name. </p> <p>It's trickier than it sounds, because spreadsheet columns don't handle the '0' digit properly. For example, if you take A-Z as digits when you increment from Z to AA it would be like going from 9 to 11 or 9 to 00 instead of 10 (depending on whether A ...
15,419
<p>Is there an NSIS var to get the path of the currently running installer?</p>
<p>Found it: $EXEPATH</p>
<p>There are few useful variables:</p> <ul> <li><code>$EXEPATH</code> - holds installer filename.</li> <li><code>$EXEDIR</code> - holds the complete path to the installer.</li> </ul> <p>So according to the topic</p> <blockquote> <p>NSIS get <strong>path</strong> of current installer file that is running</p> </bloc...
17,001
<p>Where can I find the IIS object schema? All I found from MSDN was a picture of the class hierarchy.</p> <p>To be clear, I want to configure IIS through either WMI or ADSI and I'm looking for something like <a href="http://msdn.microsoft.com/en-us/library/ms675085(VS.85).aspx" rel="nofollow noreferrer">the Active Di...
<p>While I can't point you to a definitive document, you might find this even better: WMI code creator: <a href="http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-ea15-4661-8da4-55bbc145c30e&amp;DisplayLang=en" rel="nofollow noreferrer">http://www.microsoft.com/downloads/details.aspx?FamilyID=2cc30a64-e...
<p>Can't you find some information here : <a href="http://msdn.microsoft.com/en-us/library/aa737439.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/aa737439.aspx</a> ?</p>
14,566
<p>I have a MOSS 07 site that is configured for anonymous access. There is a document library within this site that also has anonymous access enabled. When an anonymous user clicks on a PDF file in this library, he or she can read or download it with no problem. When a user clicks on an Office document, he or she is pr...
<p>To disable login prompt opening office documents from SharePoint 2010 do the following settings in web.config</p> <pre><code>&lt;system.webServer&gt; &lt;security&gt; &lt;requestFiltering allowDoubleEscaping="true"&gt; &lt;!-- here's where the magic happens --&gt; &lt;verbs allowUnlisted="true"&gt...
<p>My guess is that the Office client is loading the underlying document template from another location where anonymous access is enabled. This also explains why you can still open the document as the Office client can also work without loading the template the document was originally created from. To see the template ...
49,125
<p>I've just finished a six hour debugging session for a weird UI effect where I found that my favorite framework's implementation of an interface function called "getVisibleRegion" disabled some UI feature (and apparently forgot to restore it). </p> <p>I've filed a bug with the framework, but this made me think about...
<p>The biggest reason I can think of is caching results.</p>
<p>obj.getBusyDoingStuff()</p>
46,243
<p>This is a minor bug (one I'm willing to live with in the interest of go-live, frankly), but I'm wondering if anyone else has ideas to fix it.</p> <p>I have a C# WinForms application. When the app is launched via the executable (not via the debugger), the first thing the user sees is a console window, followed by th...
<p>My first guess would be to double check your Project Property settings and make sure that the output type is Windows Application and not Console Application.</p>
<p>If you navigate to the Properties tabs for your project in Visual Studio, you should be able to set the output type to Windows Application. It sounds like it may be set to Console Application currently.</p>
21,566
<p>I am using following code to embed files, video with <code>.wmv</code> extension, that is not working in Firefox. It's working fine in IE.</p> <pre><code>document.getElementById("QuestionMedia").innerHTML += '&lt;OBJECT ID="MediaPlayer" WIDTH="350" HEIGHT="280" CLASSID="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95...
<p>You should have the <a href="http://port25.technet.com/pages/windows-media-player-firefox-plugin-download.aspx" rel="nofollow noreferrer">Windows Media Player Plugin for Firefox</a> to be able to see the video. WMV is a Microsoft/Media Player specific format and needs a plugin for the browser.</p>
<p>Can't you have the video player object in the file and set it's SRC using JavaScript? That would be a [dirty] work-around if it's doable and you can't find the answer to your problem.</p>
37,827
<p>How can I prevent a user from resizing GridViewColumns withing a ListView control?</p>
<p>i found a solution and probably it will help someone else someday ;)</p> <p>you have to override the GridViewColumnHeader's ControlTemplate (default template is <a href="http://msdn.microsoft.com/en-us/library/ms788747.aspx" rel="noreferrer">here</a> ) and remove the <strong>PART_HeaderGripper</strong> from the tem...
<p>I was able to do something similar with the instructions in this post</p> <p><a href="http://blogs.msdn.com/b/atc_avalon_team/archive/2006/04/11/573037.aspx" rel="nofollow noreferrer">http://blogs.msdn.com/b/atc_avalon_team/archive/2006/04/11/573037.aspx</a></p> <p>I wasn't able to use a full XAML solution, since ...
21,980
<p>Conducting a user account cleanup accross Solaris and Redhat linux systems, many of which have a number of Samba shares. </p> <p>What preference do people have for creating the local unix accounts for non interactive Samba users? In particular, the shell entry:</p> <ol> <li>noshell</li> <li>nologin</li> <li>blank<...
<p>I have seen the shell set to the <code>passwd</code> command so that logging in only gives an opportunity to change the password. This may or may not be appropriate in your non-interactive user case, but it has the upside of allowing people to change passwords without bothering an admin.</p>
<p>I usualy send all mine to /dev/null that way I don't ever have to worry about it. I have known some people who set it to /bin/logout so that when someone logged in they were logged back out.</p>
10,973
<p>I have an element with an <strong>onclick</strong> method.</p> <p>I would like to activate that method (or: fake a click on this element) within another function.</p> <p>Is this possible?</p>
<p>If you're using JQuery you can do:</p> <pre><code>$('#elementid').click(); </code></pre>
<p>You can also try getting the element's onclick attribute and then passing into eval. This should work despite the big taboo over eval. I put a sample below</p> <pre><code>eval(document.getElementById('elementId').getAttribute('onclick')); </code></pre>
45,220
<p>I am working with a peripheral device that needs to be communicated through serial. I can send it commands using HyperTerminal, but now I need to write programs that will let me do it without HyperTerminal. Can somebody point me to a website and/or show me a sample hello world program to get me started? I have se...
<p>In order to interface with the serial port, you open a file with one of the special filenames "COM1" through "COM9". For serial ports with higher numbers, the special filename begins with \\?\, which in C/C++ code must be escaped as "\\\\?\\COM10", etc.</p> <p><a href="http://msdn.microsoft.com/en-us/library/ms810...
<p>I believe you will find plenty of sample code for C# as well if you find VC6 too ancient. I think there are also a bunch of "free" serial/COM port wrappers but I just wrote my own when I wrote an RS232 device controller piece of software. </p> <p>google C# and serial port or rs232</p> <p>I got these:</p> <p><a ...
29,394
<p>I am trying to use concat_ws inside a group_concat command. With a query, which simplified looks like: </p> <pre><code>SELECT item.title, GROUP_CONCAT( CONCAT_WS( ',', attachments.id, attachments.type, attachments.name ) ) as attachments FROM story AS item LEFT OUTER JOIN story_attachment AS attachments ON it...
<p>You need to cast as a char..</p> <pre><code>SELECT item.title, GROUP_CONCAT( CAST(CONCAT_WS(',', attachments.id, attachments.type, attachments.name ) as CHAR ) ) as attachments FROM story AS item LEFT OUTER JOIN story_attachment AS attachments ON item.id = attachments.item_id GROUP BY item.id </code></pre>
<p>Although I suspect CAST is the appropriate answer, it's worth mentioning that I ran into a similar thing in the past which turned out to be down to a strange/conflicting collation type and character set.</p>
23,331
<p>I have created a windows service that uses Windows Messaging System. When I test the app from the debugger the Messages go through nicely but when I install it my messag … asked 14 mins ago</p> <p>vladimir 1tuga </p>
<p>What do you mean when you say it "uses" Windows Messaging System? Are you consuming or sending Windows Messages?</p> <p>If you send a Windows message, you need ensure you are doing it correctly. I'd suggest writing a message loop to ensure your messages are being dispatched properly. I'd also suggest reading up on ...
<p>Thank you all for the answers, the issue was the operating system (vista), i tested the with my windows 2000 and everything works. </p> <p>thanks for the light Rob.</p>
46,482
<p>I'm writing some JNI code in C++ to be called from an applet on Windows XP. I've been able to successfully run the applet and have the JNI library loaded and called, even going so far as having it call functions in other DLLs. I got this working by setting up the PATH system environment variable to include the dir...
<p>I figured out the problem. This was a doozy. The message "The specified procedure could not be found" for UnsatisfiedLinkError indicates that a function in the root dll or in <strong>a dependent dll</strong> could not be found. The most likely cause of this in a JNI situation is that the native JNI function is no...
<p>Usually, when linking to other libraries, you need to link to the relevant .lib file. It sounds like you aren't referencing all the lib files you need. Check what isn't linking and make sure you add it's lib to the list for the linker.</p>
19,329
<p>We have several hundred javascript files in our app that are currently being served uncompressed. One piece of our solution to gain a little more client performance is to minify our javascript files. I've created an automated solution to do this on the build, however, when these new files are deployed, the files' ti...
<p>You are going to have to determine which files have actually changed. Or just don't worry about it and enjoy the improvement you gain with the minified files. Clients may not hold the files in cache for very long anyway, so unless you're updating the files very, very frequently, there is likely to be little gain wit...
<p>You could roll these script files out over a period of time so that no single user request takes an inordinately long time. But seriously, how much javascript are we talking about? Is a one-time re-download of the script associated with your page really that big a deal? Think of how much effort you're going to have ...
19,777
<p>I have an <a href="https://smile.amazon.com/gp/product/B01GD8LCFO/ref=ppx_yo_dt_b_search_asin_title?ie=UTF8&amp;psc=1" rel="nofollow noreferrer">all-metal V6 hotend clone</a> that has worked in the past, but recently will clog very easily.</p> <p>I've tried the following to address it:</p> <ul> <li>Clean/replace the...
<p>Since I have been unable to find a way to fix the E3D V6 clone hotend I have instead replaced it with a Creality Mk 8 that I had on-hand, which has so far worked flawlessly.</p> <p>I am assuming that the improved performance is related to the use of a shorter nozzle and/or the Bowden tube butting directly against th...
<p>I had issues with my all metal hot-end where I got heat creep. I ended up doing e-steps, PID tune, and ensuring my speed wasn't too slow either. Is your printer in an enclosure? I found that mine being in an enclosure caused the hotend to not cool sufficiently, so I had to lower the hot bed temp by 10 degrees and th...
2,169
<p>I tried printing a <a href="https://www.thingiverse.com/thing:2939079" rel="nofollow noreferrer">"improved" calibration cube</a> and noticed that the printer was laying down dots instead of a solid line. This was right after switching out my extruder motor and tweaking retraction settings. I believe my first setting...
<p>I have seen this a lot of times on my tronXY-X1 with an e3d-v6 via Bowden tube. It is <em>not</em> related to retraction but a different settin: Your first layer is set too thin or not leveled to the right height. </p> <p>Having the first layer too thin, means that with a tiny error, the calculated correct extrusio...
<p>It's not about printing settings but only about the bed: the bed is too close to the nozzle.</p> <p>Maybe you adjusted it when it was cold, instead of doing it when it's already heated to the desired temperature and the nozzle is heated at about 180°C to get close to operating temperature without oozing.</p> <p>Or...
1,561
<p>I'm designing a web site navigation hierarchy. It's a tree of nodes.</p> <p>Most nodes are pages. Some nodes are links (think shortcuts in Windows).</p> <p>Most pages hold HTML content. Some execute code.</p> <p>I'd like to represent these as this collection of classes and abstract (MustInherit) classes&hellip...
<p>Use the the <a href="http://en.wikipedia.org/wiki/Composite_pattern" rel="nofollow noreferrer">Composite Pattern</a>.</p> <hr> <p>With regard to your root nodes, are there differences in functionality or is the difference it entirely appearance? If the difference is appearance only I suggest you have an associati...
<p>Should the PageNode class simply have a property of type Root?</p> <p><a href="https://i.stack.imgur.com/m9LxO.gif" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/m9LxO.gif" alt="alt text"></a> </p> <p>Is that counter to the idea that a PageNode <a href="http://en.wikipedia.org/wiki/Is-a" rel="nofol...
10,979
<p>If I use multiple repositories, all located under a single root folder, how can I set it up so that they will use a single master <code>svnconf</code>/<code>passwd</code> file for setup but still allow me to customize each if the need arises?</p> <p>This is on Windows, but I guess the process would be similar on ot...
<p><code>svnserve</code> isn't intended for use in large deployments. If you need more fine-grained permissions, or integration, etc., use a web server (like <a href="http://en.wikipedia.org/wiki/Apache_HTTP_Server" rel="nofollow noreferrer">Apache</a>).</p>
<p>If you are using svnserve, then the <code>conf/svnserve.conf</code> file in each repository has a configuration item which names the password database file. This is the <code>password-db</code> item in the <code>[general]</code> section, just set them all to point to the same file.</p> <p>If you're not using svnser...
17,537
<p>I'm working with a webservice that offers almost duplicated code across two namesspaces. Lets say for example PigFeet and HorseFeet, both namespaces contain a Feet class and other code that works with the Feet class requires it to be part of that same namespace.</p> <p>Right now In my code I'm forced to do somethi...
<p>The namespace isn't the problem - it's simply that the 2 classes aren't related, so there's no inheritance chain that you can use for polymorphism. </p> <p>You'll need to look at something like <a href="http://www.deftflux.net/blog/page/Duck-Typing-Project.aspx" rel="nofollow noreferrer">duck typing</a>, or an <a h...
<p>Namespaces are just a way to organize your types. In your case you're having 2 or more different classes that have methods with the same signature but don't have a common interface. In case you cannot change the code of the classes, the only way to avoid duplication here is to use reflection while loosing compile-ti...
20,769
<p>We're developing a service that will accept a <code>POST</code> request. Some of the <code>POST</code> data will need to be encrypted before the <code>POST</code> as it will be stored in hidden fields on a form.</p> <p>The application is written in C#, but we want third party clients to be able to easily integrate ...
<p>Assuming that you have a safe way of sharing a key (whether RSA encryption of it, retrieval over an SSH or HTTPS link, or callling the other developer on a secured phone line), any of the major modern encryptions (like AES, as mentioned by @Ed Haber) would be suitable. I would second his suggestion of AES. There s...
<p>Sounds like RSA is the algorithm for you. </p>
12,808
<p>I've got an XML document containing news stories, and the body element of a news story contains p tags amongst the plain text. When I use XSL to retrieve the body, e.g.</p> <pre><code>&lt;xsl:value-of select="body" /&gt; </code></pre> <p>the p tags seem to get stripped out. I'm using Visual Studio 2005's implement...
<p>Try to use</p> <pre><code>&lt;xsl:copy-of select="body"/&gt; </code></pre> <p>instead. From <a href="http://www.w3schools.com/XSL/el_copy-of.asp" rel="noreferrer">w3schools' documentation on same</a>:</p> <blockquote> <p>The <code>&lt;xsl:copy-of&gt;</code> element creates a copy of the current node.</p> ...
<p>It is because the engine is interpreting the &lt;p&gt; tag (excluding it for the output). You need to specify you want the content "as it is", using the "disable-output-escaping=yes|no" attribute.</p> <pre><code>&lt;xsl:value-of select="body" disable-output-escaping="yes"/&gt; </code></pre>
19,622
<p>I'm researching Open Source GIS resources - and wonder out of all the Open Source tools that are out there - what people are actually using / finding useful.</p> <p><a href="http://en.wikipedia.org/wiki/GIS_software" rel="noreferrer">http://en.wikipedia.org/wiki/GIS_software</a></p>
<p>Here's a few I use regularly</p> <ul> <li><a href="http://www.refractions.net/products/postgis/" rel="nofollow noreferrer">postgis</a></li> <li><a href="https://gdal.org/" rel="nofollow noreferrer">gdal</a></li> <li><a href="https://mapserver.org/" rel="nofollow noreferrer">mapserver</a></li> <li><a href="http://udi...
<p>Another big list: <a href="http://www.osgeo.org/" rel="nofollow noreferrer">OSGeo</a> is a collaboration to support open source geospatial software.</p>
42,076
<p>Here's the very dumb way:</p> <pre><code>def divisorGenerator(n): for i in xrange(1,n/2+1): if n%i == 0: yield i yield n </code></pre> <p>The result I'd like to get is similar to this one, but I'd like a smarter algorithm (this one it's too much slow and dumb :-)</p> <p>I can find prime factors an...
<p>Given your <code>factorGenerator</code> function, here is a <code>divisorGen</code> that should work:</p> <pre><code>def divisorGen(n): factors = list(factorGenerator(n)) nfactors = len(factors) f = [0] * nfactors while True: yield reduce(lambda x, y: x*y, [factors[x][0]**f[x] for x in range(...
<p>Assuming that the <code>factors</code> function returns the factors of <em>n</em> (for instance, <code>factors(60)</code> returns the list [2, 2, 3, 5]), here is a function to compute the divisors of <em>n</em>:</p> <pre><code>function divisors(n) divs := [1] for fact in factors(n) temp := [] ...
20,706
<p>I have an <code>&lt;img&gt;</code> in an HTML document that I would like to highlight as though the user had highlighted it using the mouse. Is there a way to do that using JavaScript?</p> <p>I only need it to work in Mozilla, but any and all information is welcome.</p> <p><em>EDIT: The reason I want to select the...
<p>Here's an example which selects the first image on the page (which will be the Stack Overflow logo if you test it out on this page in Firebug):</p> <pre><code>var s = window.getSelection() var r = document.createRange(); r.selectNode(document.images[0]); s.addRange(r) </code></pre> <p>Relevant documentation:</p> ...
<p>You can swap the source of the image, as in img.src = "otherimage.png";</p> <p>I actually did this at one point, and there are things you can do to pre-load the images.</p> <p>I even set up special attributes on the image elements such as swap-image="otherimage.png", then searched for any elements that had it, and...
15,178
<p>I´m programming a .NET Compact Framework application which shows maps on a PDA.</p> <p>I´ve created an ad hoc component that paints it´s own piece of the whole map, using several of this components the big picture is composed. I did it this way to avoid the latency of painting the whole map in a single step.</p> <...
<p>The approach is wrong. Code that updates the ui has to run on the ui thread. You'll get an exception if you update the ui from another thread.</p>
<p>I would suggest that you have some kind of messaging system from the underlying threads to the main UI thread.</p> <p>This way the main UI thread makes all the changes and is triggered from the underlying threads. Also make sure you can send some data with those messages, in case you want to send some complex infor...
14,655
<p>I'm finding myself doing a lot of things with associative arrays in PHP.</p> <p>I was doing this:</p> <pre><code> foreach ($item as $key=&gt;$value) { if ($arr[$key] == null) { $arr[$key] = 0; } $arr[$key] += $other_arr[$value]; } </code></pre> <p>But then I realised that it works fine i...
<p>It is safe but I'd recommend against it. If you put your error reporting up to E_NOTICES you'll see your code producing a lot of them, masking any real errors (such as a mistyped variable name).</p> <p>What you should really be doing is:</p> <pre><code>if (!isset($arr[$key])) $arr[$key] = 0; </code></pre> <p>...
<p>As of <code>php 7</code> you can now do the following:</p> <pre><code>foreach ($item as $key=&gt;$value) { $arr[$key] = ($arr[$key] ?? 0) + other_arr[$value]; } </code></pre>
39,789
<p>In the past I've worked with a number of programmers who have worked exclusively writing GUI applications.</p> <p>And I've been given the impression that they have almost universally minimised the use of multiple threads in their applications. In some cases they seem to have gone to extreme lengths to ensure that t...
<p>I think in terms of windows you are limited to all GUI operations happening on a single thread - because of the way the windows message pump works, to increase responsivness most apps add at least one additional worker thread for longer running tasks that would otherwise block and make the ui unresponsive.</p> <p>T...
<p>Generally all the windowing messages from the window manager / OS will go to a single queue so its natural to have all UI elements in a single thread. Some frameworks, such as .Net, actually throw exceptions if you attempt to directly access UI elements from a thread other than the thread that created it.</p>
14,670
<p>What is everyone's favorite way to sanitize user data?</p> <p>I've been using Javascript, but have recently required something more secure (people can turn it off, after all), so I was looking at Flex, but thought I'd ask the community what they thought.</p>
<p>NEVER NEVER NEVER use javascript <strong>or any other client-side technology</strong> for the <em>only</em> validation. You can use client-side validation to save some load on your server or make your app seem more responsive by showing the error sooner when validation fails, but you should <strong>always</strong> ...
<p>It's recommended to use both server- and client-side validation. I use JQuery for client side validation. </p>
21,232
<p>I'm writing a GUI application that will let users interact with command-line programs. The programs are crystallography programs, in this case. They take a long time to run.</p> <p>There's a certain common workflow using the command-line programs. The output from one program is typically processed and then is us...
<p>Take a look at <a href="http://www.gtk-server.org/" rel="nofollow noreferrer">GTK Server</a> it is easily scriptable from any language and since it runs as a service (bit like a browser) it can be used across systems. That is, the system running the command line stuff can be on a powerful system and the GTK Server ...
<p>You can use WShell and redirect stdin stdout.</p> <pre><code>object console = WShell.Exec(cmdLine); if (console.StdOut.AtEndOfStream) s = Pipe.StdOut.ReadLine(); </code></pre> <p>Downside that you still have to figure out how to hode console window. But it is easy one. You need to find this window by window ti...
43,572
<p>I've had a go at solving the <a href="http://en.wikipedia.org/wiki/Eternity_puzzle" rel="nofollow noreferrer">Eternity puzzle</a> (1,000,000 GBP prize) and <a href="http://www.netflixprize.com/" rel="nofollow noreferrer">Netflix Prize</a> ($1,000,000) in the past. I didn't win either, but they motivated me to find o...
<p><a href="http://www.topcoder.com/" rel="noreferrer">http://www.topcoder.com/</a></p>
<p>I entered the STM32-Primer <a href="http://www.stm32circle.com/projects/list.php?contest_2009=1" rel="nofollow noreferrer">2009 programming contest</a>, came in 5th place with my <a href="http://www.stm32circle.com/projects/project.php?id=74" rel="nofollow noreferrer">Solitaire program</a>.</p> <p><a href="http://w...
19,413
<p>I'd like to implement a big int class in C++ as a programming exercise&mdash;a class that can handle numbers bigger than a long int. I know that there are several open source implementations out there already, but I'd like to write my own. I'm trying to get a feel for what the right approach is.</p> <p>I understa...
<p>Things to consider for a big int class:</p> <ol> <li><p>Mathematical operators: +, -, /, *, % Don't forget that your class may be on either side of the operator, that the operators can be chained, that one of the operands could be an int, float, double, etc.</p></li> <li><p>I/O operators: >>, &lt;&lt; This is wher...
<p>subtract 48 from your string of integer and print to get number of large digit. then perform the basic mathematical operation . otherwise i will provide complete solution.</p>
33,820