instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I've read the description of "functionoids" <a href="https://isocpp.org/wiki/faq/pointers-to-members#functionoids" rel="nofollow noreferrer">here</a>. They look like a poor-man's version of Boost::function and Boost::bind. Am I missing something? Is there a good reason to use them if you're already using Boost?</p>
<p>No. </p> <p>Alternatively see the FQA answer <a href="http://yosefk.com/c++fqa/function.html#fqa-33.10" rel="nofollow noreferrer">here.</a></p>
<p>My vote goes to tr1::function. </p> <p><em>Functors</em> or <em>functionoids</em> represent the base from which <code>tr1/boost::function</code> has evolved. The limit with common-interface functors is that they break the OO-paradigm since they represent different types and can only passed to template functions (un...
32,200
<p>I have an array (<code>arr</code>) of elements, and a function (<code>f</code>) that takes 2 elements and returns a number.</p> <p>I need a permutation of the array, such that <code>f(arr[i], arr[i+1])</code> is as little as possible for each <code>i</code> in <code>arr</code>. (and it should loop, ie. it should al...
<p>What does "such that f(arr[i], arr[i+1]) is as little as possible for each i in arr" mean? Do you want minimize the <em>sum</em>? Do you want to minimize the largest of those? Do you want to minimize f(arr[0],arr[1]) first, then among all solutions that minimize this, pick the one that minimizes f(arr[1],arr[2]), et...
<p>I don't think the problem is well-defined in this form:</p> <p>Let's instead define n fcns g_i : Perms -> Reals</p> <pre><code>g_i(p) = f(a^p[i], a^p[i+1]), and wrap around when i+1 &gt; n </code></pre> <p>To say you want to minimize <em>f</em> over all permutations really implies you can pick a value of <em>i</e...
40,052
<p>What's the secret to getting ClaimsResponse working with <a href="http://code.google.com/p/dotnetopenid/" rel="noreferrer">DotNetOpenId</a>?</p> <p>For example, in this bit of code (from <a href="http://www.hanselman.com/blog/CategoryView.aspx?category=DasBlog" rel="noreferrer">Scott Hanselman's blog</a>) the Claim...
<p>Your code looks fine. But be aware that the sreg extension, which you are using, isn't supported by all OPs. If the OP you're authenticating with doesn't support it, then the response extension will be null as you're seeing. So a null check is always a good idea. </p> <p>myopenid.com supports sreg, if you're lo...
<p>I could receive parameters correctly after the following updated in web.config that I copied from a sample.</p> <pre><code>&lt;section name="dotNetOpenAuth" type="DotNetOpenAuth.Configuration.DotNetOpenAuthSection" requirePermission="false" allowLocation="true"/&gt; </code></pre> <p>und...
37,388
<p>If I have...</p> <pre><code>class Bunny &lt; ActiveRecord::Base has_many :carrots end </code></pre> <p>...how can I check in the View if <code>@bunny</code> has any carrots? I want to do something like this:</p> <pre><code>&lt;% if @bunny.carrots? %&gt; &lt;strong&gt;Yay! Carrots!&lt;/strong&gt; &lt;% for ...
<pre><code>&lt;% if @bunny.carrots.any? %&gt; &lt;strong&gt;Yay! Carrots!&lt;/strong&gt; &lt;% for carrot in @bunny.carrots %&gt; You got a &lt;%=h carrot.color %&gt; carrot!&lt;br /&gt; &lt;% end %&gt; &lt;% end %&gt; </code></pre>
<p><code>@bunny.carrots</code> is an array, so you can treat it as such by calling <a href="http://www.ruby-doc.org/core/classes/Array.html" rel="nofollow noreferrer">array methods</a> on it, e.g. <code>unless @bunny.carrots.empty?</code></p>
38,058
<p>I'm building an Android app and I want to copy the text value of an EditText widget. It's possible for the user to press <code>Menu+A</code> then <code>Menu+C</code> to copy the value, but how would I do this programmatically?</p>
<p>Use <a href="https://developer.android.com/reference/android/content/ClipboardManager#setPrimaryClip(android.content.ClipData)" rel="noreferrer"><code>ClipboardManager#setPrimaryClip</code></a> method:</p> <pre><code>import android.content.ClipboardManager; // ... ClipboardManager clipboard = (ClipboardManager) g...
<p>Unless your app is the default input method editor (IME) or is the app that currently has focus, your app cannot access clipboard data on Android 10 or higher. <a href="https://developer.android.com/about/versions/10/privacy/changes#clipboard-data" rel="nofollow noreferrer">https://developer.android.com/about/versio...
29,468
<p>In SharePoint MOSS 2007, I have created a custom content type that I will be applying to a document library. One of the required fields is "Incoming Date" and another is the "Due Date". </p> <p>The Due Date is always 10 working days from the Incoming Date. The Incoming Date is when the mail room received the let...
<p>Firstly I should point out that you are making hard work of that formula, this will do the same.</p> <p>=[Incoming Date] + 10</p> <p>From the comments you have figured out that 10 working days (M-F) will always have 2 weekends so you can use this</p> <p>=[Incoming Date] + 14</p> <p>But this still doesn't take ac...
<p>Perhaps you can work around this limitation by using a workflow (possibly a custom one) to manage the due date? A due date implies that it is an actionable item that should be assigned to somebody anyways.</p> <p>Note that VS.NET doesn't have to be a luxury - you can use it for <a href="http://www.microsoft.com/Ex...
39,422
<p>I'm trying to determine if the user is using 24 hour or 12 hour time, and there doesn't seem to be a good way to figure this out other than creating an NSDateFormatter and searching the format string for the period field ('a' character)</p> <p>Here's what I'm doing now:</p> <pre><code>NSDateFormatter *formatter = ...
<p>This information is provided in NSUserDefaults. Maybe under the NSShortTimeDateFormatString key? (Still requires parsing of course).</p> <p>(Use</p> <pre><code>NSLog(@"%@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]); </code></pre> <p>to dump all the pre-defined user defaults).</p> <p>Not q...
<p>NSShortTimeDateFormatString is deprecated, and I believe it also effectively doesn't work in 10.5 and later. See the 10.4 and 10.5 Foundation release notes. Dumping all defaults is a good way to depend on stuff that is not guaranteed by the interface, though it can be interesting to sort of see what's going on und...
20,806
<p>When a customer logs in to my site, I need to know their account id and their menu id. This lets me know what data they can see on a page and what menu they get. I don't want to have to read this data over and over. Should I store this in a session variable or customize the membership user and membership provider...
<p>As already suggested, the profile system is super easy.</p> <p><a href="http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/2y3fs9xs.aspx</a></p>
<p>The profile system would probably suit your needs.</p>
12,076
<p>I'm doing some design (initially for Java) (but may extend to .NET in the future?) and I'm getting confused between the terms "cache" and "pool".</p> <p>As far as I can see, the main point of difference is what is contained in them?</p> <p>Any guidelines as to which should be used when?</p> <p>And what then is a ...
<p>Although they both refer to keeping objects around, they are quite different, and I wouldn't say they're interchangeable.</p> <p><strong>Cache</strong> - store frequently used values, typically because the lookup and/or creation is non-trivial. e.g. if a lookup table from a database is frequently used, or values ar...
<p>I agree with Ken, and to add a little--a Cache would not effect your system if some or all of the resources were removed from it at any time--the data is all easily reproducable/refetchable, and the reproducing is generally automatic (you ask the cache for something, if it doesn't exist in the cache, the cache makes...
36,710
<p>I'm trying to use <code>SetWindowsHookEx</code> to set up a <code>WH_SHELL</code> hook to get notified of system-wide <code>HSHELL_WINDOWCREATED</code> and <code>HSHELL_WINDOWDESTROYED</code> events. I pass 0 for the final <code>dwThreadId</code> argument which, according to <a href="http://msdn.microsoft.com/en-us/...
<p>The problem is that your hook DLL is actually being loaded into several different address spaces. Any time Windows detects an event in some foreign process that must be processed by your hook, it loads the hook DLL into that process (if it's not already loaded, of course).</p> <p>However, each process has its own a...
<p>Lol, it looks like the error is in the test code.</p> <p>If you create two separate buttons, one for Init and one for UnInit (I prefer Exit).</p> <pre><code>procedure THooktest_FO.UnInitClick(Sender: TObject); begin UninitHook; end; procedure THooktest_FO.InitClick(Sender: TObject); begin InitHook(HookCallbac...
38,349
<p>I've been asked to screen some candidates for a MySQL DBA / Developer position for a role that requires an enterprise level skill set.</p> <p>I myself am a SQL Server person so I know what I would be looking for from that point of view with regards to scalability / design etc but is there anything specific I should...
<p>Although SQL Server and MySQL are both RDBMs, MySQL has many unique features that can illustrate the difference between novice and expert.</p> <p>Your first step should be to ensure that the candidate is comfortable using the command line, not just GUI tools such as phpMyAdmin. During the interview, try asking the ...
<p>I think it would depend on the database type: transactional or data warehouse?</p> <p>Anyhow, for all types I'd ask about specific to MySQL replication and clustering, performance tuning and monitorization concepts.</p>
8,741
<p>I am a .Net programmer(both C# and VB.net) , and I want to go into F# area also, but can't find some good online article/pdf to start with. Please guide me through this.</p>
<p><a href="http://cs.hubfs.net/" rel="noreferrer">hubFS: THE place for F#</a></p> <p><a href="http://cs.hubfs.net/forums/88/ShowForum.aspx" rel="noreferrer">hubFS: THE place for F# » Establish skills in F# » Books, Tutorials, links and other resources</a></p>
<p>Check the MSDN F# Development center, they have some articles on there:</p> <p><a href="http://msdn.microsoft.com/en-us/fsharp/default.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/fsharp/default.aspx</a></p>
19,519
<p>Watching SO come online has been quite an education for me. I'd like to make a checklist of various vunerabilities and exploits used against web sites, and what programming techniques can be used to defend against them.</p> <ul> <li>What categories of vunerabilities? <ul> <li>crashing site</li> <li>breaking into...
<p>From the <a href="http://www.owasp.org/" rel="nofollow noreferrer">Open Web Application Security Project</a>:</p> <ol> <li>The <a href="http://www.owasp.org/images/e/e8/OWASP_Top_10_2007.pdf" rel="nofollow noreferrer">OWASP Top Ten</a> vulnerabilities (pdf)</li> <li>For a more painfully exhaustive list: <a href="ht...
<p>SQL injection</p>
4,864
<p>I have a project with a post build event:</p> <pre><code>copy $(ProjectDir)DbVerse\Lunaverse.DbVerse.*.exe $(TargetDir) </code></pre> <p>It works fine every time on my machine. I have a new developer who always gets the "exited with code 1" error. I had her run the same command in a DOS prompt, and it worked fi...
<p>She had a space in one of the folder names in her path, and no quotes around it.</p>
<p>So many solutions...</p> <p>In my case, I had to save the bat file with non-unicode (Western, Windows) encoding. By default when I added the file to visual studio (and probably I should have done it outside of the VS), it added with UTF-8 encoding.</p>
39,961
<p>I'm working on a REST service that has a few requirements:</p> <ol> <li>It has to be secure.</li> <li>Users should not be able to forge requests.</li> </ol> <p>My current proposed solution is to have a custom Authorization header that look like this (this is the same way that the amazon web services work):</p> <p...
<p>The answer is simple: It cannot be done. As soon as you ship any solution to the end user, he or she can allways attack the server it is communicating with. The most common version of this problem is cheating with hi-score lists in Flash games. You can make it <em>harder</em> by embedding some sort of encryption in ...
<p>There is a better discussion of this here:</p> <p><a href="https://stackoverflow.com/questions/7551/best-practices-for-securing-a-rest-api-web-service">Best Practices for securing a REST API / web service</a></p>
29,743
<p>Is it possible to create an STL-like container, or even just an STL-style iterator, for an existing array of POD-type elements?</p> <p>For example, suppose I have an array of ints. It would be convenient to be able to call some of the STL functions, such as find&#95;if, count&#95;if, or sort directly on this array...
<p>You can call many of the STL algorithms directly on a regular C style array - they were designed for this to work. e.g.,:</p> <pre><code>int ary[100]; // init ... std::sort(ary, ary+100); // sorts the array std::find(ary, ary+100, pred); find some element </code></pre> <p>I think you'll find that most stuff works...
<p>You can use <a href="http://www.boost.org/doc/libs/1_36_0/doc/html/array.html" rel="nofollow noreferrer">Boost.Array</a> to create a C++ array type with STL semantics.</p> <p>using arrays:</p> <pre><code>int a[100]; for (int i = 0; i &lt; 100; ++i) a[i] = 0; </code></pre> <p>using boost.arrays:</p> <pre><cod...
21,222
<p>Is there a way to set "work offline" in TFS without having to try opening a solution, waiting for it to time out, and then having Visual Studio work out that it has failed?</p> <p>It seems a touch ridiculous that I can't just tick a box to tell it myself, seeing as I'm probably the one most qualified to know when I...
<p>This extension should solve your problem (for VS 2010):</p> <p><a href="http://visualstudiogallery.msdn.microsoft.com/425f09d8-d070-4ab1-84c1-68fa326190f4?SRC=Home">http://visualstudiogallery.msdn.microsoft.com/425f09d8-d070-4ab1-84c1-68fa326190f4?SRC=Home</a></p>
<p>If TFS is down, you might have trouble going into offline mode. If you close and reopen your solution, a nice little dialog will appear asking you if you want to Go Offline.</p> <p>Alternatively if you don't want to close/reopen the solution, you can install <a href="https://visualstudiogallery.msdn.microsoft.com/6...
40,440
<p>OK, so see questions like <a href="https://stackoverflow.com/questions/60620/getting-started-with-silverlight-development">this one</a> and <a href="https://stackoverflow.com/questions/28826/what-exactly-is-microsoft-expression-studio-and-how-does-it-integrate-with-visu">this one</a> and the question I have is - doe...
<p>You can do everything in Visual Studio. But then again you can do everything in Notepad as well... it all depends on how much the given tool will help you along in the process. Having Blend will be a great asset from a design point of view but wont really do much for you in terms of programming the application. D...
<p>It quite is possible. If you don't care too much about the eye candy. Blend is more of a designer's tool than a development tool.</p> <p>You could try the Microsoft Action Pack Special edition for <a href="http://partner.microsoft.com/40047166" rel="nofollow noreferrer">Web Solutions</a> if you are at least a <a hr...
26,076
<p>Suppose I have a set of values, stored in a std::set:</p> <p>{1, 2, 6, 8}</p> <p>and I have a search key, say, 3. I want to put 3 into a function and get the first value greater than or equal to 3, in this case I would want to get 6.</p> <p>The find() function provided in map/set/multimap/and set will, of course,...
<p>Yes: <code>upper_bound(X)</code> returns an iterator pointing to the first element greater than <code>X</code>. There is also a <code>lower_bound(X)</code> function which returns an iterator pointing to the first element not less than <code>X</code>. Thus, all of the elements in the half-open interval <code>[lower...
<p>You want the <a href="http://www.sgi.com/tech/stl/upper_bound.html" rel="nofollow noreferrer">upper_bound</a> function.</p> <pre><code>map&lt;int, int&gt; mymap = { 1,2,6,8 }; map&lt;int,int&gt;::iterator i = mymap.upper_bound(3); // returns an iterator to the '6' element. </code></pre>
21,248
<p>I am trying to use Lambda Expressions in a project to map to a third party query API. So, I'm parsing the Expression tree by hand.</p> <p>If I pass in a lambda expression like:</p> <pre><code>p =&gt; p.Title == "title" </code></pre> <p>everything works.</p> <p>However, if my lambda expression looks like:</p> <p...
<p>Remember that when you're dealing with the lambda expression as an expression tree, you don't have executable code. Rather you have a tree of expression elements, that make up the expression you wrote.</p> <p>Charlie Calvert has <a href="https://learn.microsoft.com/en-us/archive/blogs/charlie/expression-tree-basics"...
<p>I'm not sure I understand. Where are you "seeing" that? Is that at design-time or run-time? Lambda expressions can be thought of essentially as anonymous delegates, and will operate with deferred execution. So you shouldn't expect to see the value assigned until after execution has passed that line, obviously. <...
29,483
<p>One of the web pages on our site is extremely long. Although the page itself does not call any javascript or jquery functions, its base page registers the JQuery source script (jquery-1.2.6.js) and this seems to cause IE7 to display the "A script on this page is causing Internet Explorer to run slowly." message when...
<p>As a crude workaround, could you unregister the script on the child page?</p> <p>Did you try moving the script reference to the bottom of the page?</p>
<p>If it is worth it to you. you could try to optimize the jquery calls. there are some simple techniques that could really improve performance on large pages.</p> <pre><code>//cache any jQuery objects that are used frequently $myObj = $(".someClass"); ... </code></pre> <p>Also think that this is still relevant: <a h...
49,962
<p>In a WPF UserControl, I have to make to call to a WebService. I am making this call on a separate thread but I want to inform the user that the call may take some time. </p> <p>The WebMethod returns me a collection of objects and I bind it to a ListBox in my UC. So far, so good... This part works really well. Howev...
<p>Don't go with the adorner - what I do is have two separate container controls (usually grids) that occupy the same area of the screen. One is my "progress" control, and the other is my "content" control. I set the visibility of the progress control to Collapsed and the visibility of the content control to Visible by...
<p>There is a trick you can use with a zero height Canvas that might work. Chris Anderson's WPF book goes into detail on this and why it works, but it goes something like this.</p> <ul> <li>create a StackPanel</li> <li>add a Canvas with Height="0" and a high z-index to the stack panel</li> <li>add your user control to...
42,712
<p>Basically I am inserting an image using the listviews inserting event, trying to resize an image from the fileupload control, and then save it in a SQL database using LINQ.</p> <p>I found some code to create a new bitmap of the content in the fileupload control, but this was to store it in a file on the server, fro...
<p>You should be able to change this block to</p> <pre><code> System.IO.MemoryStream stream = new System.IO.MemoryStream(); newBMP.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); PHJProjectPhoto myPhoto = new PHJProjectPhoto { ProjectPhoto = stream....
<p>Assuming, that your bitmap is bmp</p> <pre><code>byte[] data; using(System.IO.MemoryStream stream = new System.IO.MemoryStream()) { bmp.Save(stream, System.Drawing.Imaging.ImageFormat.Bmp); stream.Position = 0; data = new byte[stream.Length]; stream.Read(data, 0, stream.Length); stream.Close(); } </c...
33,624
<p>this is my first question here so I hope I can articulate it well and hopefully it won't be too mind-numbingly easy.</p> <p>I have the following class <em>SubSim</em> which extends <em>Sim</em>, which is extending <em>MainSim</em>. In a completely separate class (and library as well) I need to check if an object be...
<p>There are 4 related standard ways: </p> <pre><code>sim is MainSim; (sim as MainSim) != null; sim.GetType().IsSubclassOf(typeof(MainSim)); typeof(MainSim).IsAssignableFrom(sim.GetType()); </code></pre> <p>You can also create a recursive method:</p> <pre><code>bool IsMainSimType(Type t) { if (t == typeof(MainSim))...
<p>How about "is"?</p> <p><a href="http://msdn.microsoft.com/en-us/library/scekt9xw(VS.71).aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/scekt9xw(VS.71).aspx</a></p>
27,388
<p>I'm importing a MySQL dump and getting the following error.</p> <pre><code>$ mysql foo &lt; foo.sql ERROR 1153 (08S01) at line 96: Got a packet bigger than 'max_allowed_packet' bytes </code></pre> <p>Apparently there are attachments in the database, which makes for very large inserts.</p> <hr> <p>This is on my ...
<p>You probably have to change it for both the client (you are running to do the import) AND the daemon mysqld that is running and accepting the import.</p> <p>For the client, you can specify it on the command line:</p> <pre><code>mysql --max_allowed_packet=100M -u root -p database &lt; dump.sql </code></pre> <p>Also, ...
<p>Set max_allowed_packet to the same (or more) than what it was when you dumped it with mysqldump. If you can't do that, make the dump again with a smaller value.</p> <p>That is, assuming you dumped it with mysqldump. If you used some other tool, you're on your own.</p>
11,862
<p>For example: </p> <p>First, say I have a Silverlight app with Windowless=true so that I can place ASP.NET controls on top of it. Then I place an ASP.NET button on the page. How can I have say the text of a control in the Silverlight app change when the user presses the ASP.NET button? How would I send the Silver...
<p>For me, the difference depends on whether or not the web project is open in Visual Studio.</p> <p>I find if I commit the project file to version control with the project open in Visual Studio the SubType elements are present. Closing the solution/project then removes the SubType elements from the project file. Now ...
<p>These lines are also appearing in the project file in VS2012 when committing project changes in Tortoise SVN. This project used to be a website that I converted into a web application.</p> <p>I was able to bypass this issue using the following steps which <strong>do not</strong> require closing the project:</p> <o...
33,073
<p>I would like to generate a list of files within a directory. Some of the filenames contain Chinese characters.</p> <p>eg: [试验].Test.txt</p> <p>I am using the following code:</p> <pre><code>require 'find' dirs = ["TestDir"] for dir in dirs Find.find(dir) do |path| if FileTest.directory?(path) else ...
<p>Ruby needs to know that you are dealing with unicode in your code. Set appropriate character encoding using KCODE, as below:</p> <pre><code>$KCODE = 'utf-8' </code></pre> <p>I think utf-8 is good enough for chinese characters.</p>
<p>The following code is more elegant and doesn't require 'find.' It produces a list of files (but not directories) in whatever the working directory is (or whatever directory you put in). </p> <pre><code>Dir.entries(Dir.pwd).each do |x| p x.encode('UTF-8') unless FileTest.directory?(x) end </code></pre> <p>And ...
39,878
<p>I want to extend a WPF application with database functionality. Which database engine would you suggest and why? SQLite, SQL CE, other?</p>
<p>Depending on the applications use, <strong>I would recommend using SQL Lite</strong> because it doesn't require you to install any other software (SQL CE or Express, etc. usually would require a separate install).</p> <p>A list of the most important benefits for SQL Lite from the provider link at the bottom of this...
<p>I would agree that SQLite is the way to go. Subsonic 2.1 now includes SQLite support as well.</p>
9,271
<p>I need to test if a file is a shortcut. I'm still trying to figure out how stuff will be set up, but I might only have it's path, I might only have the actual contents of the file (as a byte[]) or I might have both.</p> <p>A few complications include that I it could be in a zip file (in this cases the path will be ...
<p>Shortcuts can be manipulated using the COM objects in SHELL32.DLL. </p> <p>In your Visual Studio project, add a reference to the COM library "Microsoft Shell Controls And Automation" and then use the following:</p> <pre><code>/// &lt;summary&gt; /// Returns whether the given path/file is a link /// &lt;/summary&gt...
<p>Check the extension? (.lnk)</p>
40,021
<p>We have an issue related to a Java application running under a (rather old) FC3 on an Advantech POS board with a Via C3 processor. The java application has several compiled shared libs that are accessed via JNI.</p> <p>Via C3 processor is supposed to be i686 compatible. Some time ago after installing Ubuntu 6.10 on...
<p>The unix.linux <code>file</code> command is great for this. It can generally detect the target architecture and operating system for a given binary (and has been maintained on and off since 1973. wow!)</p> <p>Of course, if you're not running under unix/linux - you're a bit stuck. I'm currently trying to find a jav...
<p>Expanding upon @Hi-Angel's answer I found an easy way to check the bit width of a static library:</p> <pre><code>readelf -a -W libsomefile.a | grep Class: | sort | uniq </code></pre> <p>Where <code>libsomefile.a</code> is my static library. Should work for other ELF files as well.</p>
33,613
<p>I was wondering how other developers begin refactoring. What is your first step? How this process (refactoring) differ if you refactor code which is not yours? Do you write tests while refactoring?</p>
<ol> <li>do not refactor anything non-trivial that does not already have unit tests</li> <li>write unit tests, then refactor</li> <li>refactor small pieces and re-run the tests frequently</li> <li>stop refactoring when the code is DRY<sup>*</sup> clean</li> </ol> <p><sup>*</sup> DRY = Don't Repeat Yourself</p>
<p>First step: Identify a <a href="http://en.wikipedia.org/wiki/Code_smell" rel="nofollow noreferrer">code smell.</a></p> <p>Second step: Consider alternative implementations and what the trade offs are and which do I accept in terms of which is "better."</p> <p>Third step: Implement better solution.</p> <p>This ...
25,167
<p>by default is a class:</p> <ol> <li>private ?</li> <li>internal ? </li> <li>sealed ?</li> </ol>
<p>internal</p> <p>see: <a href="http://msdn.microsoft.com/en-us/library/ms173121.aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms173121.aspx</a></p>
<blockquote> <p>Top-level types, which are not nested into other types, can only have internal or public accessibility. The default accessibility for these types is <strong>internal</strong>.</p> </blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/ba0a1yw2(VS.71).aspx" rel="nofollow noreferrer">Accessi...
45,180
<p>I've got a local .mdf SQL database file that I am using for an integration testing project. Everything works fine on the initial machine I created the project, database, etc. on, but when I try to run the project on another machine I get the following:</p> <p><em>System.Data.SqlClient.SqlException : A connection wa...
<p>I'm going to answer my own question as I have the solution.</p> <p>I was relying on the automatic connection string which had an incorrect "AttachDbFilename" property set to a location that was fine on the original machine but which did not exist on the new machine.</p> <p>I'm going to have to dynamically build th...
<p>That because your application have more than one setting to database, try to "Find All" on your solution by search your connection name likes</p> <p></p> <p>I'm using "<strong>EnergyRetailSystemConnectionString</strong>" or you can search by your database name</p>
15,431
<p>Can anyone recommend a good binary XML format? It's for a JavaME application, so it needs to be a) Easy to implement on the server, and b) Easy to write a low-footprint parser for on a low-end JavaME client device.</p> <p>And it goes without saying that it needs to be smaller than XML, and faster to parse.</p> <hr...
<p>You might want to take a look at <a href="http://en.wikipedia.org/wiki/WBXML" rel="noreferrer">wbxml</a> (Wireless Binary XML) it is optimized for size, and often used on mobile phones, but it is not optimized for parsing speed.</p>
<p>It very much depends on the target device. If you have JSR172 available, then you are done with the parsing, the runtime does it for you. And XML is mainly about making your own format. As was alredy stated if your goal is performance, than XML is probably not the best way to go and you will end up doing some binary...
3,003
<p>I am working on a project that requires the parsing of log files. I am looking for a fast algorithm that would take groups messages like this:</p> <blockquote> <p>The temperature at P1 is 35F.</p> <p>The temperature at P1 is 40F.</p> <p>The temperature at P3 is 35F.</p> <p>Logger stopped.</p> <p>Logger started.</p> ...
<p>I think you might be overlooking and missed fscanf() and sscanf(). Which are the opposite of fprintf() and sprintf().</p>
<p>@John: I think that the question relates to an algorithm that actually recognises patterns in log files and automatically "guesses" appropriate format strings and data for it. The <code>*scanf</code> family can't do that on its own, it can only be of help once the patterns have been recognised in the first place.</p...
3,121
<p>What type of exception is caught by the beanshell catch(ex): Exception or Throwable?.</p> <p>Example:</p> <pre><code>try { .... } catch (ex) { } </code></pre>
<p>That loosely typed catch will catch everything "<a href="http://java.sun.com/javase/6/docs/api/java/lang/Throwable.html" rel="nofollow noreferrer">Throwable</a>." That will include <a href="http://java.sun.com/javase/6/docs/api/java/lang/Error.html" rel="nofollow noreferrer">Errors</a>, <a href="http://java.sun.com...
<p>Throwable is a superclass (essentially) of Exception--anything that Exception catches will also be caught by Throwable. In general usage they are the same, you rarely (if ever) see other throwable types.</p>
28,180
<p>In the image, <a href="https://i.stack.imgur.com/fcPgL.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/fcPgL.png" alt="enter image description here"></a>there is an object circled in blue on the anet a8 printer that I need to buy a replacement of, however, I can not find it online, please help.</p...
<p>This is the throat block for direct drive extrusion, Anet8 is a cheap clone of Prusa printers, so it's easy to find parts for Anet printers. </p> <p>This is one extruder kit that may help your needs, <a href="https://es.aliexpress.com/store/product/1Set-3D-Printer-makerbot-MK8-Extruder-Aluminum-extrusion-Frame-Bloc...
<p>Like @ZuOverture said the name of this component is the filament drive. Most of the manufactures sell the whole extrusion device already assembled, to avoid mismatches between the components of the extrusion device. If your device is somehow damaged, and without possibilities to be used in the printer the easiest so...
740
<p>Anybody have any good FizzBuzz type questions that are not <em>the</em> FizzBuzz problem?</p> <p>I am interviewing someone and FB is relatively well known and not that hard to memorize, so my first stop in a search for ideas is my new addiction SO.</p>
<p>I've seen a small list of relatively simple programming problems used to weed out candidates, just like FizzBuzz. Here are some of the problems I've seen, in order of increasing difficulty:</p> <ol> <li>Reverse a string</li> <li>Reverse a sentence ("bob likes dogs" -> "dogs likes bob")</li> <li>Find the minimum val...
<p>How about: I want to use a single integer to store multiple values. Describe how that would work.</p> <p>If they don't have a clue about bit masks and operations, they probably can't solve other problems.</p>
14,343
<p>I'm not a great fan of duplicating effort. I do find, however, that there are benefits to tracking agile iteration progress on both a physical card wall and an online "calculator" (Excel, some scrum tools) or an online card wall (e.g. Mingle).</p> <p>I find that a physical card wall in the team space provides a vis...
<p>I feel the same. There is something very psychologically satisfying in moving a physical card around on a wall. Thinking managerially, we like stats and we like them to be automated as much as possible.</p> <p>Perhaps you can keep both? Use the physical wall as the main daily source of information your team work fr...
<p>Cross link your online and card wall.</p> <p>Set up two way replication. Method is left as an exercise for the student.</p> <p>Also handy to catch whiteboard content from discussions.</p>
25,410
<p>I'm trying to get started with <strong>USSD</strong>. I'm familiar with other <em>forms of SMS</em>. Ultimately i want to use <strong>USSD</strong> as part of a real-time payment platform.</p> <p>Thanks.</p>
<p>Here are some of the questions you'd like to find answers for as you proceed with your USSD plan.</p> <p>&bull;. How do we want the channel to work?</p> <p>For starters, USSD is just like connection-oriented SMS communication i.e, USSD is to SMS what IM is to email. The initiation of the communication can either b...
<p>I just Googled around and gathered info.</p> <p>According to <a href="http://www.telecomspace.com/messaging-ussd.html" rel="nofollow noreferrer">Unstructured Supplementary Services Data (USSD)</a>:</p> <blockquote> <p>Unstructured Supplementary Services Data (USSD) allows for the transmission of information ...
45,208
<p>How can the OpenFileDialog View Menu be set to Detail View?</p>
<p>someone did it <a href="http://www.codeproject.com/KB/dialog/OpenFileDialogEx.aspx" rel="nofollow noreferrer">here</a>, with the win32 api</p> <pre><code>DefaultViewMode: This property lets you choose which view the OpenFileDialog should start in; by default, it opens using the “Details view”. Here you can speci...
<p>Quick google search reveals this:</p> <p><a href="http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3843682&amp;SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/Forums/ShowPost.aspx?PostID=3843682&amp;SiteID=1</a></p> <p>In particular it suggests:</p> <pre><code>Dim OpenFileDialog1 As New Ope...
44,541
<p>Is there a prebuilt tool that would integrate with BEA/Oracle Weblogic 10.0 and trace on a database table each call to a web service exposed by the server?</p> <p>UPDATE: the goal is <strong>not</strong> to debug the web services (they are working well). The objective is to <strong>trace each call</strong> on a tab...
<p>This is Object-Relational Mapping, a classically hard problem. You really need a ORM tool to do this properly, or it'll drive you nuts.</p> <p>The connection problem you refer to is one of the pitfalls, and it needs very careful optimisation and query tuning, else it'll kill performance (e.g. the N+1 SELECT proble...
<p>The other option would be to use an <a href="http://en.wikipedia.org/wiki/Comparison_of_object_database_management_systems" rel="nofollow noreferrer">Object Oriented Database</a> such as db40 or Cache. It may be looking into this if performance isn't a huge concern and you are determined to store your entire object ...
17,599
<p>I have an experiment streaming up 1Mb/s of numeric data which needs to be stored for later processing. It seems as easy to write directly into a database as to a CSV file and I would then have the ability to easily retrieve subsets or ranges.</p> <p>I have experience of sqlite2 (when it only had text fields) and i...
<p>If you only need to read/write the data, without any checking or manipulation done in database, then both should do it fine. Firebird's database file can be copied, as long as the system has the same endianess (i.e. you cannot copy the file between systems with Intel and PPC processors, but Intel-Intel is fine).</p>...
<p>Depends what language you are using. If it's C/C++, TCL, or PHP, SQLite is still among the best in the single-writer scenario. If you don't need SQL access, a berkeley DB-style library might be slightly faster, like Sleepycat or gdbm. With multiple writers you could consider a separate client/server solution but it ...
12,070
<p>Despite my lack of coding knowledge I managed to write a small little app in VB net that a lot of people are now using. Since I made it for free I have no way of knowing how popular it really is and was thinking I could make it ping some sort of online stat counter so I could figure out if I should port it to other...
<p>Just a sidenote: You should inform your users that you are doing this (or not do it at all) for privacy concerns. Even if you aren't collecting any personal data it can be considered a privacy problem. For example, when programs collect usage information, they almost always have a box in the installation process ...
<p>.NET? Create an ASMX Web Service and set it up on your web site. Then add the service reference to your app.</p> <p>EDIT/CLARIFICATION: Your Web Service can then store passed data into a database, instead of relying on Web Logs: Installation Id, Install Date, Number of times run, etc.</p>
11,569
<p>From kernel mode in Windows I'm able to intercept and monitor virtually all actions performed on a particular disk. When a file is opened for any purpose I get an event.</p> <p>Now I want to trace which application that opened it. I think this should be possible but don't know how.</p> <p>I'm using the standard fi...
<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896642.aspx" rel="nofollow noreferrer">Sysinternals Filemon</a> (free) does this, and better yet they describe how they did it:</p> <blockquote> <p>For the Windows 9x driver, the heart of FileMon is in the virtual device driver, Filevxd.vxd. It is dyn...
<p>Just use Win32 N.API to get the pid from the File handle. It's a FAQ for 15 years...</p>
28,664
<p>What techniques can be applied effectively to improve the performance of SQL queries? Are there any general rules that apply?</p>
<ul> <li>Use primary keys</li> <li>Avoid select *</li> <li>Be as specific as you can when building your conditional statements </li> <li>De-normalisation can often be more efficient </li> <li>Table variables and temporary tables (where available) will often be better than using a large source table </li> <li>Partitione...
<p>I think using SQL query analyzer would be a good start.</p>
6,036
<p>I have two drop down menus that I want populated with identical data depending on what is selected on the parent drop down menu. Right now, I am using a javascript library that populates one child drop down menu based on a parent, but I need to have two drop down menus populated simultaneously.</p> <p>This javascri...
<p>Reading the document you list, it seems there's a section that allows you to specify multiple child components from the parent:</p> <pre> To create the DynamicOptionList object, pass the names of the fields that are dependent on each other, with the parent field first. Create the object by passing field names var ...
<p>In the event handler you have for your parent drop down, you are probably having some other code populate that child drop down. Simply add the code again, but instead reference the second drop down. That's the rough approach. There are some details and style guidance I'm leaving out, but that'll get the job done....
18,742
<p>Here's an interesting problem. On a recently installed Server 2008 64bit I opened IE and through the Tools -> Options I changed the homepage to iGoogle.com. Clicked okay and then clicked the homepage button. IE crashes.</p> <p>Now you'd think that I could just remove iGoogle as the homepage but when I open IE it im...
<p>Control Panel -> Internet Options</p>
<p>Not sure about IE7 on Windows Server 2008, but for IE6 the start page is stored in a registry key "Start Page" in HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\Main.</p>
8,882
<p>I have a method that can return either a single object or a collection of objects. I want to be able to run object.collect on the result of that method whether or not it is a single object or a collection already. How can i do this?</p> <pre><code>profiles = ProfileResource.search(params) output = profiles.collect ...
<p>Careful with the flatten approach, if search() returned nested arrays then unexpected behaviour might result.</p> <pre><code>profiles = ProfileResource.search(params) profiles = [profiles] if !profiles.respond_to?(:collect) output = profiles.collect do |profile| profile.to_hash end </code></pre>
<p>In the <code>search</code> method of the <code>ProfileResource</code> class, always return a collection of objects (usually an Array), even if it contains only one object.</p>
10,469
<p>I am trying to use C# to parse CSV. I used regular expressions to find <code>","</code> and read string if my header counts were equal to my match count.</p> <p>Now this will not work if I have a value like:</p> <pre><code>"a",""b","x","y"","c" </code></pre> <p>then my output is:</p> <pre><code>'a' '"b' 'x' 'y"'...
<p>CSV, when dealing with things like multi-line, quoted, different delimiters* etc - can get trickier than you might think... perhaps consider a pre-rolled answer? I use <a href="http://www.codeproject.com/KB/database/CsvReader.aspx" rel="noreferrer">this</a>, and it works very well.</p> <p>*=remember that some loca...
<p>Well, I'm no regex wiz, but I'm certain they have an answer for this.</p> <p>Procedurally it's going through letter by letter. Set a variable, say dontMatch, to FALSE.</p> <p>Each time you run into a quote toggle dontMatch.</p> <p>each time you run into a comma, check dontMatch. If it's TRUE, ignore the comma. ...
40,889
<p>I would like to start tagging my deployed binaries with the latest SVN revision number.</p> <p>However, because SVN is file-based and not directory/project-based, I need to scan through all the directory's and subdirectory's files in order to determine the highest revision number.</p> <p>Using <code>svn info</code...
<p>One way. When you check out the code, look at the last line of svn output:</p> <pre><code>$ svn up ...stuff... Updated to revision 66593. </code></pre> <p>A more direct way:</p> <pre><code>$ svn info Path: . URL: https://svn.example.com/svn/myproject/trunk Repository Root: https://svn.example.com/svn/ Repository ...
<p>This is ridiculous but <code>svn info</code> or <code>svnversion</code> wont take into consideration subdirectories; it's a feature called working 'Mixed Revisions' - I call it torture. I just needed to find the latest 'revision' of the live codebase and the hacked way below worked for me - it might take a while to ...
8,011
<p>atoi() is giving me this error:</p> <pre><code> error C2664: 'atoi' : cannot convert parameter 1 from 'char' to 'const char *' Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast </code></pre> <p>from this line: int pid = atoi( token.at(0) ); where t...
<p>token.at(0) is returning a single char, but atoi() is expecting a string (a pointer to a char.) Either convert the single character to a string, or to convert a single digit char into the number it represents you can usually<sup>*</sup> just do this:</p> <pre><code>int pid = token.at(0) - '0'; </code></pre> <p><su...
<pre><code>stringstream ss; ss &lt;&lt; token.at(0); int pid = -1; ss &gt;&gt; pid; </code></pre> <p>Example:</p> <pre><code>#include &lt;iostream&gt; #include &lt;sstream&gt; #include &lt;vector&gt; int main() { using namespace std; vector&lt;char&gt; token(1, '8'); stringstream ss; ss &lt;&lt; token.at(0...
23,543
<p>I'm pivoting data in MS SQL stored procedure. Columns which are pivoted are dynamically created using stored procedure parameter (for exampe: "location1,location2,location3,") so number of columns which will be generated is not known. Output should look like (where locations are taken from stored procedure parameter...
<p>Assuming truly dire dynamic need, you could use <a href="http://msdn.microsoft.com/en-us/library/bb361109.aspx" rel="nofollow noreferrer">DataContext.ExecuteQuery</a></p> <p>Just whip up a type that will cover the result space (the property names must match the column names in the query):</p> <pre><code>public cla...
<p>You can create your linq object for access after your returned dataset.</p> <p>But would that really be of any use. Linq are usefull for typesafe calls and not dynamic results. You would not know what to look for compile time.</p>
33,441
<p>I'd like to create a sparse file such that all-zero blocks don't take up actual disk space until I write data to them. Is it possible?</p>
<p>As in other Unixes, it's a feature of the filesystem. Either the filesystem supports it for ALL files or it doesn't. Unlike Win32, you don't have to do anything special to make it happen. Also unlike Win32, there is no performance penalty for using a sparse file.</p> <p>On MacOS, the default filesystem is HFS+ w...
<p>If you want portability, the last resort is to write your own access function so that you manage an index and a set of blocks. </p> <p>In essence you manage a single file as the OS manages the disk keeping the chain of the blocks that are part of the file, the bitmap of allocated/free blocks etc.</p> <p>Of course ...
22,512
<p>On my blog, I want to display the all the posts from the last month. But if that is less than 10 posts, I want to show the ten most recent posts (in other words, there should never be less than 10 posts on the front page). I am wondering if there is a way to do this in a single query?</p> <p>Currently, I first ru...
<pre><code>(SELECT * FROM posts WHERE `timestamp` &gt;= NOW() - INTERVAL 30 DAY) UNION (SELECT * FROM posts ORDER BY `timestamp` DESC LIMIT 10); </code></pre> <p><strong>edit:</strong> Re @doofledorfer's comment: I ran this on my test database, and it worked fine. I tried comparing <code>timestamp</code> to a date ...
<p><strong>Idea1</strong>: do a query to fetch always the posts for this month. Then do a cycle, counting the number of posts fetched. If, and only if, this number is less than 10, do the second query.</p> <p><strong>Idea 2</strong>: Why don't you <em>cache</em> your first query (<a href="http://code.google.com/appeng...
45,093
<p>So, I'll be getting my T-Mobile G1 within a month or so, and I'm excited to start developing for it.</p> <p>Has anyone started using it yet? Is there a dev wiki or anything set up for it yet?</p>
<ul> <li>Google's android groups </li> </ul> <p>This is probably the best place to go. However, a good search on google will most likely take you to one of these discussion anyways. Here, you can discuss about your difficulties possibly with the core developers too.</p> <ul> <li>Anddev.org </li> </ul> <p>They're pro...
<p>Google has set up a google code for it and has let a limited number of devs start playing arround with it.</p>
17,400
<p>I need to build full-text search functionality into our knowledge base system using C#. How do I start? </p>
<p>For example from Lucene:</p> <p><a href="http://lucene.apache.org/java/docs/" rel="nofollow noreferrer">http://lucene.apache.org/java/docs/</a></p> <p>C# port is here <a href="http://incubator.apache.org/lucene.net/" rel="nofollow noreferrer">http://incubator.apache.org/lucene.net/</a></p> <p>You should also read...
<p>You will probably need an indexing facility if your text base is non trivial.</p>
37,414
<p>Okay, my dilemma is this. I have an admin page that I use to get a summary of the day's submissions to one of my sites. This sumamry page pulls data from several tables, some of which store the actual media data, others store the website urls, ids and owners, and another table stores the day-to-day stats to calculat...
<p>SWFUpload</p> <p><a href="http://demo.swfupload.org/v220beta3/simpledemo/index.php" rel="noreferrer">http://demo.swfupload.org/v220beta3/simpledemo/index.php</a></p> <p><a href="http://swfupload.org/" rel="noreferrer">http://swfupload.org/</a></p> <p>Javascript and Flash, there's no post-back :) and there's .NET ...
<p>There is no such thing as a ajax file upload. The components that you see either use flash swfupload or a hidden iframe that they post a form to that give the impression it is happening in an ajax manner. There are many plugins avaiable to help you do this. My favourite is <a href="http://jquery.webunity.nl/" rel="n...
43,643
<p>What is the standard way of incorporating helper/utility functions in Obj-C classes?</p> <p>I.e. General purpose functions which are used throughout the application and called by more than 1 class.</p> <p>Can an Obj-C method exist outside of a class, or does it need to be a C function for it to have this kind of b...
<p>I would group similar functions as static methods in a helper class. These can then be called using the classname rather the instance name. Static methods are defined with a + instead of the usual -.</p> <p>like so:</p> <pre><code>@interface HelperClass: superclassname { // instance variables - none if all met...
<p>There are a number of options for this in Objective-C. First, since Obj-C is a strict superset of C, you can define all your library functions in a separate module (source file) and happily call them from any Obj-C object/code you already have. If you create an obj-c source file (.m file) you can then call back into...
47,994
<p>We are working on a Java EE Web Application, and the people from marketing need some really detailed stats for our site. Something similar to Google Analytics, gathering the user's information, and their navigation through the site (where they come from, what they click, where they go, etc.).</p> <p>Depending on a ...
<p>1) You could use a log analyser to analyse the web server logs - with Tomcat you need to install a module that does this, I've forgotten the name.</p> <p>2) Create a table in your database called user_journey or similar. Inside you can log all the relevant details of each hit. Then in your root servlet, or the equi...
<p>1) You could use a log analyser to analyse the web server logs - with Tomcat you need to install a module that does this, I've forgotten the name.</p> <p>2) Create a table in your database called user_journey or similar. Inside you can log all the relevant details of each hit. Then in your root servlet, or the equi...
44,394
<p>Is it possible in <code>PHP (as it is in C++)</code> to declare a <code>class method</code> OUTSIDE the <code>class definition?</code></p>
<p>No, as of PHP 5.2. However, you may use <code>__call</code> magic method to forward call to arbitrary function or method.</p> <pre><code>class A { public function __call($method, $args) { if ($method == 'foo') { return call_user_func_array('bar', $args); } } } function bar($x)...
<p>No it is not posible. if you define function/method outside class construct it becomes global function.</p>
9,699
<p>I am wrestling with a php 5.2.6 problem. An api we use returns dates in this format DDMMYYYYHHMM. Exactly that format, fixed length, no delimiters. However, in my experimentation, this format seems to break strptime, which returns a false (fail) when I feed it a date in this format. It can reproduced, at least on my...
<p>This function is locale-dependent. Have you tried setting different locale? (see <code>setlocale()</code>)</p>
<p>Nothing obvious since both versions work fine in PHP 5.2.0. I can't readily check 5.2.6 at the moment, though. That will have to wait until I get home.</p>
31,708
<p>I am creating a lightweight editor in C# and would like to know the best method for converting a string into a nicely formatted XML string. I would hope that there's a public method in the C# library like "public bool FormatAsXml(string text, out string formattedXmlText)", but it couldn't be that easy, could it?</p...
<pre><code>string unformattedXml = "&lt;?xml version=\"1.0\"?&gt;&lt;book&gt;&lt;author&gt;Lewis, C.S.&lt;/author&gt;&lt;title&gt;The Four Loves&lt;/title&gt;&lt;/book&gt;"; string formattedXml = XElement.Parse(unformattedXml).ToString(); Console.WriteLine(formattedXml); </code></pre> <p>Output:</p> <pre><code>&lt;bo...
<p>Is the string valid XML? Do you mean how can you convert an XML string into an XML document? If so, do this:</p> <pre><code>XmlDocument xml = new XmlDocument(); xml.LoadXml( YourString ); </code></pre>
23,686
<p>We are invoking Asp.Net ajax web service from the client side. So the JavaScript functions have calls like:</p> <p>// The function to alter the server side state object and set the selected node for the case tree.</p> <pre><code>function JSMethod(caseId, url) { Sample.XYZ.Method(param1, param2, OnMethodRetur...
<p>You have a callback method (OnMethodReturn) specified in the WebMethod call, but not an error handler method. You need to create one and pass it into as you do the callback method. Then you can handle your failed WebMethod calls in there.</p>
<p>try this one...use "static"</p> <pre><code>[WebMethod(EnableSession = true)] public static string Method(string param1, string param2) </code></pre>
47,980
<p>I have recently learned about binary space partitioning trees and their application to 3d graphics and collision detection. I have also briefly perused material relating to quadtrees and octrees. When would you use quadtrees over bsp trees, or vice versa? Are they interchangeable? I would be satisfied if I had e...
<p>There is no clear answer to your question. It depends entirely how your data is organized.</p> <p>Something to keep in mind:</p> <p>Quadtrees work best for data that is mostly two dimensional like map-rendering in navigation systems. In this case it's faster than octrees because it adapts better to the geometry an...
<p>Usually these things don't have a clear-cut answer. I would suggest that A,B, and C are the result of a function of the size of your space and the amount of stuff you are differentiating.</p>
12,501
<p>I am working on a site laid out with <code>div</code>s. I am having trouble with one in particular: the training photo <code>div</code>.</p> <p>If you go to <a href="http://php.wmsgroup.com/eofd6.org/education.html" rel="nofollow noreferrer">http://php.wmsgroup.com/eofd6.org/education.html</a> you'll see a photo un...
<p>Float #content right, not left.</p>
<p>Can't you change the markup to include the #training_photo div in the #nav div?</p>
27,490
<p>I wish to create an online system to track some things (e.g., a database with children, where each child has 1 or more visits from doctors). I want the users to be able to enter data as well as search for it, especially from mobile devices. So, this is a custom mobile online DB app of modest but non-zero size.</p> ...
<p>I also tried building a simple web application with Zoho Creator and got so frustrated that I am now looking for a different solution. I consider Zoho Creator to be at a point right now suitable for educational purposes but I would not consider using it for a functional application.</p>
<p>I think this systems not bad,but they are paid. Their price impresses! Use free application, example <a href="http://mytaskhelper.com" rel="nofollow noreferrer">mytaskhelper</a> Thanks</p>
42,286
<p>I want something that can check if a string is <code>"SELECT"</code>, <code>"INSERT"</code>, etc. I'm just curious if this exists.</p>
<p>Easy enough to add : </p> <pre><code> HashSet&lt;String&gt; sqlKeywords = new HashSet&lt;String&gt;(Arrays.asList( new String[] { ... cut and paste a list of sql keywords here .. })); </code></pre>
<p>why not start with <a href="http://www.novicksoftware.com/UDFofWeek/Vol2/T-SQL-UDF-Vol-2-Num-29-udf_SQL2K_IsKeywordBIT.htm" rel="nofollow noreferrer">this stored procedure</a> and modify it to suit your needs, possibly even convert it to Java using the hashmap as Steve suggested.</p> <p>Personally I like the idea o...
24,669
<p>I'm new to ASP.NET and want to have an asp:content control for the page title, but I want that value to be used for the tag and for a page header. When I tried to do this with two tags with the same id, it complained that I couldn't have two tags with the same id. Is there a way to achieve this with contentplaceho...
<p>Title is actually an attribute on content pages, so you do something like:</p> <pre><code>&lt;%@ Page Language="C#" MasterPageFile="~/default.master" Title="My Content Title" %&gt; </code></pre> <p>on the content page. To get that into a header, on the master page just render the page title:</p> <pre><code>&lt;h1...
<p>I see that someone has just provided a (far) better answer to this specific problem. You could use the solution below if you have a master page that has the same content in multiple places (excluding the title).</p> <p>The best solution I can come up with is the following:</p> <p>Add an <code>asp:Label</code> for ...
18,081
<p>Given this class</p> <pre><code>class Foo { // Want to find _bar with reflection [SomeAttribute] private string _bar; public string BigBar { get { return this._bar; } } } </code></pre> <p>I want to find the private item _bar that I will mark with a attribute. Is that possible? </...
<p>Use <code>BindingFlags.NonPublic</code> and <code>BindingFlags.Instance</code> flags</p> <pre><code>FieldInfo[] fields = myType.GetFields( BindingFlags.NonPublic | BindingFlags.Instance); </code></pre>
<p>If your .Net framework is greater than 4.5. You can use GetRuntimeFields method.</p> <p>This method returns all fields that are defined on the specified type, including inherited, non-public, instance, and static fields.</p> <p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.reflection.runtimereflection...
12,148
<p>I'm writing a sample console service host and I want to plug into WCF stack to be able to print a message to console when new message arrives, even if it won't get processed by the service at the moment (because service is working on previous calls). This is based on my assumption that messages arriving get queued b...
<p>PyString_Decode does this:</p> <pre><code>PyObject *PyString_Decode(const char *s, Py_ssize_t size, const char *encoding, const char *errors) { PyObject *v, *str; str = PyString_FromStringAndSize(s, size); if (str == NULL) return NULL; v = PyString_AsDe...
<p>You don't want to decode the string into a Unicode representation, you just want to treat it as an array of bytes, right?</p> <p>Just use <code>PyString_FromString</code>:</p> <pre><code>char *cstring; PyObject *pystring = PyString_FromString(cstring); </code></pre> <p>That's all. Now you have a Python <code>str...
26,260
<p>When scripting in bash or any other shell in *NIX, while running a command that will take more than a few seconds, a progress bar is needed.</p> <p>For example, copying a big file, opening a big tar file.</p> <p>What ways do you recommend to add progress bars to shell scripts?</p>
<p>You can implement this by overwriting a line. Use <code>\r</code> to go back to the beginning of the line without writing <code>\n</code> to the terminal.</p> <p>Write <code>\n</code> when you're done to advance the line.</p> <p>Use <code>echo -ne</code> to:</p> <ol> <li>not print <code>\n</code> and</li> <li>to...
<p>To make a tar progress bar</p> <pre><code>tar xzvf pippo.tgz |xargs -L 19 |xargs -I@ echo -n "." </code></pre> <p>Where "19" is the number of files in the tar divided the length of the intended progress bar. Example: the .tgz contains 140 files and you'll want a progress bar of 76 ".", you can put -L 2.</p> <p>Yo...
29,451
<p>I want to write a odometer-like method in a C#-style-language, but not just using 0-9 for characters, but any set of characters. It will act like a brute-force application, more or less.</p> <p>If I pass in a char-array of characters from <strong>0</strong> to <strong>J</strong>, and set length to 5, I want results...
<p>This isn't <em>quite</em> a duplicate of <a href="https://stackoverflow.com/questions/207889/recursion-instead-of-multi-loops">"recursion instead of multi-loops"</a> but it's pretty close. I'll write up a solution if this doesn't help you.</p> <p>EDIT: Here's a non-recursive solution. The recursive one is slightly ...
<p>Google for permutations.</p> <p>If however you are just dealing with that 'hex' range, just do the following:</p> <pre><code>for (int i = 0; i &lt; (1 &lt;&lt; 24); i++) string s = i.ToString("X6"); </code></pre>
28,317
<p>I am working on an implementation for RSS feeds for a collaboration platform. Say there are several thousands of different collaboration rooms where users can share information, and each needs to publish an RSS feed with news, changes, etc...</p> <p>Using a plain servlet (i.e. <a href="http://www.site.com/RSSServle...
<p>You say that a new http request to your servlet "will trigger the entire servlet lifecycle", which as Alexander has already pointed out, isn't exactly true. It will simply trigger another method call to your <code>doGet()</code> or <code>doPost()</code> methods. </p> <p>I think what you mean to say is that if you h...
<p>You should try the <a href="https://rome.dev.java.net/" rel="nofollow noreferrer">ROME</a> framework. It is excellent for RSS.</p>
23,756
<p>We are using log4net (replacing nLog) in our Asp.Net web application. nLog had a useful feature that would allow us to create a log file per user - which is helpful for organizing and locating the log statements.</p> <p>Does anyone have any ideas on how to do this with log4net?</p>
<p>Instead of logging to a file, think about logging to a database table and have the user id part of the logged data. This way you can do selects against the table based on the user (or users) and see only their data. Probably also want to log the session id, too, to make session based queries easy.</p>
<p>I just log to a single file and then use a nice log viewing program like <a href="http://www.log-expert.de/" rel="nofollow noreferrer">LogExpert</a> to filter by username etc when I want to see a particular user's session.</p> <p><img src="https://i.stack.imgur.com/9T6xS.jpg" alt="enter image description here"></p>...
39,538
<p>How can I present a control to the user that allows him/her to select a directory?</p> <p>There doesn't seem to be any native .net controls which do this?</p>
<p>The <a href="http://msdn.microsoft.com/en-us/library/system.windows.forms.folderbrowserdialog.aspx" rel="noreferrer">FolderBrowserDialog class</a> is the best option.</p>
<p>or even more better, you can put this code in a class file</p> <pre><code>using System; using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Windows.Forms; internal class OpenFolderDialog : IDisposable { /// &lt;summary&gt; /// Gets/sets folder in whic...
3,287
<p>We have a painfully slow report.I added a Response.flush and it seems a great deal better. What are some of the caveats of using this method.</p>
<p>If Response.Buffer is not set to true, then you'll get a run-time error. Also, If the Flush method is called on an ASP page, the server does not honor Keep-Alive requests for that page.</p> <p>You'll also want to look out if you're using a table-based design as it won't render in some browsers until the entire tab...
<p>Response.flush could be useful to send to the browser the report's header.. then display a "loading message", then your report process and you flush the report, then execute a little piece of javascript to hide the "loading" message.</p> <p>This way you will let your users know that something is hapenning so they w...
16,396
<p>Is there a way to combine Enums in VB.net?</p>
<p>I believe what you want is a flag type enum.</p> <p>You need to add the Flags attribute to the top of the enum, and then you can combine enums with the 'Or' keyword.</p> <p>Like this:</p> <pre><code>&lt;Flags()&gt; _ Enum CombinationEnums As Integer HasButton = 1 TitleBar = 2 [ReadOnly] = 4 ETC = 8 End Enum ...
<p>If you taking about using enum flags() there is a good article <a href="http://www.codeguru.com/vb/sample_chapter/article.php/c12963" rel="nofollow noreferrer" title="VB flags">here</a>.</p>
8,287
<p>Working on big, high loaded project I got the problem that already described in billion of topics on forums and blog, but there is no solution that will help in my case. Here is the story.</p> <p>I have the HTML code of banner, I don't know what is the code. Sometimes it's plain HTML, but sometimes it's <code>&lt;s...
<p>You need <a href="http://github.com/iamnoah/writeCapture" rel="nofollow noreferrer">writeCapture.js</a> (full disclosure: I'm the author.) All bets are off with 3rd party scripts. Today they use <code>document.write</code> to generate some specific HTML, but tomorrow they could change it and any simple hacks based o...
<p>perhaps you could use the property innerHTML: document.getElementById("x").innerHTML=".................";</p> <p>Or you could you the DOM: CreateElement and AppendChild</p>
40,738
<p>Is there a nice place for learning the JVM bytecode instruction set. The specification perhaps and maybe some tutorials?</p> <p>I ask because I would like to design a toy language and a compiler for it that generates JVM bytecode.</p> <p>Thanks for your knowledge and perhaps googling. </p>
<p>A good reference for Java bytecode specification is the <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/" rel="nofollow noreferrer">The Java Virtual Machine Specification</a>.</p> <p>See <a href="https://docs.oracle.com/javase/specs/jvms/se8/html/jvms-4.html" rel="nofollow noreferrer">Chapter 4. The cla...
<p>This is a bit more specialized, but <a href="http://www.infoq.com/presentations/click-fast-bytecodes-funny-languages" rel="nofollow noreferrer">here</a> is an on-line presentation on how to optimize generated bytecode for running on the JVM. It was presented at the recent <a href="http://openjdk.java.net/projects/ml...
46,698
<p>First off, there's a bit of background to this issue available on my blog:</p> <ul> <li><a href="http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html" rel="nofollow noreferrer">http://www.codebork.com/coding/2008/06/25/message-passing-a-plug-framework.html</a></li> <li><a href="http://www...
<p>This is my understanding of your question: You have a plugin object that may have to listen for events on x data objects - you don't want to subscribe to the event on each data object though. I'm assuming that several plugins may want to listen to events on the same data object.</p> <p>You could create a session ty...
<p>It's early yet, but have you considered trying to use <a href="http://www.codeplex.com/MEF" rel="nofollow noreferrer">MEF</a> instead of rolling your own?</p>
7,363
<p>I've been thinking about this problem for a while and have yet to come up with any stable/elegant ideas.</p> <p>I know with MyISAM tables, you can get the table def update time but thats not so true with InnoDB and I've found its not even reliable to look at the .frm file for an idea of when the definition might ha...
<p>If you run <code>mysqldump -d</code> it only dumps the schema:</p> <pre><code>[gary.richardson@server ~]$ mysqldump -d -u root mysql user -- MySQL dump 10.11 -- -- Host: localhost Database: mysql -- ------------------------------------------------------ -- Server version 5.0.45 /*!40101 SET @OLD_CHARACTER...
<p>Yeah, it's tough. That's why I use innodb. It's easier to do dump/import, we even put the schemas under VC.</p>
19,831
<p><em>&lt;flavor&gt; I want to create a spelling test program for my grade schoolers that would let them enter and record their spelling words then test them on them through out the week.&lt;/flavor&gt;</em></p> <p>What's a good Delphi API with which I could select a recording device, capture and save sound files, th...
<p>An alternative to recording would be to use the MS Speech API with C#, enter the words via keyboard, and have it state what was keyed in.</p> <p>Just a thought... Good luck on your app -- it sounds like a really cool program!</p>
<p>Why not use the TMediaPlayer that comes with Delphi (in the System Tab of the Palette)?<br> It can record and play wave files very easily</p>
17,033
<p>I need to do some simple timezone calculation in mod_perl. DateTime isn't an option. What I need to do is easily accomplished by setting $ENV{TZ} and using localtime and POSIX::mktime, but under a threaded MPM, I'd need to make sure only one thread at a time was mucking with the environment. (I'm not concerned ab...
<p>(repeating what I said over at PerlMonks...)</p> <pre><code>BEGIN { my $mutex; sub that { $mutex ||= APR::ThreadMutex-&gt;new( $r-&gt;pool() ); $mutex-&gt;lock(); $ENV{TZ}= ...; ... $mutex-&gt;unlock(); } } </code></pre> <p>But, of course, lock() should happen...
<p>If you're using apache 1.3, then you shouldn't need to resort to mutexes. Apache 1.3 spawns of a number of worker processes, and each worker executes a single thread. In this case, you can write:</p> <pre><code>{ local $ENV{TZ} = whatever_I_need_it_to_be(); # Do calculations here. } </code></pre> <p>Cha...
15,119
<p>I've been led to believe that for single variable assignment in T-SQL, <code>set</code> is the best way to go about things, for two reasons:</p> <ul> <li>it's the ANSI standard for variable assignment</li> <li>it's actually faster than doing a SELECT (for a single variable)</li> </ul> <p>So...</p> <pre><code>SELE...
<p>SET is faster on single runs. You can prove this easily enough. Whether or not it makes a difference is up to you, but I prefer SET, since I don't see the point of SELECT if all the code is doing is an assignment. I prefer to keep SELECT confined to SELECT statements from tables, views, etc.</p> <p>Here is a sample...
<p>Take a look at the "execution plan", it should tell you the cost of each line of your statement</p>
22,999
<p>I've tried this, but it doesn't work:</p> <pre><code>col * format a20000 </code></pre> <p>Do I really have to list every column specifically? That is a huge pain in the arse.</p>
<p>Never mind, figured it out:</p> <pre><code>set wrap off set linesize 3000 -- (or to a sufficiently large value to hold your results page) </code></pre> <p>Which I found by:</p> <pre><code>show all </code></pre> <p>And looking for some option that seemed relevant.</p>
<pre class="lang-sql prettyprint-override"><code>set WRAP OFF set PAGESIZE 0 </code></pre> <p>Try using those settings.</p>
22,797
<p>I need assistance finding a delivery method that best fulfills the following requirements:</p> <ul> <li>We wish to deliver a single file to my clients.</li> <li>Clients should be able to launch this file from the operating system shell - much like running an '.exe' on Windows.</li> <li>After being launched, the pro...
<blockquote> <p><em>..but internet explorer warns users when local content is launched..</em></p> </blockquote> <p>I don't get it, what's the problem with IE saying "Hey this app is trying to run <em>your</em> files!"</p> <p>I don't mean you don't have a good reason for this, it is just, I don't get it.</p> <p>IE ...
<p>"internet explorer warns users when local content is launched" </p> <p>There's a reason for this. How can they distinguish your excellent, well-behaved, polite application from a virus?</p> <p>Since the line between your app and a virus is very, very blurry, go with any of Silverlight XAP file, an adobe Flex fil...
45,555
<p>The project I´m working on needs to auth its users against AD, and as a fallback check against its own user base. Now I need to test it outside the production environment.</p> <p>What is the best method to setup a Active Directory test environment? Currently I´m downloading a Windows 2003 Virtual PC <a href="http:/...
<p>Is this environment suppose to simulate as many ActiveDirectory installations as possible, or is it to just test that authentication works against a DC?</p> <p>At a minimum, you will want to setup two Domain Controllers, a Primary and a Secondary. You will want to also setup accounts with a variety of account state...
<p>You should think about multi-domain and multi-forest environments, as well as just having multiple domain controllers in the domain you're authenticating against. You're going to need more than a single VM to do that.</p>
41,169
<p>It seems there are some missing lines on the outer wall on the Z-axis with my prints. I'm not able to pinpoint the problem. Does anyone have ideas about what might be wrong with my setup/settings?</p> <p>Example:</p> <p><a href="https://i.stack.imgur.com/3q1k3.jpg" rel="nofollow noreferrer" title="Printed model with...
<p>According to <a href="https://github.com/MarlinFirmware/Configurations/pull/633#issuecomment-995206382" rel="nofollow noreferrer">'The-EG' comment</a> in this GitHub issue, <a href="https://github.com/MarlinFirmware/Configurations/pull/633" rel="nofollow noreferrer">Add Creality Ender 2 Pro config #633</a>, you can ...
<p>MS35775 appears to be TMC208 compatible. You can find the data sheet on relmon.com here is the overview:</p> <ul> <li>2-Phase stepping motor peak current of 2A</li> <li>Step / dir interface 2, 4, 8, 16, or 32 microstep</li> <li>Internal 256 micro steps</li> <li>Quiet mode</li> <li>Fast mode</li> <li>HS Rdson 0.29 Ω...
2,073
<p>In PHP, which is quicker; using <code>include('somefile.php')</code> or querying a MySQL database with a simple <code>SELECT</code> query to get the same information?</p> <p>For example, say you had a JavaScript autocomplete search field which needed 3,000 terms to match against. Is it quicker to read those terms i...
<p>It depends. If your file is stored locally in your server and the database is installed in another machine, then the faster is to include the file.</p> <p>Buuuuut, because it depends on your system it could be not true. I suggest to you to make a PHP test script and run it 100 times from the command line, and repea...
<p>I exactly don't know, but in my opinio using MySQL, even if can be slower, sould be used if the content is dynamic. But I'm pretty sure it is faster, for big contents, using include.</p>
20,063
<p>I agree, that programming against interfaces is a good practice. In most cases in Java "interface" in this sense means the language construct interface, so that you write an interface and an implementation class and that you use the interface instead of the implementation class most of the time.</p> <p>I wonder if ...
<p>Writing interfaces "just because" strikes me as a waste of time and energy, not to mention a violation of the KISS-principle.</p> <p>I write them when they are actually useful in representing common behavior of related classes, not just as a fancy header file.</p>
<p>That's another thing to keep in mind that I've run in to, especially with generated domain and DAO objects. A lot of the interfaces are just too specific. Say a lot of domain objects have an ID and a status field, Why don't they share a common interface? This has caused me frustration, an unnecessarily flat (inhe...
18,340
<p>I need help converting WAV files to MP3 format in VB6. I did already find <a href="http://www.codeproject.com/KB/audio-video/MP3Compressor/MP3Compressor.zip" rel="nofollow noreferrer">source code in C#</a>, but I can't use that</p>
<p>Here is a code example from the greatest programmer on Earth (Google):</p> <p><a href="http://www.vbaccelerator.com/home/vb/code/vbmedia/audio/MP3_Encoding_with_LAME/VB6_Lame_MP3_Encoder.asp" rel="nofollow noreferrer">VB6 Lame MP3 Encoder</a></p> <p>Don't let the word "lame" fool you - it stands for "<strong>LA</s...
<p>AFAIK, MP3 compression is under a patent, you can do that legally only by buying a license.</p> <p>Or, like many other softwares, use the Lame DLL without distributing it but asking to download it in a site not under the same laws...</p> <p>Somehow, that's how Opera does with GPL software: they don't provide spell...
34,587
<p>I have a Visual Studio application with a splash screen image cut into "slices". The positions are specified in the Form Designer so they line up properly on the screen. However, the images are out of place when the application is run on the Chinese version of Windows XP. It looks as if the image slices were "explod...
<p>We found a solution! Apparently the picture boxes stretched out on the Chinese XP PC, but the images they contained did not. The fix was to add code like the following:</p> <pre><code>Me.PictureBoxIcon.Width = Me.PictureBoxIcon.Image.Width Me.PictureBoxIcon.Height = Me.PictureBoxIcon.Image.Height Dim loc As New Po...
<p>In the OnLoad event of the form, you could always explicitly set the location of each section. If starting at the top left with the first and assuming an array with the images in order:</p> <pre><code>images[0].Location = new Point(0,0); for (int i = 1; i &lt; images.Length; i++) { images[i].Location = new Point(...
9,185
<p>This is a scenario I've seen in multiple places over the years; I'm wondering if anyone else has run across a better solution than I have...</p> <p>My company sells a relatively small number of products, however the products we sell are highly specialized (i.e. in order to select a given product, a significant numb...
<p>The first solution you describe is the best if you want to maintain data integrity, and if you have relatively few product types and seldom add new product types. This is the design I'd choose in your situation. Reporting is complex only if your reports need the product-specific attributes. If your reports need o...
<p>Chris and AJ: Thanks for your responses. The product line may change, but I would not term it "volatile". </p> <p>The reason I dislike the third option is that it comes at the cost of metadata for the product attribute values. It essentially turns columns into rows, losing most of the advantages of the database...
14,703
<p>Is there some way I can show custom exception messages as an alert in my jQuery AJAX error message?</p> <p>For example, if I want to throw an exception on the server side via <a href="http://en.wikipedia.org/wiki/Apache_Struts" rel="noreferrer">Struts</a> by <code>throw new ApplicationException(&quot;User name alrea...
<p>Make sure you're setting <code>Response.StatusCode</code> to something other than 200. Write your exception's message using <code>Response.Write</code>, then use...</p> <pre><code>xhr.responseText </code></pre> <p>..in your javascript.</p>
<p>First we need to set &lt;serviceDebug includeExceptionDetailInFaults="True" /&gt; in web.config:</p> <pre><code>&lt;serviceBehaviors&gt; &lt;behavior name=""&gt; &lt;serviceMetadata httpGetEnabled="true" /&gt; **&lt;serviceDebug includeExceptionDetailInFaults="true" /&gt;** &lt;/behavior&gt; &lt;/servi...
49,456
<p>Im adding textboxes (not a fixed number of textboxes) dynamically to a form on ASP.NET page, how do i read back data from these textboxes?</p>
<p>Assuming you're wanting to access the controls on the postback you'd probably re-create the dynamic controls exactly as they were created on the initial load, then use the page's FindControls method to find the controls. It would probably help to create the textboxes with IDs like Textbox1, Textbox2, etc.</p>
<p>To create dynamic controls, I would usually use a ASP.NET PlaceHolder Control and add the dynamic controls to this container. </p> <p>I would give each dynamic control an ID.</p> <p>You can then subsequently use FindControl on the PlaceHolder to access the dynamic controls.</p> <p>I say "dynamic controls" to mea...
28,685
<p>The following code is in the <code>/Courses/Detail</code> action:</p> <pre><code> [AcceptVerbs("GET")] public ActionResult Detail(int id) { ViewData["Title"] = "A View Title"; return View(tmdc.GetCourseById(id)); } </code></pre> <p>The <code>tmdc.GetCourseById(id)</code> method retur...
<p>I was experiencing the same behavior in Visual Studio 2008, and after spending several minutes trying to get the symbols to load I ended up using a workaround - adding a line with the "debugger;" command in my JavaScript file.</p> <p>After adding <code>debugger;</code> when you then reload the script in Internet&nb...
<p>I sometimes have this problem with external JavaScript files - it is caused by the browser cache holding onto an old copy of the file. Forcing a refresh of the page linking to the JavaScript code solves the issue in this case.</p> <p>Of course, make sure your debugger is attached to the correct browser process. ;)<...
14,079
<p>When I get AuthenticationStatus.Authenticated (DotNetOpenId library) response from myopenid provider, i'd like to redirect user from login page to another one using MVC Redirect(myurl). But unfortunately, instead of getting to myurl, user is redirected to empty page:</p> <p>myurl?token=AWSe9PSLwx0RnymcW0q.... (+ se...
<p>First of all you should set authorization cookie:</p> <pre><code>FormsAuth.SetAuthCookie(UserName, RememberMe); </code></pre> <p>After this you should return RedirectToAction result:</p> <pre><code>return RedirectToAction(actionName, controllerName); </code></pre> <p>Or Redirect result:</p> <pre><code>return Re...
<p>I use the classic ReturnUrl querystring parameter to get the user back to the right page. Unfortunately, the RedirectFromLoginPage does not work well after OpenId Authentication so you must do it manually. Note, this is done as an authentication module rather than deeper in on the controller. It feels cleaner thi...
43,094
<p>In order to distribute a function I've written that depends on other functions I've written that have their own dependencies and so on without distributing every m-file I have ever written, I need to figure out what the full list of dependencies is for a given m-file. Is there a built-in/freely downloadable way to d...
<p>For newer releases of Matlab (eg 2007 or 2008) you could use the built in functions:</p> <ol> <li>mlint</li> <li>dependency report and </li> <li>coverage report</li> </ol> <p>Another option is to use Matlab's profiler. The command is profile, it can also be used to track dependencies. To use profile, you could do...
<p>For <code>MATLAB 2015a</code> and later you should preferably look at <a href="http://www.mathworks.com/help/matlab/ref/matlab.codetools.requiredfilesandproducts.html" rel="noreferrer">matlab.codetools.requiredFilesAndProducts</a></p> <p>or <code>doc matlab.codetools.requiredFilesAndProducts</code></p> <p>because...
12,129
<p><strong>Final Edit:</strong> I found a solution to the problem (at the bottom of the question).</p> <p>I've got an Nunit problem that's causing me grief. <strong>Edit:</strong> actually it looks more like a SQLite problem, but I'm not 100% certain yet.</p> <p>My TestFixture has a setup that generates a random file...
<p>Thanks for the posted answer at the bottom. I was digging for hours for exactly the same case and </p> <pre><code>GC.Collect (); GC.WaitForPendingFinalizers (); </code></pre> <p>did the trick.</p>
<p>Tear down is executed after each test.</p> <blockquote> <p>This attribute is used inside a TestFixture to provide a common set of functions that are performed after each test method is run.</p> </blockquote> <p>You should try to delete them all with <strong>TestFixtureTearDown</strong>:</p> <pre><code> [Test...
48,990