instruction
stringlengths
21
27.8k
chosen
stringlengths
18
28.2k
rejected
stringlengths
18
33.6k
__index_level_0__
int64
0
50k
<p>Is there someway to set the default file permission in Linux? That is, the file permission for a newly created file (regardless of the context for which it was created ). I know about putting umask in the shell startup but that only works for shell sessions. When I transfer files to a Linux box using <strong>pscp</s...
<p>Put the umask in the non-interactive shell startup (<code>.bash_profile</code>, <code>.zshenv</code>, <code>.tcshrc</code> depending on your shell). Then it'll run for non-login sessions.</p>
<p>If you want to affect the whole system, you can also put it in /etc/profile</p>
28,278
<p>In Ruby on Rails Development (or MVC in general), what quick rule should I follow as to where to put logic.</p> <p>Please answer in the affirmative - With <em>Do put this here</em>, rather than <em>Don't put that there</em>.</p>
<p>MVC</p> <p><strong>Controller</strong>: Put code here that has to do with working out what a user wants, and deciding what to give them, working out whether they are logged in, whether they should see certain data, etc. In the end, the controller looks at requests and works out what data (Models) to show and what V...
<p>Testing, Testing ... Put as much logic as possible in the model and then you will be able to test it properly. Unit tests test the data and the way it is formed by testing the model, and functional tests test the way it is routed or controlled by testing the controllers, so it follows that you can't test the integri...
8,562
<p>I just learned about <a href="http://ngrep.sourceforge.net/" rel="nofollow noreferrer">ngrep</a>, a cool program that lets you easily sniff packets that match a particular string.</p> <p>The only problem is that it can be hard to see the match in the big blob of output. I'd like to write a wrapper script to highlig...
<p>Ah, forget it. This is too much of a pain. It was a lot easier to get the source to ngrep and make it print the hash marks to stderr:</p> <pre><code>--- ngrep.c 2006-11-28 05:38:43.000000000 -0800 +++ ngrep.c.new 2008-10-17 16:28:29.000000000 -0700 @@ -687,8 +687,7 @@ } if (quiet &lt; 1) { - p...
<p>See the script at <a href="http://www.mail-archive.com/linux-il@cs.huji.ac.il/msg52876.html" rel="nofollow noreferrer">this post to Linux-IL where someone asked a similar question</a>. It's written in Perl and uses the CPAN Term::ANSIColor module.</p>
26,315
<p>I've seen some examples of C++ using template template parameters (that is templates which take templates as parameters) to do policy-based class design. What other uses does this technique have?</p>
<p>I think you need to use template template syntax to pass a parameter whose type is a template dependent on another template like this:</p> <pre><code>template &lt;template&lt;class&gt; class H, class S&gt; void f(const H&lt;S&gt; &amp;value) { } </code></pre> <p>Here, <code>H</code> is a template, but I wanted thi...
<p>In the solution with variadic templates provided by pfalcon, I found it difficult to actually specialize the ostream operator for std::map due to the greedy nature of the variadic specialization. Here's a slight revision which worked for me:</p> <pre><code>#include &lt;iostream&gt; #include &lt;vector&gt; #include...
26,277
<p>I'm building a photo gallery and what I would like to do is make it so that as the user rolls over an image (let's say for the purposes of this question it's a picture of an apple), all the other images of apples on the page also show their "over" state. </p> <p>Any and all help would be greatly appreciated, and th...
<p>You could add the 'type' of the image as a class. For example an apple will be:</p> <pre><code>&lt;img src='' class='apple fruit red' /&gt; </code></pre> <p>You can have as many space separated classes as you want.</p> <p>Then add the following handler:</p> <pre><code>$(".apple").mouseover(function() { $(".ap...
<p>If these are links (anchor tag) you don't need jQuery to do this. You can use :hover in CSS.</p> <pre><code>a.apple:hover img { /* whatever you want to change here */ } </code></pre> <p>EDIT: Ignore me. This won't change all apple elements on the page at the same time. That's what I get for perusing SO late at n...
49,362
<p>I want to delete a folder that contains thousands of files and folders. If I use Windows Explorer to delete the folder it can take 10-15 minutes (not always, but often). Is there a faster way in Windows to delete folders? </p> <p>Other details:</p> <ul> <li>I don't care about the recycle bin.</li> <li>It's an NTFS...
<h3>Using Windows Command Prompt:</h3> <pre><code>rmdir /s /q folder </code></pre> <h3>Using Powershell:</h3> <pre><code>powershell -Command &quot;Remove-Item -LiteralPath 'folder' -Force -Recurse&quot; </code></pre> <p>Note that in more cases <code>del</code> and <code>rmdir</code> wil leave you with leftover files, w...
<p>Try <kbd>Shift</kbd> + <kbd>Delete</kbd>. Did 24.000 files in 2 minutes for me.</p>
22,602
<p>Are there any tools to assist with the internationalization of Strings within JSP files?</p> <p>Most IDEs (for example, <a href="http://www.netbeans.org" rel="nofollow noreferrer">NetBeans</a>) offer such a feature for Java code. However, in the case of NetBeans, no such feature exists for JSP files.</p> <p>With <...
<p>I hope no-one minds if I bump an old question...</p> <p>When faced with the same problem, I put together (a) a method for localising strings in JSPs in the Gettext style (keeping English in the source JSP) and (b) an Ant task which can find such strings in JSPs and generate a Gettext POT file.</p> <p>(a) is provid...
<p>I found this as a <a href="http://www.eclipsezone.com/eclipse/forums/t84478.rhtml" rel="nofollow noreferrer">workaround solution</a> to this problem. Its far from ideal, but allows you to search all Strings with an IDE. Paraphrashing the solution:</p> <ol> <li>JSPs compile to servlets, so find the corresponding ser...
24,110
<p>We have a large collection of command-line utilities that we write ourselves and use frequently. At the moment, testing them is very cumbersome and consequently, we don't do as much testing as we aught to.</p> <p>I am wondering if anyone can suggest good techniques or tools for doing a good job of this kind of thing...
<p>I recommend structuring your command line tool's code so that the command line utility is a client to a library of functions and/or classes. </p> <p>Rather than simply using std::cout to print output, have the libraries function take an ostream reference that defaults to std::cout. When you are testing, provide a s...
<p>You can do this from a batch file oder windows scripting host.</p> <p>But i promise to use a task scheduler like (<a href="http://www.splinterware.com/products/wincron.htm" rel="nofollow noreferrer">http://www.splinterware.com/products/wincron.htm</a>) or other free/professional software.</p> <p>There you can easy...
45,998
<p>I am considering writing a simple database application for my wife, but I'm hung up on good programming practice, and want to have a human readable source for storing the database schema. </p> <p>Only, I don't know of any tools for the job, and I can't believe that they don't exist---probably I just don't know what...
<p>Just use SQL. SQL is not only a query language but a DDL (data definition language). If, for example you are using mysql; you can design your schema however you want, run mysqldump which will create an SQL file with DDL statements. Tidy up the schema, then you can load the schema any time you like by sourcing the SQ...
<p>I'm unable to give comments yet, but if I understand this right, you want an application or library to build a schema dependent on the data provided in the text file?</p> <p>Could you provide a sample work flow in which you're seeking to accomplish? Which step is the one you're having the issue with?</p>
45,169
<p>I have a simple SQL 'Select' query, and I'd like to dump the results into an Excel file. I'm only able to save as .csv and converting to .xls creates some super ugly output. In any case, as far as I can tell (using Google) this doesn't seem to be so straight forward. Any help would be greatly appreciated.</p>
<p>Use "External data" from Excel. It can use ODBC connection to fetch data from external source: Data/Get External Data/New Database Query</p> <p>That way, even if the data in the database changes, you can easily refresh.</p>
<p>you can right click on a grid of results in SQL server, and choose save as CSV. you can then you can import this into Excel. </p> <p>Excel gives you a import wizard, ensure you select comma delimited. it works fine for me when i needed to import 50k+ records into excel.</p>
11,330
<p>I need a Project management tool that works in Linux, and has Gantt charts.</p> <ol> <li>It doesn't have to be free, just not expensive.</li> <li>I don't care how it stores the information I give it, as long as I can access it.</li> <li>I must be able to <strong>print</strong> the Gantt charts.</li> <li>Must work i...
<p><a href="http://live.gnome.org/Planner" rel="noreferrer">Planner</a>, and <a href="http://opensched.sourceforge.net/" rel="noreferrer">OpenSched</a>, in that order. There are some decent online Gantt (this is the correct spelling) chart tools online as well, usually integrated within a project management or bug-tra...
<p>The answers to <A href="https://stackoverflow.com/questions/171809/is-there-any-latex-package-for-drawing-gantt-diagrams"><a href="https://stackoverflow.com/questions/171809/is-there-any-latex-package-for-drawing-gantt-diagrams">Is there any LaTeX package for drawing Gantt diagrams?</a></A>. may be viable.</p>
23,328
<p>As the title suggests. I want to be able to change the label of a single field in the admin application. I'm aware of the Form.field attribute, but how do I get my Model or ModelAdmin to pass along that information?</p>
<p>the <a href="http://docs.djangoproject.com/en/dev/topics/db/models/#verbose-field-names" rel="noreferrer">verbose name</a> of the field is the (optional) first parameter at field construction.</p>
<p>Use <strong>&quot;verbose_name&quot;</strong> to change <strong>a field name</strong> as the example below.</p> <p><strong>&quot;models.py&quot;</strong>:</p> <pre class="lang-py prettyprint-override"><code>from django.db import models class MyModel(models.Model): # Here name = models.CharField(max_l...
47,660
<p>I have a web server that runs my web application.</p> <p>If I want to outsource my email to another provider, is it possible if they are on their on network/data center?</p>
<p>Yes. To do this, you will need access to the DNS records for your domain. The MX record allows you to set up a mail server that's separate from the web server.</p> <p>Google offers a service that will manage your domain's email through GMail, and the instructions on how to reconfigure your DNS for this service can ...
<p>Google Apps does just that.</p>
32,921
<p>Like the title says: Can reflection give you the name of the currently executing method.</p> <p>I'm inclined to guess not, because of the Heisenberg problem. How do you call a method that will tell you the current method without changing what the current method is? But I'm hoping someone can prove me wrong there....
<p>For non-<code>async</code> methods one can use</p> <pre><code>System.Reflection.MethodBase.GetCurrentMethod().Name; </code></pre> <p><a href="https://learn.microsoft.com/en-us/dotnet/api/system.reflection.methodbase.getcurrentmethod" rel="noreferrer">https://learn.microsoft.com/en-us/dotnet/api/system.reflection.m...
<pre><code>new StackTrace().ToString().Split("\r\n",StringSplitOptions.RemoveEmptyEntries)[0].Replace("at ","").Trim() </code></pre>
6,584
<p>I'm using php and I have the following code to convert an absolute path to a url.</p> <pre><code>function make_url($path, $secure = false){ return (!$secure ? 'http://' : 'https://').str_replace($_SERVER['DOCUMENT_ROOT'], $_SERVER['HTTP_HOST'], $path); } </code></pre> <p>My question is basically, is there a be...
<p>The <a href="http://shiflett.org/blog/2006/mar/server-name-versus-http-host" rel="nofollow noreferrer">HTTP_HOST variable is not a reliable or secure value</a> as it is also being sent by the client. So be sure to validate its value before using it.</p>
<p>I think this is the wrong approach.</p> <p>URLs in a HTML support relative locations. That is, you can do <code>&lt;A href="filename.php"&gt;link&lt;/a&gt;</code> to refer to a page that has the same path in its URL as the corrent page. You can also do <code>&lt;a href="/dir/filename.php"&gt;link&lt;/a&gt;</code> t...
48,872
<p>I could not find any pointers on how to create a menubar icon on OSX using wx. I originally thought that the wxTaskBarIcon class would do, but it actually creates an icon on the Dock. On Windows, wxTaskBarIcon creates a Systray icon and associated menu, and I would think that on mac osx it would create a menubar ico...
<p>You have to set <code>wxTaskBarIconType</code> to <code>STATUSITEM</code>, not <code>DOCK</code>. The Cocoa APIs for this are <code>NSStatusBar</code> and <code>NSStatusItem</code>; <a href="http://trac.wxwidgets.org/attachment/ticket/6860/taskbar.diff" rel="nofollow noreferrer">here's the code in wxWidgets that cal...
<p>As of wxPython 2.9.2.0 <code>wx.TaskBarIcon</code> will create a menubar icon now instead on OSX, so long as you call <code>SetIcon</code>.</p>
17,587
<p>I have an application for Tomcat which needs to offer/consume web services. Since Java web services are a nightmare (xml, code generation, etc.) compared with what is possible in Python, I would like to learn from your experience using jython instead of java for offerring/consuming web services.</p> <p>What I have ...
<p>I've put together more details on how to use webservices in jython using axis. Read about it here: <a href="http://www.fishandcross.com/blog/?p=503" rel="nofollow noreferrer">How To Script Webservices with Jython and Axis</a>.</p>
<p><a href="http://www.jython.org/docs/api/org/python/util/PyServlet.html" rel="nofollow noreferrer">PyServlet</a> helps you configure Tomcat to serve up Jython scripts from a URL. You could use this is a "REST-like" way to do some basic web services without much effort. (It is also described <a href="http://www.info...
14,109
<p>Does anybody know if there is a built-in function in Mathematica for getting the lhs of downvalue rules (without any holding)? I know how to write the code to do it, but it seems basic enough for a built-in</p> <p>For example:</p> <pre><code>a[1]=2; a[2]=3; </code></pre> <p><code>BuiltInIDoNotKnowOf[a]</code> re...
<p>This is like <code>keys()</code> in Perl and Python and other languages that have built in support for hashes (aka dictionaries). As your example illustrates, Mathematica supports hashes without any special syntax. Just say <code>a[1] = 2</code> and you have a hash. [1] To get the keys of a hash, I recommend addin...
<p>This seems to work; not sure how useful it is, though:</p> <pre><code>a[1] = 2 a[2] = 3 a[3] = 5 a[6] = 8 Part[DownValues[a], All, 1, 1, 1] </code></pre>
16,392
<p>I have a Windows application (VS2005/C#) which comes in two versions, Enterprise and Pro. In the Pro version, some of the features and menus are disabled. Currently, I'm doing this by commenting out the disabling code to create the Enterprise version, then I copy each executable file to another location. Obviously t...
<p>from the BUILD menu, select configuration manager option</p> <p>on the active solution configuration dropdown select "new"</p> <p>create two new 'configurations' one for PRO and one for ENTERPRISE</p> <p>close the configuration manager.</p> <p>open the project properties (from the project context menu) select t...
<p>Why not create a separate assembly that enables / disables the features as required? Then just include the appropriate assembly for a particular version...</p>
35,863
<p>We had a bad day yesterday. One of our Domain Admins deleted an OU containing 700+ users and the same amount of computers as well as assorted other useful things like groups etc.</p> <p>We restored from a backup, but it wasn't pretty.</p> <p>I know that ADUC asks you if you're sure etc... but I'd like it if it wa...
<p>There is a feature in AD for Win2k3 and higher to mark an object to prevent accidental deletion. This check box on the object actually changes the underlying permissions for you to remove delete permissions. Therefore it is not tool specific and must be respected by other tools (like powershell and vbscript).</p>
<p>You could deny the Delete privalge from Administrators through Delegation at the root level and then you would need to be an enterprise admin to perform deletions. Ensure that no admins are in the Enterprise Admins group for day-to-day usage.</p>
31,362
<p>I have multiple Network Interface Cards on my computer, each with its own IP address.</p> <p>When I use <code>gethostbyname(gethostname())</code> from Python's (built-in) <code>socket</code> module, it will only return one of them. How do I get the others?</p>
<p>Use the <a href="https://pypi.org/project/netifaces/" rel="noreferrer"><code>netifaces</code></a> module. Because networking is complex, using netifaces can be a little tricky, but here's how to do what you want:</p> <pre><code>&gt;&gt;&gt; import netifaces &gt;&gt;&gt; netifaces.interfaces() ['lo', 'eth0'] &gt;&gt...
<p>You should directly obtain all IP configured IP addresses, e.g. by running ifconfig and parsing its output (it's also possible to do what <a href="http://pypi.python.org/pypi/netifaces/0.3" rel="nofollow noreferrer">ifconfig does directly in Python</a>, <a href="https://stackoverflow.com/questions/259389/finding-an-...
34,037
<p>I'm trying to build a hoverable Jquery tooltip. This tooltip should appear when I hover over some element, and stay put if I choose to hover over the tooltip itself too. The tooltip should disappear only if I hover away from the original element or from the tooltip body.</p> <p>Based on an example I found, I manage...
<p>There is a <a href="http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/" rel="nofollow noreferrer">tooltip plugin</a> for JQuery. If you'd rather roll your own, I'm sure you can get ideas by looking at what they have done.</p>
<p>I'm not sure if you're still interested in this... it's been almost a year o.O</p> <p>But I modified your code a little:</p> <ul> <li>I got rid of the hidetooltip (the extra extension)</li> <li>Using the that.hide_ff is fine, so I didn't change it</li> <li>The tooltip pops up at the end of the link and doesn't mov...
31,759
<p>I've got an open-source app that is hosted at code.google.com. It is cross platform ( Linux / Windows / Mac ). I uploaded the code initially from a WinXP machine using TortoiseSVN and it seems that none of the "configure" batch files that are used for the linux build have their "execute" bits set. </p> <p>What woul...
<p>Here's how to do it on the command line:</p> <pre><code>for file in `find . -name configure`; do svn ps svn:executable yes ${file} done </code></pre> <p>Or for just one file (<code>configure</code> is the filename here):</p> <pre><code>svn ps svn:executable yes configure </code></pre>
<p>Method for restoring executable permissions that are lost during svn import:</p> <p>copy permissions from your original source that you used during svn import (current dir to version1):</p> <pre><code>find . -type f | xargs -I {} chmod --reference {} ../version1/{} </code></pre> <p>then set svn:executable for all...
12,894
<p>Just wondering</p>
<p>I made them work as I wanted once ! That was cool!</p>
<p>Ian P, Mind to elaborate? AFAIK you don't need to use threading to solve a maze, unless, of course the maze is so complicated that the wait time becomes so unbearable that you have to add in status bar so that the users would not get bored and thought that your program hangs.</p>
13,629
<p>How do I get the latest version of my solution recursively like its done in the solution explorer context menu of Visual Studio? I want to do this from the command line or via a macro. I'm trying to automate a part of my daily routine by using a set of batch files. I am sure a lot of developers would love to have so...
<p>TFS has a <a href="http://msdn.microsoft.com/en-us/library/bb130146(VS.80).aspx" rel="nofollow noreferrer">.Net SDK</a> that allows you to create your own custom programs that interact with a TFS Server. You could write a small program that performs the task you need:</p> <pre><code>TeamFoundationServer tfs = Team...
<p>I know you mentioned batch files, but let me throw something else out for you.</p> <p>I'm going to guess that you are using the 2005 version of TFS. 2008 has all of the scheduling stuff built in. </p> <p>However, you could also use <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+Cruis...
5,439
<p>I am getting an vba error 3271; Invalid property value. This happens when trying to append a memo field in a querydef. Any ideas on how to get around this?</p> <p>Example:</p> <pre><code>public sub TestMemoField Dim qdf As QueryDef Set qdf = CurrentDb.QueryDefs("AppendRecord") qdf.Parameters("@SomeBi...
<p>Apparently you cannot have a parameter longer than 255 characters ( <a href="http://support.microsoft.com/kb/275116" rel="nofollow noreferrer">http://support.microsoft.com/kb/275116</a> ). </p> <p>It is possible to use a recordset, or to use:</p> <pre><code>qdf.SQL="INSERT INTO Sometable (SomeField) Values('" &amp...
<p>Um, what are you trying to do? Why are you using parameters? Why not just execute SQL in code, like this:</p> <pre><code>Public Sub TestMemoField Dim strSQL As String strSQL = "UPDATE MyTable SET MyField='" &amp; String(1000,"A") &amp; "'" CurrentDb.Execute strSQL, dbFailOnError End Sub </code></pre> <p>I d...
40,541
<p>I would like to avoid using native libaries if at all possible. Surely there is a better way to solve this issue for Linux, Windows and Mac OS X.</p>
<p>Sorry, you're out of luck. You'll need JNI, and it'll be obnoxiously different for different platforms. The base java libraries cover tasks and hardware that are pretty much universal. CD drives weren't and aren't considered so.</p>
<p>You can use the Java Sound API. I believe this is part of java 5. This may allow you to do what you want to do.</p> <p><a href="http://java.sun.com/products/java-media/sound/" rel="nofollow noreferrer">http://java.sun.com/products/java-media/sound/</a> </p> <p>here are some examples:</p> <p><a href="http://www....
10,036
<p>I have several Google calendars that I'd like to merge and place on my windows desktop using <a href="http://www.samurize.com/" rel="nofollow noreferrer">Samurize</a>. I've tried using Samurize's Page Scraper plugin, but it doesn't appear to be up to the task.</p> <p>I can get Samurize to run a script and place it'...
<p>There is no built-in way to do this. The best way you will be able to get this result is to run a custom tool on the input. This will require a lot of leg work on your part because it will involve parsing the file yourself but you should be able to get this scenario working.</p> <p>Example site for creating a cus...
<p>Sorry, the XAML language service can’t be extended this way either. The best way to do this today is to author a build task. I think you can hook it into the MarkupCompilePass1DependsOn target and it will be invoked automatically when the user saves or changes a XAML file. You still have to scan the file redundan...
43,542
<p>I produce server software and have been fine with all Linux environments so far, both for production and as deployment target. However, I want to provide a broader choice of target environments in the future and I'm also planning features that would consume and produce Office documents.</p> <p>As a first step, I am...
<p><code>$#arrayname</code> gives you the index of the last element, so if array <code>@ret</code> has 2 elements then <code>$#ret</code> is 1. </p> <p>And, as noted by Barry Brown, an empty array gives -1.</p> <p>To get the length you can use the array in scalar context:</p> <pre><code>print scalar @ret; </code></...
<p>To summarize everyone else, that code is much more legible if written like this:</p> <pre><code>my @ret = someMethod(); return if $DB_ERROR; return unless @ret; </code></pre>
29,879
<p>I have a gdi+ bitmap, and I want to convert bitmap into HBitmap. I write the following code.</p> <pre><code> HBITMAP temp; Color color; img-&gt;GetHBITMAP(color, &amp;temp); </code></pre> <p>But It do not work, How can I get a HBitmap?</p>
<p>I like the <a href="http://developer.yahoo.com/yui/autocomplete/" rel="nofollow noreferrer">Yahoo UI Autocomplete widget</a>. It does not provide the dropdown natively, but a dropdown button can be added with <a href="http://tech.groups.yahoo.com/group/ydn-javascript/message/30178" rel="nofollow noreferrer">a few l...
<p>Surely autocomplete and combo boxes serve two similar, but different purposes:</p> <ul> <li>Autocomplete; select one from a very long list (i.e. too long to scroll through)</li> <li>ComboBox; select one from a relatively short list (i.e. one that is easy to scroll through</li> </ul> <p>How many items do you have i...
41,816
<p>I have a <a href="http://www.samurize.com/modules/news/" rel="noreferrer">Samurize</a> config that shows a CPU usage graph similar to Task manager. </p> <p>How do I also display the name of the process with the current highest CPU usage percentage? </p> <p>I would like this to be updated, at most, once per secon...
<p>What you want to get its the instant CPU usage (kind of)...</p> <p>Actually, the instant CPU usage for a process does not exists. Instead you have to make two measurements and calculate the average CPU usage, the formula is quite simple:</p> <blockquote> <p>AvgCpuUsed = [TotalCPUTime(process,time2) - TotalCPUTim...
<p>With PowerShell:</p> <pre><code>Get-Process | Sort-Object CPU -desc | Select-Object -first 3 | Format-Table CPU,ProcessName -hidetableheader </code></pre> <p>returns somewhat like:</p> <pre><code> 16.8641632 System 12.548072 csrss 11.9892168 powershell </code></pre>
7,488
<p>Say I have the following XML...</p> <pre><code>&lt;root&gt; &lt;base&gt; &lt;tent key="1" color="red"/&gt; &lt;tent key="2" color="yellow"/&gt; &lt;tent key="3" color="blue"/&gt; &lt;/base&gt; &lt;bucket&gt; &lt;tent key="1"/&gt; &lt;tent key="3"/&gt; &lt;/bucket&gt; &lt;/root&gt; </code...
<p>If you're using XSLT, I'd recommend setting up a key:</p> <pre><code>&lt;xsl:key name="tents" match="base/tent" use="@key" /&gt; </code></pre> <p>You can then get the <code>&lt;tent&gt;</code> within <code>&lt;base&gt;</code> with a particular <code>key</code> using</p> <pre><code>key('tents', $id) </code></pre> ...
<p>JeniT has the appropriate response / code listed here. You need to create the key before you walk the XML Document, then perform matches against that key.</p>
17,169
<p>The one that ships with IDEA is nothing more than a GWT project creation tool. Is there a better plugin? Is there a standalone GUI editor for GWT?</p>
<p>To answer your question directly, there is no such thing as a Intellij IDEA GUI WYSIWYG editor for GWT for the moment. </p> <p>The most popular/feature complete WYSIWYG editor for GWT is <a href="http://www.instantiations.com/windowbuilder/" rel="noreferrer">Instantiations GWT Designer</a>. It is available only for...
<p>Unfortunately, there really isn't one yet. We're going to have to wait until 2016 when Google takes over the world; everything will be so much easier then! ;)</p>
46,668
<p>we have DotNet webservice which is being called by two clients , one a dotnet client and other a javaclient</p> <p>The problem is java client is taking longer time in processing the results when compared to dotnet client and affecting the performance greatly , i'm using axis in java</p> <p>Is there any know issue ...
<p>The root cause could be almost anything:--</p> <ul> <li>Slower hardware.</li> <li>Badly written client</li> <li>Long running windows client versus java client started on every invocation.</li> <li>Differences in configuration<ul> <li>XSD validation turned on for java client.</li> <li>JVM memory allocation too smal...
<p>Does the Java/Axis client re-use it's connection(s) to the web service/server, or is it initiating a new connection with each request?</p>
42,857
<p>Is there a more efficient way to convert an HTMLCollection to an Array, other than iterating through the contents of said collection and manually pushing each item into an array?</p>
<pre><code>var arr = Array.prototype.slice.call( htmlCollection ) </code></pre> <p>will have the same effect using "native" code.</p> <p><strong>Edit</strong></p> <p>Since this gets a lot of views, note (per @oriol's comment) that the following more concise expression is <em>effectively</em> equivalent:</p> <pre><c...
<p>This is my personal solution, based on the information here (this thread):</p> <pre><code>var Divs = new Array(); var Elemns = document.getElementsByClassName("divisao"); try { Divs = Elemns.prototype.slice.call(Elemns); } catch(e) { Divs = $A(Elemns); } </code></pre> <p>Where $A wa...
27,503
<p>I have a C# application that is a client to a web service. One of my requirements is to allow capturing the SOAP that I send, so that if there is a problem, I can either fix the bug, or demonstrate that the problem is in the service I am calling.</p> <p>My WebReference proxy service class derives from <code>System...
<p>I think what you are looking for is addressed in this question: </p> <p><a href="https://stackoverflow.com/questions/300674/getting-raw-soap-data-from-a-web-reference-client-running-in-aspnet">Getting RAW Soap Data from a Web Reference Client running in ASP.net</a> </p> <p>It looks like a lot of code though.</p>
<p>For some reason Fiddler was not showing my local service calls when using the ASP.NET Development Server that comes with Visual Studio. To get around this I changed the web service Url at runtime to be the Fiddler port, just to capture the SOAP message.</p> <p>You can do this from the Immediate window, for example:...
39,472
<p>I need to ensure that an application I am developing is accessable and also works with JavaScript turned off. I just need a pointer to assist with the following.</p> <p>I had 3 'chained' select boxes and I wanted JavaScript enabled clients to have a nice Ajax experience. I can easily write the required functionalit...
<p>You can check the IsMvcAjaxRequest property and use it inside your controller and then return a partial view (user control) or JSON result if true, or the full View if it's false.</p> <p>Something like this:</p> <pre><code>public ActionResult List() { if (!Request.IsMvcAjaxRequest()) { // Non AJAX req...
<p>(ref. your previous answer): You could pass a value in your Request.Form to signal that this is a browser with or without javascript enabled, and then create a controller factory that will instantiate the appropriated controller according to what you get in Request.Form; a default controller for regular requests (br...
41,404
<p>I'm looking for a way to query the ink level for my Epson DX 4050 on Mac OS X. There is some UI called EPSON StatusMonitor to display cartridges levels graphically, but I'd like to get it from the command-line so it can feed a robot.</p> <p>Any idea ?</p>
<p>This is going to be an undertaking. Either reverse engineer the StatusMonitor application to find out how it queries the drivers to find the ink level or look for some documentation for it. It may be possible to poke into the StatusMonitor application to find out internal values for its widgets (such a thing is po...
<p>If the printer supports SNMP you might be lucky to query with any SNMP command-line tool. There are standard definitions for printers and they contain APIs to query the current and max ink levels.</p> <p>Here's how I do it with simple unix shell commands (requires net-snmp installed). This is not strictly Mac but y...
40,503
<p>For a long time ago, I have thought that, in java, reversing the domain you own for package naming is silly and awkward.</p> <p>Which do you use for package naming in your projects?</p>
<p>Once you understand why the convention exists, it shouldn't feel silly or awkward in the least.</p> <p>This scheme does two important things:</p> <ul> <li><p>All of your code is contained in packages that no one else will collide with. You own your domain name, so it's isolated. If we didn't have this convention, ma...
<p>Yes, I use the reverse domain for the the start of the package, followed by the other administrative information (projects, departments, etc). The use of the domain minimizes the chance of collisions between vendors/companies/FOSS projects. My "data" package will not collide with another company's data package thank...
22,944
<p>I'm trying to send an email in html format using JavaMail but it always seems to only display as a text email in Outlook. </p> <p>Here is my code:</p> <pre><code>try { Properties props = System.getProperties(); props.put("mail.smtp.host", mailserver); props.put("mail.smtp.from", fromEmail); props....
<p>After a lot of investigation, I've been able to make some significant progress.</p> <p>Firstly, instead of using JavaMail directly, I recommend using the <a href="http://commons.apache.org/email/" rel="noreferrer">Jakarta Commons Email</a> library. This really simplifies the issue a lot!</p> <p>The code is now:</p...
<p>workaroung solution solved outlook 2003: This message uses a character set that is not supported by the Internet Service. doesn't display correctly.</p> <p>It could be due to the encoding. Most html pages use iso-8859-1 not cp-1252 try changing</p> <p>For example, your code is:</p> <pre><code>message.setContent(s...
41,723
<p>In ASP.NET (not MVC), what is the best approach to programmatically setting styles on an unordered list used for navigation so the appropriate menu item is styled as the active item if that page is being viewed? </p> <p>This would most likely be used in conjunction with a MasterPage.</p>
<p>The answer to your question depends a lot on how you have your list implemented {User control or not, etc}. How I would do it, is implement the list to be generated by a user control. </p> <p>I'd have the UserControl tag each element with something like:</p> <pre><code>&lt;{...} class="GeneratedMenuItem"&gt; {......
<p>The way I took this approach was to create ASP.NET Hyperlink Controls for each of my navigation items in my master page.</p> <p>Within the master page, I then created a public method that would assign the appropriate "selected" CSS style to the control I specify:</p> <pre><code>Public Sub SetNavigationPage(ByVal M...
40,000
<p>I'm a Java head mainly, and I want a way to generate a pseudo-random number between 0 and 74. In Java I would use the method:</p> <pre><code>Random.nextInt(74) </code></pre> <p>I'm not interested in a discussion about seeds or true randomness, just how you accomplish the same task in Objective-C. I've scoured Goog...
<p>You should use the <code>arc4random_uniform()</code> function. It uses a superior algorithm to <code>rand</code>. You don't even need to set a seed.</p> <pre><code>#include &lt;stdlib.h&gt; // ... // ... int r = arc4random_uniform(74); </code></pre> <p>The <code>arc4random</code> man page:</p> <blockquote> <pre><...
<p>For game dev use random() to generate randoms. Probably at least 5x faster than using arc4random(). Modulo bias is not an issue, especially for games, when generating randoms using the full range of random(). Be sure to seed first. Call srandomdev() in AppDelegate. Here's some helper functions:</p> <pre><code>stati...
19,442
<p>I frequently come across Windows programs that bundle in MSVCRT (or their more current equivalents) with the program executables. On a typical PC, I would find many copies of the same .DLL's. My understanding is that MSVCRT is the C runtime library, somewhat analogous to glibc/libc.so under *nix.</p> <p>Why do Wi...
<p>[I'm the current maintainer of the Native SxS technology at Microsoft]</p> <p>New versions of MSVCRT are released with new versions of Visual Studio, and reflect changes to the C++ toolset. So that programs compiled with versions of VS released after a particular version of Windows continue can work downlevel (such...
<p>Programs are linked against a specific version of the runtime, and that required version is <em>not</em> guaranteed to exist on the target machine. Also, matching up versions used to be problematic.</p> <p>In the Windows world, it's very bad manners to expect your users to go out and find and install a separate li...
16,386
<p>We are starting a new SOA project with a lot of shared .net assemblies. The code for these assemblies will be stored in SVN.</p> <p>In development phase, we would like to be able to code these assemblies as an entire solution with as little SVN 'friction' as possible. </p> <p>When the project enters more of a ma...
<p>What we did at our company was to set up a <strong>tools</strong> repository, and then a <strong>project</strong> repository. The <strong>tools</strong> repository is a Subversion repository, organized as follows:</p> <pre><code>/svn/tools/ vendor1/ too11/ 1.0/ 1.1/ latest = a copy of ...
<p>What we did with shared assemblies during development phase (in a project which had loads of these), is that we put them on a network share (N Drive) type of a place, and every developer referenced them from there.</p> <p>Our build process would always update this share with the latest versions. This way the actual...
13,281
<p>I currently use <a href="http://subversion.tigris.org/" rel="nofollow noreferrer">subversion</a> for my version control via <a href="http://ankhsvn.open.collab.net/" rel="nofollow noreferrer">AhnkSVN</a> and Visual Studio. I recently started using <a href="http://www.codeplex.com/treesurgeon" rel="nofollow noreferr...
<p>You could use <a href="http://confluence.public.thoughtworks.org/display/CCNET/Welcome+to+CruiseControl.NET" rel="nofollow noreferrer">CruiseControl.Net</a>, which can do a build on every check in, nightly builds, or however you want to do it. A quick google search suggests CC.Net has some <a href="http://ccnet.sou...
<p>You might want to consider CI-Factory. It's a continuous integration environment builder that uses CruiseControl.NET and a dozen other tools. There's an excellent screencast here: <a href="http://www.dnrtv.com/default.aspx?showID=64" rel="nofollow noreferrer">http://www.dnrtv.com/default.aspx?showID=64</a></p>
5,718
<p>We are using a WCF service layer to return images from a repository. Some of the images are color, multi-page, nearly all are TIFF format. We experience slowness - one of many issues.</p> <p>1.) What experiences have you had with returning images via WCF 2.) Do you have any suggestions tips for returning large im...
<p>Okay Just to second the responses by ZombieSheep and Seba Gomez, you should definitely look at streaming your data. By doing so you could seamlessly integrate the GZipStream into the process. On the client side you can reverse the compression process and convert the stream back to your desired image.</p> <p>By usin...
<p>In a previous project I worked we had a similar issue. We had a Web Service in C# that received requests for medias. A media can range from files to images and was stored in a database using BLOB columns. Initially the web method that handled media retrieval requests read the chunk from the BLOB and returned in to t...
23,300
<p>I have a web application (.war) that contains some static files (e.g. MS word documents). When I try to download these files, JBoss automatically sets some HTTP-headers in the response. Is there a way to configure JBoss (version 3.2.7) to set these headers to specific values (or omit them)? I'm especially intereste...
<p><a href="http://www.jboss.org/community/docs/DOC-9578" rel="nofollow noreferrer">Here</a> is a description on the JBoss community wiki on how to disable the Cache-Control behaviour.</p> <p>I wasn't aware of this IE6 feature until now. Does this also apply to IE7?</p>
<p>An option that comes to mind is to wrap a servlet (or similar) around it - so that the URL that gets called calls your servlet, which then sets the headers you want and then delivers the underlying document.</p>
39,723
<p>I have a few sites on a shared host that is running Apache 2. I would like to compress the HTML, CSS and Javascript that is delivered to the browser. The host has disabled mod_deflate and mod_gzip, so these options are out. I do have PHP 5 at my disposal, though, so I could use the gzip component of that.</p> <p>I ...
<p>Sorry about the delay - it's a busy week for me.</p> <p>Assumptions:</p> <ul> <li><code>.htaccess</code> is in the same file as <code>compress.php</code></li> <li>static files to be compressed are in <code>static</code> subdirectory</li> </ul> <p>I started my solution from setting the following directives in .hta...
<p>You can try your luck with <a href="http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html" rel="nofollow noreferrer">mod_rewrite</a>.</p> <p>Create a script that takes a local static file name as input, through e.g. <code>$_SERVER['QUERY_STRING']</code> and outputs it in compressed form. Many providers don't allow ...
7,102
<p>I have a string to tokenize. It's form is <code>HHmmssff</code> where <code>H</code>, <code>m</code>, <code>s</code>, <code>f</code> are digits. </p> <p>It's supposed to be tokenized into four 2-digit numbers, but I need it to also accept short-hand forms, like <code>sff</code> so it interprets it as <code>00000sff...
<p>I keep preaching BNF notation. If you can write down the grammar that defines your problem, you can easily convert it into a Boost.Spirit parser, which will do it for you.</p> <pre><code>TimeString := LongNotation | ShortNotation LongNotation := Hours Minutes Seconds Fractions Hours := digit digit Minutes := dig...
<p>Regular Expressions come to mind. Something like <code>"^0*?(\\d?\\d?)(\\d?\\d?)(\\d?\\d?)(\\d?\\d?)$"</code> with <code>boost::regex</code>. Submatches will provide you with the digit values. Shouldn't be difficult to adopt to your other format with colons between numbers (see sep61.myopenid.com's answer). <code>bo...
36,478
<p>If you look at the following link: <a href="http://www.enewhope.org/index2.php" rel="nofollow noreferrer">What's new at New Hope</a> </p> <p>Look at the widget on the page entitled "What's new at New Hope" which contains the Web2.0 equivalent of a MARQUEE (I guess that's what you'd call it) complete with fading ima...
<p>Why not just look at the code? <a href="http://www.enewhope.org/assets/js/turnstile.js" rel="nofollow noreferrer">http://www.enewhope.org/assets/js/turnstile.js</a></p> <p>It appears to be mostly standard jQuery effects animate calls.</p> <p><a href="http://docs.jquery.com/Effects/animate" rel="nofollow noreferrer...
<p><a href="http://malsup.com/jquery/cycle/" rel="nofollow noreferrer">JQuery Cycle Plugin</a> can do the image part, I don't know about the text stuff.</p>
47,218
<p>Let's say I'm creating a program in C that needs to use a tempfile. Creating an ad hoc tempfile in /tmp is probably not a good idea. Is there a function or OS call to supply me with a tempfile name so that I can begin to write and read from it?</p>
<p>You can use the <a href="http://www.linuxmanpages.com/man3/mkstemp.3.php" rel="noreferrer"><code>mkstemp(3)</code></a> function for this purpose. Another alternative is the <a href="http://www.linuxmanpages.com/man3/tmpfile.3.php" rel="noreferrer"><code>tmpfile(3)</code></a> function. Which one of them you choose de...
<p>You should use the mkstemp() as this is the recommended function, but it returns a file descriptor, so once you have the descriptor get it's name:</p> <pre><code>int fd; fd = mkstemp("hdrXXXXXX); /* Read out the link to our file descriptor. */ sprintf(path, "/proc/self/fd/%d", fd); memset(result, 0, sizeof(result))...
4,932
<p>I'm teaching Java EE at the university, and this was a question a student asked. I said "no", but I wasn't really sure, so I thought I might ask you mighty developers. :)</p> <p>Basically, what I'd like to do is to use entities if they were in my context: cat getters, setters, etc, so like normal POJOs. if I use an...
<p>In a basic modern world Java EE application, it is broken into various layers, where you have 4 basic layers </p> <pre><code>+--------------------+ | Presentation | +--------------------+ | Controller/Actions | +--------------------+ | Business Delegate | | (Service) | +--------------------+ | Data...
<p>One alternative is <a href="http://www.springframework.org/" rel="nofollow noreferrer">the Spring Framework</a>. Spring provides its own support for binding entity objects to the view and handles the getting/setting for you once it is wired up. There are many Spring modules to pick and choose from. Spring MVC and...
37,894
<p>I am trying to coordinate the move of a site from its current server to a new one. My original plan was to migrate the data to the new machine, which is already in place and the migration scripts tested successfully. I was planning to configure the original machine to proxy all requests to the new one, in order to e...
<p>There is nothing wrong with your original plan.</p> <p>It's also a good plan when you don't control the DNS server(s) that you use.</p> <p>[Edit] Also, since this sounds like a production environment, it is never a good idea to try something you are not familiar and comfortable with in a production environment.</p...
<p>You cannot control how long before the records propagate, only how long before you are sure they have propagated.</p> <p>The DNS records' TTL is the <em>maximum</em> time they can be cached; however, even before that time, people will already be hitting the site at the new address (for instance, if their DNS server...
37,623
<p>I have to pass parameters between two rails apps. In one side (sender) I have an array of hashes. I have a code like the following to send the data:</p> <pre><code> http = Net::HTTP.new('localhost', '3030') result = http.post('/processar_lotes', my_array_of_hashes) </code></pre> <p>Some questions</p> <ul> <l...
<p>Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the only way to be sure is to write your own benchmark. Just create a simple for loop, count from 1 to 1000, and read the file inside the loop over and over (but do not create and destroy the objects ...
<p>Considering that these objects can vary per file size, and your computer's specs (bus speed, HD speed) affect this, the only way to be sure is to write your own benchmark. Just create a simple for loop, count from 1 to 1000, and read the file inside the loop over and over (but do not create and destroy the objects ...
33,947
<p>If I've got a time_t value from <code>gettimeofday()</code> or compatible in a Unix environment (e.g., Linux, BSD), is there a compact algorithm available that would be able to tell me the corresponding week number within the month?</p> <p>Ideally the return value would work in similar to the way <code>%W</code> be...
<p>Assuming your first week is week 1:</p> <pre><code>int getWeekOfMonth() { time_t my_time; struct tm *ts; my_time = time(NULL); ts = localtime(&amp;my_time); return ((ts-&gt;tm_mday -1) / 7) + 1; } </code></pre> <p>For 0-index, drop the <code>+1</code> in the return statement.</p>
<p>Consider this pseudo-code, since I am writing it in mostly C syntax but pretending I can borrow functionality from other languages (string->int assignment, string->time conversion). Adapt or expand for your language of choice.</p> <pre><code>int week_num_in_month(time_t timestamp) { int first_weekday_of_month, d...
12,274
<p>I need to monitor number of the facebook group users and display it on the website. I know that it is possible to get User IDs using their API, but they are limited to 500 only (if the total number of members is 500+). </p> <p>What would be the easiest way to get total number of members that signed up to a Facebook...
<p>If you write an http bot, it shouldn't be very hard to scrap, given that real-time performance is not the key.</p>
<p>According to the documentation for <code>Groups.getMembers</code> it isn't possible to get > 500 group members with an API call. Worse, you seem to only be able to get 500 <em>random</em> members.</p> <p>You may want to consider using Facebook Connect with your site instead. I'm no expert on Connect but I believe y...
41,902
<p>I have an element that is similar to a tag (because it has word-wrap: pre;) to display code on a website. The only problem is that the tab size is too large and causes the element to horizontally scroll often because it is of fixed width.</p> <p>Is it possible to change the tab size?</p>
<p>You could replace tabs with spaces. Then you could control exactly the size of the indents.</p>
<p>We need some more clarity into your question, but are you perchance looking for the <code>text-indent</code> css property? You can set the indentation amount, e.g.:</p> <pre><code>&lt;style type="text/css"&gt; p { text-indent: 40px; } &lt;/style&gt; </code></pre>
47,498
<p>I am trying to add a new hello world service to amfphp, I am developing locally</p> <pre><code>&lt;?php /** * First tutorial class */ class HelloWorld { /** * first simple method * @returns a string saying 'Hello World!' */ function sayHello() { return "Hello World!"; } } ?&gt; ...
<p>I recommend <a href="http://www.charlesproxy.com/" rel="nofollow noreferrer">Charles</a> for solving this type of problem, this let's you see what's going across the wire. In your case it's likely something simple as a syntax error in the php file. PHP will output the error information into what the Service Browser ...
<p>You're trying to access a variable/method that's null. The code here is fine so the problem is somewhere else..</p>
12,815
<p>Do you know any solution to put a picture over a Flash?</p> <p>It <strong>must</strong> work in IE6, IE7, Firefox for Windows, MacOSX, Linux and Safari.</p>
<p>Off the top of my head you could try this:</p> <p>Absolute positioned div with the image over the swf </p> <p>You must set swf's parameter "wmode" value as "transparent".</p> <p>You could also go to www.actionscript.org and do a search on their forum.</p>
<p>The wmode=opaque provides better performance than "transparent", with pretty much the same results.</p>
19,685
<p>I'm not sure how password hashing works (will be implementing it later), but need to create database schema now.</p> <p>I'm thinking of limiting passwords to 4-20 characters, but as I understand after encrypting hash string will be of different length.</p> <p>So, how to store these passwords in the database?</p>
<p>Update: Simply using a hash function is not strong enough for storing passwords. You should read <a href="https://stackoverflow.com/a/55753734/20860">the answer from Gilles on this thread</a> for a more detailed explanation.</p> <p>For passwords, use a key-strengthening hash algorithm like Bcrypt or Argon2i. For ex...
<p>for md5 vARCHAR(32) is appropriate. For those using AES better to use varbinary.</p>
30,717
<p>For example, if you type something in upper-right google/yahoo search box in firefox there will be some kind 'suggested auto complete' sort of thing. </p> <p>Another example is in youtube search box and Stackoverflow tags edit box just below this question preview. How do they work? What technology behind 'em?</p>
<p>That's done with the use of AJAX, this site has a nice tutorial on it: <a href="http://www.dynamicajax.com/fr/AJAX_Suggest_Tutorial-.html" rel="nofollow noreferrer">AJAX Suggest Tutorial</a>, and the <a href="https://web.archive.org/web/20170129160828/www.dynamicajax.com/fr/AJAX_Suggest_Tutorial-.html" rel="nofollow...
<p><a href="http://digitarald.de/project/autocompleter/" rel="nofollow noreferrer">Here is one for MooTools</a>.</p>
45,434
<p>In a web-application implemented in java using JSP and Servlets; if I store information in the user session, this information is shared from all the tabs from the same browser. How to differ sessions in the browser-tabs? In this example: </p> <pre><code>&lt;%@page language="java"%&gt; &lt;% String user = request.g...
<p>You can use HTML5 SessionStorage (window.sessionStorage). You will generate a random id and save in session Storage per Browser Tab. Then each browser tab has his own Id. </p> <blockquote> <p>Data stored using sessionStorage do not persist across browser tabs, even if two tabs both contain webpages from the sam...
<p>I've been reading this post because I thought I wanted to do the same thing. I have a similar situation for an application I'm working on. And really it's a matter of testing more than practicality.</p> <p>After reading these answers, especially the one given by Michael Borgwardt, I realized the work flow that need...
48,132
<p>I have seen posts that show three ways to reset the DMV views:</p> <ol> <li>Reset the SQL Service</li> <li>Detatch the database</li> <li>Close the database</li> </ol> <p>All of these methods seem to require taking the system off-line for a few moments. Is there a way to reset the statistics on demand without inte...
<p>You can <a href="http://msdn.microsoft.com/en-us/library/ms189768(SQL.90).aspx" rel="nofollow noreferrer">reset exactly 2 DMVs</a> only (BOL link)</p> <pre><code>sys.dm_os_latch_stats sys.dm_os_wait_stats </code></pre>
<p>As far as I know, these views will only be updated when the instance is restarted.</p> <p>However, for some views you could take a copy of the data before you start measuring and doing a diff afterwards. </p>
38,138
<p>I'm developing a small utility application that needs to detect whether another one has one of its MDI child windows open (it's an off-the-shelf Win32 business application over which I have neither source code nor control). From my app, I would like to be able to poll or detect when a particular MDI Child window is...
<p>You must use native Win32 API.</p> <p><a href="http://www.pinvoke.net/default.aspx/user32/EnumChildWindows.html" rel="noreferrer">EnumChildWindows (user32)</a></p> <p><code></p> <pre><code>[DllImport("user32")] [return: MarshalAs(UnmanagedType.Bool)] public static extern bool EnumChildWindows(IntPtr window, Enum...
<p>You can use P/Invoke to access EnumWindows and EnumChidWindows to itereate through the subwindows/controls of any window.</p>
35,520
<p>Example: I have two shared objects (same should apply to .dlls). The first shared object is from a third-party library, we'll call it libA.so. I have wrapped some of this with JNI and created my own library, libB.so. Now libB depends on libA.</p> <p>When webstarting, both libraries are places in some webstart worki...
<p>Static compilation proved to be the only way to webstart multiple dependent native libraries.</p>
<p>Are both native libraries packaged into a <em>signed</em> jar which is listed as</p> <pre><code>&lt;nativelib ...&gt; </code></pre> <p>In the JNLP file?</p>
2,664
<p>Can one be simulated by periodicly syncing with GPS and in the meen while working with the accelerometer? I know for example that the N95 accelerometer is invarient to rotation on the Y axis (while beeing face up/down).</p>
<p>The original iPhone and the iPhone 3G use GPS to calculate the heading, however the iPhone 3GS now has a 3-dimensional magnetometer compass in it.</p> <p>This can only be done taking two GPS coordinates (while moving) and determining the direction from point A to B.</p>
<p>Extra info: The IPHONE 1 did not have GPS or compass.</p>
6,431
<p>Rep steps:</p> <ol> <li>create example .NET form application</li> <li>put a TextBox on the form</li> <li>wire a function up to the TextBox's Enter event</li> </ol> <p>When you run this application, the <strong>Control.Enter</strong> event fires when focus first goes to the TextBox. However, if you click away into...
<p>What are you trying to do in the Enter event?</p> <p>I can't find another control-level event that fires in your example program but when my test app does regain focus, the control that last had focus still has it.</p> <p>Interesting question but it needs a little more context.</p>
<p>in this example if you toggle between clicking the textboxes neither the enter or got focus will do as expected, however if you click the child forms instead both will behave as expected.</p> <pre><code> using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; ...
18,787
<p>I have an array with holes that I have to fill with different materials. My question is there is an easy way to fill them directly? I tried array, array draft and it is annoying to adjust them. In Blender, it easy to select the vertices and fill. Maybe it is a stupid question, but I am not really an expert.</p> <p><...
<h1>The problem</h1> <p>FDM printers slice models in STL or OBJ format. Neither of these formats can transmit properties like <em>Materials</em>: they consist <strong>fully</strong> of surface definitions.</p> <h1>But... Multi-Material printing is a thing, yes?</h1> <p>Yes, but Multi-material prints use a simple trick:...
<p>If you are asking for print then it is yes with FDM (fused deposition modeling) with multiple extrusion you can fill with different material easily. But if you are trying to change the material in your digital design then you need to work on every hole in the array, especially with FreeCAD. If you find any, please u...
1,830
<p>I couldn't find any useful information on Microsoft's site, so here is the question: has the compiler in Visual C++ 2008 been improved significantly since the 2005 version? I'm especially looking for better optimization.</p>
<p>Straight from the horses mouth....</p> <blockquote> <p><a href="http://msdn.microsoft.com/en-us/library/bb384632.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/bb384632.aspx</a></p> </blockquote>
<p>In my experience, compiler optimizations rarely improve more than a few percent between versions at most; if you really need more performance, that few percent just isn't going to cut it--you're going to have to get down and dirty in the code if you want more.</p> <p>Remember, compilers are extremely dumb, and can ...
14,532
<p>Can these two SVN clients collaborate? I have my projects checked out with Tortoise, but now I would like to be able to use the SVN functionality (mostly updating and committing) from inside Eclipse. But the Subcipse doesn't see the SVN status of the files checked out by Tortoise.</p> <p>I'm doing similar with Tort...
<p>When you check code out of Subversion to create a "sandbox", the directories all contain meta-data in the .svn directory. Any client you try to use against the "sandbox" will (assuming the client version is not behind the server), read the meta-data and understand the state of the sandbox and how to manage it with ...
<p>Watchout for versions as mentioned before. For example Tortoise (1.8.2) requires Subversion 1.10 at Eclipse side. Update site: <a href="http://subclipse.tigris.org/update_1.10.x" rel="nofollow">http://subclipse.tigris.org/update_1.10.x</a></p>
47,352
<p>How do I implement a Copy menu item in a Windows application written in C#/.NET 2.0?</p> <p>I want to let the user to mark some text in a control and then select the Copy menu item from an Edit menu in the menubar of the application and then do a Paste in for example Excel. </p> <p>What makes my head spin is how t...
<p>With the aid of some heavy pair programming a colleague of mine and I came up with this, feel free to refactor.</p> <p>The code is placed in the main form. The copyToolStripMenuItem_Click method handles the Click event on the Copy menu item in the Edit menu.</p> <pre><code> /// &lt;summary&gt; /// Recursive...
<p>It seems to me that you might be better off breaking this into smaller tasks/questions. You have a few issues you are stuck on from the way it sounds.</p> <p>You have multiple 'child' windows open. Is this an MDI application? When an action is performed on one of those child windows, it should fire an event in that...
8,826
<p>We are currently evaluating different applications that interface with Visual Studio 2008 (C#) and Subversion to do automated builds of our core libraries. We are hoping to have nightly builds performed and either email the list of changes made to each developer or have the latest versions be pushed to each worksta...
<p>Cruise Control.net (ccnet) does everything you are looking for. Its pretty easy to use, just make sure if you are going to run it as a service, you give it an account and don't make it run as network service, that way you can give it rights on intranet boxes and have it do xcopy deploys.</p> <p>It has all kinds of ...
<p>A couple of tidbits about working with cc.net and msbuild. If you are building C/C+= projects, msbuild is, um, unreliable at least with VS 2005 (and perhaps earlier). I have not tested with VS 2008. We found that sometimes msbuild would work properly, sometimes not. In trying to solve the problem, we found vcbui...
7,513
<p>In an Outlook 2003 macro; Is there a way to move a message between folders without changing the ReceivedTime-header?</p> <p>I currently use the method <code>MailItem.Move</code>. But that automatically sets the <code>ReceivedTime</code> property to the current time, which isn't really what I want.</p>
<p>I just tried moving a mailitem from my inbox to the deleted items folder, and it seems to have kept the receivedtime without a problem...</p> <p>You may want to try using the MailItem.copy function and moving the resulting mailitem object, but like I said I'm not seeing the same problem...</p> <p>Hope that helps.....
<p>Do an item.Save() and then do item.Move(), It will stamp current timestamp.</p>
8,305
<p>Ok, I've run across my first StackOverflowError since joining this site, I figured this is a must post :-). My environment is Seam 2.0.1.GA, JBoss 4.2.2.GA and I'm using JSF. I am in the process of converting from a facelets view to JSP to take advantage of some existing JSP tags used on our existing site. I ch...
<p>I was able to figure out this problem. Apparently you can not configure web.xml to have the same param-value of .jsp for Javax.faces.DEFAULT_SUFFIX as the Faces Servlet url-pattern (*.jsp). If you change your url-pattern to <em>.jspx or to /whateverdirnameyouwant/</em> the application starts up with no stack overf...
<p>So, I had a similar error. For me, it was that I had a JSF project and I was messing around with the file extensions. To start with, I had all my web files with extension .jsp. This was working, but then I wanted them to be all .jsf, then after that I went all in on using .xhtml. In the process, my web.xml file ...
11,111
<p>Any suggestion how I can document my Perl code? What do you use and what tools are available to help me?</p> <p>Which module do you use to convert pod to html?</p>
<p>Look inside almost any Perl module and you'll see the <a href="http://perldoc.perl.org/perlpod.html" rel="noreferrer">Plain Old Documentation (POD)</a> format. On <a href="http://search.cpan.org" rel="noreferrer">CPAN Search</a>, when looking at a module you have the option of viewing the raw source, so that's one w...
<p>You might also want to check out <a href="https://rads.stackoverflow.com/amzn/click/com/0596001738" rel="nofollow noreferrer" rel="nofollow noreferrer">Perl Best Practices</a> by Damian Conway. I used some of the tips to clean up a small Perl code base I inherited.</p>
23,155
<p>In my application I keep a LINQ object fetched from the database, and regularly modifies it followed by <code>db.SubmitChanges()</code>.</p> <p>I have read that you are not supposed to keep around the <code>DataContext</code> object for a long time. But if I close my <code>DataContext</code> between modifications, ...
<p>otherwise you could execute a direct SQL query against the database to make the update as quick as possible. </p> <p>Due to concurrency issues the default Linq UPDATE statement is not be most optimal due to excessive compares. take a look in SQL profiler or use the Linq SQL visualizer.</p> <p>//andy</p>
<p>Reloading the row when you want to update it shouldn't be much of a performance hit, and it will guarantee that you are updating the latest version of the row (in case another user/process has modified it since you first opened it).</p> <p>If you know nothing else will be updating the row, then you could probably k...
30,602
<p>I came across a printed <a href="http://www.eiffel.com/general/column/2008/02.html" rel="nofollow noreferrer">article by Bertrand Meyer</a> where he states that tests can be generated from specifications. My development team does nothing like this, but it sounds like a good technique to consider. How are you generat...
<p>This might be a reference to <a href="http://rspec.info/" rel="nofollow noreferrer">RSpec</a>, which is a really clever way of developing tests as a series of requirements. I'm still getting used to it, but it's been very handy in both defining what I need to do and then ensuring I do it.</p>
<p>I would say it depends on your specs. I have yet to work anywhere where the specs were good enough to create full unit tests from specifications - the level of detail just wasn't there. My managers always told us that if we specified to that level they could just ship the specs off to India and get it coded on the...
4,877
<p>Working on implementing TFS throughout our organization. It is easy to integrate with <code>.NET</code> projects and any platform that uses Eclipse or a derivative of Eclipse for editing.<br> What's the best way to use TFS version control with Xcode (now that I find out we need to write some iPhone apps)?</p>
<p>Xcode integration is something that we at <a href="http://www.teamprise.com" rel="noreferrer">Teamprise</a> have been looking into a lot. One of the main problems for us is that Apple does not provide a version control API that we can hook into to add a new version control system to Xcode - for integrated version co...
<p>The biggest problem with this is that Xcode only runs on OS X and TFS client tools only run on Windows. If you're host operating system in OS X and you have a Windows virtual environment running locally (like Parallels or VMFusion) then you could use Team Explorer or the command-line tools to work with the reposito...
9,567
<p>I'm using the <a href="http://docs.jquery.com/UI/Sortables" rel="noreferrer">jQuery UI sortables</a> plugin to allow re-ordering of some list items. Inside each list item, I've got a couple of radio buttons which allow the item to be enabled or disabled.</p> <p>When the item is dragged, both radio buttons get dese...
<p>It may not be exactly what you're looking for, but changing</p> <pre><code>$('#itemlist').sortable(); </code></pre> <p>to</p> <pre><code>$('#itemlist').sortable({placeholder: ".items li"}); </code></pre> <p>keeps the radio button selections.</p>
<p>Is this in Internet Explorer? IE is known to lose the selection of checkboxes and radios when copied/moved.</p> <p><a href="http://webbugtrack.blogspot.com/2007/11/bug-299-setattribute-checked-does-not.html" rel="nofollow noreferrer">http://webbugtrack.blogspot.com/2007/11/bug-299-setattribute-checked-does-not.html...
36,182
<p>Can any body tell me the differences between them?</p>
<p>In the C standard, a standalone implementation doesn't have to provide all of the library functions that a hosted implementation has to provide. The C standard doesn't care about embedded, but vendors of embedded systems usually provide standalone implementations with whatever amount of libraries they're willing to...
<p>C is a only programming language its used in system programming. but embedded C is used to implement the projects like real time applications </p>
28,796
<p>When I browse code in Vim, I need to see opening and closing parenthesis/ brackets, and pressing <kbd>%</kbd> seems unproductive.</p> <p>I tried <code>:set showmatch</code>, but it makes the cursor jump back and forth when you type in a bracket. But what to do if I am browsing already written code?</p>
<pre><code>DoMatchParen </code></pre> <p>in your <code>.vimrc</code> file</p> <p>or</p> <pre><code>:DoMatchParen </code></pre> <p>within vim itself.</p> <p>Edit: This comes from the <a href="http://vimdoc.sourceforge.net/htmldoc/pi_paren.html" rel="noreferrer">pi_paren</a> plugin (which is a standard plugin).</p>
<p>Maybe what you want is this plugin:</p> <p><a href="http://www.vim.org/scripts/script.php?script_id=350" rel="nofollow noreferrer">http://www.vim.org/scripts/script.php?script_id=350</a></p>
28,749
<p>What is Big O notation? Do you use it?</p> <p>I missed this university class I guess :D</p> <p>Does anyone use it and give some real life examples of where they used it?</p> <hr /> <h3>See also:</h3> <p><a href="https://stackoverflow.com/questions/107165/big-o-for-eight-year-olds">Big-O for Eight Year Olds?</a><br /...
<p>One important thing most people forget when talking about Big-O, thus I feel the need to mention that:</p> <p>You cannot use Big-O to compare the <strong>speed</strong> of two algorithms. Big-O only says how much slower an algorithm will get (approximately) if you double the number of items processed, or how much f...
<p>It says how many iterations an algorithm has in the worst case.</p> <p>to search for an item in an list, you can traverse the list until you got the item. In the worst case, the item is in the last place.</p> <p>Lets say there are n items in the list. In the worst case you take n iterations. In the Big O notiation...
16,108
<p>There are many posts on the internet about the ReadDirectoryChangesW API function missing files when there is a lot of file activity. Most blame the speed at which the ReadDirectoryChangesW function loop is called. This is an incorrect assumption. The best explanation I have seen is in the following post, the com...
<p>If the API is unreliable, then a workaround may be your only option. That of course likely involves keeping track of lastmodified and filenames. <s>What this doesn't mean is that you need to poll when looking for changes, rather, you can use the FileSystemWatcher as a means to trigger checking. </s></p> <p>So ...
<p>I met same problem. But, I didn't find a solution that guarantee to get all of events. In several tests, I could know that ReadDirectoryChangesW function should be called again as fast as possible after GetQueuedCompletionStatus function returned. I guess if a processing speed of filesystem is very faster than my ap...
8,147
<p>So, I am using the Linq entity framework. I have 2 entities: <code>Content</code> and <code>Tag</code>. They are in a many-to-many relationship with one another. <code>Content</code> can have many <code>Tags</code> and <code>Tag</code> can have many <code>Contents</code>. So I am trying to write a query to select al...
<p>After reading about the <a href="http://www.albahari.com/nutshell/predicatebuilder.aspx" rel="noreferrer">PredicateBuilder</a>, reading all of the wonderful posts that people sent to me, posting on other sites, and then reading more on <a href="http://blogs.msdn.com/meek/archive/2008/05/02/linq-to-entities-combining...
<p><em>NOTE: please edit the question itself, rather than replying with an answer -- this is not a discussion thread, and they can re-order themselves at any time</em></p> <p>If you're searching for all Contents that are marked with any one of a set of tags:</p> <pre><code>IEnumerable&lt;Tag&gt; otherTags; ... var qu...
13,554
<p>I would like to customize the background (and maybe the border too) of all of the UITableViewCells within my UITableView. So far I have not been able to customize this stuff, so I have a bunch of white background cells which is the default.</p> <p>Is there a way to do this with the iPhone SDK?</p>
<p>You need to set the backgroundColor of the cell's contentView to your color. If you use accessories (such as disclosure arrows, etc), they'll show up as white, so you may need to roll custom versions of those.</p>
<p>If we can override your cell class, you can try this approach</p> <pre class="lang-swift prettyprint-override"><code>override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { super.init(style: style, reuseIdentifier: reuseIdentifier) selectionStyle = .none } override func setSelected(_ sel...
35,623
<p>After becoming somewhat estranged open source, and spending some years developing web applications in <a href="https://en.wikipedia.org/wiki/ASP.NET" rel="nofollow noreferrer">ASP.NET</a>, I'm going to start doing quite a lot of PHP / MySQL development.</p> <p>I've quite painlessly installed <a href="https://www.wam...
<p>If you can, I'd invest in some kind of Linux, or at least *nix, development environment. For simple applications and websites, your setup is fine, but you will eventually run into subtle differences when you deploy.</p> <p>Here are some things off the top of my head you'll want to watch out for if you stick with you...
<p>No, because pretty much the only thing you can't do on WAMP if you target LAMP is using <a href="http://fr.php.net/manual/en/function.system.php" rel="nofollow noreferrer">System()</a>/<a href="http://fr.php.net/manual/en/book.exec.php" rel="nofollow noreferrer">Exec</a> Calls, and <strong>usually</strong> that is a...
28,163
<p>We need to regularly synchronize many dozens of binary files (project executables and DLLs) between many developers at several different locations, so that every developer has an up to date environment to build and test at. Due to nature of the project, updates must be done often and on-demand (overnight updates are...
<p>I'd probably take a look at rsync.</p> <p>Just create a .CMD file that contains the call to rsync with all the correct parameters and let people call that. rsync is very smart in deciding what part of files need to be transferred, so it'll be very fast even when large files are involved.</p> <p>What rsync doesn't ...
<p>Building the project should be a centralized process in order to allow for better control soon your solution will be caos in the long run. Anyway here is what I'd do.</p> <ul> <li>Create the usual repositories for source files, resources, documentation, etc for each project.</li> <li>Create a repository for resourc...
8,288
<p>Where do you draw the line to stop making abstractions and to start writing sane code? There are tons of examples of 'enterprise code' such as the dozen-file "FizzBuzz" program... even something simple such as an RTS game can have something like:</p> <pre><code>class Player {} ;/// contains Weapons class Weapons{} ...
<ol> <li><strong>YAGNI (You Ain't Gotta Need It).</strong> Don't create abstractions you don't see immediate use for or a sensible reason. This way you have a simple thing that may become more complex, instead of a complicated things that you would strive to make simpler, but lose.</li> <li>Make sure the abstractions m...
<p>I believe that the criteria may be deduced from a clear definition of what abstraction is.</p> <p>You are referring to abstraction within the Object-Oriented programing paradigm, where you have at your disposal the three principles: <a href="https://stackoverflow.com/questions/99688">'abstraction' - 'encapsulation'...
26,575
<p>Ok, this is a bit of a cheeky question. I want to build a simple text editor (using my own text mode screen handling). I just want a good example of data structures that can be used to represent the text buffer, and some simple examples of char/text insertion/deletion. I can handle all the rest of the code myself (f...
<p>I used to work for a company whose main product was a text editor. While I mainly worked on the scripting language for it, the internal design of the editor itself was naturally a major topic of discussion.</p> <p>It seemed like it broke down into two general trains of thought. One was that you stored each line b...
<p>Check out vim, it's open-source. Poke around in it to see how it handles what you want.</p>
18,635
<p>I remember reading in some Java book about any operator other than 'instanceof' for comparing the type hierarchy between two objects.</p> <p>instanceof is the most used and common. I am not able to recall clearly whether there is indeed another way of doing that or not.</p>
<p>Yes, there is. Is not an operator but a method on the Class class.</p> <p>Here it is: <a href="http://java.sun.com/javase/6/docs/api/java/lang/Class.html#isInstance(java.lang.Object)" rel="nofollow noreferrer">isIntance(Object o ) </a></p> <p>Quote from the doc:</p> <blockquote> <p><em>...This method is the dyn...
<pre><code>if ( someClass.isAssignableFrom( obj.getClass() ) ) </code></pre> <p>is equivalent to</p> <pre><code>if ( obj instanceof Foo ) </code></pre> <p>Use <code>instanceof</code> if the class to be checked against is known at compile time, use <code>isAssignableFrom</code> if it is only known at runtime.</p>
49,354
<p>I'm looking for best practices to integrate log4net to SharePoint for web request, feature activation and all timer stuff. </p> <p>I have several subprojects in my farm, and I would like to have only one Log4Net.config file.</p> <p><strong>[Edit]</strong><br> Not only I need to configure log4net for the web appli...
<p>I implemented this recently and came up with a solution that worked for me.</p> <p>Deploy your log4net config file to the 12 hive and the log4net dll into the GAC using a globally scoped solution. Then in your application code explicitly initialize log4net from the location of your global file. This allows you to l...
<p>You could release the config file as part of the solution package(s) to the 12 hive (use <a href="http://www.codeplex.com/stsdev" rel="nofollow noreferrer">STSDev</a>) to create any packages). This would give you a set location for the config and any changes to it can be released in a controlled manner (i.e. no need...
27,044
<p>After you've let the VS.NET (2008 in this case) wizard upgrade your solution, do you perform any manual steps to upgrade specific properties of your solution and projects? For instance, you have to go to each project and target a new version of the framework (from 2.0 to 3.5 in this case). Even after targeting a new...
<p>All versions of the .Net Framework from 2.0 onwards (i.e. 3.0 and 3.5) use exactly the same core framework files (i.e. the CLR, you'll notice there are no directories relating to 3.0 or 3.5 in the C:\Windows\Microsoft.Net\Framework directory) therefore you shouldn't worry too much about any performance issues.</p> ...
<p>the target framework feature, you'll need to manually add a reference to System.Core.dll to utilise some of the latest features like Linq.</p>
5,001
<p>What's the difference between the inner workings of Java's JVM and .NET's CLR?</p> <p>Perhaps a starting point would be, are they basically the same thing in their respective environments (Java > JVM > Machine code) (C# > CLR > IL).</p> <hr> <p><strong>Update:</strong> Several people have alluded to the points I...
<p>From <a href="http://social.msdn.microsoft.com/forums/en-US/clr/thread/38223155-c07c-472a-8903-6cdaf5f110ea/" rel="nofollow noreferrer">here</a>. I couldn't have said it better (Well, with the exception of a flame war, this is a flameless place :-) ).</p> <blockquote> <p>Hello,</p> <p>Responding to your ques...
<p>There differences in garbage collection as well. JVM uses Copying collector and Mark and sweep. .NET user Copying collector and Mark and compact (Much harder to implement).</p> <p>Also type erasure mentioned by Flyswat is important. JVM doesn't have a clue about generics and everything is object and associated per...
8,367
<p>I have this Python application that gets stuck from time to time and I can't find out where.</p> <p>Is there any way to signal Python interpreter to show you the exact code that's running? </p> <p>Some kind of on-the-fly stacktrace?</p> <p><strong><em>Related questions:</em></strong></p> <ul> <li><a href="https:...
<p>I have module I use for situations like this - where a process will be running for a long time but gets stuck sometimes for unknown and irreproducible reasons. Its a bit hacky, and only works on unix (requires signals):</p> <pre><code>import code, traceback, signal def debug(sig, frame): """Interrupt running ...
<p>At the point where the code is run, you can insert this small snippet to see a nicely formatted printed stack trace. It assumes that you have a folder called <code>logs</code> at your project's root directory.</p> <pre class="lang-py prettyprint-override"><code># DEBUG: START DEBUG --&gt; import traceback with ope...
16,013
<p>I need to achieve the following when opening an HTML in Excel <code>(Response.contentType="application/vnd.ms-excel")</code> :</p> <ul> <li>force Excel to consider content of td cells as numbers</li> <li>make the above so that any subsequent user-entered formulas work on these cells (when the spreadsheet is opened)...
<p>If you add a CSS Class to your page:</p> <pre><code>.num { mso-number-format:General; } .date { mso-number-format:"Short Date"; } </code></pre> <p>And slap those classes on your TD's, does it work?</p> <pre><code>&lt;td class="num"&gt;34&lt;/td&gt; &lt;td class="num"&gt;17.0&lt;/td&gt; &lt;td class="date"&gt;...
<pre><code>mso-number-format:0 NO Decimals mso-number-format:&quot;\#\,\#\#0\.000&quot; 3 Decimals mso-number-format:&quot;mm\/dd\/yy&quot; Thousand comma with 3 decimals mso-number-format:&quot;mmmm\\ d\\\,\\ yyyy&quot; Date7 mso-number-format:&quot;m\/d\/yy\\ h\:mm\\ AM\/PM&quot; Date9 </code></pre> <p>T...
46,181
<p>This sounds really stupid, but I was told that you could drag-and-drop visual components (including JavaScript or AJAX components?) onto a web page view in ASP.NET MVC and then "customize" the components by editing code behind them once they were in place. Either I misunderstood what I was told or I'm blind and don'...
<p>Drag and drop is more suited to standard ASP.NET webforms, not MVC. I think you can still do it in MVC, but only if the controls do not rely on viewstate (which MVC does not support).</p> <p>try Googling on "asp.net mvc user controls"</p>
<p>Even with Webforms, the Design view is pretty useless. It's nowhere near the wysiwyg editor you're envisioning for even a relatively simple website design. While you can technically drag-and-drop components onto the page, they usually bear no resemblance to the rendered html.</p> <p>If you want to design website wi...
38,429
<p>Do you think ASP.NET MVC is able to develop RESTful web services and which approach you would use for it?</p>
<p>I have written a whole series of posts on developing a RESTful <a href="http://shouldersofgiants.co.uk/blog/" rel="noreferrer">Web Service using ASP.Net MVC</a>... well at least I'm 80% of the way through after 8 posts. Have a look at:</p> <p><a href="http://shouldersofgiants.co.uk/blog/" rel="noreferrer">http://sh...
<p>I would seriously look at ADO.NET Dataservices. (formaly code named Astoria) There's some really nice tooling for Restful services in there!</p> <p><a href="http://msdn.microsoft.com/en-us/data/bb931106.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/data/bb931106.aspx</a></p>
27,202
<p>I am actually rendering an excel file in the browser. I use the Response.Writefile(filePath) to dod this. It is working perfectly fine in few of the machines. I am getting a pop up with "Open","Save" and "Cancel" option. </p> <p>But incase of few machines after i do a save click on the popup a plain empty page rema...
<p>Are you setting any HTTP headers? If you are not, you are relying on the browser to interpret the data correctly.</p> <p>To tell the browser you are sending excel content:</p> <pre><code>Response.ContentType = "application/x-excel"; </code></pre> <p>To tell the browser to treat the response as download:</p> <pre...
<p>The problem with this approach is that date fields and number fields are all rendered as a string. The end user has to then explicitly modify the type for these fields if they want to sort them.</p> <p>If you have the budget, I suggest using a component like: <a href="http://www.aspose.com/categories/file-format-co...
47,271
<p>While writing a custom IHttpHandler I came across a behavior that I didn't expect concerning the HttpCachePolicy object.</p> <p>My handler calculates and sets an entity-tag (using the SetETag method on the HttpCachePolicy associated with the current response object). If I set the cache-control to public using the S...
<p>I think you need to use HttpCacheability.ServerAndPrivate</p> <p>That should give you cache-control: private in the headers and let you set an ETag.</p> <p>The documentation on that needs to be a bit better.</p> <p><strong>Edit:</strong> Markus found that you also have call cache.SetOmitVaryStar(true) otherwise t...
<p>If like me you're unhappy with the workaround mentioned here of using Cacheability.ServerAndPrivate, and you really want to use Private instead - perhaps because you are customising pages individually for users and it makes no sense to cache on the server - then at least in .NET 3.5 you can set ETag through Response...
5,282
<p>So WPF doesn't support standard sorting or filtering behavior for views of CompositeCollections, so what would be a best practice for solving this problem. </p> <p>There are two or more object collections of different types. You want to combine them into a single sortable and filterable collection (withing having t...
<p>Change the code for the About box to </p> <pre><code>Me.LabelVersion.Text = String.Format("Version {0}", My.Application.Deployment.CurrentVersion.ToString) </code></pre> <p>Please note that all the other answers are correct for "how do I get my assembly version", not the stated question "how do I show my publish v...
<p>I'm no VB.NET expert, but have you tried to set the value to for example 1.0.0.*? This should increase the revision number (at least it does in the AssemblyInfo.cs in C#).</p>
3,243