instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Google / Youtube has an API for Youtube for javascript and Actionscript 2.</p> <p>Unfortunately this API is not compatible with Actionscript 3 without a wrapper - which google does not themselves provide.</p> <p>Has anybody got an actionscript 3 wrapper they can make available?</p>
<p>FINALLY! YouTube's official API changed from AS2 to AS3</p> <blockquote> <p><a href="http://code.google.com/apis/youtube/flash_api_reference.html" rel="nofollow noreferrer">http://code.google.com/apis/youtube/flash_api_reference.html</a></p> <p>Note: This documentation was updated in October 2009 to explain how to u...
<p>Yes there is an AS3 WRAPPER HERE <a href="http://flashden.net/item/as3-youtube-wrapper-full-xml-site/21685" rel="nofollow noreferrer">http://flashden.net/item/as3-youtube-wrapper-full-xml-site/21685</a></p>
13,231
<p>We have <a href="https://3dprinting.stackexchange.com/questions/1117/alternative-3d-molding-techniques-at-home">a recent question</a> that brings up the question of "<em>Should we support general hobbyist questions?</em>"</p> <p>Currently, there doesn't appear to be a viable site within the SE network. The question...
<p><s>There is a <a href="https://3dprinting.meta.stackexchange.com/questions/138/what-is-our-scope">new question on Meta</a> that should help define what is okay on this site. </s></p> <p>However, your question is important to address here.</p> <p>Ultimately, you shouldn't be afraid to go ahead and ask the question....
<p>I think your situation fits for many new users on this site, and saying that "easy" or "semi-defined" questions are discouraged would probably turn you - and many others - away from the site.</p> <p>Rather, I believe it is the community's job to help you find a proper scope for your question. As long as you follow ...
28
<p>I've created a database in Visual Studio 2008 in an App_Data folder of a MVC Web Application project. This results in an mdf file for the database that can be explored in the Server Explorer tab. You can create a SQL script for changes you do to the database.</p> <p>So I'm wondering how you run these sql change scr...
<p>The syntax is:</p> <pre><code>CREATE DATABASE [databaseName] </code></pre> <p>This will create a database on the SQL Server you are connected do, creating files with the standard names in the standard location. There are additional options (<a href="http://msdn.microsoft.com/en-us/library/aa258257.aspx" rel="nofo...
<p>What you can do is create a Database Project* and connect the project to your database. Database Projects can be found under '<em>Other Project Types/Database</em>' in the new project dialog. If you then place the create script in the Database project you can run it simply by right clicking on the script in Solution...
45,493
<p>when releasing an instance that could exist or not, I usually write this:</p> <p>if (object != nil) [object release];</p> <p>but since sending a message to nil is not a problem, is that conditional necessary?</p> <p>I suppose the question comes down to this: which uses more overhead, comparing an object to nil, o...
<p>See <a href="http://developer.apple.com/documentation/MacOSX/Conceptual/universal_binary/universal_binary_tips/chapter_5_section_22.html" rel="noreferrer">this page</a> which explains that passing messages to nil (to generalize your example) is perfectly fine.</p> <p>As to what has more overhead, any performance im...
<p>That check is not necessary. Unless you're doing a LOT of iterations of this code (10,000s, maybe more), the time differential is insignificant.</p>
41,279
<p>Model Driven Software Development.</p> <p>As I understand it it raises the abstraction level of the design to better reflect the domain the software will attempt to run in. That's alot to say in just one sentence.</p> <p>The communication between the domain experts (customer) and the developers is crucial to make...
<p>If you are developing on Microsoft platforms, you might want to check out Oslo also. There is a nice overview here: <a href="http://www.pluralsight.com/community/blogs/aaron/archive/2008/11/03/introducing-quot-oslo-quot.aspx" rel="nofollow noreferrer">http://www.pluralsight.com/community/blogs/aaron/archive/2008/1...
<p>You should read this excellent paper about MDSD best practices, from Markus Voelter : <a href="http://www.jot.fm/issues/issue_2009_09/column6.pdf" rel="nofollow noreferrer">http://www.jot.fm/issues/issue_2009_09/column6.pdf</a></p> <p>Regarding the MDSD/DSL option, the EMF ecosystem (<a href="https://www.eclipse.or...
32,821
<p>Is there a way to get a background in CSS to stretch or scale to fill its container?</p>
<p>For modern browsers, you can accomplish this by using <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/background-size" rel="noreferrer"><code>background-size</code></a>:</p> <pre class="lang-css prettyprint-override"><code>body { background-image: url(bg.jpg); background-size: cover; } </code></pr...
<p>Use the <strong><code>border-image : yourimage</code></strong> property to set your image and scale it upto the entire border of your screen or window .</p>
49,252
<p>I've seen lots of ways to backup a single repository in subversion. Is there any way to backup all the repositories in one go. I have lots of repositories for different projects and don't want to have to create a script every time.</p>
<p>If you have configured all repositories to use the fsfs backend, then you can use regular file-based backup tools (such as tar, dump, rsync, ...).</p> <p>If you use bsddb repositories, I recommend to convert them to fsfs, with a svndump/restore cycle.</p>
<p>If you have configured all repositories to use the fsfs backend, then you can use regular file-based backup tools (such as tar, dump, rsync, ...).</p> <p>If you use bsddb repositories, I recommend to convert them to fsfs, with a svndump/restore cycle.</p>
42,108
<p>I have a button on an ASP.NET wep application form and when clicked goes off and posts information a third party web service. </p> <p>I have an UpdateProgress associated with the button. </p> <p>how do disable/hide the button while the progress is visible (i.e. the server has not completed the operation) </p> <p>...
<p>You'll have to hook a javascript method to the page request manager (Sys.WebForms.PageRequestManager.getInstance().add_initializeRequest). Here is the code I would use to hide the buttons, I would prefer the disable them (see how that's done in the link at the bottom).</p> <h2>ASP.NET</h2> <pre><code>&lt;div id="B...
<p>I also wrote a blog post about this which I hope is helpful to you: <a href="http://www.fitnessconnections.com/blog/post/2008/01/Disabling-a-submit-button-UpdatePanel-Update-method.aspx" rel="nofollow noreferrer">http://www.fitnessconnections.com/blog/post/2008/01/Disabling-a-submit-button-UpdatePanel-Update-method....
17,885
<p>I have an msi installer which was working fine. I added an external merge module. There were some directory merge errors during compilation. I removed the directories causing the error from the directory table of the merge module.</p> <p>I am getting the error:</p> <blockquote> <p>MSI error 2732 error :Directory...
<p>The <a href="http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx" rel="noreferrer">Windows Installer Error Messages</a> documentation for error 2732 says:</p> <p>"The directory manager is responsible for determining the target and source paths. It is initialized during the costing actions (CostInitialize a...
<p>One possibility is that you may not have put a backslash (\) after a directory path in the set directory action or the custom action should be CostInitialize</p>
16,802
<p>In building an ASP.NET 3.5 WAP, I'm always frustrated by the feeling that no matter how I "isolate" or "encapsulate" bits of logic or UI I'm still going to bring down the whole site any time I need to update a single line of code. I may be misunderstanding how ASP.NET handles changes in the "bin" directory, but give...
<p>This is really hard to achieve since .NET doesn't support unloading a type that has been loaded into the app domain. </p> <p>One way to do it is playing around with app-domains, or having WCF do it for you. </p> <p>Another would be implementing ayende's <a href="http://ayende.com/hibernating-rhinos.aspx" rel="nofo...
<p>Just an added thought, but I bet that was what that whole "COM+" bit allowed (save for shared hosts). Breaking logic down into little stateless sausage factories probably allowed for smooth fix-in-flight operations.</p>
35,706
<p>I would like to do something like the following but can't seem to get the syntax for the Do method quite right.</p> <pre><code>var sqr = new _mocks.CreateRenderer&lt;ShapeRenderer&gt;(); Expect.Call(sqr.CanRender(null)).IgnoreArguments().Do(x =&gt;x.GetType() == typeof(Square)).Repeat.Any(); </code></pre> <p>So ba...
<p>Are you looking for this?</p> <pre><code>Expect.Call(sqr.CanRender(null)).IgnoreArguments() .Do((Func&lt;Shape, bool&gt;) delegate(Agent x){return x.GetType() == typeof(Square);}) .Repeat.Any(); </code></pre> <p>EDIT: The answer was correct in spirit bu the original syntax did not quite work. </p>
<p>As of Rhino Mocks 3.5 you can now do the following:</p> <pre><code>Expect.Call( sqr.CanRender( Arg&lt;Shape&gt;.Is.TypeOf&lt;Square&gt;() ).Repeat.Any(); </code></pre> <p>Look at this <a href="http://ayende.com/Wiki/Rhino+Mocks+3.5.ashx" rel="nofollow noreferrer">wiki article</a> for more information.</p>
40,348
<p>Does anybody know of a way to list up the "loaded plugins" in <strong>Vim</strong>? I know I should be keeping track of this kind of stuff myself but it would always be nice to be able to check the current status.</p>
<p>Not a VIM user myself, so forgive me if this is totally offbase. But according to what I gather from the following <a href="http://rayninfo.co.uk/vimtips.html" rel="noreferrer">VIM Tips</a> site: </p> <pre><code>" where was an option set :scriptnames : list all plugins, _vimrcs loaded (super) :verbos...
<p>If you use <a href="https://github.com/junegunn/vim-plug" rel="noreferrer">vim-plug</a> (Plug), &quot; A minimalist Vim plugin manager.&quot;:</p> <pre><code>:PlugStatus </code></pre> <p>That will not only list your plugins but check their status.</p>
7,136
<p>I realize that this question is impossible to answer absolutely, but I'm only after ballpark figures:</p> <p>Given a reasonably sized C-program (thousands of lines of code), on average, how many ASM-instructions would be generated. In other words, what's a realistic C-to-ASM instruction ratio? Feel free to make ass...
<p>There is no answer possible. statements like <code>int a;</code> might require zero asm lines. while statements like <code>a = call_is_inlined();</code> might require 20+ asm lines. </p> <p>You can see yourself by compiling a c program, and then starting <code>objdump -Sd ./a.out</code> . It will display asm and C ...
<p>I am not sure there is really a useful answer to this. For sure you will have to pick the architecture (as you suggested).</p> <p>What I would do: Take a reasonable sized C program. Give gcc the "-S" option and check yourself. It will generate the assembler source code and you can calculate the ratio for that progr...
42,942
<p>I want to transfer data between a smart phone app and a website. What are the conventional and not-so-conventional ways of doing it? </p> <p>Here's what I have thought of so far:</p> <ol> <li>Simple HTTP GET/POST with data being represented as JSON array string, variations of this being encrypted/compressed string...
<p>Since 1.8.5 it's possible to <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/freeze" rel="noreferrer">seal and freeze the object</a>, so define the above as:</p> <pre><code>const DaysEnum = Object.freeze({&quot;monday&quot;:1, &quot;tuesday&quot;:2, &quot;wednesday&qu...
<pre><code>var DaysEnum = Object.freeze ({ monday: {}, tuesday: {}, ... }); </code></pre> <p>You don't need to specify an <em>id</em>, you can just use an empty object to compare enums. </p> <pre><code>if (incommingEnum === DaysEnum.monday) //incommingEnum is monday </code></pre> <p><strong>EDIT:</strong> If you are...
36,636
<p>I am looking to parse INSERT and UPDATE MySQL SQL queries in PHP to determine what changes where made from what original data. Now this would be pretty easy to create, but I want to see if there are any existing libraries in PHP to do this.</p> <p>Basically what I have is a table with all of the above queries that ...
<p><a href="http://pear.php.net/package/SQL_Parser" rel="nofollow noreferrer">http://pear.php.net/package/SQL_Parser</a></p> <p><a href="http://sourceforge.net/projects/txtsql" rel="nofollow noreferrer">http://sourceforge.net/projects/txtsql</a></p> <p><a href="http://code.google.com/p/php-sql-parser" rel="nofollow n...
<p>Facebook released a open-source PHP version of their <a href="http://developers.facebook.com/opensource.php" rel="nofollow noreferrer">FQL parser</a>. From what I was it was quite neat code. You could possibly hack that to work with regular SQL.</p>
35,871
<p>Is there a way to find out what gcc flags a particular binary was compiled with?</p>
<p>A quick look at the GCC documentation doesn't turn anything up.</p> <p>The Boost guys are some of the smartest C++ developers out there, and they <a href="http://www.boost.org/doc/libs/1_36_0/more/getting_started/unix-variants.html#library-naming" rel="noreferrer">resort</a> to naming <a href="http://www.boost.org/...
<p>I don't think so. </p> <p>You can see if it has debug symbols, which means -g was used ;) But I can't think of any way how you could find out which directories have been used to search for include headers for example.</p> <p>Maybe a better answer is possible if you only target for a specific flag; e.g. if you only...
22,962
<p>Is it possible to send a HTTP response with a permanent redirect from a Stellent (now called Oracle UCM) website? We're using version 7.5.2 with iDoc script.</p> <p>We can use the iDoc function setHttpHeader() to send the Location HTTP header, but how to send the HTTP response code 301, to signal the permanent redi...
<p>There is component "IdocScriptRedirect" avialable on meta link for 301 redirect. you can request oracle support to provide you download link.</p>
<p>No... that function appends new HTTP headers, and the response code is set prior to that. You'll need a custom IdocScript function to get that behavior.</p>
31,673
<p>I'm trying to automate a program I made with a test suite via a .cmd file.</p> <p>I can get the program that I ran's return code via %errorlevel%. </p> <p>My program has certain return codes for each type of error.</p> <p>For example: </p> <p>1 - means failed for such and such a reason</p> <p>2 - means failed f...
<p>You can do this quite neatly with the <code>ENABLEDELAYEDEXPANSION</code> option. This allows you to use <code>!</code> as variable marker that is evaluated after <code>%</code>.</p> <pre><code>REM Turn on Delayed Expansion SETLOCAL ENABLEDELAYEDEXPANSION REM Define messages as variables with the ERRORLEVEL on th...
<p>You can use the 'IF ERRORLEVEL' statement to do different things based on the return code. </p> <p>See:</p> <p><a href="http://www.robvanderwoude.com/errorlevel.html" rel="nofollow noreferrer">http://www.robvanderwoude.com/errorlevel.html</a></p> <p>In response to your second question, I would move to using a sc...
15,820
<p>What would you say are the essential steps in verifying a file upload?</p> <p>I'd tend to check the MIME type, give it a new (random) name, make sure its got an allowed file extension, and then I'd check the contents of the file. How do you go about it?</p>
<p>Check (in this order): the file MIME type (and note certain browsers have MIME type detection problems...); that the file path exists; that a previous version of the file with the same name doesn't exist, else, rev it; that the file isn't too big; on success, run a virus check on the server.</p>
<p>Check the file type, check the file size, the image dimension.</p> <p>These are the 3 I always check to be sure to have good result.</p>
12,911
<p>I'm trying to display a boolean field in Report Designer in Visual Studio 2008. When I tried to run it, an error occurred:</p> <pre><code> "An error has occurred during report processing. String was not recognized as a valid Boolean." </code></pre> <p>I tried to convert it using CBool() but it didn't work. ...
<pre><code>=iif(Fields!YourBool.Value, "True", "False") </code></pre> <p>Am I missing anything?</p>
<p>I'm using SQL Server 2005. The data type is bit. </p>
18,338
<p>I want to override OnMouseClick and OnMouseDoubleClick and perform different actions depending on which click style was used.</p> <p>The problem is that OnMouseClick is happening for both single and double clicks, and is getting called before OnMouseDoubleClick.</p> <p>I'm certain this must be a common requirement...
<p>That happens throughout Windows. I don't think they added anything special to handle it in .Net.</p> <p>The normal means of handling this is</p> <ul> <li>a) just make single click something you'd want to happen before a double click, like select.</li> <li>b) if that's not an option, then on the click event, start...
<p>You could start a timer within the OnMouseClick event handler. </p> <ul> <li>If the timer times out (say 300ms) then a single click is intended. </li> </ul> <p><em>Else</em></p> <ul> <li>If another OnMouseClick event was generated before the time times out you could examine the x&amp;y position of the click and i...
26,890
<p>We wanted to test the post process properties of PVA but did not want to print anything. We unloaded the ABS that was in the printer and then started loading some PVA. After the PVA was loaded we let it keep going through the loading process until it pushed all the PVA out and we had our test sample. We then stop...
<p>Run some cleaning filament through the extruder at the printing temperature of your PVA or ABS filament, whichever is greater, until the old stuff has been completely displaced. Then load the new filament until the cleaning filament has been completely displaced.</p> <p>This should be done every time you are switch...
<p>Run some cleaning filament through the extruder at the printing temperature of your PVA or ABS filament, whichever is greater, until the old stuff has been completely displaced. Then load the new filament until the cleaning filament has been completely displaced.</p> <p>This should be done every time you are switch...
922
<p>Ok, i've read most relevant questions asked here previously on this but I still don't see a clear "best in class" suggestion for WYSIWYG editors for ASP.net</p> <p>I've used fckeditor up to now (found it ok but many problems with config/permissions on folder etc.).</p> <p>I'm looking for something that has a lot ...
<p><a href="http://tinymce.moxiecode.com/" rel="nofollow noreferrer">TinyMCE</a> - besides beeing configurable and extendable, it's quite nice to integrate with asp.net (or any other web framework) since it's just javascript over a textarea</p>
<p>Not sure what budget you're working with, but it might be worth taking a look at Dreamweaver CS3+. It has support for ASP.NET and its WYSIWYG is quite good.</p>
39,770
<p>I have a question about implementing caching (memoization) using arrays in Haskell. The following pattern works:</p> <pre><code>f = (fA !) where fA = listArray... </code></pre> <p>But this does not (the speed of the program suggests that the array is getting recreated each call or something):</p> <pre><code>f ...
<p>The best way to find what is going on is to tell the compiler to output its intermediate representation with <code>-v4</code>. The output is voluminous and a bit hard to read, but should allow you to find out exactly what the difference in the generated code is, and how the compiler arrived there.</p> <p>You will p...
<p>Cool, thank you for your answers which helped a lot, and I will definitely check out data-memocombinators on Hackage. Coming from a C++-heavy background, I've been struggling with understanding exactly what Haskell will do (mainly in terms of complexity) with a given program, which tutorials don't seem to get in to...
39,539
<p>I'm a kinda newbie developer with a few years under my belt. Recently I interviewed at a game company and was asked "have you done any multi-threading?" I told them about having a C# app with a few Threads... and then I said a bit about transactions and locking etc in Sql. The interviewer politely told me that th...
<p>The canonical implementation of "low level threads" is <a href="http://en.wikipedia.org/wiki/POSIX_Threads" rel="nofollow noreferrer">pthreads</a>. The most basic examples of threading problems that are usually taught along with pthreads are some form of <a href="http://en.wikipedia.org/wiki/Readers-writers_problem"...
<p>well if you really want to take this idea to the "max" and you are willing to get your hands dirty with threads. I would recommend trying to implement a user space thread library. </p> <p>look into uconext.h and its various procedures (setcontext, swapcontext and makecontext) and try to write a simple cooperative...
24,102
<p>When working with some open source projects (in my case Joomla and Moodle), I've often had to delve into the core code to make some alterations, but the problem is keeping track of these changes so I know which files to update on the production server, as well as which files to keep a special eye on when upgrading t...
<p>I'm not sure why you're resistant to version control; your situation is exactly what version control is designed to handle!</p> <p>In fact, the case of several small local changes to a large externally-driven codebase makes it even more important to use proper source control. Using a source control system that has...
<p>Ultimately, it sounds like what you've done is you've forked the code. Was that really your intention? Get your changes merged into the original source, and then you don't have to continue making those changes for future updates.</p> <p>If your changes are inappropriate for any other consumers of the project, then ...
45,355
<p>I am trying to provide my own labelFunction for a CategoryAxis programatically but am completely stumped. The regular way is to do it in your MXML file, but I want to do it in my Actionscript file.</p> <p>The regular way of doing it is:</p> <pre><code>&lt;mx:Script&gt; &lt;![CDATA[ private function cate...
<p>Well, I'm baffled by your problem, because it works absolutely fine for me.</p> <p>I took the example application for CategoryAxis from the Adobe Flex site: <a href="http://livedocs.adobe.com/flex/3/langref/index.html?mx/charts/CategoryAxis.html&amp;mx/charts/class-list.html" rel="nofollow noreferrer">http://li...
<p>Just I though, I don't think it will make a difference, but maybe change your label function scope to protected rather than private???</p>
34,050
<p>I need to write a script to set ip address/mask/broadcast as an alias on eth0:0 plus set the default gateway.</p> <p>This solution works:</p> <pre><code>ifconfig eth0:0 &lt;ip&gt; netmask &lt;mask&gt; up ip route replace default via &lt;ip&gt; </code></pre> <p>but sometimes the second call gets an error "network ...
<p>You could use <code>ping -c1 -w</code> on the gateway address in a loop until it comes up.</p>
<p>I think it is a bit strange that the interface isn't up when ifconfig returns.. I would try to skip ifconfig and only use the 'ip' command:</p> <pre><code>ip address add &lt;ip&gt;/&lt;mask&gt; dev eth0 ip route replace default via &lt;ip&gt; </code></pre> <p>This doesn't create a new alias interface eth0:0, it ju...
45,925
<p>To deploy a new version of our website we do the following:</p> <ol> <li>Zip up the new code, and upload it to the server.</li> <li>On the live server, delete all the live code from the IIS website directory.</li> <li>Extract the new code zipfile into the now empty IIS directory</li> </ol> <p>This process is all s...
<p>You need 2 servers and a load balancer. Here's in steps:</p> <ol> <li>Turn all traffic on Server 2</li> <li>Deploy on Server 1</li> <li>Test Server 1</li> <li>Turn all traffic on Server 1</li> <li>Deploy on Server 2</li> <li>Test Server 2</li> <li>Turn traffic on both servers</li> </ol> <p>Thing is, even in this c...
<p>I would suggest keeping the old files there and simply overwriting them. That way the downtime is limited to single-file overwrite times and there is only ever one file missing at a time. </p> <p>Not sure this helps in a "web application" though (i think you are saying that's what you're using), which is why we alw...
17,842
<p>I'm just starting to play around with directx and I've read a few articles on the internet that use XInput to interface with the Xbox controller.</p> <p>When I try to use it in my c# app, I can't seem to find the correct assembly to reference. From what I understand, it's supposed to be in <code>Microsoft.DirectX....
<p>In the late 80s, before I was programming in C, I was programming in <a href="http://en.wikipedia.org/wiki/Applesoft_BASIC" rel="noreferrer">Applesoft BASIC</a> and <a href="http://en.wikipedia.org/wiki/Logo_(programming_language)" rel="noreferrer">Logo</a>. As a child I thought the <a href="http://en.wikipedia.org/...
<p>I learned to program in BASIC by writing simple programs drawing faces (I mean circles and squares) on the screen. Somehow the whole turtle programming was never my thing, although a few of my friends learned that way. Later on I moved to Pascal, then to Delphi, Java and C++/C#. In my opinion the trick is to "wow" y...
45,033
<p>I added some custom fields (public booleans) to the global class in global.asax.cs which are initialized during the Application_Start event. How do I access them in a webhandler (ashx)? Or is it better to save them in the Application state object?</p>
<p>You would probably need to access the class as the type that your Global.asax.cs is rather than the type it is inheriting from.</p> <p>I believe it is more common to just use the Application State object for application wide variables.</p>
<p>have you tried ((global)Application).PublicBooleanField ? </p>
10,931
<p>We're looking at CouchdDB for a CMS-ish application. What are some common patterns, best practices and workflow advice surrounding backing up our production database?</p> <p>I'm particularly interested in the process of cloning the database for use in development and testing.</p> <p>Is it sufficient to just copy t...
<p>CouchDB supports replication, so just replicate to another instance of CouchDB and backup from there, avoiding disturbing where you write changes to.</p> <p><a href="https://docs.couchdb.org/en/latest/maintenance/backups.html" rel="nofollow noreferrer">https://docs.couchdb.org/en/latest/maintenance/backups.html</a><...
<p>I do it via powershell and the <strong>PSCouchDB</strong> module with the command <a href="https://pscouchdb.readthedocs.io/en/latest/databases.html#export-and-import-databases" rel="nofollow noreferrer">Export-CouchDBDatabase</a>.</p> <p>This exports an entire database to a json file, which you can re-import via th...
14,783
<p>What is the best practice for setting up a LAMP server in terms of linux users and groups? If there are multiple sites hosted on the same server, is it best to have a single user that owns all site source files (and uploads) that is in the same group as apache - or to have a different user for each site (so that ea...
<p>On our platform each site's htdocs etc has it's own user. This means if one site is compromised, the others should be fine.</p>
<p>I assume you don't want to go crazy and get WHM for cPanel and may want to do this inexpesnively. </p> <p>I think its a best practice to have each user access their space from their own username and group - especially if unrelated users may be using the webserver.</p> <p>If you have over 10 domains and users and ...
21,059
<p>I would like to replace the default malloc at link time to use a custom malloc. But when I try to redefine malloc in my program, I get this error:</p> <pre><code>MSVCRT.lib(MSVCR80.dll) : error LNK2005: _malloc already defined in test.lib(test.obj) </code></pre> <p>This works perfectly on any Unix, and it works on...
<p>There is really good discussion of how hard this is here:</p> <p><a href="http://benjamin.smedbergs.us/blog/2008-01-10/patching-the-windows-crt/" rel="noreferrer">http://benjamin.smedbergs.us/blog/2008-01-10/patching-the-windows-crt/</a></p> <p><s>Apparently, you need to patch the CRT</s></p> <p>Edit: actually, a...
<p>From version 3.0 Firefox uses a custom allocator (AFAIR jmalloc) -- you could check how they did it. I read that they had some problems with it. You may check this <a href="http://blog.pavlov.net/2008/01/12/jemalloc-builds/" rel="nofollow noreferrer">blog post</a>.</p>
14,668
<p>I am trying to write an rspec test for a controller that accesses a model Group.</p> <pre> @request.env['HTTP_REFERER'] = group_url(@mock_group) ### Line 49 </pre> <p>I get this:</p> <pre> NoMethodError in 'ActsController responding to create should redirect to :back' You have a nil object when you didn't expect...
<p>This happens because url_for depends on stuff that's initialized during request processing. I assume your test looks something like this:</p> <pre><code>it "should do whatever when referrer is group thing" do @request.env["HTTP_REFERER"] = url_for(@mock_group) get :some_action "something".should == "something...
<p>Look at this. I think it is relevant.</p> <p><a href="http://jakescruggs.blogspot.com/2008/11/if-you-use-mocha-and-rspec-then-read.html" rel="nofollow noreferrer">http://jakescruggs.blogspot.com/2008/11/if-you-use-mocha-and-rspec-then-read.html</a></p>
39,603
<p>I am powering a web search using Sphinx, and am getting the following error message while building the indexes:</p> <blockquote> <p>WARNING: sort_hits: merge_block_size=76 kb too low, increasing mem_limit may improve performance</p> </blockquote> <p>The problem is I can't find any documentation on where this set...
<p>This is probably happening because you're trying to index too many items at once. Make sure you're using <a href="http://www.sphinxsearch.com/docs/current.html#conf-sql-query-range" rel="noreferrer">ranged queries</a>. If you're already using ranged queries, increasing the <code>mem_limit</code>, as it suggests, m...
<blockquote> <p>In sphinx.conf:</p> <pre><code>sql_query_range = SELECT MIN(id),MAX(id) FROM documents sql_range_step = 1000 sql_query = SELECT * FROM documents WHERE id&gt;=$start AND id&lt;=$end </code></pre> <p>If the table contains document IDs from 1 to, say, 2345, then sql_query would be run three tim...
37,967
<p>I have a function that automatically exports a table into a CSV file, then I try to attach that same file into a function that will email it. I have sent attachments using html mime mail before, but I was wondering if that created CSV file needs to be stored on the server first before attaching it to the email?</p>
<p>It depends on your functions, if you have a function that can export the table as CSV into a string and then the mail functions support creating attachments from a string then I think you have what you need...</p>
<p>In theory you could embed it yourself by writing the appropriate tags and handcrafing the email yourself.</p> <p>Or you can go the easy way and save it to a temporary location, use a tool like PHPMailer (which might also support string attachment) to attach the file, send the mail and then remove the temp file.</p>...
27,332
<p>I can use DCOMCNFG to disable remote launch on my DCOM application, but I would like to do this programatically. I looked at CoInitializeSecurity, but that does not seem to do it. Anyone done this?</p> <p>I am using Delphi BTW.</p>
<p>The binary data is simply a security descriptor structure (PSecurityDescriptor). I mean it is a copy of the memory of this structure. And, of course, the security descriptor is self relative. JWSCL can create such a structure easily. </p> <p>Launch- and AccessPermission list for every user access rights that also c...
<p>This is very similar to <a href="https://stackoverflow.com/questions/1998882/change-access-permissions-in-component-services-com-security-with-script-api/2072344#2072344">change Access Permissions in Component Services > COM Security with script/api?</a> for which i posted a response.</p>
10,767
<p>When I type the following code in Emacs ruby-mode, the "#{foo}" is fontified in a different color than the enclosing string. How do I do this in my own Emacs mode? I tried to decipher the ruby-mode source code but couldn't understand it in a reasonable amount of time.</p> <pre><code>"a #{foo} a" </code></pre>
<p>Finally figured it out. The answer is that the "override" parameter in a fontification rule should be set to t, which means that the given face will override the string face. See the documentation for the variable "font-lock-keywords" for details. Here's an example:</p> <pre class="lang-el prettyprint-override">...
<p>Search for where ruby-mode.el sets <code>font-lock-syntactic-keywords</code>:</p> <pre><code>(setq ruby-font-lock-syntactic-keywords '( ;; #{ }, #$hoge, #@foo are not comments ("\\(#\\)[{$@]" 1 (1 . nil)) </code></pre> <p>Here's some documentation on the similar <a href="http://www.delorie.com/gnu/docs/e...
29,266
<p>I have done Java and JSP programming in the past, but I am new to Java Server Faces and want to know if there's a set of best practices for JSF development. </p>
<p>Some tips: Understand the JSF request <a href="http://www.java-samples.com/showtutorial.php?tutorialid=470" rel="nofollow noreferrer">lifecycle</a> and where your various pieces of code fit in it. Especially find out why your model values will not be updated if there are validation errors.</p> <p>Choose a tag libra...
<p>Select a good component library .Do not use richfaces , i suggest you dont use jsf , use spring mvc,jquery fro view and json in a rest architecture. but if you have to ,use primefaces it easy to use and has enough components.</p>
5,188
<p>I'm currently looking at ways to allow people to select multiple files at once to batch upload images. I'm evaluating these options for my ASP.NET web app:</p> <ul> <li><a href="http://developer.yahoo.com/yui/uploader/" rel="nofollow noreferrer">YUI Uploader</a></li> <li><a href="http://www.codeplex.com/FlajaxianFi...
<p>Thanks for everyone's opinion but I ended up using <a href="http://developer.yahoo.com/yui/uploader/" rel="nofollow noreferrer">YUI Uploader</a> because that's what <code>flickr</code> uses and the project spec was basically an analysis of <code>flickr</code>'s features.</p> <p>The experience of using it was essent...
<p>Look at this one too. It's free. </p> <p><a href="http://www.codeproject.com/KB/aspnet/FlashUpload.aspx" rel="nofollow noreferrer">http://www.codeproject.com/KB/aspnet/FlashUpload.aspx</a></p> <p>I'm using it in an application I'm developing for uploading multiple music files. The author provides the source cod...
23,296
<p>I can find lots of information on how Long Polling works (For example, <a href="http://jfarcand.wordpress.com/2007/05/15/new-adventures-in-comet-polling-long-polling-or-http-streaming-with-ajax-which-one-to-choose/" rel="noreferrer">this</a>, and <a href="http://en.wikipedia.org/wiki/Comet_(programming)#Ajax_with_lo...
<p>It's simpler than I initially thought.. Basically you have a page that does nothing, until the data you want to send is available (say, a new message arrives).</p> <p>Here is a really basic example, which sends a simple string after 2-10 seconds. 1 in 3 chance of returning an error 404 (to show error handling in th...
<p>Simplest NodeJS</p> <pre class="lang-js prettyprint-override"><code>const http = require('http'); const server = http.createServer((req, res) =&gt; { SomeVeryLongAction(res); }); server.on('clientError', (err, socket) =&gt; { socket.end('HTTP/1.1 400 Bad Request\r\n\r\n'); }); server.listen(8000); // the lo...
43,254
<p>Have you guys had any experiences (positive or negative) by placing your source code/solution on a network drive for Visual Studio 2005 or 2008? Please note I am not referring to placing your actual source control system on that drive, but rather your working folder.</p> <p>Thanks</p>
<p>Without any more information it is difficult to pinpoint the problem, but the root cause is that you most likely have compiled a class against a different version of the class that is missing a method, than the one you are using when running it.</p> <p>Look at the stack trace ... If the exception appears when calli...
<p>If your file name is different than the class name which contain main method then it may be the possibility that this error may cause.</p>
5,563
<p>Assuming Windows, is there a way I can detect from within a batch file if it was launched from an open command prompt or by double-clicking? I'd like to add a pause to the end of the batch process if and only if it was double clicked, so that the window doesn't just disappear along with any useful output it may hav...
<p>I just ran a quick test and noticed the following, which may help you:</p> <ul> <li>When run from an open command prompt, the %0 variable does not have double quotes around the path. If the script resides in the current directory, the path isn't even given, just the batch file name.</li> <li>When run from explorer,...
<p>Just add pause regardless of how it was opened? If it was opened from command prompt no harm done apart from a harmless pause. (Not a solution but just thinking whether a pause would be so harmful / annoying )</p>
49,421
<p>I've created an "attached behaviour" in my WPF application which lets me handle the Enter keypress and move to the next control. I call it EnterKeyTraversal.IsEnabled, and you can see the code on my blog <a href="http://www.madprops.org/blog/enter-to-tab-as-an-attached-property/" rel="noreferrer">here</a>.</p> <p>M...
<p>I do not agree DannySmurf</p> <p>Some WPF layout objects can clog up your memory and make your application really slow when they are not garbage collected. So I find the choice of words to be correct, you are leaking memory to objects you no longer use. You expect the items to be garbage collected, but they aren't,...
<p>Well that (the manager bit) I can certainly understand, and sympathize with.</p> <p>But whatever Microsoft calls it, I don't think a "new" definition is appropriate. It's complicated, because we don't live in a 100% managed world (even though Microsoft likes to pretend that we do, Microsoft itself does not live in ...
3,492
<p>What is the best way to interact with a database using Haskell? I'm accustomed to using some sort of ORM (Django's ORM, hibernate, etc.) and something similar would be nice when creating apps with <a href="http://www.happs.org/" rel="noreferrer">HAppS</a>.</p> <p><strong>Edit:</strong> I'd like to be free to choos...
<p>The library I have in mind is not an ORM, but it may still do what you want.</p> <p>If you want something that makes your database accesses safe while integrating things into your program nicely then try out <a href="http://www.haskell.org/haskellwiki/Applications_and_libraries/Database_interfaces/HaskellDB" rel="n...
<p>Have you looked through the database mapping and access packages at <a href="http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Database" rel="nofollow noreferrer">http://hackage.haskell.org/packages/archive/pkg-list.html#cat:Database</a></p> <p>I haven't used them, so can't recommend any particular one....
13,056
<p>What is the best approach to make sure you only need to authenticate once when using an API built on WCF?</p> <p>My current bindings and behaviors are listed below</p> <pre><code> &lt;bindings&gt; &lt;wsHttpBinding&gt; &lt;binding name="wsHttp"&gt; &lt;security mode="Transpor...
<p>If you're on an intranet, Windows authentication can be handled for "free" by configuration alone. </p> <p>If this isn't appropriate, token services work just fine, but for some situations they may be just too much.</p> <p>The application I'm working on needed bare-bones authentication. Our server and client run i...
<p>While I hate to give an answer I'm not 100% certain of, the lack of responses so far makes me think a potentially correct answer might be okay in this case.</p> <p>As far as I'm aware there isn't the kind of session token mechanism you're looking for out-of-the-box with WCF which means you're going to have to do so...
5,066
<p>Given this data set:</p> <pre><code>ID Name City Birthyear 1 Egon Spengler New York 1957 2 Mac Taylor New York 1955 3 Sarah Connor Los Angeles 1959 4 Jean-Luc Picard La Barre 2305 5 Ellen Ripley Nostromo 2092 6 James T. Kirk Riverside...
<p>Probably not the most elegant of solutions, and the performance of <code>IN</code> may suffer on larger tables.</p> <p>The nested query gets the minimum <code>Birthyear</code> for each city. Only records who have this <code>Birthyear</code> are matched in the outer query. Ordering by age then limiting to 3 results ...
<p>Not pretty but should work also with multiple people with the same dob:</p> <p>Test data:</p> <pre><code>select id, name, city, dob into people from (select 1 id,'Egon Spengler' name, 'New York' city , 1957 dob union all select 2, 'Mac Taylor','New York', 1955 union all select 3, 'Sarah Connor','Los Angeles', 195...
23,150
<p>I'm looking for a simple way to put up musical "tunes" on a website.</p> <p>So here's an analogy to explain my question:</p> <p>Let's say I want to put up a couple of big triangles as a picture on my web page. I can either draw a bitmap and save as GIF/JPG/PNG, put it up somewhere on the internet, and link to it w...
<p>You could use a MIDI file, this stores durations/pitches etc. as you suggest. You should be able to easily find software to create this type of file. However you will probably find the results sound terrible, as it is very dependent on the synthesiser hardware/software that is available on the end-user's machine. </...
<p>Check out the MIDI format for instruments. <a href="http://en.wikipedia.org/wiki/MIDI" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/MIDI</a></p>
46,445
<p>I have a 2 dimensional array, like so:</p> <pre><code>char[,] str = new char[2,50]; </code></pre> <p>Now, after I've stored contents in both str[0] and str[1], how do I store it in a </p> <pre><code>string[] s = new string[2]; </code></pre> <p>?</p> <p>I tried </p> <pre><code>s[0] = str[0].ToString(); </code><...
<p>A jagged array is almost always the best solution for a variety of reasons, and this is one good example. There is so much more flexibility available with an array of arrays than with a multi-dimensional array. In this case, once you have the values in an array of chars, then a constructor on the string class can be...
<p>You can do it with LINQ:</p> <pre><code>string[] Convert(char[,] chars) { return Enumerable.Range(0, chars.GetLength(1)) .Select(i =&gt; Enumerable.Range(0, chars.GetLength(0)) .Select(j =&gt; chars[j, i])) .Select(chars =&gt;...
23,601
<p>I'm starting a new web project and I am considering two presentation frameworks. I am thinking either about ASP.NET MVC or Silverlight. I would tend toward Silverlight since I'm quite experienced .NET developer while I have just a basic knowledge of ASP.NET controls.</p>
<blockquote> <p>It is mainly going to be an iternal product so browsers are not an issue.</p> </blockquote> <p>You still have not written a <em>proper</em> description about the nature of your application. It is difficult to assess which technology is a good fit without first knowing well enough the domain the app...
<p>It's hard to recommend one over the other without knowing what your application is. Whatever you do decide, make sure you keep your target audience in mind; not everyone is going to have Silverlight installed on their computers.</p> <p>Personally, unless I was designing an incredibly interactive and beautiful web ...
5,358
<p>Should new projects use logback instead of log4j as a logging framework ?</p> <p>Or with other words :'Is logback better than log4j (leaving the SLF4J-'feature' of logback beside)?'</p>
<p>You should use SLF4J+Logback for logging.</p> <p>It provides neat features like parametrized messages and (in contrast to commons-logging) a Mapped Diagnostic Context (MDC, <a href="http://slf4j.org/apidocs/org/slf4j/MDC.html" rel="noreferrer">javadoc</a>, <a href="http://logback.qos.ch/manual/mdc.html" rel="norefe...
<p>I'm not familiar with SLF4J, and I've only taken a brief look at logback, but two things come to mind.</p> <p>First, why are you excluding a tool from examination? I think it's important to keep an open mind and examine all possibilities to choose the best one.</p> <p>Second, I think that in some projects one tool...
21,556
<p>How do I integrate AJAX toolkit into MVC applications in .net?</p>
<p>When you say AVLTree "redefines" the insert, what exactly do you mean? It has to override the method, which means having exactly the same signature (modulo variance).</p> <p>Could you post the signatures of insert() in both BSTree and AVLTree?</p> <p>If you apply the @Override annotation in AVLTree (assuming a sui...
<p>In java, (I'm talking relatively to C++), polymorphism should "always" work. It's hard to see what's wrong without looking at the code.. maybe you could post interesting part? Such as the method's signature, class declaration, etc.. My guess is that you haven't used the same signature for both methods. </p>
43,731
<p>Somewhere along the line I picked up the notion that using iframes is 'bad practice'. </p> <p>Is this true? What are the pros/cons of using them?</p>
<p>As with all technologies, it has its ups and downs. If you are using an iframe to get around a properly developed site, then of course it is bad practice. However sometimes an iframe is acceptable. </p> <p>One of the main problems with an iframe has to do with bookmarks and navigation. If you are using it to simply...
<p>I have seen IFRAMEs applied very successfully as an easy way to make dynamic context menus, but the target audience of that web-app was only Internet Explorer users.</p> <p>I would say that it all depends on your requirements. If you wish to make sure your page works equally well on every browser, avoid IFRAMEs. If...
47,342
<p>Our organization provides a variety of services to our clients (e.g., web hosting, tech support, custom programming, etc...). There's a page on our website that lists all available services and their corresponding prices. This was static data, but my boss wants it all pulled from a database instead.</p> <p>There ar...
<p>Consider that this column is a <strong>price displayed to the customer</strong> that can contain anything.</p> <p>You'd be inviting grief if you try to make it a numeric column. You're already struggling with two non-conforming values, and tomorrow your boss might want more...</p> <ul> <li>PRICE ON APPLICATION!</...
<p><a href="http://books.google.co.in/books?id=0f9oLxovqIMC&amp;pg=PA352&amp;lpg=PA352&amp;dq=How+do+you+handle+%E2%80%9Cspecial-case%E2%80%9D+data+when+modeling+a+database%3F&amp;source=bl&amp;ots=KxN9eRgO9q&amp;sig=NqWPvxceNJPoyZzVS4AUtE-FF5c&amp;hl=en&amp;ei=V3RlSpDtI4bVkAWkzbHNDg&amp;sa=X&amp;oi=book_result&amp;ct=...
44,889
<p>I just received my Wanhao Duplicator i3 PLUS. Everything prints and functions fine via SD card and the display but when connecting to my Mac computer the printer seems to restart.</p> <ul> <li>Baud Rate: 115200</li> <li>Serial Port: <code>/dev/tty.wchusbserial1420</code></li> </ul> <p>Any ideas what it could be?</...
<p>I don't know that printer. But Arduino has a feature that a USB connection causes a reset. The Idea is that this helps when doing software update as the Arduino Boot loader will be active for one second after that reset.</p> <p>This can be disabled, but needs hardware modification.</p>
<p>That is normal on most printers. They restart if you connect.</p> <p>As you have an SD card slot I would recommend using it rather than your computer. If your connected computer goes to sleep it would also reset the connection after wakeup.</p>
353
<p>When using mercurial, I'd like to be able to diff the working copy of a file with the tip file in my default remote repository. Is there an easy way to do this?</p> <p>I know I can do an "hg incoming -p" to see the patch sets of changes coming in, but it'd be nice to just directly see the actual changes for a part...
<p>After some digging, I came across the <a href="https://www.mercurial-scm.org/wiki/RdiffExtension" rel="nofollow noreferrer">Rdiff extension</a> that does most of what I want it to.</p> <p>It doesn't come with mercurial, but it can be installed by cloning the repository:</p> <pre><code>hg clone http://hg.kublai.com...
<p>Using templates you can get a list of all changed files:</p> <pre><code>hg incoming --template {files} </code></pre>
18,903
<p>I have a dataset in a worksheet that can be different every time. I am creating a pivottable from that data, but it is possible that one of the PivotItems is not there. For example:</p> <pre><code>.PivotItems("Administratie").Visible = False </code></pre> <p>If that specific value is not in my dataset, the VBA scr...
<p>I've got it! :D</p> <pre><code>Dim Table As PivotTable Dim FoundCell As Object Dim All As Range Dim PvI As PivotItem Set All = Worksheets("Analyse").Range("A7:AZ10000") Set Table = Worksheets("Analyse").PivotTables("tablename") For Each PvI In Table.PivotFields("fieldname").PivotItems Set Found...
<p>Try something like this:</p> <pre><code>Public Function Test() On Error GoTo Test_EH Dim pvtField As PivotField Dim pvtItem As PivotItem Dim pvtItems As PivotItems ' Change "Pivot" to the name of the worksheet that has the pivot table. ' Change "PivotTable1" to the name of the pivot table;...
48,061
<p>When I try to do that I get the following error:</p> <blockquote> <p>Changes to 64-bit applications are not allowed.</p> </blockquote> <hr /> <p>@Wilka: That option wasn't available until I selected Tools &gt; Options &gt; Projects and Solutions &gt; General and check &quot;Show advanced build configurations&quot;. ...
<p>You could try:</p> <blockquote> <p>In Visual Basic 2008 Express Edition: Build menu > Configuration Manager...</p> <p>Change Active solution platform: to "...", choose "x86", save the new platform.</p> <p>Now the "x86" option is available in the Compile settings.</p> </blockquote> <p>You may ...
<p>AFAIK Visual Studio Express does not come with 64bit support.</p>
5,006
<p>I use an XML file in App_Data in conjunction with a Repeater on the main page of an intranet application allow me to display messages to users when they logon about application status, maintenance, etc. To test the functionality, it would be nice to have the file in the App_Data folder under development, but if I d...
<p>In Visual Studio 2005, I see a checkbox labeled "Include files from the App_Data folder", which defaults to checked. Have you tried publishing with that checkbox unchecked?</p> <p><strong>EDIT:</strong> Seeing as how that checkbox isn't available for your project, I would look into using the <a href="http://weblogs...
<p>To avoid that problem I would also deploy to a local "staging" location, essentially a folder on my desktop. Once the files were compiled and deployed there by Visual Studio I would delete the files I wasn't interested in (in your case App_Data) and then either XCopy or using Windows Explorer to copy the files to th...
26,117
<p>I've seen the following code many times:</p> <pre><code>try { ... // some code } catch (Exception ex) { ... // Do something throw new CustomException(ex); // or // throw; // or // throw ex; } </code></pre> <p>Can you please explain the purpose of re-throwing an exception? Is it follow...
<p>Rethrowing the same exception is useful if you want to, say, log the exception, but not handle it.</p> <p>Throwing a new exception that wraps the caught exception is good for abstraction. e.g., your library uses a third-party library that throws an exception that the clients of your library shouldn't know about. In...
<p>THE MAIN REASON of re-throwing exceptions is to leave Call Stack untouched, so you can get more complete picture of what happens and calls sequence.</p>
13,868
<p>I am creating an HTTP handler that listens for calls to a specific file type, and handles it accordingly. My HTTP Handler listens for .bcn files, then writes a cookie to the user's computer and sends back an image... this will be used in advertising banners so that the user is tagged as seeing the banner, and we ca...
<p>You can access the Response object from the HttpContext object passed to the ProcessRequest method from IHttpHandler. This is the same object exposed by Page.Response.</p>
<p>the ProcessRequest() method defined in IHttpHandler is passed a HttpContext reference. This HttpContext object will have a property named Response and Request, which you can use.</p>
15,924
<p>This seems to me to be the kind of issue that would crop up all the time with SQL/database development, but then I'm new to all this, so forgive my ignorance.</p> <p>I have 2 tables:</p> <pre><code>CREATE TABLE [dbo].[Tracks]( [TrackStringId] [bigint] NOT NULL, [Id] [bigint] IDENTITY(1,1) NOT NULL, [Ti...
<p>First, insert into <code>TrackStrings</code>, omitting the primary key column from the column list. This invokes its <code>IDENTITY</code> column which generates a value automatically.</p> <pre><code>INSERT INTO [dbo].[TrackStrings] ([String]) VALUES ('some string'); </code></pre> <p>Second, insert into <code>...
<p>First insert into the primary table.</p> <pre><code>INSERT INTO trackstrings VALUES('myvalue') </code></pre> <p>Next get the identity. This method depends on whether you're are doing it all in 1 statement or a stored procedure or some other method. I will assume 1 statement so I'll just insert with the identity ...
41,753
<p>Our Windows Forms application by default saves data files in a user's 'My Documents' folder (on XP) or 'Documents' folder (on Vista). We look up this location by calling:</p> <pre><code>Environment.GetFolderPath( Environment.SpecialFolder.Personal ) </code></pre> <p>We know for sure this works great for users whos...
<p>Yes it does. You can test this out yourself by updating the corresponding registry entry for the folder. Look under ...</p> <pre><code>\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\Shell Folders\ </code></pre>
<p>I would expect that it does. The documentation for both <code>Environment.GetFolderPath</code> and the underlying <a href="http://msdn.microsoft.com/en-us/library/bb762204(VS.85).aspx" rel="nofollow noreferrer"><code>SHGetSpecialFolderPath</code></a> don't give any indication that it would not resolve correctly nor...
36,348
<p>Another angle: how do I browse all the XUL for a given chrome path, e.g.</p> <p><a href="http://kb.mozillazine.org/Dev_:_Firefox_Chrome_URLs" rel="nofollow noreferrer">http://kb.mozillazine.org/Dev_:_Firefox_Chrome_URLs</a> has a listing but seems to be out of date.</p>
<p>At least in Firefox 3, <code>chrome://global/content/netError.xhtml?e=nssBadCert&amp;u=</code> is what you're looking for. <code>netError.xhtml</code> handles all sorts of connection problems, and modifies itself depending on what the actual error is.</p>
<p>Mozilla <a href="https://developer.mozilla.org/en/XUL_Tutorial/The_Chrome_URL" rel="nofollow noreferrer"><code>chrome://</code> URLs</a> refer to actual files located in a .jar file in some fairly well-defined places.</p> <p>The main browser (chrome://browser/content/...) itself:</p> <pre><code>{where you installe...
36,270
<p>I want do something like this:</p> <pre><code>Result = 'MyString' in [string1, string2, string3, string4]; </code></pre> <p>This can't be used with strings and I don't want to do something like this:</p> <pre><code>Result = (('MyString' = string1) or ('MyString' = string2)); </code></pre> <p>Also I think that cr...
<p>You could use <code>AnsiIndexText(const AnsiString AText, const array of string AValues):integer</code> or <code>MatchStr(const AText: string; const AValues: array of string): Boolean;</code> (Both from <code>StrUtils</code> unit)</p> <p>Something like:</p> <pre><code>Result := (AnsiIndexText('Hi',['Hello','Hi','Foo...
<p>Here is a function that does the job:</p> <pre><code>function StringInArray(Value: string; Strings: array of string): Boolean; var I: Integer; begin Result := False; for I := Low(Strings) to High(Strings) do Result := Result or (Value = Strings[I]); end; </code></pre> <p>In fact, you do compare MyString with...
30,614
<p>Is it possible for the compiler to remove statements used for debugging purposes (such as logging) from production code? The debug statements would need to be marked somehow, maybe using annotations.</p> <p>It's easy to set a property (debug = true) and check it at each debug statement, but this can reduce performa...
<p>Two recommendations.</p> <p><strong>First:</strong> for real logging, use a modern logging package like log4j or java's own built in logging. Don't worry about performance so much, the logging level check is on the order of nanoseconds. (it's an integer comparison).</p> <p>And if you have more than a single log st...
<p>To directly answer your question: I don't know.</p> <p>But here is another solution to your problem: In my mind, there are two statements that collide with each other here: "debug statements" and "production code". </p> <p>What is the purpose of debug statements? Help to get rid of bugs while (unit) testing. If a ...
5,199
<p>Need a function like: </p> <pre><code>function isGoogleURL(url) { ... } </code></pre> <p>that returns true iff URL belongs to Google. No false positives; no false negatives.</p> <p>Luckily there's <a href="http://www.google.com/supported_domains" rel="nofollow noreferrer">this</a> as a reference:</p> <blockquote...
<p>Here is an updated version of Prestaul's answer which solves the two problems I mentioned in the comment there.</p> <pre><code>var GOOGLE_DOMAINS = ([ '.google.com', '.google.ad', '.google.ae', '.google.com.af', '.google.com.ag', '.google.com.ai', '.google.am', '.google.it.ao', '...
<p>Without a regex to individually match each and every TLD, there isn't really an 'elegant way of doing it'.</p>
32,455
<p>We have a CustomAction that sets some registry key HKEY LOCAL_MACHINE. This wasn't working on Vista with UAC, until we made the action "deferred". The installer worked in other cases. Anyone knows why?</p> <p>We are using WIX to create the installer.</p>
<p>+1 Lance. To phrase it another way and give some more info</p> <p>There are 2 steps in the MSI process</p> <ul> <li><strong>Immediate</strong> - where you collect preferences (install dir etc) - no changes to the machine should be made here</li> </ul> <p>and then later</p> <ul> <li><strong>Deferred</strong> - wh...
<p>Your custom action was being run immediately when it was encountered in the InstallExecuteSequence; instead of when the actual install script was being executed. This caused your custom action to be executed with the users permissions rather than with the system's elevated permissions. This series of blog posts wi...
31,083
<p>If there will be a small number of files it should be easy with a recursive function to pass through all the files and add the size but what if there are lots of files, and by lots i really mean lots of files.</p>
<p>You mean something like this?</p> <pre><code>import os for path, dirs, files in os.walk( root ): for f in files: print path, f, os.path.getsize( os.path.join( path, f ) ) </code></pre>
<p>If you are on a posix system that provides du, you should be able to use <code>pexpect.run</code> or <code>subprocess</code> to execute <code>du &lt;path to folder&gt;</code> to get the size of the folder and subfiles. Keep in mind it will output a string with each file listed and each folder totaled. (Look at the...
43,457
<p>How can I programatically get the path to MSBuild from a machine where my .exe is running?</p> <p>I can get the .NET version from the Environment but is there a way of getting the correct folder for a .NET version?</p>
<p>Poking around the registry, it looks like</p> <pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\2.0 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\3.5 HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\4.0 </code></pre> <p>may be what you're after; fire up regedit.exe and...
<p>If You want to compile a Delphi project, look at <a href="https://stackoverflow.com/questions/1342859/error-msb4040-there-is-no-target-in-the-project-when-using-msbuilddelphi2009">&quot;ERROR MSB4040 There is no target in the project&quot; when using msbuild+Delphi2009</a></p> <p>Correct answer there are said: "The...
42,522
<p>We host a C++ based WebServices application in IIS and we're finding that when we try to start our own C++ threads IIS has a fit and crashes. The threads are based on boost.thread which clearly dribbles down to the standard Windows threading API underneath. </p> <p>The reason I need to start the thread is to list...
<p>It sounds like you're creating a persistent thread, which lives longer than the lifetime of the request that initiates it. You don't mention whether it's ASP.NET C++/CLI, Managed C++ or an ISAPI extension or filter, or even CGI.</p> <p>Conceptually, code that is called by IIS is only supposed to "live" for the life...
<p>I don't know about C++, but in my C# ASP.NET application, I am creating threads and it's working fine. Are .NET "real" threads? I don't know... but they behave like you'd want a thread to behave. Maybe you can have just that part of your app be ASP.NET C#? </p>
34,200
<p>The purpose of this component is to test knowledge of a student on a given subject - in the example below it would be geography. The student is given a piece of text with missing words in it. He/she has to fill in (type in this case) the missing words - hence this kind of test/exercise is called gap-fill.There could...
<p>You need a container that supports flow layout. It's not part of the standard Flex framework but you can find some working implementation <a href="http://flexlib.googlecode.com/svn/trunk/docs/flexlib/containers/FlowBox.html" rel="nofollow noreferrer">here</a> (part of the excellent FlexLib) and <a href="http://www.m...
<p>I guess you could have a Canvas, and dynamically add Labels &amp; TextInputs. The problem here would be knowing where the line-breaks go; I'm not sure how you can easily calculate the width of a text-based control from the set text but it must be possible.</p> <p>I wondered if there is a layout control which can do...
15,726
<p>I'm building a .net application with windows forms. I'm pondering on the following problem: If I specify fonts in my application that are available only in Vista and Office 07, what will happen when the application tries to run in a machine without these ?</p> <p>I suppose the system won't be able to fall back to a...
<p>I think it's <code>System.Drawing.SystemFonts.MessageBoxFont</code> that gives Segoe UI, Tahoma, then MS Sans Serif depending on the OS. As long as your layout is fluid enough---WPF is good at this, but in Windows Forms it's much harder---then it'll work great. Regardless, it'd be worth using that setting then testi...
<p>Check the EULA first in both Office and Vista to make sure the fonts aren't sacred, but you may be able to include those fonts in your installer package and have it install them.</p>
31,743
<p>I'm wondering about instances when it makes sent to use #define and #if statements. I've known about it for a while, but never incorporated it into my way of coding. How exactly does this affect the compilation?</p> <blockquote> <p>Is #define the only thing that determines if the code is included when compiled? I...
<p>In C# <code>#define</code> macros, like some of Bernard's examples, are not allowed. The only common use of <code>#define</code>/<code>#if</code>s in C# is for adding optional debug only code. For example:</p> <pre><code> static void Main(string[] args) { #if DEBUG //this only compiles if...
<p>@Ed: When using C++, there is rarely any benefit for using #define over inline functions when creating macros. The idea of "greater speed" is a misconception. With inline functions you get the same speed, but you also get type safey, and no side-effects of preprocessor "pasting" due to the fact that parameters are e...
3,658
<p>So, I've read that it is not a good idea to install VS2008 on my test server machine as it changes the run time environment too much. I've never attempted remote debugging with Visual Studio before, so what is the "best" way to get line by line remote debugging of server side web app code. I'd like to be able to s...
<p>First, this is MUCH easier if both the server and your workstation are on the same domain (the server needs access to connect to your machine). In your C:\Program Files\Microsoft Visual Studio 9.0\Common7\IDE\Remote Debugger\x86 (or x64, or ia64) directory are the files you need to copy to your server. There are dif...
<p>Visual Studio comes with a <a href="http://msdn.microsoft.com/en-us/library/bt727f1t(VS.71).aspx" rel="nofollow noreferrer">remote debugger</a> that you can run as an exe on your server. It works best if you can run it as the same domain user as your copy of visual studio. You can then do an attach to process from t...
6,087
<p>This code works perfectly</p> <pre><code>myNotebook = new wxNotebook( this, IDC_NOTEBOOK, wxDefaultPosition, wxSize(500, 500) ); myNotebook-&gt;AddPage( new wxNotebookPage( myNotebook, -1 ), L"TEST RECOMMENDATIONS 1" ); myNotebook-&gt;AddPage( new wxNotebookPage( myNotebook, -1 ), L"TEST RECOMMENDATIONS 2" ); myNot...
<p>After experimentation, I found this way:</p> <p>Add one line, after all the AddPage() calls</p> <pre><code> myNotebook-&gt;Layout(); </code></pre>
<p>After experimentation, I found this way:</p> <p>Add one line, after all the AddPage() calls</p> <pre><code> myNotebook-&gt;Layout(); </code></pre>
39,262
<p>I've been playing around with Qt for a few hours now. I found that qmake produces Xcode project files on Mac OS X instead of good ol' makefiles. I don't want to launch Xcode every time I want to build "Hello, world".</p> <p>How do I make qmake generate regular makefiles or, if that's something that cannot be done o...
<pre><code>$ man xcodebuild </code></pre> <p>So a typical command might be something like:</p> <pre><code>$ xcodebuild -project myProject.xcodeproj -alltargets </code></pre>
<p>Looking at this part of your back trace:</p> <blockquote> <p># 2008-12-18 20:40:52.333 xcodebuild[1070:613] [MT] ASSERTION FAILURE in /SourceCache/DevToolsBase/DevToolsBase-921/pbxcore/FileTypes/PBXCFBundleWrapperFileType.m:174 # Details: path should be a non-empty string, but it's an empty string # Ob...
49,507
<p>Ok thanks for the 1st guy I found the code.</p> <p>Machine.Migrations: I mean, the data schema/data migration framework.</p> <p>I mean, the one mentioned here: <a href="http://blog.eleutian.com/2008/04/25/AFirstLookAtMachineMigrations.aspx" rel="nofollow noreferrer">http://blog.eleutian.com/2008/04/25/AFirstLookAt...
<p>It is an experimental library authored by the blog author.</p> <p>See <a href="http://blog.eleutian.com/Default.aspx#a2e4f933f-e00c-445e-ab64-17bf9a64d96f" rel="nofollow noreferrer">http://blog.eleutian.com/Default.aspx#a2e4f933f-e00c-445e-ab64-17bf9a64d96f</a></p> <p>There is a link at the bottom of that post.</p...
<p>I've just publish a new migrations library called Mig#. You can find it on GitHub: <a href="https://github.com/dradovic/MigSharp" rel="nofollow">https://github.com/dradovic/MigSharp</a></p> <p>It should be mature enough as we are using it at my workplace for productive code.</p> <p>Mig# currently offers support fo...
12,934
<p>I need to store the summer time (daylight saving time) change-over rules for different world regions in a database. I already have a way of storing regions and sub-regions (so the whole <a href="http://en.wikipedia.org/wiki/Image:DaylightSaving-World-Subdivisions.png" rel="nofollow noreferrer">"half of Australia"/A...
<p>You're pretty much doomed to the first option. You can pre-generate dates as far ahead as you wish for countries that have "rules" regarding time changes, but some areas do not have any rule and the changes are enacted either by dictatorial fiat or by legislative vote annually (Brazil did so until this year).</p> <...
<p>The Oracle DBMS automatically handles this for you. The date is stored in an internal representation (lets imagine UMT for the sake of the argument) and is formatted according to the rules of the timezone when converted to a string.</p> <p>This also solves the argument about what to do during the change over time....
18,655
<p>Does SQLAlchemy support some kind of caching so if I repeatedly run the same query it returns the response from cache instead of querying the database? Is this cache automatically cleared when the DB is updated?</p> <p>Or what's the best way to implement this on a CherryPy + SQLAlchemy setup?</p>
<p>We have a pretty comprehensive caching solution, as an example in conjunction with embedded hooks, in 0.6. It's a recipe to subclass Query, make it aware of Beaker, and allow control of query caching for explicit queries as well as lazy loaders via query options.</p> <p>I'm running it in production now. The exam...
<p>Or use an application-level cache via weak references dicts (weakref.WeakValueDictionary), see an example here : <a href="http://www.sqlalchemy.org/trac/wiki/UsageRecipes/UniqueObject" rel="noreferrer">http://www.sqlalchemy.org/trac/wiki/UsageRecipes/UniqueObject</a></p>
25,099
<pre><code> self.logger.info(msg) popinstance=poplib.POP3(self.account[0]) self.logger.info(popinstance.getwelcome()) popinstance.user(self.account[1]) popinstance.pass_(self.account[2]) try: (numMsgs, totalSize)=popinstance.stat() self.logger.info("POP contains " + str(numMsgs) +...
<p>It is probably a Space character encoded in <a href="http://en.wikipedia.org/wiki/Quoted-printable" rel="noreferrer">quoted-printable</a></p>
<p>Use the <a href="http://docs.python.org/library/quopri.html" rel="noreferrer">quopri</a> module to decode the string.</p>
41,409
<p>I have an iterable of entries on which I would like to gather some simple statistics, say the count of all numbers divisible by two and the count of all numbers divisible by three.</p> <p>My first alternative, While only iterating through the list once and avoiding the list expansion (and keeping the <a href="http:...
<p>Having to iterate over the list multiple times isn't elegant IMHO.</p> <p>I'd probably create a function that allows doing:</p> <pre><code>twos, threes = countmatching(xrange(1,10), lambda a: a % 2 == 0, lambda a: a % 3 == 0) </code></pre> <p>A starting po...
<p>I would definitely be looking at a <a href="http://www.numpy.org/" rel="nofollow noreferrer">numpy</a> array instead of an iterable list if you just have numbers. You will almost certainly be able to do what you want with some terse arithmetic on the array.</p>
19,005
<p>I'm currently working on a class that calculates the difference between two objects. I'm trying to decide what the best design for this class would be. I see two options:</p> <p>1) Single-use class instance. Takes the objects to diff in the constructor and calculates the diff for that.</p> <pre><code>public cla...
<h3>Use Object-Oriented Programming</h3> <p>Use option 2, but do <em>not</em> make it static.</p> <h3>The Strategy Pattern</h3> <p>This way, an instance <code>MyObjDiffer</code> can be passed to anyone that needs a <a href="http://en.wikipedia.org/wiki/Strategy_pattern" rel="nofollow noreferrer">Strategy</a> for com...
<p>I'd take numero 2 and reflect on whether I should make this static.</p>
15,529
<p>Does anyone know a good SMTP/IMAP server library for C#?</p> <p>I only found some long abandoned projects.</p> <hr> <p>Only <strong>SERVER SIDE</strong> libraries, please no more posts about client libs.</p> <p>Thanks, Fionn</p>
<p>LumiSoft.Net, a library from the LumiSoft mail server, is a free server side library. The server classes (e.g. IMAP Server, POP3 Server and SMTP Server) fire events when they need information or action for your server application, for example "give me a list of messages in virtual folder XXY".</p> <p><a href="http:...
<p>For SMTP, there's <code>System.Net.Mail</code>. For IMAP, I don't know. But once you fetch the email from the server, you'll want to parse it. The MIME parsing is the hard part. For that, I use, and recommend, <code>SharpMimeTools</code>.</p>
30,956
<p>I have a simple list I am using for a horizontal menu:</p> <pre><code>&lt;ul&gt; &lt;h1&gt;Menu&lt;/h1&gt; &lt;li&gt; &lt;a href="/" class="selected"&gt;Home&lt;/a&gt; &lt;/li&gt; &lt;li&gt; &lt;a href="/Home"&gt;Forum&lt;/a&gt; &lt;/li&gt; &lt;/ul&gt; </code></pre> <p>When I add a ...
<p>The a element is an inline element, meaning it only applies to the text it encloses. If you want the background color to stretch across horizontally, apply the selected class to a block level element. Applying the class to the li element should work fine.</p> <p>Alternatively, you could add this to the selected cla...
<p>Put the selected class on the <code>&lt;li&gt;</code> and not the <code>&lt;a&gt;</code></p>
13,724
<p>I need to consume an external web service from my VB6 program. I want to be able to deploy my program without the SOAP toolkit, if possible, but that's not a requirement. I do not have the web service source and I didn't create it. It is a vendor-provided service.</p> <p>So outside of the SOAP toolkit, what is the ...
<p>I use this function to get data from a web service.</p> <pre><code>Private Function HttpGetRequest(url As String) As DOMDocument Dim req As XMLHTTP60 Set req = New XMLHTTP60 req.Open "GET", url, False req.send "" Dim resp As DOMDocument If req.responseText &lt;&gt; vbNullString Then ...
<p>The SOAP toolkit is arguably the best you could get. Trying to do the same thing without it would require considerable extra effort. You need to have quite serious reasons to do that.</p> <p>The format of the SOAP messages is not really easy to read or write manually and a third-party library is highly advised.</p>...
14,914
<p>What are the established coding standards for JavaScript?</p>
<p>Not exactly what you're looking for, but (like Doug Crockford's vids) I think everybody who writes/edits/reviews JS should look at Chris Heilmann's <a href="http://www.slideshare.net/cheilmann/fronteers-maintainability-presentation" rel="noreferrer">slides</a> and <a href="http://ajaxian.com/archives/maintainable-ja...
<p>The <a href="http://jibbering.com/faq/notes/code-guidelines/" rel="nofollow noreferrer">comp.lang.javascript Code Guidelines</a> document points to causes of errors and problems related to javascript for web applications and how to avoid them.</p>
26,034
<p>According to the documentation, they're pretty much interchangeable. Is there a stylistic reason to use one over the other?</p>
<p>I like to use double quotes around strings that are used for interpolation or that are natural language messages, and single quotes for small symbol-like strings, but will break the rules if the strings contain quotes, or if I forget. I use triple double quotes for docstrings and raw string literals for regular expr...
<p><code>'</code> = <code>"</code></p> <p><code>/</code> = <code>\</code> = <code>\\</code></p> <p>example : </p> <pre><code>f = open('c:\word.txt', 'r') f = open("c:\word.txt", "r") f = open("c:/word.txt", "r") f = open("c:\\\word.txt", "r") </code></pre> <p>Results are the same</p> <p>=>> no, they're not the sa...
7,987
<p>Is it possible to have one application binary build for multiple mobile devices (on <a href="http://brew.qualcomm.com/brew/" rel="nofollow noreferrer">BREW</a> platform), rather than making a separate build for each device using build script with conditional compilation.</p> <p>In particular is is possible to use s...
<p>Yes, it is possible, we were able to do this at my previous place of work. What's required is tricky though:</p> <ol> <li>Compile for the lowest common denominator BREW version. Version 1.1 is the base for all current handsets out there.</li> <li>Your code must be able to handle multiple resolutions. The methods fo...
<p>Another idea might be to have the handsets divided into 2 to 4 categories based on say screen dimensions and create builds for them. It is a much faster route too as you will be able to support all the handsets you want to support with much lesser complexity.</p> <p>Another thing to see is the BREW versions on the ...
9,676
<p>Can you convert a 3D printer to a laser engraver?</p> <p>If so is there a specific thing I have to buy?</p>
<p>Yes, one can convert a 3D printer into a Laser Engraver, and it isn't even all that problematic.</p> <ul> <li>You'd need to acquire a laser diode. These are usually not available with a lot of power - certainly not the hundreds of Watts that come from a proper CO2 laser - but depending on your printer, it might be p...
<p>Probably a laser... and a mount for the laser. Then connect its power supply to be switched by the extruder supply/signal. Also, there would be no need for any Z-axis movement, beyond setting the correct height of the laser device.</p> <p>However, unless you are handy with DIY, messing about with microcontrollers an...
2,043
<p>Odd behavior loading emacs on ubuntu, there seems to be some initialization that goes on that is not in the .emacs nor in any of the files emacs reports loading through "emacs --debug-init". I've found some references to font-related resizing but this behavior doesn't seem to be limited to that (e.g reappearing menu...
<p>The sequence of the Emacs initialization is the following (at least, for Emacs 22):</p> <ol> <li>Load the file <em>debian-startup</em> (.el or .elc) found in <em>load-path</em> (usually, <em>/usr/share/emacs/site-lisp/debian-startup.el</em> or <em>/usr/share/emacs22/site-lisp/debian-startup.elc</em>) and call the f...
<p>I've found this official document that introduces the emacs init steps: <a href="http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html" rel="nofollow">http://www.gnu.org/software/emacs/manual/html_node/emacs/Init-File.html</a> </p> <blockquote> <p>When Emacs is started, it normally tries to load...
22,954
<p>My company is looking to start distributing some software we developed and would like to be able to let people try the software out before buying. We'd also like to make sure it can't be copied and distributed to our customers' customers.</p> <p>One model we've seen is tying a license to a MAC address so the softw...
<p>I'd suggest you take the pieces of information you want in the key, and hash it with md5, and then just take the first X characters (where X is a key length you think is manageable).</p> <p>Cryptographically, it's far from perfect, but this is the sort of area where you want to put in the minimum amount of effort w...
<p>It is difficult to provide a good answer without knowing anything about your product and customers. For enterprise software sold to technical people you can use a fairly complex licensing system and they'll figure it out. For consumer software sold to the barely computer-literate, you need a much simpler system.</p>...
7,228
<p>I have a class that I want to use to store "properties" for another class. These properties simply have a name and a value. Ideally, what I would like is to be able to add <em>typed</em> properties, so that the "value" returned is always of the type that I want it to be.</p> <p>The type should always be a primitive...
<p>I am not sure whether I understood your intentions correctly, but let's see if this one helps.</p> <pre><code>public class TypedProperty&lt;T&gt; : Property where T : IConvertible { public T TypedValue { get { return (T)Convert.ChangeType(base.Value, typeof(T)); } set { base.Value = value.To...
<pre><code>public class TypedProperty&lt;T&gt; : Property { public T TypedValue { get { return (T)(object)base.Value; } set { base.Value = value.ToString();} } } </code></pre> <p>I using converting via an object. It is a little bit simpler.</p>
3,007
<p>I want a single number that represents the current date and time, like a <a href="https://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">Unix timestamp</a>.</p>
<h3>Timestamp in milliseconds</h3> <p>To get the number of milliseconds since <a href="https://en.wikipedia.org/wiki/Unix_time" rel="noreferrer">Unix epoch</a>, call <a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/now" rel="noreferrer"><code>Date.now</code></a>:</p> <pre><...
<pre><code>time = Math.round(((new Date()).getTime()-Date.UTC(1970,0,1))/1000); </code></pre>
27,266
<p>Are there plans or ideas floating around for a logo contest, or is that a Public-Beta stage thing?</p>
<p>Getting a logo is part of getting a design, which is something that happens when a site <em>graduates</em> out of public beta.</p> <p>In short, not for a long time yet.</p> <p>While the site is in beta it will keep this theme that it currently has.</p>
<p>Getting a logo is part of getting a design, which is something that happens when a site <em>graduates</em> out of public beta.</p> <p>In short, not for a long time yet.</p> <p>While the site is in beta it will keep this theme that it currently has.</p>
5
<p>I need to execute a batch file as part of the un-install process in a Windows installer project (standard OOTB VS 2008 installer project-vdproj). One cannot execute a bat file directly from the Custom Actions in the installer project, so I wrote a quick vbs script to call the required bat file.<br> vbs code: </p> ...
<p>I've run into this same problem and the issue is that you can't call WScript within the vbs file - you will need to JUST call CreateObject</p> <p>ie.</p> <pre><code>Set WshShell = CreateObject( "WScript.Shell" ) command = "uninstall-windows-serivce.bat" msgbox command WshShell.Run ("cmd /C " &amp; """" &amp; comm...
<p>In your installer class, are you overriding the Uninstall method: </p> <pre><code> Public Overrides Sub Uninstall(ByVal savedState As System.Collections.IDictionary) MyBase.Uninstall(savedState) 'Shell to batch file here End Sub </code></pre> <p>And secondly, have you qualified the full ...
12,411
<p>When using a <code>Zend_Form</code>, the only way to validate that an input is not left blank is to do</p> <pre><code>$element-&gt;setRequired(true); </code></pre> <p>If this is not set and the element is blank, it appears to me that validation is not run on the element.</p> <p>If I do use <code>setRequired()</co...
<p>I did it this way (ZF 1.5):</p> <pre><code>$name = new Zend_Form_Element_Text('name'); $name-&gt;setLabel('Full Name: ') -&gt;setRequired(true) -&gt;addFilter('StripTags') -&gt;addFilter('StringTrim') -&gt;addValidator($MyNotEmpty); </code></pre> <p>so, the addValidator() is the interesting par...
<p>As far as I can see <a href="http://framework.zend.com/manual/en/zend.form.forms.html#zend.form.forms.validation.errors/" rel="nofollow noreferrer">Changing the error message</a> has no way of changing the message of a specific error. Plus the manual makes it look like like this is a function belonging to Zend_Form,...
5,521
<p>What GNU/Linux command-line tool would I use for performing a search and replace on a file? </p> <p>Can the search text, and replacement, be specified in a regex format?</p>
<pre><code>sed 's/a.*b/xyz/g;' old_file &gt; new_file </code></pre> <p><a href="http://www.gnu.org/software/sed/" rel="nofollow noreferrer">GNU sed</a> (which you probably have) is even more versatile:</p> <pre><code>sed -r --in-place 's/a(.*)b/x\1y/g;' your_file </code></pre> <p>Here is a brief explanation of those op...
<p><a href="http://www.grymoire.com/Unix/Sed.html" rel="noreferrer">sed</a>, the stream editor, and yes, it uses regex.</p>
18,866
<p>Structs seem like a useful way to parse a binary blob of data (ie a file or network packet). This is fine and dandy until you have variable size arrays in the blob. For instance:</p> <pre><code>struct nodeheader{ int flags; int data_size; char data[]; }; </code></pre> <p>This allows me to...
<p>You cannot have multiple variable sized arrays. How should the compiler at compile time know where friend[] is located? The location of friend depends on the size of data[] and the size of data is unknown at compile time.</p>
<p>(Was 'Use std::vector')</p> <p>Edit: </p> <p>On reading feedback, I suppose I should expand my answer. You can effectively fit two variable length arrays in your structure as follows, and the storage will be freed for you automatically when file_data goes out of scope:</p> <pre><code>struct nodeheader { std:...
21,558