instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>I am trying to upgrade an named instance of MSDE to SQL Server 2008 Express. When I get to the "Select Features" page of the 2008 installer there are no instances listed. The upgrade to SQL Server 2005 Express (on the same VM image) however works fine.</p> <p>It seems to be a supported scenario (<a href="http://m...
<p>It looks to be supported: <a href="http://msdn.microsoft.com/en-us/library/ms143393.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ms143393.aspx</a></p> <p>There are also comments you might find useful.</p>
<p>I just had the same problem, so I'll post my solution for anyone that happens upon this thread;</p> <p>You are probably seeing your named instance on that screen but it is greyed out. Check that you have SP4 for MSDE, which is version 8.0.2039.</p>
13,976
<p>Does any one know of some kind of Comparator factory in Java, with a </p> <pre><code>public Comparator getComparatorForClass(Class clazz) {} </code></pre> <p>It would return Comparators for stuff like String, Double, Integer but would have a</p> <pre><code>public void addComparatorForClass(Class clazz, Comparator...
<p>Instead of:</p> <pre><code>factory.getComparatorForClass(x.getClass()).compare(x, y) </code></pre> <p>you could simply implement <code>Comparable</code> and write:</p> <pre><code>x.compareTo(y) </code></pre> <p>String, the primitive wrappers, and standard collections already implement <code>Comparable</code>.</p...
<p>Default comparator is not exist in Java. However, if you are coding with, for example, a customized searcher, which intends to use comparator rather than the compareTo() method of derived type of Comparable class, you may write a static inner comparator class as the default comparator, simply implementing the compar...
29,413
<p>Can anyone give me pointers to good books or web sites that teach how to do Flex programming?</p>
<p>Check out <a href="http://joshblog.net/2007/04/05/ten-ways-beginners-can-learn-adobe-flex/" rel="noreferrer">Ten Great Ways to Learn Flex</a>, but I think number one should be to use the <a href="http://www.adobe.com/devnet/flex/?tab:quickstart=1" rel="noreferrer">Quickstarts on the Adobe Site</a>.</p>
<p>lynda.com has <a href="http://movielibrary.lynda.com/html/modListing.asp?pid=205" rel="nofollow noreferrer">a set of Flex videos</a>, including <a href="http://movielibrary.lynda.com/html/modPage.asp?ID=438" rel="nofollow noreferrer">basic Flex 3</a>, <a href="http://movielibrary.lynda.com/html/modPage.asp?ID=437" r...
31,553
<p>How do I set a disabled TextBox's current text color to be the same as its current background color in C#?</p> <p>Simply doing txtLala.ForeColor = txtLala.BackColor does not seems to work.</p>
<p>This works:</p> <pre><code>txtLala.Text = "Red"; txtLala.BackColor = System.Drawing.Color.Red; txtLala.ForeColor = txtLala.BackColor; txtLala.ReadOnly = true; </code></pre> <p>Try setting the <code>color</code>, before the <code>readonly</code>. And also check how you are setting the color!</p> <p><strong>EDIT</s...
<p>If this is a readonly textbox, you need to explicitly set your BackColor first, then your statement will work.</p> <pre><code>txtLala.BackColor = System.Drawing.SystemColors.Info; txtLala.ForeColor = txtLala.BackColor; </code></pre> <p>Ref: <a href="http://bytes.com/groups/net-c/233961-read-only-textbox" rel="nofo...
47,329
<p>If something is making a single-thread program take, say, 10 times as long as it should, you could run a profiler on it. You could also just halt it with a "pause" button, and you'll see exactly what it's doing. </p> <p>Even if it's only 10% slower than it should be, if you halt it more times, before long you'll se...
<p>On Java servers it's always been a neat trick to do 2-3 quick <kbd>Ctrl</kbd>-<kbd>Breaks</kbd>s in a row and get 2-3 threaddumps of all running threads. Simply looking at where all the threads "are" may extremely quickly pinpoint where your performance problems are.</p> <p>This technique can reveal more performanc...
<p>EDIT 2008/11/25: OK, Vineet's response has finally made me see what the issue is here. Better late than never.</p> <p>Somehow the idea got loose in the land that performance problems are found by measuring performance. That is confusing means with ends. Somehow I avoided this by single-stepping entire programs long...
33,400
<p>I have two multidimensional arrays (well actually they're only 2D) which have inferred size. How do I deep clone them? Here's what I have gotten so far:</p> <pre><code>public foo(Character[][] original){ clone = new Character[original.length][]; for(int i = 0; i &lt; original.length; i++) clone[i]...
<pre><code>/**Creates an independent copy(clone) of the boolean array. * @param array The array to be cloned. * @return An independent 'deep' structure clone of the array. */ public static boolean[][] clone2DArray(boolean[][] array) { int rows=array.length ; //int rowIs=array[0].length ; //clone the 'sh...
<p>I found this answer for cloning multidimensional arrays on <a href="http://www.jguru.com/faq/view.jsp?EID=20435" rel="nofollow noreferrer">jGuru</a>:</p> <pre><code>ByteArrayOutputStream baos = new ByteArrayOutputStream(); ObjectOutputStream oos = new ObjectOutputStream(baos); oos.writeObject(this); ByteArrayInputS...
24,443
<p>I've been doing some HTML scraping in PHP using regular expressions. This works, but the result is finicky and fragile. Has anyone used any packages that provide a more robust solution? A config driven solution would be ideal, but I'm not picky.</p>
<p>I would recomend <a href="https://sourceforge.net/projects/simplehtmldom/" rel="noreferrer">PHP Simple HTML DOM Parser</a> after you have scraped the HTML from the page. It supports invalid HTML, and provides a very easy way to handle HTML elements. </p>
<p>I've had very good with results with the <a href="https://sourceforge.net/projects/simplehtmldom/" rel="nofollow noreferrer">Simple Html DOM Parser</a> mentioned above as well. And then there's the  <a href="http://www.php.net/tidy" rel="nofollow noreferrer">tidy Extension for PHP</a> as well which works really well...
5,428
<p>I've been curious about the various UV/Laser printers in (or coming into) market that use liquid resin. I've seen the samples of the <a href="https://fslaser.com/Products/View/1" rel="noreferrer">Pegasus Touch</a>, <a href="http://formlabs.com/products/materials/" rel="noreferrer">Form1</a>, and the <a href="http://...
<p>Taken in order your questions:</p> <p>Maintenance for a resin printer means keeping the vat or tray clean, using appropriate methods to remove the unused resin (or leaving it in the vat per manufacturer's directions). Cleaning the tray should be done also per manufacturer's spec, although each printer's user forum ...
<p>Despite how many vendors make it appear, resin-curing SLA/DLP printers are industrial or commercial tools that are really not suitable for home desktop use. Here are the major downsides:</p> <ul> <li>Significantly more expensive to operate than FDM printers, in most cases. </li> <li>The resin is seriously toxic unt...
229
<p>We all know that having a good note taking tool is important as a developer.</p> <p>However, OneNote and Evernote forces us to be locked in to a particular vendor.</p> <p>Anyone know of good open-source tools, or even other method of taking notes w/o being "locked-in"?</p> <p>EDIT: I should kick myself in the hea...
<p>Pen and paper.</p>
<p>Notepad and/or VI</p>
29,655
<p>I understand the first argument must be the result of GetFileVersionInfo().</p> <p>The third and forth are target buffer and size</p> <p>What is the second argument, lpSubBlock?</p> <p>Thanks In Advance</p>
<p>When you view the version info through the resource editor you might notice that there is an initial section with FILEVERSION, PRODUCTVERISON etc. and then one or more blocks which contain language specific settings.</p> <pre><code>VS_VERSION_INFO VERSIONINFO FILEVERSION 5,0,0,0 PRODUCTVERSION 5,0,0,0 FILEFLAGSM...
<p>It must be a string whose format you can find here:<br> <a href="http://www.hep.wisc.edu/~pinghc/books/apirefeng/v/verqueryvalue.html" rel="nofollow noreferrer">http://www.hep.wisc.edu/~pinghc/books/apirefeng/v/verqueryvalue.html</a></p> <p>There is another example of usage (in VB, easy to read):<br> <a href="http:...
41,261
<p>Let's assume you have one massive table with three columns as shown below:</p> <pre><code>[id] INT NOT NULL, [date] SMALLDATETIME NOT NULL, [sales] FLOAT NULL </code></pre> <p>Also assume you are limited to one physical disk and one filegroup (PRIMARY). You expect this table to hold sales for 10,000,000+ ids, a...
<p>This table is awesomely narrow. If the real table will be this narrow, you should be happy to have table scans instead of index->lookups.</p> <p>I would do this:</p> <pre><code>CREATE TABLE Narrow ( [id] INT NOT NULL, [date] SMALLDATETIME NOT NULL, [sales] FLOAT NULL, PRIMARY KEY(id, date) --EDIT, just n...
<p>If you are using the partitions in the select statements, then you cn gain some speed.</p> <p>If you are not using it, only using "standard" selects, then you have no benefit.</p> <p>On your original problem: I would recommend you option #1 with the non-clustered index on id included.</p>
14,681
<p>I'm (surprisingly) having a problem getting my PEI substrate to stick to the heated bed surface. The ABS item being printed stuck great to the PEI surface. I've not seen anyone else post on this problem, but perhaps someone has seen it.</p> <p>Note, this is the PRINT SURFACE warping, not the item being printed. ...
<p>Perhaps this is due to the aluminum build plate warping/crowning as it heats? I use a PEI print surface on my Monoprice Maker Select (Wanhao Di3), which has an 8.5"x8.5" build plate, and I've had no issues with the PEI coming unstuck. However, instead of attaching mine directly to the aluminum heated build plate, ...
<p>I never used one, but the thing that makes two parts stick together is the atmospheric pressure. The glue is just a thing that, even if it does not make any chemical bond, is keeping the air out. A pure example of that is if you put water in a glass and then put another one on it. Although the water is not glue you ...
493
<p>Is it possible to store web content (such as JSPs, HTML, images, CSS etc) in a JAR file?</p> <p>I've been looking at various options at modularising our web applications and this is one possibility.</p> <p>We are currently using JSF and Facelets for our view technology - I'm thinking it may be possible to write so...
<p>Yes, it is possible to store files e.g. properties, xml, xslt, image etc; in a JAR (or WAR) file and pull them at runtime.</p> <p>To load a resource from your deployment jar, use the following code.</p> <pre><code>this.getClass().getClassLoader().getResourceAsStream( filename ) ; </code></pre> <p>In a maven proje...
<p>Absolutely. Heck, you can store content directly in a WAR file, which is basically a JAR file with a few extra bits. Yes, you may need to write a custom resolver to use ClassLoader.getResourceAsStream, but basically as you're given the ability to generate the content however you like, fetching it from a jar file see...
24,432
<p>ASP.NET server-side controls postback to their own page. This makes cases where you want to redirect a user to an external page, but need to post to that page for some reason (for authentication, for instance) a pain.</p> <p>An <code>HttpWebRequest</code> works great if you don't want to redirect, and JavaScript i...
<p>Here's how I solved this problem today. I started from <a href="http://www.c-sharpcorner.com/UploadFile/desaijm/ASP.NetPostURL11282005005516AM/ASP.NetPostURL.aspx" rel="nofollow noreferrer">this article</a> on C# Corner, but found the example - while technically sound - a little incomplete. Everything he said was ...
<p>If you're using ASP.NET 2.0, you can do this with <a href="http://msdn.microsoft.com/en-us/library/ms178139.aspx" rel="nofollow noreferrer">cross-page posting</a>.</p> <p>Edit: I missed the fact that you're asking about an <em>external</em> page. For that I think you'd need to have your ASP.NET page gen up an HTML...
2,715
<p>Should I instantiate my worker variables inside or outside my for loop</p> <p>E.g.</p> <p>a)</p> <pre><code>bool b = default(bool); for (int i = 0; i &lt; MyCollection.Length; i++) { b = false; foreach(object myObject in myObjectCollection) { if (object.Property == MyCollection[i].Property) { ...
<p>Previous answer deleted as I'd misread the code. (Using "default(bool)" anywhere is a bit odd, btw.)</p> <p>However, unless the variable is captured by a delegate etc, I'd expect them to <em>either</em> compile to IL which is effectively the same (in terms of both behaviour and performance).</p> <p>As ever, write ...
<p>I like to declare them inside the loop, it saves a line of code (to declare and set it on the same line), and it's easier to see what variables I'm using outside and inside the scope of the loop, which is good when you're working on something complicated.</p>
49,525
<p>I'm using Team Foundation Build but we aren't yet using TFS for problem tracking, so I would like to disable the work item creation on a failed build. Is there any way to do this? I tried commenting out the work item info in the TFSBuild.proj file for the build type but that didn't do the trick.</p>
<p>Try adding this inside the PropertyGroup in your TFSBuild.proj:</p> <pre><code>&lt;SkipWorkItemCreation&gt;true&lt;/SkipWorkItemCreation&gt; </code></pre> <hr> <p>If you are curious as to how this works, Microsoft.TeamFoundation.Build.targets contians the following:</p> <pre><code> &lt;Target Name="CoreCreateWo...
<p>If you are using tfs2010 or above you can do this in the build definition itself.</p> <p>In the <strong>Process tab</strong> of Build Definition set the <code>Create Work Item on failure</code> property to <code>false</code> (under the Advanced section)</p>
14,850
<p>I created an Ajax website in Visual Studio, added a simple page with a textbox and button, when I click the button once everything works, when I click it twice I get the error</p> <p>Sys.WebForms.PageRequestManagerServerErrorException: An unknown error occurred while processing the request on the server. The statu...
<p><strong>Edit</strong> There appears to be a better LZW solution that handles Unicode strings correctly at <a href="http://pieroxy.net/blog/pages/lz-string/index.html" rel="noreferrer">http://pieroxy.net/blog/pages/lz-string/index.html</a> (Thanks to pieroxy in the comments).</p> <hr> <p>I don't know of any gzip im...
<p>Most browsers can decompress gzip on the fly. That might be a better option than a javascript implementation.</p>
37,570
<p>I need to convert latitude/longitude coordinates into Easting/Northing coordinates in the Alberta 10 TM Projection.</p> <p>The 10 TM projection is similar to UTM, but it is a custom projection for the province of Alberta, Canada. I think (with some effort) I could code it myself but would rather not reinvent the w...
<p>Grab <a href="https://proj.org" rel="nofollow noreferrer">PROJ Cartographic Projections library</a> - open source library.</p> <p>Suggested parameters for 10TM:</p> <blockquote> <p>+proj=tmerc +lon_0=-115 +k_0=0.9992 +x_0=500000 +datum=NAD27</p> </blockquote> <p>According to <a href="http://mapserver.gis.umn.edu/dat...
<p>You can also use <a href="http://code.google.com/p/android-openmap-framework/" rel="nofollow">http://code.google.com/p/android-openmap-framework/</a> which can convert an Android Location to a LatLonPoint, UTMPoint, or MGRSPoint.</p>
6,335
<p>I have a console application that require to use some code that need administrator level. I have read that I need to add a Manifest file myprogram.exe.manifest that look like that :</p> <pre><code>&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;yes&quot;?&gt; &lt;assembly xmlns=&quot;urn...
<p>For anyone using Visual Studio, it's super easy. I was about to go set up the Windows SDK and do mt.exe post-build steps and all that before realizing it's built into VS. I figured I'd record it for posterity.</p> <ol> <li>Project | Add New Item -> Visual C# Items -> Application Manifest File</li> <li>Open app.mani...
<p>You need to embed the UAC manifest as an embedded Win32 resource. See <a href="http://blogs.msdn.com/shawnfa/archive/2006/04/06/568563.aspx" rel="noreferrer">Adding a UAC Manifest to Managed Code</a>.</p> <p>In short, you use a Windows SDK command line tool to embed it into your executable.</p> <p>You can automate...
28,110
<p>So I added an EXE to my project's solution. The EXE does some stuff and outputs data via stdout. I want to capture the output, but more importantly how do I execute that EXE within my program?</p>
<pre><code>Process p = new Process(); p.StartInfo.UseShellExecute = false; p.StartInfo.RedirectStandardOutput = true; p.StartInfo.FileName = "myExec.exe"; p.Start(); </code></pre>
<p><a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.process.start.aspx" rel="nofollow noreferrer"><code>Process.Start</code></a>. To capture stdout you need to redirect it via <code>ProcessStartInfo</code> - there is an example on <a href="http://msdn.microsoft.com/en-us/library/system.diagnostics.pr...
41,281
<p>I'm looking for a decent lexical scanner generator for C#/.NET -- something that supports Unicode character categories, and generates somewhat readable &amp; efficient code. Anyone know of one?</p> <hr> <p>EDIT: I <strong><em>need</em></strong> support for <strong>Unicode categories</strong>, not just Unicode cha...
<p>GPLEX seems to support your requirements.</p>
<p>I just found this </p> <p><a href="http://www.seclab.tuwien.ac.at/projects/cuplex/lex.htm" rel="nofollow">http://www.seclab.tuwien.ac.at/projects/cuplex/lex.htm</a></p> <p>It says that it's configurable enough to support unicode ;-).</p> <p>Herber</p>
20,752
<p>I just switched to the Duet Wifi board (used MKS Gen L 1.0 before) and now small structures look terrible. From my observations the hot end moves correctly, but almost no filament gets extruded. On the other hand larger structures look very good. With the MKS board the exact same G-code worked fine. After that I gra...
<p>The OP found the solution and shared this in comments but has not written a proper answer. The OP found:</p> <blockquote> <p>To complete this, the issue was related to the part cooling fan not spinning correctly. After replacing it the problem was gone.</p> </blockquote>
<p>This actually just looks like heating issues. Cura has an option to set a minimum layer time and speed, and any layer that takes less than that amount of time it'll lift the head away from the print to allow the plastic to cool.</p> <p>Unfortunately, the only things I can find for Simplify3D around head lift and mi...
1,179
<p>I have a generic printer with no support documentation. </p> <p>How do I determine what firmware is in use so that I can research how to make the print run?</p>
<p>Send <code>M115</code> to the printer. This command is </p> <blockquote> <p>Request the Firmware Version and Capabilities of the current microcontroller.</p> </blockquote> <p>Response example:</p> <blockquote> <p>ok PROTOCOL_VERSION:0.1 FIRMWARE_NAME:FiveD FIRMWARE_URL:http%3A//reprap.org MACHINE_TYPE:Mendel ...
<h1>Startup</h1> <p>Usually, when a printer starts up, the screen shows a boot-screen. This contains usually the firmware version, but not who or what the settings are.</p> <h1>LCD: About Printer</h1> <p>Some printers have an LCD main menu item that is &quot;About Printer&quot; or similar. It would one of the last item...
679
<p>I'm developing a .NET 3.5 XBAP application that runs perfectly fine in FF3 and IE6/7 etc. I'm just wondering if its possible to get these to run under other browsers, specifically (as its in the limelight at the moment) Google Chrome.</p>
<p>XBAP applications do work in google chrome, however you have to set your environments PATH variable to the directory where xpcom.dll is located.</p> <p>for example SET PATH=PATH;"C:\Program Files\Mozilla Firefox"</p>
<p>At the moment, XBAPs do not work in Google Chrome. I've gotten it to run once, somehow, but every time there after I've received an error that the browser cannot locate xpcom.dll. Apparently this error occurs for more than just XBAP applications. From what I've read users will have to wait for a fix seeing as Chr...
10,060
<p>What is a "table-driven method"?</p> <p>As mentioned by Bill Gates in the <a href="https://www.youtube.com/watch?v=nNOohFst9Lc" rel="nofollow noreferrer">second Windows Vista commercial</a> at 1:05.</p>
<blockquote> <p>Table-driven methods are schemes that allow you to look up information in a table rather than using logic statements (i.e. case, if). In simple cases, it's quicker and easier to use logic statements, but as the logic chain becomes more complex, table-driven code is simpler than complicated logic, easi...
<p>A table-driven method is quite simple. Use data structures instead of if-then statements to drive program logic. For example, if you are processing two types of records (tv versus cable) you might do this:</p> <pre><code>hash[tv] = process_tv_records hash[cable] = process_cable_records </code></pre> <p>In some langu...
13,083
<p>How can I find the parameters of an <em>undocumented</em> Dll function?</p> <p>I have searched all over the internet and ended up finding one way: it involves decorated functions. However, I cannot find a way to get those. </p> <p><em>Any help would be appreciated.</em></p>
<p>You need to disassemble the application using, as Paul noted, something like IDA Pro (or the free version of the same).</p> <p>A good introductory resource is the Wikibook, <a href="http://en.wikibooks.org/wiki/X86_Disassembly" rel="noreferrer">x86 Disassembly</a>. Specifically, take a look at the section on <a hre...
<p>If the only piece of information you have is the undecorated function name, then unfortunately it's not possible to deduce the function parameters from that alone.</p> <p>If you're good with assembly it might be possible to disassemble the machine code for the function and reverse engineer it. But that's reasonably...
37,284
<p>I'm sure this is going to be a long shot, but I need help with a query involving QuickBooks Items.</p> <p>I need to query for all QuickBooks Items that are linked to an Income account. Is there an easy way to do this, or do I need to make 2 queries (one for items ans one for accounts) and then check the account ref...
<p>You need to use at least two queries. You'll need to fetch a list of accounts, and then compare the items AccountRef FullName to the income accounts in the list. </p>
<p>Using the XML, at least, if you query all items you can get back the accounts of all of them, and filter for the account that you want. The full name of the account will be included in the item query response if you specifically ask for it in IncludeRetElement.</p>
27,687
<p>Using VBA i have a set of functions that return an <code>ADODB.Recordset</code> where all the columns as <code>adVarChar</code>. Unfortunately this means numerics get sorted as text. So 1,7,16,22 becomes 1,16,22,7</p> <p>Is there any methods that can sort numerics as text columns without resorting to changing the t...
<p>Left pad with Zeros with at least as many as maximum number digits. e.g.</p> <p>0001 0010 0022 1000</p> <p>You can use Right$() to accomplish this.</p>
<p>Use the Val() function to sort numerically on a text column. Example:</p> <pre><code>SELECT ID, Field1 FROM tablename ORDER BY Val(Field1); </code></pre>
18,884
<p>I started using a Sql Compact version of my DB and during the development it occured that the DB needs to be accessible over the network. Cause I wasn't able to find a way to share the SDF file over net without replication I need to import it into SQL Server 2008 (Express).</p> <p>Any Ideas?</p>
<p>I solved my problem. GvS's advice gave the keywords to search for: <a href="http://bembengarifin-tech.blogspot.com/2008/08/generate-script-export-data-from-sql-ce.html" rel="noreferrer">http://bembengarifin-tech.blogspot.com/2008/08/generate-script-export-data-from-sql-ce.html</a></p>
<p>I was looking out to see if you could use ODBC to directly access the database file, but apparently, no... According to <a href="http://www.mydatabasesupport.com/forums/ms-sqlserver/216820-odbc-driver-sql-ce.html" rel="nofollow noreferrer">this forum thread</a> your best bet is to try to access it through OLEDB/ADO....
36,951
<p>Easy question this time.</p> <p>I'm trying to test whether or not a string does not contain a character using regular expressions. I thought the expression was of the form "[^<em>x</em>]" where <em>x</em> is the character that you don't want to appear, but that doesn't seem to be working.</p> <p>For example,</p> ...
<p>Your solution is half right. The match you see is for the other characters. What you want to say is something like "hey! I do not want to see this character in the entire string".</p> <p>In that case you do:</p> <pre><code>Regex.IsMatch("103","^[^0]*$") </code></pre>
<p>The first character the parser reaches is "1", which is true for [^0] and also true for [^&amp;], so therefore it will return true in both of those examples. </p>
24,227
<p>The question is this, why do I need to add an "import" directive on my <strong>Site.Master</strong> file to get Intellisense when the html helpers work without it.</p> <p>Using a simple C# string extension method without a namespace == no problem. However, I wanted to put this extension in a namespace to be a good ...
<p>It's a VS limitation that when you add it to &lt;namespaces&gt; in <b>web.config</b>, IntelliSense doesn't show up.</p> <p>But for the sake of completeness, I'll discuss the cause of it: <li>Method 1 is not a correct way to do it at all, since <b>using</b> directives (<b>Imports</b> will compile down to <b>using</b...
<p>I agree that it is sometimes very annoying. But it is all with separation of concerns. You'll have to learn all your own and MS namespaces to find the correct extension methods.</p>
39,053
<p>I have experimented with a sigmoid and logarithmic fade out for volume over a period of about half a second to cushion pause and stop and prevent popping noises in my music applications.</p> <p>However neither of these sound "natural". And by this I mean, they sound botched. Like an amateur engineer was in charge o...
<p>I spent many of my younger years mixing music recordings, live concerts and being a DJ for my school's radio station and the one thing I can tell you is that where you fade is also important.</p> <p>Fading in on an intro or out during the end of a song sounds pretty natural as long as there are no vocals, but some ...
<p>If you're just looking to get a clean sound sound when pausing or stopping playback then there's no need to fade at all - just find a zero-crossing point and stop there (or more realistically just fill the rest of that final buffer with silence). Fading out when the user expects the sound to stop immediately will so...
25,371
<p>I need a Datepicker for a WPF application. What is considered to be the best one? </p>
<h3>There is also the <a href="http://www.codeplex.com/wpf" rel="noreferrer">WPF Tool Kit</a> which has a DatePicker/Calendar control</h3> <p>(i added emphasis because this is the answer)</p>
<p>I'm thinking of using this one: <a href="http://marlongrech.wordpress.com/2007/09/11/wpf-datepicker/" rel="nofollow noreferrer">Marlon Grech Date Picker</a>.</p>
7,309
<p>I've got a collection that implements an interface that extends both IList&lt;T> and List. </p> <pre><code>public Interface IMySpecialCollection : IList&lt;MyObject&gt;, IList { ... } </code></pre> <p>That means I have two versions of the indexer. </p> <p>I wish the generic implementation to be used, so I implem...
<p>You can't do this with </p> <p><code>public interface IMySpecialCollection : IList&lt;MyObject&gt;, IList { ... }</code></p> <p>But you can do what you want with a class, you will need to make the implementations for one of the interfaces explicit. In my example I made IList explicit.</p> <p><code>public class My...
<p>List&lt;T> implies IList, so it's a bad idea to use both in the same class.</p>
8,125
<p>I'm working on developing a regular dump of our database. I'm using <a href="http://davidwalsh.name/backup-mysql-database-php" rel="nofollow noreferrer">this script</a> to create the backup and then feeding it through a regular cron job. In the end we end up with a text file as well as an email archive of everythin...
<p>You can use a crob job to execute mysqldump to dump the tables down that you wish to backup. Then just use a differential backup on that file for the daily backup and do a full backup once a week. The backup's heavy lifting should be done by your backup engine of choice.</p> <p>Restoring a DB is never fun, so reg...
<p>Consider using LVM snapshots to take periodic snapshots of your datasource, then use maatkit on the snapped copy in order to store an SQL dump. Do this on a slave MySQL db so that your backups don't cause performance problems for your live platform.</p>
37,994
<p>I just started creating my data-access layer using LinqToSql. Everybody is talking about the cool syntax and I really like Linq in general. </p> <p>But when I saw how your classes get generated if you drag some tables on the LinqContext I was amazed: So much code which nobody would need?!</p> <p>So I looked how ot...
<p>The created classes are not as heavy as it seems. Of course it takes quite a few lines of code, but all in all it is as lightweight as it can be for the features it's providing.</p> <p>I used to create my own tables, too, but now instead I just use the LINQtoSQL DataContext. Why? Creating is simpler, the features a...
<p>Use compiled queries. Linq to SQL is dog slow otherwise. <a href="http://blogs.msdn.com/ricom/archive/2007/06/22/dlinq-linq-to-sql-performance-part-1.aspx" rel="nofollow noreferrer">Really</a>.</p>
29,897
<p>I've inherited a mobile app which sends auth credentials (userid/password) in the clear.</p> <p>I'd imagine that I have 2 choices: a) use TLS. b) write my own auth protocol.</p> <p>If I choose (b) what are the key guidelines that I must follow to make it it secure. e.g. how to avoid replay attacks, encryption stra...
<p>If you use b), the key guidelines are: Don't. If you want it secure, that is.</p> <p>Try to stick with a).</p>
<p>For both <em>"you can't get sued for it"</em> and <em>"reasonably protected"</em> definitions of 'safe', for a mobile application, you can assume that the line is secure vs man-in-the-middle attacks and wide open to eavesdropping. SSL/TLS sounds the easiest way to go, but this might depend on your carrier and target...
23,921
<p>So I have this app that checks for updates on the server getting a JSON response, each new update is put at the top of my list on a new div that is added via insertBefore using javascript.</p> <p>All works just fine, but i'd like to add an animation effect when the div is added, i.e. "slowly" move the existing divs...
<p>Since you are looking to do it yourself you'll need to use setTimeout to repeatedly change the height of your div. The basic, quick and dirty code looks something like this:</p> <pre><code>var newDiv; function insertNewDiv() { // This is called when you realize something was updated // ... newDiv = ...
<p>It depends on the JavaScript framework you're using; but look at <a href="http://demos.mootools.net/Fx.Slide" rel="nofollow noreferrer">MooTools</a>, <a href="http://github.com/madrobby/scriptaculous/wikis/combination-effects-demo" rel="nofollow noreferrer">Scriptaculous</a>, <a href="http://docs.jquery.com/Effects"...
41,608
<p>In my C/C++ program, I'm using <a href="http://opencvlibrary.sourceforge.net/" rel="noreferrer">OpenCV</a> to capture images from my webcam. The camera (<a href="http://en.wikipedia.org/wiki/Quickcam" rel="noreferrer">Logitech QuickCam IM</a>) can capture at resolutions <strong>320x240</strong>, <strong>640x480</str...
<p>There doesn't seem to be a solution. The resolution can be increased to <strong>640x480</strong> using <a href="http://tech.groups.yahoo.com/group/OpenCV/message/28735" rel="noreferrer">this hack</a> shared by <em>lifebelt77</em>. Here are the details reproduced:</p> <p>Add to <strong>highgui.h</strong>:</p> <pre>...
<pre><code>cvQueryFrame(capture); cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_WIDTH, any_supported_size ); cvSetCaptureProperty( capture, CV_CAP_PROP_FRAME_HEIGHT, any_supported_size); cvQueryFrame(capture); </code></pre> <p>should be just enough!</p>
3,506
<p>How to get file name and revision number as a list starting from a designated folder?</p>
<p>You can use <code>cvs status</code> at the base folder of your project and grep for the appropriate line:</p> <pre><code>&gt; cvs status | grep Repository\ revision\: Repository revision: 1.16 /cvsroot/module/.cvsignore,v Repository revision: 1.1.1.1 /cvsroot/module/build.sh,v Repository revision: 1.251 /cvsro...
<p><code>cvs status</code> will give you that information in the following form per file:</p> <pre><code>=================================================================== File: test.pas Status: Up-to-date Working revision: 1.4 Repository revision: 1.4 /cvsroot/MyModule/test.pas,v Expansion opti...
37,990
<p>How can I unit test SSIS packages? I want to be able to create and maintain unit tests for various components such as the workflow tasks, data flow tasks, event handlers, etc.</p> <p>Are there any existing techniques, frameworks, and/or tools that can be used?</p>
<blockquote> <p><a href="http://www.codeplex.com/ssisUnit" rel="noreferrer">ssisUnit</a></p> </blockquote> <p>A unit testing framework for SQL Server Integration Services</p>
<p><a href="https://github.com/BartekR/ssisUnitLearning" rel="nofollow noreferrer">ssisUnitLearning</a> is a SSIS Tester</p> <p>SSIS project to learn SSIS-Unit testing</p> <p>For more go to with &quot;ssisUnit testing&quot; series at <a href="http://blog.bartekr.net/series/" rel="nofollow noreferrer">bartekr</a></p>
28,027
<p>I was wondering how to unit test abstract classes, and classes that extend abstract classes.</p> <p>Should I test the abstract class by extending it, stubbing out the abstract methods, and then test all the concrete methods? Then only test the methods I override, and test the abstract methods in the unit tests for ...
<p>There are two ways in which abstract base classes are used.</p> <ol> <li><p>You are specializing your abstract object, but all clients will use the derived class through its base interface.</p></li> <li><p>You are using an abstract base class to factor out duplication within objects in your design, and clients use ...
<p>Following @patrick-desjardins answer, I implemented abstract and it's implementation class along with <code>@Test</code> as follows:</p> <p><strong>Abstract class - ABC.java</strong></p> <pre><code>import java.util.ArrayList; import java.util.List; public abstract class ABC { abstract String sayHello(); ...
30,139
<p>It's not a matter of life or death but I wonder if this could be possible:</p> <p>I got a couple of events from one type of custom event (FormEvent) now I got a FormListener that listens to all those events and handles them according to the event type. Instead of adding one eventListener at the time I wish to add a...
<p>You only really need one event listener in this case anyhow. That listener will be listening for any change with the form and a parameter equal to what the change was becomes available to the event listener function. I will show you, but please remember that this is a pseudo situation and normally I wouldn't dispat...
<p>I don't know of any routines that let you do that directly, but you could write your own. The syntax here won't be perfect, but here's a first pass:</p> <pre><code>private function addMultipleEventListeners( evts:Array, callback:function ):void { for each( var evt:Event in evts ) { addEventListener...
16,458
<p>I have a file with several thousand rows and several columns separated with tabs What I'd like to do is loop through each individually, Drop the columns into an array so that I can place them in another application individually, then move onto the next line. Unfortunately I got about as far as this:</p> <pre><code...
<pre><code>Dim str() as String Open mytextfile.txt For Input As #FileHandle Do While Not EOF(FileHandle) Line Input #FileHandle, IndividualLine str = Split(IndividualLine, vbTab) Debug.Print str(0) 'First array element Loop </code></pre> <p>To clarify: I would avoid the use of Variants and use vbTab....
<p>Use the split command</p> <pre><code>Dim StringArray as Variant Open mytextfile.txt For Input As #FileHandle Do While Not EOF(FileHandle) Line Input #FileHandle, IndividualLine StringToBreakup = IndividualLine StringArray = Split(StringToBreakup, CHR(9)) Process array here... Loop </code></pre>
37,223
<h2>Update: giving a much more thorough example.</h2> <p>The first two solutions offered were right along the lines of what I was trying to say <em>not</em> to do. I can't know location, it needs to be able to look at the whole document tree. So a solution along these lines, with /Books/ specified as the context will...
<p>It's not clear for me from your example what you're actually trying to achieve. Do you want to return a new XML with all the nodes stripped out except those that fulfill the condition? If yes, then this looks like the job for an XSLT transform which I don't think it's built-in in MSSQL 2005 (can be added as a UDF: <...
<p>The question is not really clear, but is this what you're looking for?</p> <pre><code>DECLARE @Xml AS XML SET @Xml = N' &lt;Books&gt; &lt;Book ID="1"&gt;Book1&lt;/Book&gt; &lt;Book ID="2"&gt;Book2&lt;/Book&gt; &lt;Book ID="3"&gt;Book3&lt;/Book&...
11,542
<p>I've been building a database input form. There are three fields for notes. They were all build at the same time. They have the same logic &amp; class system - but one of them is returning with escape marks when I update the record, e.g. I enter</p> <pre><code>1 2 3 </code></pre> <p>and the updated record returns ...
<p>As Konrad suggested your question lacks clarity. Are they both on the same page? If not, do both pages have the same <code>DOCTYPE</code>?</p> <p>The simplest solution to this is to handle it regardless, <code>addslashes</code> (or <code>mysql_real_escape_string</code>) for <code>INSERT</code>s and <code>UPDATE</co...
<p>As it is, your question lacks a lot of crucial information. Obviously, if everything is done identically, the data will be the same as well. Additionally, you probably don't mean that there are escape marks in your data (or do you?). In that case, you must have explicitly called a function to convert line breaks int...
49,611
<p>How would I be able to get N results for several groups in an oracle query.</p> <p>For example, given the following table:</p> <pre><code>|--------+------------+------------| | emp_id | name | occupation | |--------+------------+------------| | 1 | John Smith | Accountant | | 2 | Jane Doe | Engin...
<p>I don't have an oracle instance handy right now so I have not tested this:</p> <pre><code>select * from (select emp_id, name, occupation, rank() over ( partition by occupation order by emp_id) rank from employee) where rank &lt;= 3 </code></pre> <p>Here is a link on how rank works: <a href="http://www....
<p>I'm not sure this is very efficient, but maybe a starting place?</p> <pre><code>select * from people p1 join people p2 on p1.occupation = p2.occupation join people p3 on p1.occupation = p3.occupation and p2.occupation = p3.occupation where p1.emp_id != p2.emp_id and p1.emp_id != ...
16,347
<p>What does the following code do in C/C++?</p> <pre><code>if (blah(), 5) { //do something } </code></pre>
<p>Comma operator is applied and the value 5 is used to determine the conditional's true/false.</p> <p>It will execute blah() and get something back (presumably), then the comma operator is employed and 5 will be the only thing that is used to determine the true/false value for the expression.</p> <hr> <p>Note that ...
<p>The following was written assuming it is C code, either in a C file or within a C block of a C++ file:</p> <p>It is a pointless <em>if</em>. It will call blah(), however the result of blah() is not considered by <em>if</em> at all. The only thing being considered is 5, thus the if will always evaluate to true. IOW ...
18,016
<p>Does any one have a preference on how to check if a value is <code>DBNull</code>? I've found these two statements give me the results I want, but just wondering if there's a preference?</p> <p><code>if (any is System.DBNull)</code></p> <p>same as:</p> <p><code>if (any == System.DBNull.Value)</code></p> <p>Thank...
<p>I tend to use</p> <pre><code>if (DBNull.Value.Equals(value)) { // } </code></pre> <p>or</p> <pre><code>if (Convert.IsDBNull(value)) { // } </code></pre>
<p>I like the "is System.DBNull" more because I hate the idea of comparing something to NULL and having it be true. Many other syntaxes (what the hell is the plural of that?) would have anything==NULL return NULL.</p> <p>I understand that there's DBNull.Value for a reason. I know. I'm listing my PREFERENCE :)</p>
13,117
<p>I have added some code which compiles cleanly and have just received this Windows error:</p> <pre><code>--------------------------- (MonTel Administrator) 2.12.7: MtAdmin.exe - Application Error --------------------------- The exception Privileged instruction. (0xc0000096) occurred in the application at location ...
<p>To answer the question, a privileged instruction is a processor op-code (assembler instruction) which can only be executed in "supervisor" (or Ring-0) mode. These types of instructions tend to be used to access I/O devices and protected data structures from the windows kernel.</p> <p>Regular programs execute in "us...
<p>I saw this with Visual c++ 6.0 in the year 2000.</p> <p>The debug C++ library had calls to physical I/O instructions in it, in an exception handler. If I remember correctly, it was dumping status to an I/O port that used to be for DMA base registers, which I assume someone at Microsoft was using for a debugger card...
11,511
<p>Hey all. Newbie question time. I'm trying to setup JMXQuery to connect to my MBean, so far this is what I got.</p> <p>java -classpath jmxquery org.nagios.JMXQuery -U service:jmx:rmi:///jndi/rmi://localhost:8004/jmxrmi -O java.lang:type=Memory -A "NonHeapMemoryUsage"</p> <p>Here's what I get.</p> <p>JMX CRITICAL A...
<p>According to the source, you should be able to use -username and -password arguments.</p> <p><a href="http://code.google.com/p/jmxquery/source/browse/trunk/src/main/java/jmxquery/JMXQuery.java?r=3" rel="nofollow noreferrer">http://code.google.com/p/jmxquery/source/browse/trunk/src/main/java/jmxquery/JMXQuery.java...
<p>It seems that this is an addon to the original JMX-query, look at the comment field.</p> <blockquote> <p>/** * * JMXQuery is used for local or remote request of JMX attributes * It requires JRE 1.5 to be used for compilation and execution. * Look method main for description how it can be invoked. ...
14,742
<p>I have two fields in a table. One contains values such as BTA, BEA, REA. The other contains values such as 1,2,63,103.</p> <p>I want to combine the 2 fields so they look like this BTA001, BTA002, BTA063, BTA103.</p> <p>Notice how if the numbers are not 3 characters in length, I want to pad some 0's to the left o...
<pre><code>select Type + right('00' + cast(id as varchar(10)), 3) from ... </code></pre> <p>Edit: if id can be null and you would like a zero to show, you can do:</p> <pre><code>select Type + right('00' + cast(isnull(id, 0) as varchar(10)), 3) from ... </code></pre>
<p>select C1 + right(('000' + cast(C2 as nvarchar(10)),3) as </p> <p>from t1</p>
49,132
<p>I would like to call python script files from my c++ program.</p> <p>I am not sure that the people I will distribute to will have python installed.</p>
<p>Boost has a python interface library which could help you.</p> <p><a href="http://www.boost.org/doc/libs/release/libs/python/doc/index.html" rel="noreferrer">Boost.Python</a></p>
<p>Using Inter Process Communication (IPC) over socket can be a possible solution. Use a local network socket to listen/trasfer commands between both.</p>
7,155
<p>I need to build a function which parses the domain from a URL.</p> <p>So, with</p> <pre><code>http://google.com/dhasjkdas/sadsdds/sdda/sdads.html </code></pre> <p>or</p> <pre><code>http://www.google.com/dhasjkdas/sadsdds/sdda/sdads.html </code></pre> <p>it should return <code>google.com</code></p> <p>with</p> <pre><...
<p>Check out <a href="http://php.net/parse_url" rel="noreferrer"><code>parse_url()</code></a>:</p> <pre><code>$url = 'http://google.com/dhasjkdas/sadsdds/sdda/sdads.html'; $parse = parse_url($url); echo $parse['host']; // prints 'google.com' </code></pre> <p><code>parse_url</code> doesn't handle really badly mangled ...
<p>Just use as like following ...</p> <pre><code>&lt;?php echo $_SERVER['SERVER_NAME']; ?&gt; </code></pre>
34,869
<p>When we create stored procedures in Visual Studio (with the extension .sql) the file encoding is automatically set to 'Unicode (UTF-8 with signature) - Codepage 65001'.</p> <p>This causes ours DBA's problems as their scripts don't like it.</p> <p>We have to manually go in and change them to 'Western European (wind...
<p>I think somebody faced a similar problem like yours and had the following workaround which is posted at</p> <p><a href="http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830" rel="nofollow noreferrer">http://connect.microsoft.com/VisualStudio/feedback/Workaround.aspx?FeedbackID=319830...
<p>To summarise the link provided by Codeslayer (in case the page url changes)...</p> <p><em>Change the sql file templates to ANSI encoding by opening with notepad and then saving it as an ANSI file. You can do the same for files already created. \Common7\Tools\Templates\Database Project Items</em></p> <p>You've just...
6,731
<p>I am writing a webapp using CodeIgniter that requires authentication. I created a model which handles all my authentication. However, I can't find a way to access this authentication model from inside another model. Is there a way to access a model from inside another mode, or a better way to handle authentication i...
<p>In general, you don't want to create objects inside an object. That's a bad habit, instead, write a clear API and inject a model into your model.</p> <pre><code>&lt;?php // in your controller $model1 = new Model1(); $model2 = new Model2(); $model2-&gt;setWhatever($model1); ?&gt; </code></pre>
<p>Don't handle authentication in your model. Only use models to interface with your database, or ldap or whatever.</p> <p>I created an Auth library that I use to manage authentication and authorization. You can access a library like this from your controllers.</p>
6,842
<p>I have a bunch of old classic ASP pages, many of which show database data in tables. None of the pages have any sorting functionality built in: you are at the mercy of whatever ORDER BY clause the original developer saw fit to use.</p> <p>I'm working on a quick fix to tack on sorting via client-side javascript. I...
<p>You can try grabbing the <code>cssText</code> and <code>className</code>.</p> <pre><code>var css1 = table.rows[1].style.cssText; var css2 = table.rows[2].style.cssText; var class1 = table.rows[1].className; var class2 = table.rows[2].className; // sort // loop if (i%2==0) { table.rows[i].style.cssText...
<p>Don't set the style object itself, set the background color property of the style object that is a property of the element.</p> <p>And yes, even though you said no, jquery and <a href="http://www.tablesorter.com" rel="nofollow noreferrer">tablesorter</a> with its zebra stripe plugin can do this all for you in 3 lin...
44,765
<p>I used to work with Subversion and a system tray tool (<a href="http://svnnotifier.tigris.org/" rel="nofollow noreferrer">SVN Notifier</a>) to monitor the repository so I would immediately see when my local copy was not up-to-date anymore, and I am wondering if some equivalent was available for Perforce (on Windows...
<p>stimms answer will certainly do exactly as you ask.</p> <p>But if you want to go a little further an alternative would be to use the P4 Review mechanism, where you can get Perforce to send you an email if changes are made to a user specified part of the depot. It will need setting up on the server, but is trivial t...
<p>I haven't seen such a thing but it would be pretty trivial to write. Just check to see if the output of p4 sync -n contains any informaiton. </p>
20,163
<p>How can I open a cmd window in a specific location without having to navigate all the way to the directory I want?</p>
<p>This might be what you want: </p> <pre><code>cmd /K "cd C:\Windows\" </code></pre> <p>Note that in order to change drive letters, you need to use <code>cd /d</code>. For example:</p> <pre><code>C:\Windows\System32\cmd.exe /K "cd /d H:\Python\" </code></pre> <p><a href="http://ss64.com/nt/cd.html" rel="noreferrer...
<p>For a better experience using a terminal in windows system, <a href="http://cmder.net/" rel="nofollow noreferrer">cmder</a> may help for a shortcut usage:</p> <ol> <li>Download <a href="http://cmder.net/" rel="nofollow noreferrer">cmder</a> into your system</li> <li>Make shortcut</li> <li>type <code>path_of_the_cmd...
8,597
<p>I'm trying to run dot net console application via Java:</p> <pre><code>process = Runtime.getRuntime().exec(commandLine); </code></pre> <p>I get the following output:</p> <pre><code>Detecting The handle is invalid. </code></pre> <p>when running it directly via the console (windows) there is no problem:</p> <pre>...
<p>The console application is trying to set the cursor position for a console. This isn't possible, since there is in fact no console. All operations which don't result in a simple read or write are likely to cause errors when there is no console (since most of them require a console output buffer to work).</p> <p>It i...
<p>Hard to diagnose without more detail - perhaps permissions... a little bit of exception handling (perhaps writing stack-trace to stderr) would help enormously. but not much help if you don't own the app.</p> <p>If you don't get anywhere, you could try using <a href="http://www.red-gate.com/products/reflector/" rel=...
42,425
<p>When creating a new list do you specify an initial size or leave it blank? I know by specifying an initial size you avoid having the list reallocate the underlying array every-time you add x number of items but you also add verbosity to your code. Is the minimal performance gain worth adding verbosity and complexity...
<p>If you know something about how it's going to be used you should always specify an initial size since C# starts lists with a size of four (!) and doubles in size as the list grows. It just isn't a micro-optimization, since it takes so little effort to give .Net the hint. And readability just isn't an issue, especi...
<p>If you really can't accurately (and easily) predict the size of the list, don't bother.</p> <p>Don't build any code around determining it in advance (less code == better code).</p> <p>Also, doubling is a pretty effective way to grow the list with respect to performance.</p> <p>4 8 16 32 64 128 256 512 1024...you ...
43,404
<p>Could somebody please do a rundown of how to programmatically encrypt a config-file in .NET, preferably in C#.</p> <p>What I would like to do is do some kind of check on an application's startup to see if a section is unprotected, and if it is, then encrypt it. This for both settings and connection-strings.</p> <p...
<p>To summarize the answers and what I've found so far, here are some good links to answer this question:</p> <ul> <li><a href="https://web.archive.org/web/20211029043331/https://aspnet.4guysfromrolla.com/articles/021506-1.aspx" rel="nofollow noreferrer">Encrypting Configuration Information in ASP.NET 2.0 Applications...
<p>I haven't used it myself, but the Microsoft Enterprise library has good encryption support that will possibly suit your needs:</p> <p><a href="http://msdn.microsoft.com/en-us/library/cc309503.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/cc309503.aspx</a></p>
4,198
<p>How do you split a string?</p> <p>Lets say i have a string "dog, cat, mouse,bird"</p> <p>My actual goal is to insert each of those animals into a listBox, so they would become items in a list box.</p> <p>but i think i get the idea on how to insert those items if i know how to split the string. or does anyone know...
<pre><code> string[] tokens = text.Split(','); for (int i = 0; i &lt; tokens.Length; i++) { yourListBox.Add(new ListItem(token[i], token[i])); } </code></pre>
<p>It gives you a string array by strVar.Split</p> <pre><code>"dog, cat, mouse,bird".Split(new[] { ',' }); </code></pre>
30,057
<p>What I'm looking for looks like this in jQuery:</p> <pre><code>jQuery.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("Accept", "text/javascript"); } }); ... $("#my_form").submit({ $.post($(this).attr("action", $(this).serialize(), null, "script"); return false; }); </code></pre> <p>Then...
<p>I believe the answer is:</p> <pre><code>form = dojo.byId("my_form") form.onsubmit = function() { dojo.xhrGet({ url: form.action, form: form, handleAs: "javascript", headers: { "Accept": "text/javascript" } }) } </code></pre>
<p>Not sure about dojo myself but I do know that phiggins (lead dojo dev) is available on the #dojo channel over on freenode irc, that is if nobody else can give you an answer.</p>
38,488
<p>I just set up SSHd through Cygwin on a Windows XP Pro box overseas using a RAT and discluded the openssh package from the install. I ran the cywin shell (from c:\cywin) and ran Now, It's under a port I know is safe and fowarded properly, but I won't share it's number. It's not a common port, but it's under 40000. Fi...
<p>Profile before attempting any optimisation. </p> <p>9 times out of 10, the time won't be consumed where you might guess it is.</p> <p>The usual unsuccessful strategy is micro-optimisation, when what is actually required is the appropriate algorithm.</p> <p>Obligatory Donald Knuth quote:</p> <blockquote> <p><em...
<p>Be sure to have enough unit test to make sure any optimization you will make will not break anything</p> <p>Make sure to qualify your <em>execution environment</em>. Sometime, a simple change in the execution options can go a long way.</p> <p>Then and only then, start analyzing the code.</p> <p>The rewrite decisi...
42,119
<p>We all know that RAW pointers need to be wrapped in some form of smart pointer to get Exception safe memory management. But when it comes to containers of pointers the issue becomes more thorny.</p> <p>The std containers insist on the contained object being copyable so this rules out the use of std::auto_ptr, thoug...
<p>Boost pointer containers have strict ownership over the resources they hold. A std::vector&lt;boost::shared_ptr&lt;X>> has shared ownership. There are reasons why that may be necessary, but in case it isn't, I would default to boost::ptr_vector&lt;X>. YMMV.</p>
<p>Well, overhead is one case.</p> <p>A vector of shared pointers will do a lot of extraneous copying that involves creating a new smart pointer, incrementing a reference, decrementing a reference, etc on a resize. All of this is avoided with a pointer container. </p> <p>Requires profiling to ensure the container ope...
14,141
<p>A friend of mine brought up this questiont he other day, he's recently bought a garmin heart rate moniter device which keeps track of his heart rate and allows him to upload his heart rate stats for a day to his computer.</p> <p>The only problem is there are no linux drivers for the garmin USB device, he's managed ...
<p>I had the same problem and initially found this project at Google Code that aims to complete a cross-platform version of tools for the Garmin devices ... see: <a href="http://code.google.com/p/garmintools/" rel="nofollow noreferrer">http://code.google.com/p/garmintools/</a>. There's a link on the front page of that...
<p>Can you synthesize a heart beat using something like a computer speaker? (I have no idea how such devices actually work). Watch how the binary results change based on different inputs.</p> <p>Ripping apart the device and checking out what's inside would probably help too.</p>
14,120
<p>Is there an event that fires when a WCF service gets started or shut down? Hopefully, independent of whether it is self hosted or hosted in IIS?</p>
<p>Sure, the constructor of your object (especially if you are using a Singleton style). Please pardon the shameless self promotion, but I've written two articles on how to get started with a WCF (Net.Tcp) client/server system... The first is non-IIS (to which the service starts on your own terms), the latter is how to...
<p>ServiceHost exposes quite a few events:</p> <p><a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehost_events.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.servicemodel.servicehost_events.aspx</a></p> <p>You could hook into these events by using a custom se...
32,420
<p>I used to be able to launch a locally installed helper application by registering a given mime-type in the Windows registry. This enabled me to allow users to be able to click once on a link to the current install of our internal browser application. This worked fine in Internet Explorer 5 (most of the time) and Fir...
<p><code>enum</code> defines a syntactical element.</p> <p><code>#define</code> is a pre-preprocessor directive, executed <em>before</em> the compiler sees the code, and therefore is not a language element of C itself.</p> <p>Generally enums are preferred as they are type-safe and more easily discoverable. Defines a...
<p>There is little difference. The C Standard says that enumerations have integral type and that enumeration constants are of type int, so both may be freely intermixed with other integral types, without errors. (If, on the other hand, such intermixing were disallowed without explicit casts, judicious use of enumeratio...
16,569
<p>What is the <em>best</em> way to print the cells of a <code>String[][]</code> array as a right-justified table? For example, the input</p> <pre><code>{ { "x", "xxx" }, { "yyy", "y" }, { "zz", "zz" } } </code></pre> <p>should yield the output</p> <pre><code> x xxx yyy y zz zz </code></pre> <p>This seems like...
<p>Indeed, if you specify a width for the fields, it should be right-justified.<br> If you need to have a dynamic padding, minimal for the longest string, you have to walk the array, getting the maximal width, generate the format string with the width computed from this maxima, and use it for format the output.</p>
<p>find the length of the longest string..<br> left pad all the strings with spaces until they r that length + 1<br> System.out.print them using 2 nested for loops</p>
34,699
<p>We have some old C code here that's built with nmake.</p> <p>Is there an automated way to pull the Makefile into Visual Studio 2005 and create a project? Some searching on MSDN indicates <a href="http://msdn.microsoft.com/en-us/library/aa269915(VS.60).aspx" rel="noreferrer">VS6</a> could do this, but it looks like ...
<p>Here is a link to the <a href="http://msdn.microsoft.com/en-us/library/txcwa2xx(VS.80).aspx" rel="nofollow noreferrer">VS 2005 docs on the subject</a>. It also has links to VS 2003 &amp; 2008, which are probably the same.</p> <p><b>Edit:</b> I would only want to do this with old code that would not change much, esp...
<p>This ought to be possible using Visual Studio's COM-interface, but I can't help you with any details.</p>
18,653
<p>I would like to access the Rails session secret programmatically (I am using it to generate a sign-on token).</p> <p>Here's what I've come up with:</p> <pre><code>ActionController::Base.session.first[:secret] </code></pre> <p>This returns the session secret. However, every time you call ActionController::Base.ses...
<p>For Rails4</p> <pre><code>Rails.configuration.secret_token Rails.configuration.secret_key_base </code></pre> <p>For Rails3</p> <pre><code>Rails.configuration.secret_token </code></pre> <p>But if for Rails2.x, like Don Parish mentioned</p> <pre><code>ActionController::Base.session_options[:secret] </code></pre>
<p>For Rails 3, Rails.configuration is same to Rails.application.config, so Rails.configuration.secret_token acts just as what choonkeat provided.</p>
23,355
<p>I have a linker command file that assigns the top address of the stack into a variable </p> <pre><code>_stack = . + 0x80000; </code></pre> <p>I want to use this address in a 'c' program - I want to copy the stack to another location and then update the stack pointer to point to the new location before doing a de...
<p>Try</p> <pre><code>extern u32 _stack; U32 * stackPtr; stackPtr = &amp;_stack; </code></pre>
<p><em>myFunction(&amp;_stack);</em> should pass myFunction the address of the variable * _stack*. Else, it will pass the value contained in the variable <em>_stack</em>. </p>
22,740
<p>I need to create a 'slider' for a client's site. The slider should allow people to select how many items they want of x item, and show what the price will be based on that. The weird(ish) part is that the ratio of the price increase will go down as the amount of items goes up:</p> <ul> <li>1 item: $100</li> <li>2 i...
<p>Check out Yahoo! UI. they have a slider widget: <a href="http://developer.yahoo.com/yui/slider/" rel="noreferrer">http://developer.yahoo.com/yui/slider/</a></p> <p>The following example should get you started: <a href="http://developer.yahoo.com/yui/examples/slider/slider-ticks.html" rel="noreferrer">http://develop...
<p>While there are presumably endless ways of getting a slider done with JS, I think the easiest way to calculate the prices are just hard-coding (or listing) them somewhere, and just <code>else-if</code>:ing through them.</p> <p>You <em>could</em> do an algorithm that counts <code>100-(i*10)</code> for the five first...
23,818
<p>I need to rebuild an apache server, but the original source is no longer available. Is there any way ( command line switch to httpd? ) to get the build options which were originally used?</p>
<p>Try -V which "Print the version and build parameters of httpd, and then exit."</p> <pre><code>httpd -V </code></pre> <p>Also, you can see the options for httpd via:</p> <pre><code>httpd -h </code></pre>
<p>I re-compiled apache 2.4.3 recently and change the MPM from worker to prefork, what you have to do if you still keep your original compiled directory without ran "make distclean" (if you ran "make clean" it still OK). You can use the SAME configure option to re-configure by exec ./config.status or you can find and c...
16,592
<p>I've got a fairly large MFC application that has just been migrated from VS6.0 to VS2008. It was a pretty painful process, but now I'd like to explore any managed-code options that may be available. I was able to successfully build the project using the /clr switch which seems to give me access to managed types. </p...
<p>Option 3 works for pretty much the same reason option 2 does. CString::operator= has an overload for System::String. Don't forget that the assignment operator can do a lot more than copy a reference.</p> <p>This page: <a href="http://msdn.microsoft.com/en-us/library/ms235631.aspx" rel="nofollow noreferrer">How to:...
<p>You can go from a system::String to CString because they share a common conversion (lptstr?) going to a System::String from CString will always need System::String^ test = gcnew System::String( CStringVar );</p>
39,066
<p>Let's say I have a web site for hosting community generated content that targets a very specific set of users. Now, let's say in the interest of fostering a better community I have an off-topic area where community members can post or talk about anything they want, regardless of the site's main theme.</p> <p>Now, ...
<p>This will work for all well-behaving search engines, just add it to the <code>&lt;head&gt;</code>:</p> <pre><code>&lt;meta name="robots" content="noindex, nofollow" /&gt; </code></pre>
<p>You can disallow search engines to read or index your content by restricting robot meta tags. In this way, spider will consider your instructions and will index only such pages that you want.</p>
6,560
<p>Do you have any advice/rules on selecting a multiplier to use in a (multiplicative) hash function. The function is computing the hash value of a string.</p>
<p>You want to use something that is relatively prime to the size of your set. That way, when you loop around, you won't end up on the same numbers you just tried.</p>
<p>Historically 33 seems like a popular choice, and it tends to work pretty well. No one knows why though. For more details, <a href="http://www.cse.yorku.ca/~oz/hash.html" rel="nofollow noreferrer">look here</a></p>
3,757
<p>I need to check CPU and memory usage for the server in java, anyone know how it could be done?</p>
<p>If you are looking specifically for memory in JVM:</p> <pre><code>Runtime runtime = Runtime.getRuntime(); NumberFormat format = NumberFormat.getInstance(); StringBuilder sb = new StringBuilder(); long maxMemory = runtime.maxMemory(); long allocatedMemory = runtime.totalMemory(); long freeMemory = runtime.freeMemo...
<p>For Eclipse, you can use TPTP (Test and Performance Tools Platform) for analyse memory usage and etc. <a href="http://eclipse.org/articles/Article-TPTP-Profiling-Tool/tptpProfilingArticle.html" rel="nofollow">more information</a></p>
10,033
<p>As the title says on a website is it possible to tell if a user has viewed a portion of the page?</p>
<p>Will moving that portion to a separate iframe work? then if they scroll to the bottom, issue a get request for a small image file..forgot the name of the technique..</p> <p>Update: It is called <a href="http://en.wikipedia.org/wiki/Web_bug" rel="nofollow noreferrer">Web Bug</a>..A Web bug is an object that is embed...
<p>Unless you require a user action of some kind, all you will be able to tell is that they downloaded some portion, not that they actually looked at it.</p>
12,964
<p>I'm considering supporting both <strong><a href="http://textism.com/tools/textile/" rel="nofollow noreferrer">Textile</a></strong> and <strong><a href="http://daringfireball.net/projects/markdown/" rel="nofollow noreferrer">Markdown</a></strong> on a current project. I would prefer not forcing users to choose one or...
<p>Consider that users might only use one specific syntax element in a posting, so you'd have to check for everything. Looking for "h1." obviously only works if the user uses exactly that element. </p> <p>It's pretty easy with things like headers, but consider that markdown formats <code>*this*</code> as <code>&lt;em&...
<p>Auto-detection, I don't know, both are based on "natural" typing.<br> Perhaps you can ask the user to choose a format, with a pair of radio-buttons or something.</p>
16,723
<p>I'm using T4 for generating repositories for LINQ to Entities entities. </p> <p>The repository contains (amongst other things) a List method suitable for paging. The documentation for <a href="http://msdn.microsoft.com/en-us/library/bb738474.aspx" rel="nofollow noreferrer">Supported and Unsupported Methods</a> does...
<p>Paging depends on Ordering in a strong way. Why not tightly couple the operations? Here's one way to do that:</p> <p>Support objects</p> <pre><code>public interface IOrderByExpression&lt;T&gt; { ApplyOrdering(ref IQueryable&lt;T&gt; query); } public class OrderByExpression&lt;T, U&gt; : IOrderByExpression&lt;...
<pre><code> ProvideDefaultSorting(ref query); if (!IsSorted(query)) { query = query.OrderBy(c =&gt; c.CategoryID); } </code></pre> <p>Change to:</p> <pre><code> //apply a default ordering query = query.OrderBy(c =&gt; c.CategoryID); //add to the ordering ProvideDefaultSorting...
27,870
<p>What is the best way to overwrite a specific line in a file? I basically want to search a file for the string '@parsethis' and overwrite the rest of that line with something else.</p>
<p>If the file isn't too big, the best way would probably be to read the file into an array of lines with <a href="http://php.net/file" rel="noreferrer">file()</a>, search through the array of lines for your string and edit that line, then <a href="http://php.net/implode" rel="noreferrer">implode()</a> the array back t...
<p>I'd most likely do what Jeremy suggested, but just for an alternate way to do it here is another solution. This has not been tested or used and is for *nix systems.</p> <pre><code>$cmd = "grep '@parsethis' " . $filename; $output = system($cmd, $result); $lines = explode("\n", $result); // Read the entire file as a ...
29,162
<p>What is the "functional body" of a program?</p> <p>I thought it was its functions' prototypes, is it?</p>
<p>It's the code that actually gets executed, so that would be the code inside your methods.</p>
<p>Unfortunately, many programs have no functional parts.</p> <p>Seriously, you are over-thinking this. It doesn't mean much. It's the human code that actually generates machine code. The machine finds all our comments rather useless and non-functional. </p>
30,857
<p>How can I make the command button in my VC++ 6.0 dialog visible or invisible on load?</p>
<p>From the resource editor once you select the button, you can see its properties in the properties window. Here you can set the visible property to true / false. (assuming this functionality is present in 6.0 - i use 2003 now and cannot remember if this used to be present in 6.0)</p> <p><strong>Add CButton variable<...
<p>What do you mean by 'commnad button' exactly ? </p> <p>Anyway, you need to obtain the handle of the button then call ShowWindow function:</p> <pre><code>BOOL prevState = ShowWindow( itemHandle, SW_HIDE ); </code></pre>
32,198
<p>Is it possible to specify a Java <code>classpath</code> that includes a JAR file contained within another JAR file?</p>
<p>If you're trying to create a single jar that contains your application and its required libraries, there are two ways (that I know of) to do that. The first is <a href="http://one-jar.sourceforge.net/" rel="noreferrer">One-Jar</a>, which uses a special classloader to allow the nesting of jars. The second is <a hre...
<p>Extracting into an Uber-dir works for me as we s should all be using root:\java and have outlets code in packages with versioning. Ie ca.tecreations-1.0.0. Signing is okay because the jars are intact from their downloaded location. 3rd party signatures intact, extract to c:\java. There’s my project dir. run from lau...
22,158
<p>Currently I am using FOP to generate a pdf from java code and an xslt document. The FOP spits out a PDF file that is displayed (embeded) into a webpage. The documents can range between one and several thousand pages long, and it can take some time to generate them. </p> <p>Is there a better tool that and do this? I...
<p>We use <a href="http://www.lowagie.com/iText/" rel="nofollow noreferrer">iText</a>.</p> <p>Here is a blog entry <a href="http://blog.xebia.com/2008/03/03/comparing-apache-fop-with-itext/" rel="nofollow noreferrer">Comparing Apache FOP with iText</a>.</p> <p>Judging by your usage (generate a pdf from java code and ...
<p>Adobe ColdFusion has the <a href="http://www.adobe.com/products/coldfusion/features/pdf_features/" rel="nofollow noreferrer">best built-in PDF support</a>.</p>
47,554
<p>(mingw32, windows xp) Hello, I am attempting to migrate from Java to c++. I am confused and frustrated about finding, installing, and compiling non-standard c++ libraries. in Java it's so convenient they stuffed every functionality and documentation ever needed in java's standard api. Is there a list of essential c+...
<p>The C++ standard library is extremely light. It contains nowhere near the functionality offered by the Java runtimes or by the .NET CLR.</p> <p>The <a href="http://www.boost.org/" rel="nofollow noreferrer">Boost</a> libraries add a whole bunch of functionality to C++, but not much (if any) in the area of user inter...
<p>Threading, XML, Networking, some image generation, encoding and processing - <a href="http://boost.org" rel="nofollow noreferrer">boost</a> provides those. As for XML, there's for example <a href="http://www.jezuk.co.uk/cgi-bin/view/arabica" rel="nofollow noreferrer">Arabica</a> - it abstracts away platform-specific...
28,313
<p>I've got an Apache server that has one access log file that is topping 600MB. This makes it really hard to search the file or parse it.<br> What software or modules for Apache are available that will make a daily copy of my access file to make it more manageable?</p>
<p>Have you looked at <a href="https://linux.die.net/man/8/logrotate" rel="noreferrer">logrotate</a> - this is probably the simplest, most widely available and well understood method of achieving this. It is highly configurable and will probably do 90% of what you need.</p>
<p>I have a module that does this for you without the need for external pipes etc :</p> <p><a href="http://www.poptart.org/bin/view/Poptart/ModAutorotate" rel="nofollow">http://www.poptart.org/bin/view/Poptart/ModAutorotate</a></p> <p>I've tried to add it to the Apache modules collection but that seems to have been b...
6,568
<p>Let me try to explain what I need. I have a server that is visible from the internet. What I need is to create a ASP.NET application that get the request of a web Site and send to a internal server, then it gets the response and publish the the info. For the client this should be totally transparent.</p> <p>For dif...
<p>Why won't any old proxy software work for this? Why does it need to be an ASP.NET application? There are TONS of tools out there (both Windows and *nix) that will get the job done quite easily. Check <a href="http://www.squid-cache.org/" rel="nofollow noreferrer">Squid</a> or <a href="https://web.archive.org/web/...
<p>I use apache mod_proxy and mod_proxy_balancer. Works awesome running 5 domains a cluster of 4 web boxes.</p>
3,257
<p>In Microsoft SQL Server, is there a way to detect whether a database has had its isolation level set via the T-SQL command <code>ALTER DATABASE &lt;database&gt; SET READ_COMMITTED_SNAPSHOT ON;</code>?</p> <p>I cannot find a simple way to detect this in either T-SQL or via the Management Studio's GUI.</p>
<pre><code>SELECT is_read_committed_snapshot_on FROM sys.databases WHERE name= 'YourDatabase' </code></pre> <p>Return value:</p> <ul> <li><strong>1</strong>: <code>READ_COMMITTED_SNAPSHOT</code> option is <strong>ON</strong>. Read operations under the <code>READ COMMITTED</code> isolation level are based on snapshot s...
<p>Neither on SQL2005 nor 2012 does <code>DBCC USEROPTIONS</code> show <code>is_read_committed_snapshot_on</code>:</p> <pre><code>Set Option Value textsize 2147483647 language us_english dateformat mdy datefirst 7 lock_timeout -1 quoted_identifier SET arithabort SET ansi_null_dflt_on SET ansi_warning...
7,521
<p>I need to migrate Access databases to SQL Server 2005. Since this needs to be done from within a setup so that a customers' installation is transparently migrated to SQL Server 2005, I wonder if it is possible to automate the SSMA toolkit from Microsoft.</p>
<p>I continued work on the library that was mentioned by <a href="https://stackoverflow.com/questions/217961/serializing-and-deserializing-expression-trees-in-c/1486253#1486253">Serializing and Deserializing Expression Trees in C#</a></p> <p>It looks like the project was abandoned (2008) but I did some work on it and ...
<p>I was working on a project for serializing expressions. It's OK and you can use it. <a href="http://www.codeproject.com/Articles/851187/ServicePredicateBuilder-for-creating-Serializable" rel="nofollow">http://www.codeproject.com/Articles/851187/ServicePredicateBuilder-for-creating-Serializable</a> </p>
26,804
<p>Could any one give an explanation on how a DHT works?</p> <p>Nothing too heavy, just the basics.</p>
<p>Ok, they're fundamentally a pretty simple idea. A DHT gives you a dictionary-like interface, but the nodes are distributed across the network. The trick with DHTs is that the node that gets to store a particular key is found by hashing that key, so in effect your hash-table buckets are now independent nodes in a net...
<p>The core of a DHT is a hash table. Key-value pairs are stored in DHT and a value can be looked up with a key. The keys are unique identifiers to values that can range from blocks in a blockchain to addresses and to documents.</p> <p><strong>What differentiates a DHT from a normal hash table is the fact that storage ...
17,412
<p>I am just starting with SL and WPF. I am using the DataGrid control and I need to remove the mouseover effect (I actually will need to do more customizations than that). How do I do this. I think I need to do it with a control template but not sure how. I'm researching and reading right now. Any help would be apprec...
<p>Yeah You have to change the Style and ControlTemplate , But are you using experssion blend to edit XAML? Blend is the easiest tool to do this.</p> <p>Try changing the ControlTemplate for a Standard Button or ListBox and once you are comfortable then go to DatGrid. Why I am suggesting this is DataGrid is a complex c...
<p>Yeah You have to change the Style and ControlTemplate , But are you using experssion blend to edit XAML? Blend is the easiest tool to do this.</p> <p>Try changing the ControlTemplate for a Standard Button or ListBox and once you are comfortable then go to DatGrid. Why I am suggesting this is DataGrid is a complex c...
18,885
<p>I've been thinking about this object oriented design question for a while now and have unable to come up with a satisfactory solution, so thought I'd throw it open to the crowds here for some opinions.</p> <p>I have a <em>Game</em> class that represents a turn based board game, we can assume it's similar to Monopol...
<p>I think you should not let the Game class handle IO. this way, the (blocking) TakeTurn method will hide from the game board the means of implementation. it can use other objects to communicate with the user.</p> <p>All the Game class should concern itself with is the state of the board and the turn. the players sh...
<p>I think the <code>Game</code> Class should not concern about any implementations of the Player classes, and also ignore the User Interface.</p> <p>Any user input needs to be handled by the <code>HumanPlayer</code> class.</p>
11,645
<p>This one has me stumped regularly while creating top level class diagrams for documentation. Methods and attributes/fields are easy to model. I usually end up adding a method named EvChanged to indicate a .Net event Changed.</p> <p>What is the right way to show that a type publishes a specific event?</p>
<p>Just add an «event» stereotype to a classifier attribute.</p>
<p>Not the type of answer that I like to give, but <a href="http://office.microsoft.com/en-us/visio/HP815503691033.aspx" rel="nofollow noreferrer">Microsoft</a> has an answer on the Office website.</p>
7,452
<p>EDIT1: Tried to clear the question up by renaming the tables AND their relationships. EDIT2: Please don't look at the what TYPE of data i'm holding in the three DB tables. They were made up on the fly. They are NOT my real world scenarios (and no, I can't talk about my real world data .. in fact it's 1 parent and 6 ...
<p>I find your question confusing, but maybe I can help a little.</p> <p>First of all, tables don't have joins, queries have. You don't make a table with a join to another table. There are just 2 tables that may be related, and you can query those tables using joins.</p> <p>I recommend you to read about db normalizat...
<p>So you are basically adding bogus records in tables B and C in order to have the same number of rows as in A? I wouldn't do it if I were you, because if your dataset is large, then you are increasing the number of rows without any real need and also you are running a risk of an inconsistency (your layout heavily de...
41,387
<p>I'm getting near completely different objects from the same WSDL file when I try to Add a Web Reference depending if I am using Express or Pro version of the vs2008 .NET IDE.</p> <p>1) Why is this happening? I'd expect the WSDL's to act the same across platforms--clearly they are not! 2) How do I determine what too...
<p>I'm sorry to say that the proxies visual studio generates are pretty bad.</p> <p>The real solution for this right now is to write your own contracts and proxies. I know, it's not great news, but 30 minutes of typing might save you from a world of hurt.</p> <p>Check out the helper classes at <a href="http://www.id...
<p>I have seen in the past where wsdl.exe would produce different proxy classes than the VS IDE wizard does. This is probably the explanation.</p>
12,904
<p>I want to create a function that performs a function passed by parameter on a set of data. How do you pass a function as a parameter in C?</p>
<p><strong>Declaration</strong></p> <p>A prototype for a function which takes a function parameter looks like the following:</p> <pre><code>void func ( void (*f)(int) ); </code></pre> <p>This states that the parameter <code>f</code> will be a pointer to a function which has a <code>void</code> return type and which ...
<p>It's not really a function, but it is an localised piece of code. Of course it doesn't pass the code just the result. It won't work if passed to an event dispatcher to be run at a later time (as the result is calculated now and not when the event occurs). But it does localise your code into one place if that is all...
3,083
<p>How do I create a toolbar for Excel using an XLA document?</p>
<p>To make a toolbar, in the onload event, you are going to do something like:</p> <pre><code>Dim myBar As CommandBar, myButt As CommandBarControl 'Delete the toolbar if it already exists' On Error Resume Next CommandBars("My Toolbar").Delete On Error Goto 0 Set myBar = CommandBars.Add(Name:="My Toolbar", _ ...
<p>Not sure if this is what you're looking for but I thought this might help you out:</p> <p><a href="http://www.contextures.com/xlToolbar02.html" rel="nofollow noreferrer">Excel -- Macro Toolbar</a></p> <p>Since you don't specify a version of Excel I'm not sure if this will work for you or not but perhaps it will fu...
32,819