instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I have a field in my report that needs to have a length of 40. If the string is not of that length I need to append some space. </p>
<p>Thanks.</p>
| <p>try something along the lines of</p>
<p>if length({yourfieldname here}) < 40
then
{yourfieldnamehere} + space(40 - length({yourfieldnamehere}))
else
{yourfieldnamehere}</p>
| <p>Append 40 blanks to the variable and take the first 40 characters of the resulting string.</p>
<p>Something like </p>
<pre><code>mid( (yourfield + space(40)), 1, 40)
</code></pre>
<p>should work. </p>
| 48,940 |
<p>I experience some lines on my prints. However, I would not really call them "stringing".</p>
<p>I have seen some stringing and it was rather like an undefined spider web.</p>
<p>But the lines that you see in my photo are super straight and fine.</p>
<p>Are they called "stringing" too? And how do ... | <p>They're caused by filament being pulled during travel so they qualify as stringing.</p>
<p>You need to look at your retraction and heat, speed as well makes a difference. You can try combing and other things or just pull them off.</p>
| <p>You should provide a better picture, i.e. a finished print.</p>
<p>Stringing is generally something you don't worry about - adjust your retraction settings a tiny bit to retract more.
I didn't see what software you used, that will help with where the settings are.</p>
<p>Also the plate is very different from the res... | 2,216 |
<p>I would like to provide two different versions of my iPhone app on the App Store -- one free that is limited by the number of items displayed through the application, and another one completely unlimited.</p>
<p>The source code for both apps will be exactly the same, the only difference would be the SQLite database... | <p>Just create a second target in your project. One can be the full featured application, which includes the full database, and the new target will be your demo build, with the demo database. We do this with Crosswords, and it works fine. You can then keep all your source in one place, and not worry about things gettin... | <p>I have explored this and it seems that doing a "download a trial and upgrade it through the web" violates the terms of the app store. It seem you will really need two separate versions of the app in the store. (referencing back to Ben Gottlieb's entry). So one source, two distros.</p>
| 34,621 |
<p>This often comes up: your application has gotten extensive enough that it's time to add some programmability into it to make it flexible. One example might be a finance application - you want to add a formula editor so that you can create your own custom formulas without having to re-compile the code.</p>
<p>You ha... | <p>There are no trades offs -- embed a throughly tested, well documented interpretor. Otherwise, you'll end up with an abomination like MAXScript.</p>
| <p>I would create my own interpreter using an existing parser generator (like ANTLR or Haskell/Scala's parser combinators). It's really not as hard as all that, and for simple languages, it's really quite easy. I create the implementation for a devilishly simple DSL in an afternoon and it ran perfectly the first time... | 41,139 |
<p><strong>Scenario:</strong></p>
<p>(If anyone has answered/viewed my questions recently this will be somewhat familar)</p>
<p>I have 3 different web services which expose a set of objects that have commonality. I've written wrapper classes and conversion logic using generic methods to change between the intermediar... | <p>I think in general, if you want your code to have different type signatures, you'll have to write the code three different times. Since the types are different, it's not "the same code" at all.</p>
<p>You could put what you have into an inherited method and then wrap the results in each subclass.</p>
| <p>I am not sure if it fits to your scenario but reading through your question <a href="http://en.wikipedia.org/wiki/Inversion_of_Control" rel="nofollow noreferrer">Inversion of Control</a> comes me on mind.</p>
| 27,313 |
<p>In Python, is there a portable and simple way to test if an executable program exists?</p>
<p>By simple I mean something like the <code>which</code> command which would be just perfect. I don't want to search PATH manually or something involving trying to execute it with <code>Popen</code> & al and see if it fa... | <p>Easiest way I can think of: </p>
<pre><code>def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
for path in os.env... | <p>So basically you want to find a file in mounted filesystem (not necessarily in PATH directories only) and check if it is executable. This translates to following plan: </p>
<ul>
<li>enumerate all files in locally mounted filesystems</li>
<li>match results with name pattern</li>
<li>for each file found check if it i... | 49,357 |
<p>Does anyone know how to change the color of a row (or row background) in the UIPickerView control from the iPhone SDK? Similiar to the below title for row, however I would also like to change the color of the row:</p>
<pre><code>- (NSString *)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forCompo... | <p>You can return an arbitrary view in the delegate's -pickerView:viewForRow:forComponent:reusingView: method, documented <a href="http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIPickerViewDelegate_Protocol/Reference/UIPickerViewDelegate.html#//apple_ref/occ/intfm/UIPickerViewDelegate/pickerVi... | <p>Do this:</p>
<pre><code>label.backgroundColor = [UIColor yourcolorColor];
</code></pre>
| 40,051 |
<p>How can i get all the class properties and its sub classes with properties from an RDF datasource using SPARQL query given a class name and namespace?</p>
| <p>How about <a href="http://dbpedia.org/snorql/?query=%0D%0ASELECT+%3FsubClass%2C+%3Fpredicate+%0D%0AWHERE+%7B%0D%0A+++%3FsubClass+rdfs%3AsubClassOf+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FWork%3E+.%0D%0A+++%3Fpredicate+rdfs%3Adomain+%3FsubClass%0D%0A%7D" rel="nofollow noreferrer">this</a>: </p>
<pre><code>PREFIX rd... | <p>How about <a href="http://dbpedia.org/snorql/?query=%0D%0ASELECT+%3FsubClass%2C+%3Fpredicate+%0D%0AWHERE+%7B%0D%0A+++%3FsubClass+rdfs%3AsubClassOf+%3Chttp%3A%2F%2Fdbpedia.org%2Fontology%2FWork%3E+.%0D%0A+++%3Fpredicate+rdfs%3Adomain+%3FsubClass%0D%0A%7D" rel="nofollow noreferrer">this</a>: </p>
<pre><code>PREFIX rd... | 49,144 |
<p>I have a table that looks something like this:</p>
<pre>
word big expensive smart fast
dog 9 -10 -20 4
professor 2 4 40 -7
ferrari 7 50 0 48
alaska 10 0 1 0
gnat -3 0 0 0
</pre>
<p>Th... | <p>abs value fartherest from zero:</p>
<pre><code>select max(abs(mycol)) from mytbl
</code></pre>
<p>will be zero if the value is negative:</p>
<pre><code>select n+abs(mycol)
from zzz
where abs(mycol)=(select max(abs(mycol)) from mytbl);
</code></pre>
| <p>Can you use the built-in database aggregate functions like MAX(column)?</p>
| 21,358 |
<p>Hello I have the following error by git-fsck, which cannot be cleaned by git-gc even in --aggressive mode. What can I do next to fix this repository error? </p>
<pre><code>$ git-fsck
bad sha1 file: .git/objects/55/tmp_obj_a07724
</code></pre>
| <p>It's not a simple answer, sadly. But this might help:</p>
<p><a href="http://schacon.github.com/git/user-manual.html#recovering-from-repository-corruption" rel="noreferrer">Recovering from repository corruption</a> (from the Git's user manual).</p>
| <p>From <code>man git-fsck</code>:</p>
<pre><code>Any corrupt objects you will have to find in backups or other archives
(i.e., you can just remove them and do an rsync with some other site in
the hopes that somebody else has the object you have corrupted).
</code></pre>
| 6,055 |
<p>I'm trying to deploy <a href="http://code.google.com/p/elmah/" rel="nofollow noreferrer">elmah</a>. For inexplicable reasons, I'm getting an error: .axd files are explicitly forbidden. I've already fixed what I can control (my web.config) and solutions requiring collaboration from the system admin are <em>not</em>... | <p>The answer is to change the web.config to look like this:</p>
<pre><code><add verb="POST,GET,HEAD" path="elmah.ashx" type="Elmah.ErrorLogPageFactory, Elmah" />
</code></pre>
<p>In fact, some source on the web say, unless you are microsoft you shouldn't name any handlers axd lest you have a name conflict with... | <p>Good to see you got the answer :)</p>
<p>The axd extension is normally used in the cases where only .NET 1.1 or earlier is being used. And the developer does not have access to modify the extensions allowed in IIS 6 or earlier.</p>
<p>In your case, it seems all tracing has been disabled on the server from a higher... | 46,980 |
<p>I have lots and lots of data in various structures. Are there any better platforms other than Excel charts which can help me. </p>
<p>thanks</p>
| <p>What about <a href="http://code.google.com/apis/chart/" rel="nofollow noreferrer">google charts</a>?</p>
| <p>Depends a bit what your objectives are and how technical you are willing to get.</p>
<p><a href="http://incanter.org/" rel="nofollow">Incanter</a> is a great toolset that I can heartily recommend (I use it for visualisation in my own projects). It's a statistical computing and visualisation library for Clojure - wh... | 7,862 |
<p>Below is my $.ajax call, how do I put a selects (multiple) selected values in the data section?</p>
<pre><code>$.ajax({
type: "post",
url: "http://myServer" ,
dataType: "text",
data: {
'service' : 'myService',
'program' : 'myProgram',
'start' : start,
'end' : end ,
... | <p>how about using an array?</p>
<pre><code>data: {
...
'select' : ['value1', 'value2', 'value3'],
...
},
</code></pre>
<p><strong>edit</strong>: ah sorry, here's the code, a few caveats:</p>
<pre><code>'select' : $('#myselectbox').serializeArray(),
</code></pre>
<p>in order for serializeArray() to work... | <p>Thanks to the answer from @Owen, I got this code to work.</p>
<p>For a select box with an id="mySelect" multiple="true"</p>
<pre><code> var mySelections = [];
$('#mySelect option').each(function(i) {
if (this.selected == true) {
mySelections.push(this.value);
}
});
$.aj... | 23,694 |
<p>Lets say on MySQL database (if it matters).</p>
| <p>No, you will not be completely safe. As others have mentioned, parameterized queries are always the way to go -- no matter how you're accessing the database.</p>
<p>It's a bit of an urban legend that with procs you're safe. I think the reason people are under this delusion is because most people assume that you'll ... | <p>No, as you could still use D-SQL in your stored procedures... and validating and restricting your input is a good idea in any case. </p>
| 29,693 |
<p>In the process of updating a web app from ASP to ASP.NET, I want to insert one of the new files into the old app to test something - is this an offence against reason?</p>
| <p>Yes but they will not share the session memory. I have an old ASP website and have replaced the main page with a asp.net page with a masterpage/content page setup. I use asp.net to send emails instead of the old asp/com components.</p>
<p>One work-a-round the session sharing issue is to create a bridge page that do... | <p>Yes.</p>
<p>It's just not a very good way of doing things. But it will work quite well until you'll try to share the session states and so on. Then you'll have to do some extra work.</p>
| 19,579 |
<p>I have an RFID reader connected to an Arduino board. I'd like to connect to it over its serial interface, and whenever the RFID reader omits a signal ( when it has read an (RF)ID ), I'd like to retrieve it in my C++ program.</p>
<p>I already have the code for simply printing the RFID to serial from the Arduino.</p>... | <p>On unix you use the select() call to wait for an input.
The select() call acts like a sleep - using no CPU until the kernel receives the hardware interrupt and triggers the select().</p>
<p><a href="http://tldp.org/HOWTO/Serial-Programming-HOWTO/index.html" rel="noreferrer">http://tldp.org/HOWTO/Serial-Programming-... | <p>Hi I created a Simple library for this: <strong>cArduino</strong>
<a href="https://github.com/ranma1988/cArduino" rel="nofollow">https://github.com/ranma1988/cArduino</a>
C++ can find auto find connect Arduino port, read, write</p>
| 20,420 |
<p>Is it possible to include one CSS file in another?</p>
| <p>Yes:</p>
<pre><code>@import url("base.css");
</code></pre>
<p>Note:</p>
<ul>
<li>The <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@import" rel="noreferrer"><code>@import</code></a> rule <a href="https://drafts.csswg.org/css-cascade-3/#at-import" rel="noreferrer">must precede</a> all other rules (exce... | <p>I stumbled upon this and I just wanted to say PLEASE DON'T USE @IMPORT IN CSS!!!! The import statement is sent to the client and the client does another request. If you want to divide your CSS between various files use Less. In Less the import statement happens on the server and the output is cached and does not cre... | 17,758 |
<p>We just did a move from storing all files locally to a network drive. Problem is that is where my VS projects are also stored now. (No versioning system yet, working on that.) I know I heard of problems with doing this in the past, but never heard of a work-around. Is there a work around?</p>
<p>So my VS is install... | <p>While we do use Source Control, we do also run all our projects from Network Drives (not shared directories, private directories on network drives). The network drives are backed up nightly, and also use Volume Shadow Copy, so if you need to revert to something <em>before</em> it made it's way to SC, then you can.</... | <p>Well, my question would be why you are asking this. Is it not working when you are storing it on a network drive? I haven't tried this myself, and one problem I could envision would be that .NET code running from a network drive (ie. from the bin\Debug directory, also located on the network drive) would be running i... | 19,312 |
<p>I have heard there is a way to cheat single inheritance and implement multiple inheritance in Java. Does anyone know how to implement this(with out using interface)?</p>
<p>Just out of curiosity ;-)</p>
| <p>Sure you can, but it's tricky and you should really consider if that's the way you want to go.<br>
The idea is to use scope-based inheritance coupled with type-based one. Which is type-talk for saying that for internal purposes, inner classes "inherit" methods and fields of the outer class. It's a bit like mixins, w... | <p>Yes you can say that it's a trick and it is very Interesting you cannot inherit multiple classes to a single class but it is possible to implement multiple Interfaces to a class like</p>
<pre><code>public class parents implements first, second{
}
</code></pre>
<p>but remember, you have to override methods declare... | 9,596 |
<p>So I'm in the process of getting GIT sold at work. First thing I need is to convince everyone that GIT is better at what they're already used to doing. We currently use Perforce. Anybody else go through a similar sale? Any good links/advice?</p>
<p>One of the big wins is that we can work with it disconnected from t... | <p>The Perl 5 interpreter source code is currently going through the throes of converting from Perforce to git. Maybe Sam Vilain’s <code>git-p4raw</code> importer is of interest.</p>
<p>In any case, one of the major wins you’re going to have over every centralised VCS and most distributed ones also is raw, bliste... | <p>Using GIT as substitute for bad code line management is common. Many of the disadvantages of Perforce are a result of bad branching strategies. The same for any other centralized tool. If you have to create a ton of branches you are doing something wrong. Why do developers need to create so many branches?</p>
<p>Al... | 27,492 |
<p>I work on a Fedora Linux box.</p>
<p>I have a whole host of binaries and libraries that I've installed locally under my home directory.</p>
<p>I'd like to set my system up so installing software there functions the same way (for me) as if the root user installed it without a prefix.</p>
<p>I can run binaries inst... | <p>Set the <code>LIBRARY_PATH</code> environment variable to <code>$HOME/local/lib:$HOME/local/lib64</code>. You can also set the environment variables <code>C_INCLUDE_PATH</code> and <code>CPLUS_INCLUDE_PATH</code> to find include files in <code>$HOME/local/include</code>. These are environment variables used by GCC t... | <p>As well as setting LD_LIBRARY_PATH, you can also look at /etc/ld.so.conf (which works for all users, even root). Also consider the security of your system if you use /etc/ld.so.conf; if people run the library from your directory, they are trusting you not to mess with them.</p>
| 32,629 |
<p>I have a Java process that opens a file using a FileReader. How can I prevent another (Java) process from opening this file, or at least notify that second process that the file is already opened? Does this automatically make the second process get an exception if the file is open (which solves my problem) or do I h... | <p>FileChannel.lock is probably what you want.</p>
<pre><code>try (
FileInputStream in = new FileInputStream(file);
java.nio.channels.FileLock lock = in.getChannel().lock();
Reader reader = new InputStreamReader(in, charset)
) {
...
}
</code></pre>
<p>(Disclaimer: Code not compiled and certainly not t... | <p>Below is a sample snippet code to lock a file until it's process is done by JVM. </p>
<pre><code> public static void main(String[] args) throws InterruptedException {
File file = new File(FILE_FULL_PATH_NAME);
RandomAccessFile in = null;
try {
in = new RandomAccessFile(file, "rw");
File... | 15,585 |
<p>I've heard a bit about folks using air compressors with tubing to the toolhead and outlet openings there as part cooling. One example is the <a href="https://the-makerhive.myshopify.com/products/berd-air-max" rel="nofollow noreferrer">Berd Air</a>, but from the information I can gather, it works with rather low pres... | <p>I'm an owner of both an FDM printer and a resin one:</p>
<p>I've long searched a resin capable of printing durable objects even in tiny details but with poor luck. I've tried ABS-Like resins, and they provide a slightly better resistance than regular resin but do not expect great improvements; I've tryed the siraya... | <p>I'm an owner of both an FDM printer and a resin one:</p>
<p>I've long searched a resin capable of printing durable objects even in tiny details but with poor luck. I've tried ABS-Like resins, and they provide a slightly better resistance than regular resin but do not expect great improvements; I've tryed the siraya... | 2,014 |
<p>I read something the other day about a guy who found a way to knock over completed prints with the printer head itself, then slide them to the edge of the build plate, where they fall into a box/basket. This allows printing several Eiffel Towers while you sleep for example. It doesn't work with skirts (duh), and the... | <p>You could cool down the heated bed (with e.g. <code>[M109][1] R28</code>) and cool down the hotend (with e.g. <code>[M190][1] R40</code>). This will usually release the print from the plate, perform the actions to move the head (e.g. go to the largest X, Y position <code>G1 X{max} Y{max}</code>, move down <code>G1 Z... | <p>For fun, from Thingiverse - <a href="https://www.thingiverse.com/thing:872617" rel="nofollow noreferrer">Automatic Print Ejector - The Punching Machine</a>. </p>
<p>There's even a video: <a href="https://www.youtube.com/watch?v=Viy928RLsdU" rel="nofollow noreferrer">MatterHackers Punch-Out!</a></p>
<p><sub>Hover ... | 961 |
<p>After two years of C#, I'm now back to VB.net because of my current job. In C#, I can do a short hand testing for null or false value on a string variable like this:</p>
<pre><code>if(!String.IsNullOrEmpty(blah))
{
...code goes here
}
</code></pre>
<p>however I'm a little confused about how to do this in VB.net... | <p>In the context you show, the VB <code>Not</code> keyword is indeed the equivalent of the C# <code>!</code> operator. But note that the VB <code>Not</code> keyword is actually overloaded to represent two C# equivalents:</p>
<ul>
<li>logical negation: <code>!</code></li>
<li>bitwise complement: <code>~</code></li>
</... | <p>Seconded. They work identically. Both reverse the logical meaning of the expression following the !/not operator.</p>
| 35,270 |
<p>Each cell contains some text and a background color. So I have some cells that are blue and some that are red. What function do I use to count the number of red cells?</p>
<p>I have tried <code>=COUNTIF(D3:D9,CELL("color",D3))</code> with no success (Where <code>D3</code> is red).</p>
| <p>Excel has no way of gathering that attribute with it's built-in functions. If you're willing to use some VB, all your color-related questions are answered here:</p>
<p><a href="http://www.cpearson.com/excel/colors.aspx" rel="nofollow noreferrer">http://www.cpearson.com/excel/colors.aspx</a></p>
<p>Example form the... | <p>Yes VBA is the way to go.</p>
<p>But, if you don't need to have a cell with formula that auto-counts/updates the number of cells with a particular colour, an alternative is simply to use the 'Find and Replace' function and format the cell to have the appropriate colour fill.</p>
<p>Hitting 'Find All' will give you... | 7,259 |
<p>I was wondering if there was a simple way to use WMI to get you the current windows user name with domain. The Windows API call just gets you the short username, so you end up doing another call for the domain name. I have some code, but I get an automation error.
Any ideas? I think I'm on the right path, but I am a... | <p>There is no TOP 1 clause in WQL. Leave it out and your query should work:</p>
<pre><code>"SELECT * FROM Win32_Process WHERE Name = 'EXCEL.EXE'"
</code></pre>
| <p>There is no TOP 1 clause in WQL. Leave it out and your query should work:</p>
<pre><code>"SELECT * FROM Win32_Process WHERE Name = 'EXCEL.EXE'"
</code></pre>
| 36,551 |
<p>It seems that most of the installers for Perl are centered around installing Perl modules, not applications. Things like ExtUtils::MakeMaker and Module::Build are very well suited for modules, but require some additional work for Web Apps.</p>
<p>Ideally it would be nice to be able to do the following after checki... | <p>What are your limitations for installing web apps? Can you log into the machine? Are all of the machines running the same thing? Are the people installing the web apps co-workers or random people from the general public? Are the people installing this sysadmins, programmers, web managers, or something else? Do you i... | <p>I'd recommend seriously considering a package system such as RPM to do this. Even if you're running on Windows I'd consider RPM and cygwin to do the installation. You could even set up a yum or apt repository to deliver the packages to remote systems.</p>
<p>If you're looking for a general installer for customers... | 17,335 |
<p>I'm trying to write an iterator for results from a PDO statement but I can't find any way of rewinding to the first row. I would like to avoid the overhead of calling fetchAll and storing all the result data.</p>
<pre><code>// first loop works fine
foreach($statement as $result) {
// do something with result
}
... | <p>I'm pretty sure this is database dependent. Because of that, it is something you should try to avoid. However, I think you can achieve what you want by enabling <a href="http://www.php.net/pdo-mysql#pdo-mysql.constants" rel="noreferrer">buffered queries</a>. If that doesn't work, you can always pull the result into ... | <p>You'll probably want to take a look at some of the PHP SPL classes that can be extended to provide array-like access to objects. </p>
<ul>
<li><a href="http://us.php.net/spl" rel="nofollow noreferrer">Standard PHP Library (SPL)</a> I would specifically
recommend that you look at the
ArrayIterator, ArrayObject, and
... | 35,132 |
<p>I notice that Rails 2.2 (currently edge) supports <a href="http://rails.lighthouseapp.com/projects/8994/tickets/1046-http-only-cookies-in-cookiestore" rel="nofollow noreferrer">setting HttpOnly on the session cookie</a>.</p>
<p>Is there a way of setting it on a Rails 2.1 application without moving to edge/2.2?</p>
| <p>I have <a href="http://gist.github.com/14086" rel="nofollow noreferrer">written a monkey patch</a> to add this support to Rails 2.1, from the patch for Rails 2.2.</p>
<p>I've not tested on anything other than Rails 2.1, and your mileage may vary!</p>
| <p>Set the <code>http_only</code> option to true in the cookie's options hash:</p>
<pre><code>cookies['visits'] = { :value => '20', :http_only => true }
</code></pre>
| 18,526 |
<p>I have a set of templates for emails that my app sends out. The templates have codes embedded in them that correspond to properties of my business object. </p>
<p>Is there a more elegant way than calling </p>
<pre><code>string.Replace("{!MyProperty!}", item.MyProperty.ToString())
</code></pre>
<p>a zillion times... | <p>First of all, when I do this I use StringBuilder.Replace() as I have found that its performance is much better suited when working with 3 or more replacements.</p>
<p>Of course there are other ways of doing it, but I've found that it is not usually worth the extra effort to try other items.</p>
<p>You might be abl... | <p>After looking at the examples previously included, I thought I'd look at the real code.
@mark-brackett You were closer than you knew.</p>
<pre><code>//The guts of MailDefinition.CreateMailMessage
//from https://github.com/Microsoft/referencesource/blob/master/System.Web/UI/WebControls/MailDefinition.cs
if (replace... | 29,819 |
<p>When I cut (kill) text in Emacs 22.1.1 (in its own window on X, in KDE, on Kubuntu), I can't paste (yank) it in any other application.</p>
| <p>Insert the following into your <code>.emacs</code> file:</p>
<pre><code>(setq x-select-enable-clipboard t)
</code></pre>
| <p>What I do is to use a good terminal tool (PuTTY on Windows, Konsole or Terminal on Linux) that has copy facilities built-in.</p>
<p>In PuTTY, you highlight the text you want with the mouse and then paste it elsewhere. Right-clicking in a PuTTY window pastes the contents of the Windows copy/paste buffer.</p>
<p>In ... | 8,989 |
<p>I got an HTML with the <code><body onload="window.print()"></code>. </p>
<p>The question I'm trying to ask is:</p>
<ul>
<li>Is there any way to remove the strings that the web browsers add to the printed page?</li>
<li>Such as:
<ul>
<li>Web site from where the page was printed</li>
<li>Page count</li>
<li>T... | <p>Google Docs is now <a href="http://docs.google.com/support/bin/answer.py?hl=en&answer=50089">skirting around</a> this issue by generating a PDF version of your document.</p>
<p>If you are using Chrome, it will automatically open the PDF in a new tab and pop up the print dialog. Other browsers will prompt you to... | <p>Use this css code</p>
<pre><code>@page {
margin-top: 0cm;
margin-bottom : 0cm;
}
</code></pre>
| 31,885 |
<p>Is there a way?</p>
<p>I need all types that implement a specific interface to have a parameterless constructor, can it be done?</p>
<p>I am developing the base code for other developers in my company to use in a specific project.</p>
<p>There's a proccess which will create instances of types (in different thread... | <p>Not to be too blunt, but you've misunderstood the purpose of interfaces.</p>
<p>An interface means that several people can implement it in their own classes, and then pass instances of those classes to other classes to be used. Creation creates an unnecessary strong coupling.</p>
<p>It sounds like you really need ... | <p>I don't think so. </p>
<p>You also can't use an abstract class for this.</p>
| 4,657 |
<p>Where can I find the option to switch between the Windows Working Set in Eclipse 3.4 (Ganymede)? In the previous version it was under then Window menu, but it appears to have moved.</p>
| <p>You still have it under 'Windows' menu. </p>
<p>Windows/Working Sets/[your different working sets]</p>
<p>You select the different working sets you want to be displayed in the package explorer. So it is not exactly a "switch" anymore, rather a filter.</p>
| <p>I neglected to read the slashnick's comment:</p>
<p>Correct, although I had to customize the perspective to show it (window > customize perspective) – slashnick (Oct 28 at 9:26)</p>
<p>Window > customize perspective
commands tab.
check window working set in available command groups section</p>
| 29,739 |
<p>Theres is a little problem I want to solve with Haskell:
let substitute a function that change all of the wildcards in a string for one concrete parameter. The function has de signature of:</p>
<pre><code>subs :: String -> String -> String -> String
-- example:
-- subs 'x' "x^3 + x + sin(x)" "6.2" will gen... | <p>You could use the <a href="http://hackage.haskell.org/package/regex-compat-0.95.1" rel="nofollow noreferrer">Text.Regex</a> package.</p>
<p>Your example might look something like this:</p>
<pre><code>import Text.Regex(mkRegex, subRegex)
subs :: String -> String -> String -> String
subs wildcard input val... | <p>Use regular expressions (<code>Text.Regex.Posix</code>) and search-replace for <code>/\Wx\W/</code> (Perl notation). Simply replacing <code>x</code> to <code>6.2</code> will bring you trouble with <code>x + quux</code>.</p>
<p><a href="http://lukeplant.me.uk/blog.php?id=1107301690" rel="nofollow noreferrer">Haskel... | 9,029 |
<p>I have a two tables joined with a join table - this is just pseudo code:</p>
<pre><code>Library
Book
LibraryBooks
</code></pre>
<p>What I need to do is if i have the id of a library, i want to get all the libraries that all the books that this library has are in.</p>
<p>So if i have Library 1, and Library 1 has b... | <pre><code>l = Library.find(:all, :include => :books)
l.books.map { |b| b.library_ids }.flatten.uniq
</code></pre>
<p>Note that <code>map(&:library_ids)</code> is slower than <code>map { |b| b.library_ids }</code> in Ruby 1.8.6, and faster in 1.9.0.</p>
<p>I should also mention that if you used <code>:joins</c... | <p>Perhaps:</p>
<pre><code>l.books.map {|b| b.libraries}
</code></pre>
<p>or</p>
<pre><code>l.books.map {|b| b.libraries}.flatten.uniq
</code></pre>
<p>if you want it all in a flat array.</p>
<p>Of course, you should really define this as a method on Library, so as to uphold the noble cause of encapsulation.</p>
| 10,504 |
<p>I'm looking for feedback on peoples experiences with developing sites that work across browsers. It seems to me there are at least two obvious ways to approach the task of making your site/webapp work across browser:</p>
<ol>
<li>Constantly test across all supported browsers every step of the way; or</li>
<li>Pick... | <p>I’ve found that if you get too deep into developing a website without looking at other browsers you’ll quickly get to a place that is too much of a headache to debug. I consistently open my web pages in all the browsers I care about. </p>
<p>I strongly suggest you verify all browsers each time you make a large chan... | <p>Depends mostly on your experience, which could be applied to any programming activity including this one. If you know in advance what likely pitfalls you're going to have to avoid (eg. in cross-browser development, don't make it hard on yourself by trying to do something that is going to be a hassle in a different b... | 28,692 |
<p>EDIT: I found out that I can get it to compile if I cast the IMetadataType object to the TMetadata type. Why do I need to do this?</p>
<p>EDIT #2: The "Values" property is a .NET dictionary of type <TMetadata, TData>.</p>
<p>I have this generic method:</p>
<pre><code>private void FillMetadata<TMetadat... | <p>First, try with boost::signal anyway. Don't assume it will not be fast enough until you try in your specific case that is your application</p>
<p>If it's not efficient enough, maybe something like <a href="http://www.codeproject.com/KB/cpp/FastDelegate.aspx" rel="nofollow noreferrer">FastDelegate</a> will suit your... | <p>An another option can be <a href="https://github.com/yigityuce/YSignalSlot" rel="nofollow">YSignalSlot</a>. I used it. I think it is pretty good.</p>
| 46,968 |
<p>What all would be the requirements for the following scenario:</p>
<blockquote>
<p>A GSM modem connected to a PC running
a web based (ASP.NET) application. In
the application the user selects a
phone number from a list of phone nos.
When he clicks on a button named the
PC should call the selected phone
... | <p>I'll pick some points of your very broad question and answer them. Note that there are other points where others may be of more help...</p>
<p>First, a GSM modem is probably not the way you'd want to go as they usually don't allow for concurrency. So unless you just want one user at the time to use your service, yo... | <p>You'll need a GSM library. There appear to be a few of these.<br>
e.g. <a href="http://www.wirelessdevstudio.com/eng/" rel="nofollow noreferrer">http://www.wirelessdevstudio.com/eng/</a></p>
| 7,196 |
<p>I'm looking for a good way to perform multi-row inserts into an Oracle 9 database. The following works in MySQL but doesn't seem to be supported in Oracle.</p>
<pre><code>INSERT INTO TMP_DIM_EXCH_RT
(EXCH_WH_KEY,
EXCH_NAT_KEY,
EXCH_DATE, EXCH_RATE,
FROM_CURCY_CD,
TO_CURCY_CD,
EXCH_EFF_DATE,
EXCH_EFF_E... | <p>This works in Oracle:</p>
<pre><code>insert into pager (PAG_ID,PAG_PARENT,PAG_NAME,PAG_ACTIVE)
select 8000,0,'Multi 8000',1 from dual
union all select 8001,0,'Multi 8001',1 from dual
</code></pre>
<p>The thing to remember here is to use the <code>from dual</code> statement.</p>
| <p>Cursors may also be used, although it is inefficient.
The following stackoverflow post discusses the usage of cursors :</p>
<p><a href="https://stackoverflow.com/questions/11921889/insert-and-update-a-record-using-cursors-in-oracle">INSERT and UPDATE a record using cursors in oracle</a></p>
| 6,068 |
<p>I'm pretty sure there should be a more Pythonic way of doing this - but I can't think of one: How can I merge a two-dimensional list into a one-dimensional list? Sort of like zip/map but with more than two iterators.</p>
<p>Example - I have the following list:</p>
<pre><code>array = [[1, 2, 3], [4, 5, 6], [7, 8, 9... | <pre><code>[sum(a) for a in zip(*array)]
</code></pre>
| <blockquote>
<p>[sum(a) for a in zip(*array)]</p>
</blockquote>
<p>I like that. I needed something related for interleaving objects in to a list of items, came up with something similar but more concise for even length lists:</p>
<pre><code>sum(zip(*array),())
</code></pre>
<p>for example, interleaving two lists:... | 32,983 |
<p>Around 30% into a large print I had to cancel as the layers of the print were not full layers and looked very stringy. Here's a couple pictures of what it looked like.</p>
<p><a href="https://i.stack.imgur.com/krwhC.jpg" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/krwhC.jpg" alt="enter image descr... | <p>It appears that at a certain point, you're running into issues with the extrusion being a bit too viscous / melted causing it to over-deposit or string (fail to retract completely). It also looks like this issue gradually gets worse as you go. This really feels like nozzle over-heating to me.</p>
<p><a href="https:... | <p>Try using 20 mm/s and 3.9 mm for your retraction and that should help. Also, what is your fan speed at?</p>
| 614 |
<p>Visual Studio 2008 has built-in unittesting that was previously only available in the Team Suite editions. What unittesting framework is this based on? MbUint, MStest, xUnit or something completely different?</p>
| <p>MSTest is included with VS2008, as it was with Dev. edt. and Test edt. in VS2005.</p>
| <p>MSTest is included with VS2008, as it was with Dev. edt. and Test edt. in VS2005.</p>
| 32,647 |
<p>I'm running VS2008's Code Coverage against a unit-tested DLL that I'm developing. For some of the functions it claims that 2 blocks are not covered and 50 or so are. When I view the function with the VS2008 highlighting it can't find the uncovered blocks.</p>
<p>The highlighting appears to work with some functions ... | <p>I've seen some issues where the code coverage analyzer has trouble with closing braces on try/catch blocks. When I see these sorts of things, I just don't worry about it -- as long as I can see that the actual code gets covered.</p>
<p>[EDIT] I'd second the TestDriven.NET recommendation. I like it for the right-c... | <p>I had a situation in which a switch statement that chose a different path for every member of an enumeration didn't have a "default" path. You could spot the not-completely-covered block by the parens of the switch statement not being highlighted.</p>
| 31,341 |
<h3>I am looking for an easily digestible book to present to my boss/team.</h3>
<hr>
<p><strong>Background info:</strong> More and more of our meetings at work involve my boss/team pondering how to implement more "best practices" around here. ("Here" = a very small application development shop. 4 developers)</p>
<... | <p>To throw another Pragmatic Programmers title in the mix: <a href="http://pragprog.com/titles/prj/ship-it" rel="nofollow noreferrer">Ship It!</a></p>
<p>Great book - take a look, might suit your needs with management.</p>
| <p>my favorite is <a href="https://rads.stackoverflow.com/amzn/click/com/0201710919" rel="nofollow noreferrer" rel="nofollow noreferrer">Planning Extreme Programming</a></p>
<p>EDIT: it provides a complete replacement for traditional project management geared towards an XP/Agile team</p>
<p>the danger is, adopting mo... | 22,252 |
<p>Is it possible to return an XElement from a webservice (in C#/asp.net)?</p>
<p>Try a simple web service that returns an XElement:</p>
<pre><code>[WebMethod]
public XElement DoItXElement()
{
XElement xe = new XElement("hello",
new XElement("message", "Hello World")
);
return xe;
}
</code></pre>
<p>T... | <p>There appears to be an issue with how an XElement is serialized, check <a href="http://www.developersdex.com/csharp/message.asp?p=1111&r=6149937" rel="noreferrer">here</a>...</p>
<p>You can try outing the XElement as a string or as the article suggests you could just use a class wrapper and place your XElement ... | <p>Strangely enough, it seems that this only happens if you are trying to look at the "Discovery" part of the service - You can run the method without a problem... </p>
| 45,505 |
<p>I have a popup window containing a form which gathers data for a report.
When I click submit in that window, I want it to close the popup, and open the report in the original window that called the popup.</p>
<p>I think I can open the report in the correct window by using</p>
<pre><code>{ :target => <name of... | <p><code>:target =></code> adds the html attribute target to the link. This opens up a new window and names the new window the target.</p>
<p>You have to use javascript or Ajax to redirect the old page,</p>
<pre><code>window.opener.location.href="http://new_url";
</code></pre>
<p>and then close the old window.</... | <p>How is <a href="http://railsforum.com/viewtopic.php?id=17785" rel="nofollow noreferrer">this</a> for starters?</p>
<pre><code># The submit button in your child window's view:
<%= button_to_function 'Save', "$('my_form').submit(); window.opener.location.reload(); window.close();" %>
</code></pre>
| 5,669 |
<p>After returning to an old Rails project I found none of the destroy/delete links worked and clicking cancel on the confirmation popup would still submit the link.</p>
<p>Example of my code is:</p>
<pre><code><%= link_to 'Delete', admin_user_path(@user), :confirm => 'Are you sure?', :method => :delete %>... | <p>This problem occurs if you are using jQuery, and if not, then look for something like that:</p>
<p>In my case, I was using: </p>
<p>javascript_include_tag :all %></p>
<p>And it was not working, but when I put it like:</p>
<p>javascript_include_tag :defaults %></p>
<p>It worked!</p>
| <p>Chris, Hi. I had the same problem. I deleted Firebug and the problem persisted. I read from another user that he needed to restart Firefox, that didn't work either. Some said try Safari, that didn't work either. </p>
<p>In the end it was a novice thing:</p>
<p>I have helpers to insert an icon, like edit_icon, whic... | 46,296 |
<p>Let me set the stage here. I'm a very junior developer who's recently made the transition from Network Admin who does some WinForms for his employer to a full-time development position working on an ASP.NET product that will be transitioning to Silverlight. I have precious little web development experiences. Some b... | <p>My advice:</p>
<p>Don't make a website from scratch. Use a content management system such as DotNetNuke or Drupal to do it. Find a provider that will host these platforms and learn it. Don't reinvent the wheel.</p>
| <p>There's this recommendation that is valid for anyone learning anything new: keep it simple. In the case of web development, I would certainly vote against Silverlight, for a number of reasons. </p>
<p>The first one you have already mentioned, it is very Google-unfriendly.</p>
<p>The second one is that it is not an... | 48,604 |
<p>I was wondering; which logging libraries for Delphi do you prefer?</p>
<ul>
<li><a href="http://www.raize.com/devtools/codesite/" rel="noreferrer">CodeSite</a></li>
<li><a href="http://www.gurock.com/products/smartinspect/" rel="noreferrer">SmartInspect</a></li>
<li><a href="http://log4delphi.sourceforge.net/" rel=... | <p>I've used Codesite and it has been fantastic. On one project, a word-processor, I could easily output a million debug lines, all structured, and Codesite helped greatly with its auto-collapsing indented output. For any task where you have to know what really is happening "underneath" a process that can't be interrup... | <p>I am looking into Codesite as well. I built my own in the past but I really like the featrues in Codesite. The Raize componenets are very well written and always quality stuff.</p>
| 9,859 |
<p>I'm trying to build a shared library (DLL) on Windows, using MSVC 6 (retro!) and I have a peculiar link issue I need to resolve. My shared library must access some global state, controlled by the loading application.</p>
<p>Broadly, what I have is this:</p>
<p>application.c:</p>
<pre><code>static int g_private_v... | <p>This is actually going to be pretty difficult to get working. On Unix/Linux you can have shared objects and applications import symbols from each other, but on Windows you can't have a DLL import symbols from the application that loads it: the Windows PE executable format just doesn't support that idiom.</p>
<p>I k... | <p>I'll start with half of the answer.</p>
<p>In shared_library.c:</p>
<pre><code>__declspec(dllexport) int __stdcall shared_library_method(void)
{
}
</code></pre>
<p>The <a href="http://msdn.microsoft.com/en-us/library/z4zxe9k8(VS.80).aspx" rel="nofollow noreferrer">MSDN article</a> about exporting function from ... | 30,739 |
<p>I'm a huge fan of robocopy and use it extensively to copy between various servers I need to update.</p>
<p>Lately I've been archiving to an Amazon S3 account that I access via a mapped drive using JungleDisk. I then robocopy my files from local PC to S3.</p>
<p>Sometimes I get a very strange 'Incorrect function' ... | <p>Don't know if you're allowed to answer your own questions but I think I've fixed it...</p>
<p>I found this in the <a href="http://forum.jungledisk.com/viewtopic.php?t=14039&highlight=invalid+msdos+function" rel="nofollow noreferrer">jungledisk support forums</a></p>
<blockquote>
<p>The quick solution is to z... | <p>I've had similar issues from both OSX and linux. At first I was not concerned by it but then it occurred to me these issues could result in potential data contamination or backup failure. So I have abandon JungleDisk for everything except my lightweight work.</p>
<p>Zipping/taring files was not an option for me b... | 25,175 |
<p>I am trying to paginate the results of an SQL query for use on a web page. The language and the database backend are PHP and SQLite.</p>
<p>The code I'm using works something like this (page numbering starts at 0)</p>
<p><a href="http://example.com/table?page=0" rel="nofollow noreferrer">http://example.com/table?... | <p>i'd suggest just doing the count first. a count(primary key) is a very efficient query.</p>
| <p>I doubt that it will be a problem for your users to wait for the backend to return ten rows. (You can make it up to them by being good at specifying image dimensions, make the webserver negotiate compressed data transfers when possible, etc.)</p>
<p>I don't think that it will be very useful for you to do a count(*)... | 7,601 |
<p>I am looking for a tool that can serialize and/or transform SQL Result Sets into XML. Getting dumbed down XML generation from SQL result sets is simple and trivial, but that's not what I need.</p>
<p>The solution has to be database neutral, and accepts only regular SQL query results (no db xml support used). A part... | <p>With SQL Server you really should consider using the <em>FOR XML</em> construct in the query. </p>
<p>If you're using .Net, just use a DataAdapter to fill a dataset. Once it's in a dataset, just use its .WriteXML() method. That breaks your DB->object->XML rule, but it's really how things are done. You might be a... | <p>dbunit (www.dbunit.org) does go from sql to xml and vice versa; you might be able to modify it more for your needs.</p>
| 11,242 |
<p>I've noticed that when you create a web service object (inheriting from SoapHttpClientProtocol) and you use the Async method, it makes the callback on the Windows GUI thread.</p>
<ol>
<li>Does anyone know how this works?</li>
<li>How can I achieve the same thing.</li>
</ol>
<p>I figure this will save me having to ... | <p>I suspect it uses <a href="http://msdn.microsoft.com/en-us/library/system.componentmodel.asyncoperationmanager.synchronizationcontext.aspx" rel="nofollow noreferrer">AsyncOperationmanager.SynchronizationContext</a> to statically get a synchronization context. This then allows you to post callbacks appropriately.</p>... | <p>You can create a WindowsFormsSynchronizationContext object in the main thread and then, on a different thread, call its Send method.</p>
| 27,264 |
<p>I'm building a toy database in C# to learn more about compiler, optimizer, and indexing technology.</p>
<p>I want to maintain maximum parallelism between (at least read) requests for bringing pages into the buffer pool, but I am confused about how best to accomplish this in .NET.</p>
<p>Here are some options and the... | <p>I'm not sure I see why option 1 wouldn't work for you. Keep in mind that you can't have two different threads trying to use the same FileStream at the same time - doing so will definitely cause you problems. BeginRead/EndRead is meant to let your code continue executing while the potentially expensive IO operation t... | <p>Use approach #1, <em>but</em></p>
<ol>
<li><p>When a request comes in, take lock A. Use it to protect a queue of pending read requests. Add it to the queue and return some new async result. If this results in the first addition to the queue, call step 2 before returning. Release lock A before returning.</p></li>
<l... | 11,463 |
<p>I run a site using the <a href="http://modxcms.com/" rel="nofollow noreferrer">MODx</a> Content Management System. What I'd like to do is set up a news feed on the front page, with a blog-style backend that supports the usual things (tags, categories, archives basically).</p>
<p>I've looked into the MODx plugins wh... | <blockquote>
<p><strong><a href="http://chyrp.net/" rel="nofollow noreferrer">Chyrp</a></strong> seems like an interestng option: clean, lightweight php/mysql/a dash of ajax (John Gruber <a href="http://daringfireball.net/linked/2008/february#wed-06-chyrp" rel="nofollow noreferrer">made note of it</a> earlier this ye... | <blockquote>
<p><strong><a href="http://chyrp.net/" rel="nofollow noreferrer">Chyrp</a></strong> seems like an interestng option: clean, lightweight php/mysql/a dash of ajax (John Gruber <a href="http://daringfireball.net/linked/2008/february#wed-06-chyrp" rel="nofollow noreferrer">made note of it</a> earlier this ye... | 27,242 |
<p>I have a VB application which extracts data and creates 3 CSV files (a.csv, b.csv, c.csv). Then I use another Excel spreadsheet (import.xls) to import all the data from the above CSV files into this sheet.</p>
<p>import.xls file has a macro which opens the CSV files one by one and copies the data. The problem I am ... | <p>When I run into this problem I usually write out the dates as yyyy-mm-dd which Excel will interpret unambiguously.</p>
| <p>I had a similar problem and solved it like this, essentially it is the 'all of the above' option</p>
<ol>
<li>With <code>format(date,'dd-mmm-yyyy')</code>
convert the date to the 2-3-4 format
e.g.01-aug-2008, no way a computer
mistakes 01-aug for 08-jan :-)</li>
<li>Since copying this in excel
automatically reverts... | 24,933 |
<p>I work at a smallish web agency (3 programmers, 2 project managers), we mostly make sites for marketing campaigns and also some larger sites. Most of our projects are a week, maybe two, in development. The majority of projects are only worked on by a single developer. </p>
<p>Up until now we've been using a spreads... | <p>I would probably try to use something like <a href="http://redmine.org/" rel="nofollow noreferrer">Redmine</a> for that. It is not project management per se, it is more forge-like software but it has time-tracking, fora, documents & files uploading, a lightweight gantt-chart and bug/issue tracker. It is evolvi... | <p>What about RationalPlan?</p>
<p>Single Project Version, Multi Project Version and Free Project Viewer:</p>
<p><a href="http://www.RationalPlan.com" rel="nofollow noreferrer">http://www.RationalPlan.com</a></p>
<p>Ioan Lucian</p>
| 45,485 |
<p>pl give vb code for custom paging and sorting in asp:repeater using stored procedure</p>
| <p>Here is step <a href="https://web.archive.org/web/20210510021915/http://aspnet.4guysfromrolla.com/articles/031506-1.aspx" rel="nofollow noreferrer">one</a> and <a href="https://web.archive.org/web/20211020202742/https://aspnet.4guysfromrolla.com/articles/032206-1.aspx" rel="nofollow noreferrer">two</a> from 4guys th... | <p>You're going to need to give a little bit more information than just that. If you're using ASP.NEt 1.x, the code will be a whole lot different to that for ASP.NET 2.0 or higher. Indeed, what do you mean by 'custom' paging and sorting? You could use VS to create a DataSource that calls the stored procedure and does t... | 31,557 |
<pre><code>if(!eregi("^([0-9a-z_\[\]\*\- ])+$", $subuser))
$form->setError($field, "* Username not alphanumeric");
</code></pre>
<p>Can anybody tell me why it is not allowing characters such as <code>-</code> and <code>*</code>?</p>
<pre><code>if(!eregi("^([0-9a-z])+$", $subuser))
$form->setError($field... | <p>Your regex uses PCRE syntax, so you have to use preg_match() instead of eregi().</p>
<p>Try this code instead:</p>
<pre><code>else if (!preg_match("/^([0-9a-z_\[\]* -])+$/i", $subuser)) {
$form->setError($field, "* Username not alphanumeric");
}
</code></pre>
| <p>even using preg_* functions the pattern needs to be wrapped in nonalphanum delimiters:</p>
<p>"~^([0-9a-z_[]*- ])+$~"</p>
| 29,917 |
<p>The project I'm working on has two type of accounts, "<code>people</code>" and "<code>companies</code>". </p>
<p>I hold a single "<code>users</code>" table with all the accounts and just the basic info needed for login (email, pass, etc), and two other tables "<code>user_profiles</code>" (regular people) and "<code... | <pre><code>select
u.user_id, u.user_type, concat_ws(profile_first_name + profile_last_name) as full_name
from
users u, user_profiles up
where u.key = up.key
and u.user_type = 'user'
union
select
u.user_id, u.user_type, concat_ws(profile_first_name + profile_last_name) as full_name
from
users u, company_profile... | <p>Does the query you already have work? Is it that you're experiencing performance issues from using this approach already?</p>
<p>Unless using the above query is taking way longer than you're expecting it to be or is causing issues in the software calling this information, this might be pre-mature optimization. </p>... | 45,264 |
<p>Our company has multiple domains set up with one website hosted on each of the domains. At this time, each domain has its own authentication which is done via cookies. </p>
<p>When someone logged on to one domain needs to access anything from the other, the user needs to log in again using different credentials on ... | <p>The SSO solution that I've implemented here works as follows:</p>
<ol>
<li>There is a master domain, <code>login.mydomain.example</code> with the script <code>master_login.php</code> that manages the logins.</li>
<li>Each client domain has the script <code>client_login.php</code></li>
<li>All the domains have a shar... | <p>If you use Active Directory you could have each app use AD for authentication, login could then be seamless. </p>
<p>Otherwise, if the applications can talk to each other behind the scenes, you could use sessionids and have one app handling id generation serving all of your other applications.</p>
| 6,628 |
<p>When I am running the following statement:</p>
<pre><code>@filtered = map {s/&nbsp;//g} @outdata;
</code></pre>
<p>it is returning an empty list instead of the filtered list that I expected. What I am trying to do is remove every occurrence of <code>&nbsp;</code> from an array of string (which is an XML f... | <p>Try this:</p>
<pre><code>@filtered = map {s/&nbsp;//g; $_} @outdata;
</code></pre>
<p>The problem is the s operator in perl modifies $_ but actually returns the number of changes it made. So, the extra $_ at the end causes perl to return the modified string for each element of @outdata.</p>
| <p>As a counterpoint to Greg's answer, you could misuse grep:</p>
<pre><code>@filtered = grep {s/&nbsp;//g; 1} @outdata;
</code></pre>
<p><strong>Don't do this.</strong></p>
| 3,319 |
<p>I needed some simple string encryption, so I wrote the following code (with a great deal of "inspiration" from <a href="http://www.codeproject.com/KB/security/DotNetCrypto.aspx" rel="noreferrer">here</a>):</p>
<pre><code> // create and initialize a crypto algorithm
private static SymmetricAlgorithm getAlgori... | <p>Although this have been already answered I think it would be a good idea to explain <strong>why</strong> it is to be expected.</p>
<p>A padding scheme is usually applied because most cryptographic filters are not semantically secure and to prevent some forms of cryptoatacks. For example, usually in RSA the <a href=... | <p>The answer updated by the user "atconway" worked for me.</p>
<p>The problem was not with the padding but the key which was different during encryption and decryption.
The key and iv should be same during encypting and decrypting the same value.</p>
| 3,285 |
<p>I'm not talking about the kind you get in college, but rather implementing progress reports on the Job for developers.</p>
<p>My thoughts in organizing a development team is encouraging and, to some extend, requiring regular progress updates were developers would report on what they did in the last hour or few hour... | <p>Every hour is too frequent. That many interruptions will decrease productivity, and increase developer frustration. I would suggest looking into the Scrum methodology, they have a "daily scrum" meeting, every morning where you update the team on your progress the previous day and planned work for the current day. It... | <p>The scrum methodology handles this pretty well. You have short daily meetings to report progress and obstacles. It allows everyone to be caught up without being bogged down by the minutia. </p>
| 15,018 |
<p>I'm looking for a library in PHP that can create a tree structure from a database (or array of values) with left and right ids. For the result when getting values I am only looking for an array so I can create any type of view. For adding and removing, it would be nice if the library did it all. Even if the library ... | <p><a href="http://ezcomponents.org/docs/tutorials/Tree#database-based-back-ends" rel="nofollow noreferrer">ezComponents Tree</a> library has different backends (tie-ins), that you can choose between. The documentation is pretty good as well.</p>
| <p>This is the code i used to build binary tree and its opeartions in php:</p>
<pre><code> <?php
class Node
{
public $data;
public $leftChild;
public $rightChild;
public function __construct($data)
{
$this->data=$data;
$this->leftChild=null;
$this->rightChild=null;
}
public function dis... | 37,111 |
<p>We have only had activity on 3 questions in the past 2 days. It is recommended that we get 10 new questions per day. This is far below these goals.</p>
<p>What can we do to get more questions?</p>
| <p>I wouldn't worry too much about it. </p>
<p>We're still currently in the private beta stage, and we'll be in this spot for another 9 days. After nearly two weeks of private beta, it's perfectly natural for activity to slow down. </p>
<h2>So what should you do?</h2>
<p>Don't lose out. Make sure that you keep your ... | <p>I agree with Erik. This is something we need to improve on if we want the site to be viable and <a href="https://stackoverflow.blog/2010/10/21/when-will-my-site-graduate/">Graduate from Beta</a>. Our Beta stats on <a href="http://area51.stackexchange.com/proposals/82438?phase=beta">Area51</a> need improvement.</p>... | 15 |
<p>I didn't get the answer to this anywhere. What is the runtime complexity of a Regex match and substitution?</p>
<p>Edit: I work in python. But would like to know in general about most popular languages/tools (java, perl, sed).</p>
| <p>From a purely theoretical stance:</p>
<p>The implementation I am familiar with would be to build a Deterministic Finite Automaton to recognize the regex. This is done in O(2^m), m being the size of the regex, using a standard algorithm. Once this is built, running a string through it is linear in the length of th... | <p>You can trade space for speed by building a nondeterministic finite automaton instead of a DFA. This can be traversed in linear time. Of course, in the worst case this could need O(2^m) space. I'd expect the tradeoff to be worth it.</p>
| 4,180 |
<p>What would be the best way to do an <code>scp</code> or <code>sftp</code> copy in a Unix environment using C?</p>
<p>I'm interested in knowing the best library to use and an example if at all possible. I'm working on a <a href="https://en.wikipedia.org/wiki/Solaris_%28operating_system%29" rel="nofollow noreferrer">S... | <p>Try <a href="http://curl.haxx.se/libcurl/" rel="nofollow noreferrer">Libcurl</a></p>
<blockquote>
<p>libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, > FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TF... | <p>In the past, I've simply called a shell script that contained the file transfer code.</p>
<pre><code>int transferFile()
{
// Declare the transfer command
char transferCommand[50] = "/home/tyler/transferFile.shl";
// Execute the command
return system(transferCommand);
}
</code></pre>
<p>This will re... | 6,422 |
<p>How do you add a new variable to be inserted into a Java code template. How do I add a variable to the list in Window->Preferences->Java->Code Style->Code Templates->Code->New Java Files->Edit->Insert Variable... ?</p>
<p>Currently my new files get created with:</p>
<pre><code>${filecomment}
${package_declaration}... | <p>I'm pretty sure that the list of "variables" is generated by Eclipse and there is no way to add a new template variable.</p>
<p>What do you want <code>${begin_filecomment}</code> and <code>${end_filecomment}</code> to be? Just type the content into the Edit box - there is nothing that says you cannot put static con... | <p>To add on to the conversation, I also wanted to insert a custom variable into a template. My issue was that I wanted to insert a variable from jsp/jstl definition inside the template.</p>
<p>(I.E. <code><c:set var="myVariable" value="${requestScope.variableName}" /></code>)</p>
<p>This apparently caused some... | 45,633 |
<p>I need to accept form data to a WCF-based service. Here's the interface:</p>
<pre><code>[OperationContract]
[WebInvoke(UriTemplate = "lead/inff",
BodyStyle = WebMessageBodyStyle.WrappedRequest)]
int Inff(Stream input);
</code></pre>
<p>Here's the implementation (sample - no error handling and other safeguards... | <p>I remember speaking to you about this at DevLink.</p>
<p>Since you have to support form fields the mechanics of getting those (what you are currently doing) don't change.</p>
<p>Something that might be helpful, especially if you want to reuse your service for new applications that don't require the form fields is ... | <p>You can serialize your form fields with jquery and package it as json request to wcf service.</p>
| 17,735 |
<p>I am trying to write a tool that can compare a database’s schema to the SQL in an install script. Getting the information from the database is pretty straightforward but I am having a little trouble parsing the install scripts. </p>
<p>I have played with a few of the parsers that show up on Google but they seemed... | <p><a href="http://www.sqlparser.com/" rel="nofollow noreferrer">General SQL Parser</a> is decent. You'd probably found it already, but what does it not do for you since you said the SQL is pretty simple?</p>
| <p>SQL Server may be able to do some of this for you. It provides a pretty good dependency tree, which is accessible through the SDK.</p>
| 33,812 |
<p>Does anyone know of a good component for .NET that will allow me to create a menu and .iso for a DVD? For each DVD I have several video files and photos that I'd like to turn into a DVD automatically. </p>
| <p>YMMV, but it is unlikely that you would find a drop-in component that would do this. DVD authoring is a very involved task, and generally only implemented in full software packages that support the whole process end-to-end.</p>
<p>That said, there are some OSS projects out there that do DVD authoring (e.g., dvdauth... | <p><a href="http://www.dmapp.com/index.php?option=com_products&task=view&cid=15&Itemid=43" rel="nofollow noreferrer">RocketDVD Professional</a> may be what I'm looking for.</p>
| 44,974 |
<p>Some of the features I think it must include are:</p>
<ol>
<li>Print Entire Solution</li>
<li>Ability to print line numbers</li>
<li>Proper choice of coding font and size to improve readability</li>
<li>Nice Header Information</li>
<li>Ability to print regions collapsed</li>
</ol>
<p>Couple feature additions:</p>
... | <p>I use <a href="http://submain.com/?nav=products.pcp.net" rel="nofollow noreferrer">PrettyCode.Print for .NET</a>. It does everything on your list, and more. (I use it for printing code excerpts for copyright registration paperwork, which is similar to your escrow case.)</p>
<p>It is a little slow to open a really b... | <p>Couple feature additions:</p>
<ul>
<li>Automatically insert page breaks after methods/classes </li>
<li>Keep long lines readable (nearly all current implementations are broken)</li>
</ul>
| 7,509 |
<p>In our project we have a standard auto-generated designer.cs file, linked to a DBML file, that contains all our object classes that map onto our database tables.</p>
<p>We want to pass these objects directly through a WCF Service and so they need decorating with the [DataContract] and [DataMember] attributes where ... | <p>Setting the DBML serialization mode to unidirectional will decorate the classes and a number of the members with the required attributes however it will ignore some of the associations to avoid circular references that were a problem prior to SP1.</p>
<p>If you want those too check out my <a href="http://damieng.co... | <p>The dbml files give partial classes, so you can create a new .cs file, define the partial class that you want to extend, and then decorate that with the attributes that you want. For instance if you have a generated data context that looks like</p>
<pre><code>public partial class MyDataContext : System.Data.Linq.Da... | 11,866 |
<p>I am porting some queries from Access to T-SQL and those who wrote the queries used the Avg aggregate function on datetime columns. This is not supported in T-SQL and I can understand why - it doesn't make sense. What is getting averaged?</p>
<p>So I was about to start reverse engineering what Access does when it... | <p>I'd imagine that Access is averaging the numeric representation of the dates. You could do similar in T-SQL with the following...</p>
<pre><code>select AverageDate = cast(avg(cast(MyDateColumn as decimal(20, 10))) as datetime)
from MyTable
</code></pre>
| <p>I'm more familiar with non-MS DBMS, but... Since you cannot add two DATETIME values, you cannot ordinarily average them. However, you could do something similar to:</p>
<pre><code>SELECT AVG(datetime_column - TIMESTAMP '2000-01-01 00:00:00.000000') +
TIMESTAMP '2000-01-01 00:00:00.000000'
FROM ta... | 39,334 |
<p>Should simple JavaBeans that have only simple getters and setters be unit tested?? </p>
<p>What about Beans with some logic in getters and setters?</p>
| <p>You should not write tests which:</p>
<ul>
<li>Test the language or the IDE (i.e. automatically generated getters and setters)</li>
<li>Add no value to your test harness and kill your enthusiasm for Unit Testing</li>
</ul>
<p>The same applies for .NET objects which only have properties (sometimes called 'Info' obj... | <p>if it's just a getter/setter without changing anything to the values, I'd say there's no need for testing. If it does do some logic, a few simple unit tests will provide some security.</p>
| 13,657 |
<p>Does anyone know why the DropShadowBitmapEffect and the EmbossBitmapEffect won't work on a TextBlock (not textBOX) in WPF? OuterGlow, Blur and Bevel seem to work fine. </p>
<hr>
<p>The transparent background brush is apparently not the answer because you <em>can</em> get a dropshadow with a null background brush. ... | <p>Bitmap effects work by looking at the post-rendered pixels and running standard image manipulation on them. It should only be dependent on the color of the pixels. I wonder if their algorithms don't work well on white. Try changing the color to see if that has an effect -- if it does, you might want to try putti... | <p><strong>Important Sidenote:</strong> you shouldn't really be using BitmapEffects any more. Use the Effect property based on ShaderModel effects introduced in .net 3.5 SP1, it uses hardware rendering and has far better performance.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/system.windows.media.effects.... | 13,692 |
<p>Is anyone out there* using <a href="http://web2py.com/" rel="noreferrer">web2py</a>?</p>
<p>Specifically:</p>
<ul>
<li>In production?</li>
<li>With what database?</li>
<li><p>With Google Application Engine?</p>
<ul>
<li>by "out there" I mean at stackoverflow.</li>
</ul></li>
</ul>
| <p>You are welcome to ask the same question on the <a href="http://groups.google.com/group/web2py" rel="noreferrer">google group</a>. You will find more than 500 users there and some of them are development companies building projects for their clients.</p>
<p>My impression is that most of them use postgresql (that's ... | <p>Well, I am using Web2Py professionally, with PostgreSQL, and on linux. I am working on my Social network named "<a href="http://www.ourway.ir" rel="nofollow">Ourway</a>". You may like some features of it like "<a href="http://www.ourway.ir/pages/blog" rel="nofollow">Blog</a>" part.</p>
| 10,241 |
<p>I have this idea for a free backup application.</p>
<p>The largest problem I need to solve at the moment is how to access files which are being used or are system files. I would like the application to be able to perform a full backup of files (i.e. not on a disk sector by sector level).</p>
<p>I'll turn the serve... | <p>What you're looking for regarding the files in use is the "<a href="http://msdn.microsoft.com/en-us/library/bb968832(VS.85).aspx" rel="nofollow noreferrer" title="MSDN - Volume Shadow Copy Service">Volume Shadow Copy Service</a>" which is available on Windows XP, Server 2003 and above. This will allow you... | <p>Do a Google on HoboCopy. It is an open source backup tool for windows that can backup files that are in use using Windows Volume Shadow Service.</p>
| 10,376 |
<p>I'm using PayPal Website Payments Standard. Whenever the user lands on PayPal with the variables I sent, it shows a PayPal Login form and at the bottom it shows "Don't have a PayPal account? Use your credit card or bank account (where available)."</p>
<p>I want it to default to always ask for credit card and maybe... | <p>I've struggled with this question and found the answer following Roberts comment about using LANDINGPAGE=Billing in the ExpressCheckout API.</p>
<hr>
<p>From the page:</p>
<p><a href="https://cms.paypal.com/us/cgi-bin/?cmd=_render-content&content_ID=developer/e_howto_api_nvp_r_SetExpressCheckout" rel="norefer... | <p>On <a href="http://www.paypaldeveloper.com/pdn/board/message?board.id=basicpayments&message.id=28117&query.id=71300" rel="noreferrer">a thread in the PayPal Developer Community</a> they explain it with cookies based visits to the checkout page.</p>
<p>Basically if PayPal detects you being a user and spots t... | 39,862 |
<p>I have an Access form where each record has some info that is computed on the fly. I'm using the Form_Current() event; each time a record is selected, I compute some information and change some form controls to reflect it, based on the record's ID.</p>
<p>I want to print a bunch of these records. However, in this s... | <p>Make a query that computes the information you need as the source of your report. You can use vba functions if needed for complex calculations.</p>
| <p>In a comment, Luis Oliveira asked:</p>
<blockquote>
<p>My function was in the Form itself,
which is why I couldn't call it from
the SQL query, I suppose?</p>
</blockquote>
<p>By default, functions in a form are private. If made public they can only be called when the form is open, as in Forms!MyForm.PublicFu... | 32,551 |
<p>I totally understand the MVP pattern now, but I still struggle to see where views and presenters are instantiated. I have seen some examples where the presenter is newed up in the view, but is this correct. After reading a blog post of Jeremy Miller about communicating between View and Presenter he had a function on... | <p>In webforms, the page gets instantiated by the request. Since the page is the view and you cannot control the order of execution, it is the view that has to register itself with the presenter</p>
| <p>Firstly good question. Secondly, it may not matter, much. My personal preference is to almost always wire up Presenter and View in the View. </p>
<p>Compare this scenario:</p>
<pre><code>public class SomePresenter
{
public ShowContactView(IContactView view)
{
IContact model = new Contact();
... | 46,168 |
<h2>Background</h2>
<p>I am working on a legacy small-business automation system (inventory, sales, procurement, etc.) that has a single database hosted by SQL Server 2005 and a bunch of client applications. The main client (used by all users) is an MS Access 2003 application (ADP), and other clients include various VB... | <p>When designing a database, I prefer the following:</p>
<ul>
<li>no direct table access by the code (but is ok from stored procedures and views and functions)</li>
<li>a base view for each table that includes all columns</li>
<li>an extended view for each table that includes lookup columns (types, statuses, etc.)</l... | <p>I agree with <a href="https://stackoverflow.com/questions/237601/sql-server-2005-wrapping-tables-by-views-pros-and-cons#237607">Steven's comment</a>--primarily because you are using Access. It's extremely important to keep the pros/cons of Access in focus when re-designing this database. I've been there, done that w... | 29,401 |
<p>I need to find occurrences of "(+)" in my sql scripts, (i.e., Oracle outer join expressions). Realizing that "+", "(", and ")" are all special regex characters, I tried:</p>
<pre>
grep "\(\+\)" *
</pre>
<p>Now this does return occurrences of "(+)", but other lines as well. (Seemingly anything with open and close p... | <p>GNU grep (which is included in Cygwin) supports two syntaxes for regular expressions: basic and extended. <code>grep</code> uses basic regular expressions and <code>egrep</code> or <code>grep -E</code> uses extended regular expressions. The basic difference, from the <a href="http://www.gnu.org/software/grep/doc/gre... | <p>You probably need to add some backslashes because the shell is swallowing them.</p>
<p>ETA: Actually, I just tried on my Cygwin and <code>grep "(+)"</code> seems to work just fine for what you want.</p>
| 22,891 |
<p>I'm creating an interface wrapper for a class. The member within the class is a reference(to avoid copying the large structure). If I create a private constructor, what is the best way to initialize that reference to appease the compiler?</p>
<pre><code>struct InterfaceWrapper {
InterfaceWrapper( SomeHugeStru... | <p>As others have mentioned, if your purpose is to prevent others from calling the default constructor, then you don't want to provide a body at all, and declaring it is unnecessary since you have another constructor and the compiler won't generate it for you.</p>
<p>If the purpose is to limit access to friends of the... | <p>What is the point of the private ctor? If m_internal is not referencing a valid object, how can it be useful?</p>
<p>Also the m_internal-> won't compile. That is pointer syntax, not ref.</p>
| 36,108 |
<p>I'd like to write some small applications for Windows and OSX. </p>
<p>Portable is good. For instance, the simple TclKit solution for TCL would work well if I could stand to look at Tcl for any length of time.</p>
<p>I'm considering using Javascript + extensions -- I really like Javascript -- seems to me there sho... | <p>If you want to write a desktop app in Javascript, check out HTA: <a href="http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx" rel="noreferrer">http://msdn.microsoft.com/en-us/library/ms536496(VS.85).aspx</a></p>
<p>Here is an example of an app that I wrote a long time ago in HTA: <a href="http://www.boltb... | <p><a href="http://www.mozilla.org/rhino/" rel="nofollow noreferrer">Rhino</a> would probably give you access to swing. Though, I don't know how much work would be involved. </p>
<p>On the other hand, building a swing app with JRuby is so easy <a href="http://www.artima.com/weblogs/viewpost.jsp?thread=220459" rel="nof... | 27,537 |
<p>This post probably will need some modification. I'll do my best to explain...</p>
<p>Basically, as a tester, I have noticed that sometimes programers who use template-based web back ends push a lot of stuff into onload handlers that then do stuff like load menu items, change display values in forms, etc.</p>
<p>Fo... | <p>I think what you're saying is what we should be doing is <a href="http://www.alistapart.com/articles/progressiveenhancementwithjavascript" rel="nofollow noreferrer">Progressive Enhancement with JavaScript</a>.</p>
<p>Also related: <a href="http://www.alistapart.com/articles/progressiveenhancementwithcss" rel="nofol... | <p>So the actual question is "What are advantages/disadvantages" of javascript content generation? </p>
<p>here's one: a lot of the things designers want are hard in straight html/css, or not fully supported. using Jquery to do zebra-tables with ":odd" for instance. Sometimes the server-side framework doesn't have goo... | 47,571 |
<p>Is there some way I can define <code>String[int]</code> to avoid using <code>String.CharAt(int)</code>?</p>
| <p>No, there isn't a way to do this.</p>
<p>This is a common question from developers who are coming to JavaScript from another language, where <strong>operators can be defined or overridden</strong> for a certain type.</p>
<p>In C++, it's not entirely out of the question to overload <code>operator*</code> on <code>M... | <p>This is not an answer, just a trick (strongly deprecated!). It shows, in particular, that in Javascript you can do whatever you want. It's just a matter of your fantasy.</p>
<p>You can use a fact that you can set any additional properties to String Object like to all others, so you can create String.0, String.1, ..... | 31,821 |
<p>I have been trying to use routes.rb for creating a URL /similar-to-:product (where product is dynamic) for my website. The issue is that routes.rb readily supports URLs like /:product-similar but doesn't support the former because it requires :product to be preceded with a separator ('/' is a separator but '-' isn't... | <p>I would refactor your URLs so that they're simply "similar-to/product"</p>
| <p>I'm a little confused, but could you maybe add "to-" as a seperator? </p>
| 14,682 |
<p>As the title suggests, I am having trouble maintaining my code on postback. I have a bunch of jQuery code in the Head section and this works fine until a postback occurs after which it ceases to function! </p>
<p>How can I fix this? Does the head not get read on postback, and is there a way in which I can force thi... | <p>If you just have that code hard coded into your page's head then a post back won't affect it. I would check the following by debugging (FireBug in FireFox is a good debugger):</p>
<ul>
<li>Verify the script is still in the head on postback.</li>
<li>verify that the css classes are in fact attached to some element i... | <p>Instead of using $(document).ready you should put your code in a function called pageLoad(). The pageLoad() function is by convention wired up to be called whenever the page has a postback/asyncpostback.</p>
| 35,603 |
<p>I'm wondering if there is a better/inbuilt way, other than using a byte buffer and looping, to read from one stream and write it to another (in .NET). Generally this is done to apply a transform to a stream and move it on.</p>
<p>In this instance, what I am loading a file, putting it through a deflate stream and wr... | <p>There's not really a better way than that, though I tend to put the looping part into a <code>CopyTo</code> extension method, e.g.</p>
<pre><code>public static void CopyTo(this Stream source, Stream destination)
{
var buffer = new byte[0x1000];
int bytesInBuffer;
while ((bytesInBuffer = source.Read(buff... | <p>Now that I think about it, I haven't ever seen any built-in support for piping the results of an input stream directly into an output stream as you're describing. <a href="http://msdn.microsoft.com/en-us/magazine/cc163290.aspx" rel="nofollow noreferrer">This article on MSDN</a> has some code for a "StreamPipeline" c... | 40,802 |
<p>I am using a custom item renderer in a combobox to display a custom drawing instead of the default text label.</p>
<p>This works fine for the dropdown list but the displayed item ( when the list is closed) is still the textual representation of my object.</p>
<p>Is there a way to have the displayed item rendered t... | <p>By default you cannot do this. However, if you extend ComboBox you can add this functionality easily. Here is a quick example, it is a rough version and probably needs testing / tweaking but it shows how you could accomplish this.</p>
<pre><code>package
{
import mx.controls.ComboBox;
import mx.core.UICompon... | <p>Thank you maclema and Maurits de Boer. I added a couple more things to this class to make it fit my needs:</p>
<ul>
<li><p>I overrode set itemRenderer so that this will work if you set the itemRenderer through AS instead of mxml. I moved the text input replacement code to its own function to avoid duplication.</p><... | 33,897 |
<p>I have <code>periodically_call_remote</code> updating a div (<code>main_div</code>) in my web app. This <code>main_div</code> contains links that the user can click that invokes an action that overwrites data within <code>main_div</code>.</p>
<p>My problem is that the timer is running on the <code>periodically_call... | <p>This thread: <a href="http://www.ruby-forum.com/topic/119372" rel="nofollow noreferrer">http://www.ruby-forum.com/topic/119372</a> provided the answer that I needed. </p>
<p>Essentially it boils down to overriding <code>periodically_call_remote</code> in the <code>application_helper.rb</code> file to put the <code>... | <p>You would want to setup the layout/template to conditionally enable the updater</p>
| 49,763 |
<p>I'm working on a project in Java using the spring framework, hibernate and tomcat.</p>
<p>Background:
I have a form page which takes data, validates, processes it and ultimately persists the data using hibernate. In processing the data I do some special command (model)
manipulation prior to persisting using hiber... | <p>If you are testing in IE, make note that in some versions of IE it sometimes submits two requests. What browsers are you testing the app in?</p>
<p>There is the javascript issue, if an on click handler is associated with submit button and calls submit() and does not return false to cancel the event bubble.</p>
| <p>Could be as simple as users clicking on a link twice, re-submitting a form while the server is still processing the first request, or hitting refresh on a POST-ed page.</p>
<p>Are you doing anything on the server side to account for duplicate requests such as these from your users?</p>
| 30,279 |
<p>In Windows Server 2003, how I can check if my program is running in local console ("on the screen of the server machine") instead of remote session?</p>
<p>I'm using Delphi Win32, so any Windows API based method should work..</p>
| <p>Wouldn't the session number tell you this ?</p>
<p>ProcessIdToSessionId (GetCurrentProcessId(),&dwSessionNum)</p>
<p>You'd have to check the OS version as well, using GetVersionEx: for everything up to XP/Server 2003 session 0 is local (service or interactive console), anything higher is virtual. For Vista/200... | <p>Brian is correct, I have since encountered Vista reporting a session id of 2 for an interactive console, despite the fact that Fast User Switching was not in use. Of course, this may be just be a bug :-)</p>
| 30,306 |
<p><em>I was wondering as to the practicalities of storing an in memory tree structure as directory tree for persistence purposes. In my case he target filesystem will be ZFS, and once the structure has been created it will be accessed by multiple processes infrequently.</em></p>
<h3>How performant is using a Directory... | <p>In order to read and write your tree, you will be calling the filesystem several times per node. This is much more expensive than any sane code you could devise to walk a memory image.</p>
<p>Whether it is a sensible approach depends on what your usage pattern is expected to be. If in a typical invocation of your c... | <p>If I understand it correctly you're talking about building a tree structure that would give an in-code representation of your filesystem, so I suspect you'll incur overhead at the start where you're reading in your tree structure, but subsequent lookups and traversals of the tree would likely be quicker than hitting... | 22,217 |
<p>There are many skills a programmer could have (understanding the problem, asking good questions, good design skills, etc.).</p>
<p>I think <strong>System Debugging skill</strong> is incredibly valuable. This general skill of debuggin any technical system (from the batteries being dead in your remote control to sign... | <p>if you define "troubleshooting" to include "debugging" then yes, it is critical!</p>
<p>EDIT: based on your edits, the top-down process-of-elimination technique you listed is systematic and very valuable.</p>
<p>Another technique is reasoning backwards:</p>
<ul>
<li>start at the end, with the variables/calls that... | <p>I think that commitment is more important.</p>
| 26,714 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.