instruction stringlengths 21 27.8k | chosen stringlengths 18 28.2k | rejected stringlengths 18 33.6k | __index_level_0__ int64 0 50k |
|---|---|---|---|
<p>I need a Linux text editor to replace Textpad 4.7.3 (a Windows nagware app), but all the alternatives I've tried are either bloated or incomplete. Here are the features I find most important, in descending order:</p>
<ul>
<li>Regex search, mark, and replace (across all open files, even), regex search in directory t... | <p><em>Vim and emacs do not take full advantage of my screen, mouse, and keyboard.</em> </p>
<p>Have you looked at gvim? I'm a console guy myself, but I'm pretty sure it's GUIlicious.</p>
| <p>Have you tried <a href="http://kate-editor.org/" rel="nofollow noreferrer">Kate</a>? I'm not sure it complies with all your requirements, but it may. Also, for a more development oriented tool, you could try <a href="http://www.kdevelop.org/" rel="nofollow noreferrer">KDevelop</a>, whose default editor is Kate (but ... | 27,170 |
<p>I've isolated the behaviour into the following test case. I'd be grateful to anyone who can tell me how to expect/verify a property set for a <code>List<T></code> property - it appears there's something going on inside <code>It.Is<T>(predicate)</code> that isn't making a whole lot of sense to me right no... | <p>I'm not using the very latest version of Moq, so I don't have an overload of ExpectSet that takes two parameters, but I've had some success with this pattern:</p>
<pre><code>mockView.ExpectSet(mv => mv.Names).Callback(n => Assert.That(n != null));
</code></pre>
<p>The Assert (from NUnit) call in the callback... | <p>Moq doesn't provide an overload receiving It.IsAny as it's effectively the same as calling ExpectSet without passing an expected value ;)</p>
| 46,704 |
<p>Is it possible to add a "metadata"-like description or comments to a table in Microsoft SQL 2000 and above? </p>
<p>How would you do this through the CREATE TABLE statement?</p>
<p>Is it possible to add a description or comment to fields?</p>
<p>How do you query this info back in MSSQL 2000? 2005?</p>
| <p>Use extended properties. For example to add an extended property to a table in the dbo schema you can use:</p>
<pre><code>EXEC sys.sp_addextendedproperty @name=N'<NameOfProp>',
@value=N'<Value>' , @level0type=N'SCHEMA',@level0name=N'dbo',
@level1type=N'TABLE',@level1name=N'<Table>'
</code></pre>... | <p>Most tools and people use the Extended Properties for supporting this. The common name used by SSMS is MS_Description</p>
<p>There are several built in stored procedures for creating these properties as well as reading them, they procs changed over time so there will be compat differences between SQL versions.</p>
| 49,609 |
<p>Consider the following simple C program that read a file into a buffer and displays that buffer to the console:</p>
<pre><code>#include<stdio.h>
main()
{
FILE *file;
char *buffer;
unsigned long fileLen;
//Open file
file = fopen("HelloWorld.txt", "rb");
if (!file)
{
fprintf(s... | <p>You need to NUL-terminate your string. Add</p>
<pre><code>buffer[fileLen] = 0;
</code></pre>
<p>before printing it.</p>
| <p>You can use <code>calloc</code> instead of <code>malloc</code> to allocate memory that is already initialised. <code>calloc</code> takes on extra argument. It's useful for allocating arrays; the first parameter of <code>calloc</code> indicates the number of elements in the array that you would like to allocate memor... | 32,522 |
<p>My father died recently and I've inherited his Mac. I'd love to put it to use in my own life, but I don't want to wipe its brains out just so I can reconfigure it to use in my network, etc. His old files are historically important to me—I trust you can understand my desire to keep them.</p>
<p>I can log in as... | <p>Sincere condolences.</p>
<p>Try this: <a href="http://kb.wisc.edu/helpdesk/page.php?id=3853" rel="nofollow noreferrer">Mac OS X - Resetting a Forgotten Account Password</a></p>
<p>The link shows a walk-through of starting up from the Mac OS X installation DVD and using its Reset Password functionality to reset the... | <p>If you can access the files in question, then the first thing to do would be to back them up...</p>
| 23,784 |
<p>What would you suggest for the following scenario: </p>
<p>A dozen of developers need to build and design a complex system. This design needs to be documented for future developers and the design decisions must be noted. These reports need to be made about every two months. My question is how this project should be... | <p>We approach this from 2 sides, using a RUP style approach. In the first case, you'll have a domain expert who is responsible for roughing out the design of what you're going to deliver - with developers chipping in as necessary. In the second case, we use a technical author - they document the application, so they s... | <p>I think you can use Sand Castle to document your project.</p>
<p>Check it out</p>
<p><a href="http://www.codeplex.com/DocProject/Wiki/View.aspx?title=How%20To%20Configure%20Visual%20Studio%202005%20For%20DocProject&referringTitle=Home" rel="nofollow noreferrer">Sand Castle from Microsoft</a></p>
| 47,744 |
<p>Is there a way to print all methods of an object in JavaScript?</p>
| <p>Sure:</p>
<pre><code>function getMethods(obj) {
var result = [];
for (var id in obj) {
try {
if (typeof(obj[id]) == "function") {
result.push(id + ": " + obj[id].toString());
}
} catch (err) {
result.push(id + ": inaccessible");
}
}
return result;
}
</code></pre>
<p>Us... | <p>Since methods in JavaScript are just properties that are functions, the for..in loop will enumerate them with an exception - it won't enumerate built-in methods. As far as I know, there is no way to enumerate built-in methods. And you can't declare your own methods or properties on an object that aren't enumerable t... | 18,400 |
<p>Have done fft (see earlier posting if you are interested!) and got a result, which helps me. Would like to analyse the noisiness / spikiness of an array (actually a vb.nre collection of single). Um, how to explain ...</p>
<p>When signal is good, fft power results is 512 data points (frequency buckets) with low valu... | <p>The key is defining what is noise and what is signal, for which modelling assumptions must be made. Often an assumption is made of white noise (constant power per frequency band) or noise of some other power spectrum, and that model is fitted to the data. The signal to noise ratio can then be used to measure the amo... | <p>calculate the signal to noise ratio
<a href="http://en.wikipedia.org/wiki/Signal-to-noise_ratio" rel="nofollow noreferrer">http://en.wikipedia.org/wiki/Signal-to-noise_ratio</a></p>
<p>you could also check the stdev for each point and if it's under some level you choose then the signal is good else it's not.</p>
| 18,438 |
<p>I'm building a group calendar application that needs to support recurring events, but all the solutions I've come up with to handle these events seem like a hack. I can limit how far ahead one can look, and then generate all the events at once. Or I can store the events as repeating and dynamically display them when... | <p>I would use a 'link' concept for all future recurring events. They are dynamically displayed in the calendar and link back to a single reference object. When events have taken place the link is broken and the event becomes a standalone instance. If you attempt to edit a recurring event then prompt to change all futu... | <blockquote>
<p>What if you have a recurring appointment with no end date? As cheap as space is, you don't have infinite space, so Solution 2 is a non-starter there... </p>
</blockquote>
<p>May I suggest that "no end date" can be resolved to an end date at the end of the century. Even for a dayly event the amount of... | 11,122 |
<p>Would anyone know why MSVC++ 2008 always returns error 5 on GetLastError() when I try to call OpenProcess with PROCESS_ALL_ACCESS as my desired access? PROCESS_VM_READ works just fine. I'm an administrator on this computer and it is working fine in Dev C++.</p>
<p>Do I need to set an option somewhere?</p>
| <p>Opening a process with full access rights can be a highly privileged operation if it's not a process running under you credentials or in your logon session - you'll need to follow this bit of documentation from MSDN:</p>
<blockquote>
<p>To open a handle to another process
and obtain full access rights, you
mu... | <p>Which process is it? Opening a service or a process in another user session is likely to return Access Denied (5). A process in another session will open for read but you wouldn't be able to debug it. It's one reason why Windbg has the non-intrusive attach. It works across user sessions. You're not actually debug... | 20,444 |
<p>The workflow is like this:</p>
<ol>
<li>I receive a scan of a coupon with data (firstname, lastname, zip, city + misc information) on it.</li>
<li>Before I create a new customer, I have to search the database if the customer might exist already.</li>
</ol>
<p>Now my question: What's the best way to find an existin... | <p>We are using the <a href="http://en.wikipedia.org/wiki/Levenshtein_distance" rel="nofollow noreferrer">Levenshtein distance</a> algorithm to check users for duplication. However we have quite strict rules to enter the data itself, so we have to check only for misstyping, case differences and such.</p>
| <p>You query the database for all customers that match the given data, e.g.</p>
<pre><code>SELECT ID FROM tbl_customers WHERE
first_name LIKE 'JOHN'
AND last_name LIKE 'Doe'
AND zip_code=12345
AND city LIKE 'Ducktown'
</code></pre>
<p>If the number of rows returned is 0, create a new entry in the data... | 18,968 |
<p>In the Delphi IDE, you can hold control and click on a method to jump to its definition. In VS2008, you have to right-click and select "Go To Definition".</p>
<p>I use this function quite often, so I'd really like to get VS to behave like Delphi in this regard - its so much quicker to ctrl+click.</p>
<p>I don't th... | <p>You could create an Autohotkey script that does that. When you ctrl-click a word, send a doubleclick then a F12.</p>
<p>I don't have AHK handy so I can't try and sketch some code but it should be pretty easy; the AHK recorder should have enough features to let you create it in a point 'n' click fashion and IIRC it ... | <p>Put the mouse cursor on the method name or any identifier, and press <kbd>F12</kbd></p>
| 10,643 |
<p>ASP.NET 2.0 provides the <code>ClientScript.RegisterClientScriptBlock()</code> method for registering JavaScript in an ASP.NET Page.</p>
<p>The issue I'm having is passing the script when it's located in another directory. Specifically, the following syntax does not work:</p>
<pre><code>ClientScript.RegisterClien... | <p>What you're after is: </p>
<pre><code>ClientScript.RegisterClientScriptInclude(this.GetType(), "scriptName", "../dir/subdir/scriptName.js")
</code></pre>
| <p>Your script value has to be a full script, so put in the following for your script value.</p>
<pre><code><script type='text/javascript' src='yourpathhere'></script>
</code></pre>
| 11,198 |
<p>I've just bought <strong>Anycubic i3 Mega</strong> printer and trying to level it.
So far I've printed test object and 2 others but looks like there are problems with leveling.</p>
<p>I want to make image of 5 small one layer squares(one in each corner and one in center). Looking for recommendations of <strong>simp... | <p>You are probably looking for something like <a href="https://www.thingiverse.com/thing:2479352" rel="nofollow noreferrer">this</a>:</p>
<p><img src="https://cdn.thingiverse.com/renders/0f/68/62/46/9f/646e9a4ee9ff75a7f0cacb396a0b7ed4_preview_featured.jpg" alt="leveling print object"></p>
<p>Note this is for large b... | <p>One of the most accessible modelling tools has to be <a href="https://www.tinkercad.com/" rel="nofollow noreferrer">tinkercad</a>. Everything is done in the browser, and it even works (to an extent) on a tablet. </p>
<p>I wouldn't recommend getting too attached to it, since it is fairly limited. As an introduction ... | 995 |
<p>Our development process is highly automated via a raft of bash and php scripts (including subversion hook scripts.) These scripts do a number of things to integrate with our Bugzilla 3.0 installation.</p>
<p>But the current integration approach is a bunch of SQL calls which update the bugzilla database directly - ... | <p>According to the Bugzilla WebServices API, some of the features needed (e.g. changing a bug status) are not yet available, so for the time being, direct SQL calls seem the most appropriate option.</p>
<p>The database schema has not changed significantly between version 3.0 and 3.2 so this is a practical way forward... | <p>Be careful! Some database changes imply other changes as well. Adding a comment to a bug by adding a row to longdescs works, but you should also be updating delta_ts in table bugs.</p>
<p>Until web services are available, here's what I would do: perform the action using the UI that you want to do from the shell. ... | 44,237 |
<p>I have a <code><div></code> that I want to be on a line by itself. According to <a href="http://www.w3schools.com/Css/pr_class_clear.asp" rel="nofollow noreferrer">W3Schools</a>, this rule:</p>
<pre><code>div.foo {
clear: both;
}
</code></pre>
<p>...should mean this:</p>
<blockquote>
<p>"No floating ele... | <p>When you apply clear to an element, it will move THAT element so that it doesn't have items left or right of it. It does not re-position any of the other elements, it simply moves the element to a position where nothing is around it.</p>
<p><strong>Edit</strong></p>
<p>Items above the item cleared are not moved, ... | <p>I generally do the following for that effect:</p>
<pre><code>float: left;
clear: right;
</code></pre>
<p>I don't know if it applies merely to the element to which it is applied, though it makes sense.</p>
<p>The specs are available here, though: <a href="http://www.w3.org/TR/REC-CSS2/" rel="nofollow noreferrer">h... | 26,141 |
<p>Just curious, did I overlook somewhere in the API to display a chat bubble type image as found in the iPhone's SMS application? There's a few applications out there that use bubbles that look verbatim to the iPhone's and I'm wondering if they're using a native widget or their own image.</p>
<p>This is also seen in ... | <p>I suggest using the stretch method they recommend for button images.</p>
<pre><code>[UIImage stretchableImageWithLeftCapWidth:15 topCapHeight:13]
</code></pre>
<p>You can see a working example by downloading <a href="http://twitterfon.net/" rel="noreferrer">Twitterfon</a>'s source(it's on the FAQ page). You can s... | <p>Many of our applications have chat or messaging facility, and many of the clients are asking to build chat "similar to that iPhone's SMS chat, with bubbles".</p>
<p>Unfortunately, Cocoa SDK does not provide convenient and easy way to display chat bubbles, and numerous code snippets that we've googled were not perfe... | 45,782 |
<p>I know this sounds very basic but I just started with visual studio and I am looking for instructions on the basic control functions. In general, what the different options do. I am just trying to get familiar with some of the functions and I am not completely understanding how to manipulate the data. For example... | <p><a href="http://www.learnvisualstudio.net/" rel="nofollow noreferrer">http://www.learnvisualstudio.net/</a></p>
<p>excellent tutorial videos, a very good place to start</p>
| <p>There are some video tutorials about programming in Visual Studio on the Internet. If you like books - take for a start something like lessons in VS.</p>
<p>To handle return button in textbox just handle KeyPressed event and in parameter e you have all necessary information.</p>
<p>To do something like clock you c... | 43,111 |
<p>Delphi 2009 complains with an E2283 error: [DCC Error] outputcode.pas(466): E2283 Too many local constants. Use shorter procedures</p>
<p>Delphi 2007 compiles just fine. I can't find an abundance of local constants, it's a short (500 line) unit. Do you see any abundance of constants or literals I can address?</p>
... | <p>Is Win32 defined, could the constants be from all the included units.</p>
<p>i would do a binary search: keep tearing half the unit out until it compiles, then add stuff back in.</p>
<p>Yes it sucks, but that's one of the features of trying to debug BorlandCodeGaembarcadero's internal compiler errors.</p>
| <p>I've found the method (FormCreate) that is the problem and have been refactoring but no matter how small I make the chunks the compiler still has a problem unless I delete some of the code. </p>
<p>François thanks, but I did refactor the code and still get the error. If it built with D2007, and doesn't with D2009, ... | 30,253 |
<p>I've spent a good amount of time coming up with solution to this problem, so in the spirit of <a href="https://stackoverflow.com/questions/21245/questions-vs-conveying-information">this post</a>, I'm posting it here, since I think it might be useful to others. </p>
<p>If anyone has a better script, or anything to a... | <p>I've modified the version above to run for all tables and support new SQL 2005 data types. It also retains the primary key names. Works only on SQL 2005 (using cross apply).</p>
<pre><code>
select 'create table [' + so.name + '] (' + o.list + ')' + CASE WHEN tc.Constraint_Name IS NULL THEN '' ELSE 'ALTER TABLE '... | <p>If you are using management studio and have the query analyzer window open you can drag the table name to the query analyzer window and ... bingo! you get the table script.
I've not tried this in SQL2008</p>
| 4,168 |
<p>Lets say I have a Dictionary object:</p>
<pre><code>Dictionary myDictionary<int, SomeObject> = new Dictionary<string, SomeObject>();
</code></pre>
<p>Now I want to iterate through the dictionary in reverse order. I can't use a simple for loop because I don't know the keys of the dictionary. A <em>forea... | <p>A dictionary or any other form of hashtable has no ordering. So what you are trying to do is pointless :)</p>
| <pre><code>foreach (Sample in Samples)
try the following:
Int32 nEndingSample = Samples.Count - 1;
for (i = nEndingSample; i >= 0; i--)
{
x = Samples[i].x;
y = Samples[i].y;
}
</code></pre>
| 10,855 |
<p>Is it possible to deploy a website using <code>git push</code>? I have a hunch it has something to do with using <a href="http://www.git-scm.com/book/en/v2/Customizing-Git-Git-Hooks" rel="noreferrer">git hooks</a> to perform a <code>git reset --hard</code> on the server side, but how would I go about accomplishing t... | <p>I found <a href="https://stackoverflow.com/questions/279169/deploy-php-using-git/3387030#3387030">this script</a> on <a href="http://git.or.cz/gitwiki/GitFaq#head-b96f48bc9c925074be9f95c0fce69bcece5f6e73" rel="noreferrer">this site</a> and it seems to work quite well.</p>
<ol>
<li>Copy over your .git directory to y... | <p>Given an environment where you have multiple developers accessing the same repository the following guidelines may help.</p>
<p>Ensure that you have a unix group that all devs belong to and give ownership of the .git repository to that group.</p>
<ol>
<li><p>In the .git/config of the server repository set sharedre... | 35,263 |
<p>I am using the <strong>System.Messaging.MessageQueue</strong> to send and receive multicast <strong>System.Messaging.Messag</strong>e’s on my LAN – this works fine.</p>
<p>However, I have a requirement to receive the msgs without using a message queue.</p>
<p>As the <strong>MessageQueue</strong> uses the PGM proto... | <p>If you are looking purely for PGM use on MS Windows then <a href="http://code.google.com/p/emcaster/" rel="nofollow noreferrer">Emcaster</a> is very good info source with example how to use it.</p>
<p>But if you are looking for more mature solution with broader range of capability then <a href="http://www.nserviceb... | <p>You can just peek at them? The MSMQ supports that functionality. Or are you just trying to read messages on queues you don't typically listen on?</p>
| 29,217 |
<p>How do I multiply 10 to an <code>Integer</code> object and get back the <code>Integer</code> object?</p>
<p>I am looking for the neatest way of doing this.</p>
<p>I would probably do it this way:
Get int from <code>Integer</code> object, multiply it with the other int and create another Integer object with this in... | <p>With Java 5's <a href="http://java.sun.com/j2se/1.5.0/docs/guide/language/autoboxing.html" rel="nofollow noreferrer">autoboxing</a>, you can simply do:</p>
<pre><code>Integer a = new Integer(2); // or even just Integer a = 2;
a *= 10;
System.out.println(a);
</code></pre>
| <p>toolkit's answer above is correct and the best way, but it doesn't give a full explanation of what is happening.
Assuming Java 5 or later:</p>
<pre><code>Integer a = new Integer(2); // or even just Integer a = 2;
a *= 10;
System.out.println(a); // will output 20
</code></pre>
<p>What you need to know is that this ... | 6,799 |
<p>Does any one know as to why Java does not allow you to switch on numbers larger than integers? Is there any technical reason behind this?</p>
| <p>As said <a href="http://java.sun.com/docs/books/tutorial/java/nutsandbolts/switch.html" rel="noreferrer">here</a>, switch works with the byte, short, char, and int primitive data types. It also works with enumerated types and a few special classes that "wrap" certain primitive types: Character, Byte, Short, and Inte... | <p>Maybe because it's really bad programming to have more than integer max cases in a switch?</p>
<p>If you want to switch over long variables, just projet them in the interger space.</p>
| 39,696 |
<p>A lot of times in code on the internet or code from my co-workers I see them creating an Object with just one method which only gets used once in the whole application. Like this:</p>
<pre><code> class iOnlyHaveOneMethod{
public function theOneMethod(){
//loads and loads of code, say 100's of lines
// ... | <p>The problem is not whether it's in a function or an object. </p>
<p>The problem is that you have hundreds of lines in one blob. Whether that mass of code is in a method of an object or just a class seems more or less irrelevant to me, just being minor syntatic sugar. </p>
<p>What are those hundreds of lines doing?... | <p>yes, the presences of loads and loads of code is a <a href="http://en.wikipedia.org/wiki/Code_smell" rel="nofollow noreferrer">Code Smell</a>.</p>
| 47,835 |
<p>My company releases a small software product for which I've recently been taking over the development side. It is a C# Windows Forms application.</p>
<p>One of the things I've noticed is that much of the information about how the software is used is filtered through my superiors and I get the feeling that I'm miss... | <p>I would suggest you get your application to write its "usage information" somewhere and then, <em>with the users permission</em>, transmit it electronically every so often.</p>
<p>Note the emphasis above. Depending on your jurisdiction, you could get into serious trouble transmitting any sort of data from someone ... | <p>I believe that you've already received a good answer to your question re the privacy aspect of the technological solution.</p>
<p>I would also like to mention that you should try to use HTTP or HTTPS over normal 80/443 ports - these are the least likely to cause problems with the firewalls and proxy. Use MS IE prox... | 17,336 |
<p>I am using SQL Advantage and need to know what the SQL is to identify the triggers associated with a table. I don't have the option to use another tool so the good old fashioned SQL solution is the ideal answer.</p>
| <p>I also found out that </p>
<pre><code>sp_depends <object_name>
</code></pre>
<p>will show you a lot of information about a table, including all triggers associated with it. Using that, along with Ray's query can make it much easier to find the triggers. Combined with this query from Ray's linked article:<... | <ol>
<li>Open Sybase Central and navigate to the triggers view.</li>
<li>Click on the "Object Name" column to sort. </li>
</ol>
<p>The "Object Name" column apparently shows the table associated with the trigger. Scroll down to the table you're interested in.</p>
| 41,165 |
<p>I knew ActionScript and ActionScript2 inside out, but I've been away from Flash for a couple years. What's the magnitude of becoming fluent in ActionScript3 and the new Flash functionality? From Colin Moock's blog, I heard that some of the fundamental movieclip methods have changed...</p>
| <p>You've probably already seen the <a href="http://livedocs.adobe.com/flex/3/langref/migration.html" rel="noreferrer">as2 -> as3 migration doc</a>?</p>
<p>Sure, some syntax has changed but if you know as2 well writing as3 won't be a problem at all. Some weird things may come up in the beginning with the syntax, but t... | <p>Actionscript3 is indeed far different in many ways, but it is important to realize that you are merely memorizing built-in packages, classes, properties, and methods as similar to learning prior versions. Some of the larger hurdles to get over are the Display list and events (event flow > Example: Bubbling). Much ... | 12,559 |
<p>Here is the directory layout that was installed with Leopard. What is the "A" directory and why the "Current" directory in addition to the "CurrentJDK"?</p>
<p>It seems like you can easily switch the current JDK by move the CurrentJDK link, but then the contents under Current and A will be out of sync.</p>
<pre>
... | <p>The (<code>A</code>, <code>Current</code> symbolic-linked to <code>A</code>) is part of the structure of a Mac OS X framework, which <code>JavaVM.framework</code> is. This framework may have C or Objective-C code in it, in addition to the actual JVM installations. Thus it could potentially be linked against from s... | <p>If you want to revert to an older JVM (here, 1.5), you can put the following in your <code>~/.profile</code> (or paste it into a specific Terminal window):</p>
<pre><code>export JAVA_HOME="/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/"
export PATH=$JAVA_HOME/bin/:$PATH
</code></pre>
| 18,251 |
<p>I am creating a component and want to expose a color property as many flex controls do, lets say I have simple component like this, lets call it foo_label:</p>
<pre>
<code>
<mx:Canvas>
<mx:Script>
[Bindable] public var color:uint;
</mx:Script>
<mx:Label text="foobar" color="{color}" ... | <p>Color is not a property, it is a style. You need to define the style like this:</p>
<pre><code>[Style(name="labelColor", type="uint", format="Color" )]
</code></pre>
<p>(enclose it in tag if you define it directly in MXML). You then need to add some ActionScript to handle this style and apply it to whichever cont... | <p>Here you are 2 of my utils functions:</p>
<pre><code> public static function convertUintToString( color:uint ):String {
return color.toString(16);
}
public static function convertStringToUint(value:String, mask:String):uint {
var colorString:String = "0x" + value;
... | 15,913 |
<p>What is the best was to evaluate an expression like the following:
<br />
(A And B) Or (A And C) Or (Not B And C)<br />
or<br />
(A && B) || (A && C) || (!B && C)<br /></p>
<p>At runtime, I was planning on converting the above expressions to the following:<br />
(True And False) Or (True An... | <p>If you're using .NET3.5 then you can parse the text and create an abstract sytax tree using the Expression classes. Then create a suitable LambdaExpression instance and compile it into a delegate, which you can then execute.</p>
<p>Constructing a parser and syntax tree builder for this kind of fairly simple grammer... | <p>You can write a simple interpreter/parser. Use something like <a href="http://www.antlr.org/" rel="nofollow noreferrer">ANTLR</a> and reuse existing grammars.</p>
| 45,575 |
<p>I am working with a PC based automation software package called Think'n'Do created by <a href="http://www.phoenixcontact.com" rel="nofollow noreferrer">Phoenix Contact</a> It does real time processing, read inputs/ control logic / write outputs all done in a maximum of 50ms. We have an OPC server that is reading/wri... | <p>It depends on how you have your OPC client configured to pull data. When you subscribe to a group in OPC, you get to specify a refresh rate. This might default to 1s or even 5s, depending on the OPC client. There's also a limit the OPC server might put on the frequency of updated data. This only applies if you h... | <p>Here are a few places to look: OPC Client configuration, OPC Client itself, OPC Server, or the PLC itself. </p>
<p>Here are things you should check:</p>
<ol>
<li>OPC Client configuration - The OPC Group you've added the OPC tags to should have a fast scan rate (ie. 100 ms to 1 sec depending on what you use it for... | 6,118 |
<p>I am still very new to Ruby (reading through the Pickaxe and spending most of my time in <code>irb</code>), and now that I know it's possible to patch classes in Ruby, I'm wondering when it's acceptable to do so, specifically whether it's acceptable to patch Ruby's base classes. For example: I answered another Ruby ... | <p>My personal answer, in a nutshell: <a href="http://avdi.org/devblog/2008/02/25/full-disclosure/" rel="noreferrer">the core-class patching hammer should be at the bottom of your toolbox</a>. There are a lot of other techniques available to you, and in almost all cases they are sufficient, cleaner, and more <a href="... | <p>I think its like this: If you honestly feel that most other programmers would agree with your patches, then fine. If not, perhaps you should instead be implementing a code library?</p>
| 29,549 |
<p>I've recently embarked upon the <em>grand voyage</em> of Wordpress theming and I've been reading through the Wordpress documentation for how to write a theme. One thing I came across <a href="http://codex.wordpress.org/Theme_Development" rel="nofollow noreferrer">here</a> was that the <code>style.css</code> file mu... | <p>Based on <a href="http://codex.wordpress.org/Theme_Development" rel="nofollow noreferrer">http://codex.wordpress.org/Theme_Development</a>:</p>
<p>The following is an example of the first few lines of the stylesheet, called the style sheet header, for the Theme "Rose":</p>
<pre><code>/*
Theme Name: Rose
Theme U... | <p>You are probably thinking about this:</p>
<pre><code>/*
THEME NAME: Parallax
THEME URI: http://parallaxdenigrate.net
VERSION: .1
AUTHOR: Martin Jacobsen
AUTHOR URI: http://martinjacobsen.no
*/
</code></pre>
<p>If I'm not way off, Wordpress uses this info to display in the "Activate Design" dialog in the admin back... | 11,234 |
<p>In order to improve performance reading from a file, I'm trying to read the entire content of a big (several MB) file into memory and then use a istringstream to access the information.</p>
<p>My question is, which is the best way to read this information and "import it" into the string stream? A problem with this ... | <p><code>std::ifstream</code> has a method <code>rdbuf()</code>, that returns a pointer to a <code>filebuf</code>. You can then "push" this <code>filebuf</code> into your <code>stringstream</code>:</p>
<pre><code>#include <fstream>
#include <sstream>
int main()
{
std::ifstream file( "myFile" );
i... | <p>This seems like premature optimization to me. How much work is being done in the processing. Assuming a modernish desktop/server, and not an embedded system, copying a few MB of data during intialization is fairly cheap, especially compared to reading the file off of disk in the first place. I would stick with wh... | 16,049 |
<p>I want to change the behavior of a JavaScript used to display a banner, coming from a central source.</p>
<p>Today I include a script-tag inline in code, like this:</p>
<pre><code><script type="text/javascript" src="http://banner.com/b?id=1234"></script>
</code></pre>
<p>But what that... | <p>Yes, you can override document.write. Prototyping is not necessary, you can do it directly on the document object itself. I do this commonly for analysing malware, but it could certainly be used to capture ad script output, as long as the ad script doesn't do any particularly convoluted processing that would turn up... | <p>Why not use jQuery? It has a DOM ready function:</p>
<pre><code>$.ready(function() {
});
</code></pre>
<p>Then you can easily manipulate an element using</p>
<pre><code>$("#div_id").html
</code></pre>
| 40,924 |
<p>How would you dynamically subscribe to a C# event so that given a Object instance and a String name containing the name of the event, you subscribe to that event and do something (write to the console for example) when that event has been fired?</p>
<p>It would seem using Reflection this isn't possible and I would ... | <p>You can compile expression trees to use void methods without any arguments as event handlers for events of any type. To accommodate other event handler types, you have to map the event handler's parameters to the events somehow. </p>
<pre><code> using System;
using System.Linq;
using System.Linq.Expressions;
u... | <p>Do you mean something like:</p>
<pre><code>//reflect out the method to fire as a delegate
EventHandler eventDelegate =
( EventHandler ) Delegate.CreateDelegate(
typeof( EventHandler ), //type of event delegate
objectWithEventSubscriber, //instance of the object with the matching method
e... | 6,777 |
<p>I'm trying to set up an enclosed (custom enclosure) Prusa i3 style printer for ABS, but having a fair amount of difficulty preventing the part corners from curling.</p>
<p><a href="https://i.stack.imgur.com/k9YT6.png" rel="nofollow noreferrer" title="Example of curling at part corners"><img src="https://i.stack.img... | <p>Adding 20mm mouse ears was sufficient to resolve the problem using the original extrusion / heatbed settings. I did not expect mouse ears to be required on the Benchy model, but given the lack of better advice it seems this may be a poorly documented "feature" of ABS.</p>
<p>Results on the original worst-case test... | <p>A tall skirt (like 1 cm tall or more, even as tall as the part) few millimetres from the part would shield the corners and the outer parts from colder air and keep the part temperature high, reducing curling. </p>
<p>It is in principle better than mouse ears, because these just pull the corners, which will still ha... | 1,280 |
<p>We are currently evolving our development processes in an effort to become CMMI compliant (we will start with level 2, and move up from there). We are trying to locate a tool that is inexpensive (or free) that will allow us to develop requirements in the spirit of CMMI. In other words, we need to be able to enter ... | <p>INCOSE is an excellent resource for this sort of question. They maintain a <a href="http://www.incose.org/ProductsPubs/products/toolsdatabase.aspx" rel="nofollow noreferrer">Tools Database</a> that indexes COTS and GOTS System Engineering tools. Some of the tools that perform requirements management also have high... | <p>We're heavily into CMMI at our company, but all of our tools are developed in-house.</p>
<p>All I can recommend is to develop your own tools. You will at least have the advantage that it will reflect your business process.</p>
<p>In general, for a new tool, we start off with a tool developed on a project, which is... | 23,547 |
<p>I am trying this:</p>
<pre><code>Provider=MSDASQL.1;Persist Security Info=False;User ID=sys;Password=pwd;Initial Catalog=DATABASE;Data Source=OdbcDataSource;DBA Privilege=SYSDBA
</code></pre>
<p>But I get the error:</p>
<pre><code>[Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
</code></pre>
<... | <p>You can't connect as SYSDBA using standard System.Data.OracleClient, as stated by this post : <a href="http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2245591&SiteID=1" rel="nofollow noreferrer">http://forums.microsoft.com/MSDN/ShowPost.aspx?PostID=2245591&SiteID=1</a>.</p>
<p>You can do that using OD... | <p>Oracle Connection string sample</p>
<p>You must have your Oracle SID defined in your TNSNames file. Which is the data source.</p>
<pre><code>Data Source=oracl;User Id=userID;Password=password;Integrated Security=no
</code></pre>
<p>If you are using Visual Studios you can add a data source in the Sever Explore an... | 21,628 |
<p>What's the best practice for making sure that certain ajax calls to certain pages are only accepted from authenticated users?</p>
<p>For example:</p>
<p>Let's say that I have a main page called <strong>blog.php</strong> (I know, creativity abounds). Let's also say that there is a page called <strong>delete.php</s... | <p>You were correct in trying to use session variables. Once your user authenticates, you should store that information in their session so that each subsequent page view will see that. Make sure you are calling <code>session_start()</code> on both pages (blog.php and delete.php) before accessing $_SESSION. Also mak... | <p>It is not recommended that you rely on sessions for authentication without taking additional actions.
<a href="http://shiflett.org/articles/the-truth-about-sessions" rel="nofollow noreferrer">Read more on</a>.</p>
| 3,618 |
<p>I think it would be interesting to get a programmers viewpoint on UI design.</p>
<p>What is your favorite User Interface that you have come across in a web application?</p>
<p>If possible, say a little bit about why you like it.</p>
| <p><a href="http://www.google.com" rel="nofollow noreferrer">http://www.google.com</a> is my favorite. Can be considered a "lack of UI" ;)</p>
| <p>The new Yahoo Mail UI blew me away when I first saw it. The keyboard shortcuts, drag 'n' drop, tabs, etc. really make it look and feel like a desktop app. Admittedly this quality of UI has become a lot more common on the web in the last few years, but for me at least, Yahoo Mail was the first web app in my experienc... | 27,945 |
<p>I have a code sample that gets a <code>SEL</code> from the current object, </p>
<pre><code>SEL callback = @selector(mymethod:parameter2);
</code></pre>
<p>And I have a method like </p>
<pre><code> -(void)mymethod:(id)v1 parameter2;(NSString*)v2 {
}
</code></pre>
<p>Now I need to move <code>mymethod</code> to ano... | <p>SEL is a type that represents a selector in Objective-C. The @selector() keyword returns a SEL that you describe. It's not a function pointer and you can't pass it any objects or references of any kind. For each variable in the selector (method), you have to represent that in the call to @selector. For example:</p>
... | <p>Beyond what's been said already about selectors, you may want to look at the NSInvocation class.</p>
<blockquote>
<p><em>An NSInvocation is an Objective-C message rendered static, that is, it is an action turned into an object. NSInvocation objects are used to store and forward messages between objects and between a... | 38,097 |
<p>I know this isn't really what XPath is for but if I have a HashMap of XPath expressions to values how would I go about building an XML document. I've found dom-4j's
DocumentHelper.makeElement(branch, xpath) except it is incapable of creating attributes or indexing. Surely a library exists that can do this?</p>
<pr... | <p>Here's a slightly different example, one with final reference-type fields rather than final value-type local variables:</p>
<pre><code>public class MyClass {
public final MyOtherObject obj;
}
</code></pre>
<p>Every time you create an instance of MyClass, you'll be creating an outgoing reference to a MyOtherOb... | <p>The only thing that I can think of is that the compiler might optimize away the final variables and inline them as constants into the code, thus you end up with no memory allocated.</p>
| 39,475 |
<p>I have some UserControls that I created in ProjectA. I have ProjectB that has a windows form that I want to put the controls on. Both of these projects are in a single solution. There's a reference to ProjectA from ProjectB so it can "see" the UserControls.</p>
<p>However, the UserControls do not show up in the ... | <p>Check this setting:</p>
<p>Tools > Options > Windows Forms Designer > General : AutoToolboxPopulate</p>
<p>It should be set to True for this to work.</p>
| <p>hello its answer Ctrl+Alt+X take this and later u have TOOLBOX :) </p>
| 36,655 |
<p>I'm writing some data acquisition software and need a gui plotting library that is fast enough to do realtime updated graphs. I've been using Nplot which is pretty good for a free library, but I'm wondering if there are any better libraries (preferably free or cheap).</p>
| <p>There's a good post about this <a href="http://weblogs.asp.net/gbarnett/archive/2008/06/03/visualising-data.aspx" rel="nofollow noreferrer">here</a> and <a href="http://weblogs.asp.net/gbarnett/archive/2008/03/23/free-graphing-libraries-for-net-my-thoughts.aspx" rel="nofollow noreferrer">here</a>. I have also used N... | <p>You might want to take a look at <a href="http://teethgrinder.co.uk/open-flash-chart/" rel="nofollow noreferrer">Open Flash Chart</a>. It's an open source graphing tool built in flash and can be dynamically updated.</p>
<p>Check out the <a href="http://teethgrinder.co.uk/open-flash-chart/gallery-js-2.php" rel="nofo... | 2,760 |
<p>I don't understand how GCC works under Linux. In a source file, when I do a:</p>
<pre><code>#include <math.h>
</code></pre>
<p>Does the compiler extract the appropriate binary code and insert it into the compiled executable OR does the compiler insert a reference to an external binary file (a-la Windows DLL... | <p>Well. When you include <code>math.h</code> the compiler will read the file that contains declarations of the functions and macros that can be used. If you call a function declared in that file (<em>header</em>), then the compiler inserts a call instruction into that place in your object file that will be made from t... | <p>The compiler is allowed to do whatever it pleases, as long as, in effect, it acts as if you'd included the file. (All the compilers I know of, including GCC, simply include a file called math.h.)</p>
<p>And no, it doesn't usually contain the function definitions itself. That's libm.so, a "shared object", similar to... | 43,083 |
<p>Hoping some of you TinyXML++ people can help me out. Really, since you recomended to me before I think you owe me ;)</p>
<p>I have the following code:</p>
<pre><code> //ticpp::Iterator< ticpp::Element > child( "SetPiece" );
ticpp::Iterator< ticpp::Node > child("SetPiece");
GLuint lc_SPieces =... | <p>just poking in the dark, i don't know tinyxml, but it seems that a dynamic_cast went wrong.
If you dynamic_cast<> a pointer, you get a NULL-pointer on failure. However, if you cast to a reference type, there is no concept of a NULL-reference, so the runtime throws this exception (or bad_type). <a href="http://m... | <p>Project -> Properties -> C/C++ -> Language -> Enable Run-Time Type Info</p>
| 31,854 |
<p>I will take the example of the SO site. To go to the list of questions, the url is www.stackoverflow.com/questions. Behind the scene, this goes to a controller (whose name is unknown) and to one of its actions. Let's say that this is <strong>controller=home</strong> and <strong>action=questions</strong>.</p>
<p>How... | <p>Different.</p>
<p>foreach iterates over a list and <strong>performs</strong> some operation with side effects to each list member (such as saving each one to the database for example)</p>
<p>map iterates over a list, <strong>transforms</strong> each member of that list, and returns another list of the same size with... | <p>ForEach tries to apply a function such as writing to db etc on each element of the RDD without returning anything back.</p>
<p>But the <code>map()</code> applies some function over the elements of rdd and returns the rdd. So when you run the below method it won't fail at line3 but while collecting the rdd after appl... | 46,249 |
<p>There are certain messages which i wish to display to the personal who is doing putty to a linux shell. How do i like configure some kind of welcome message when people login to the linux shell?</p>
| <p><a href="http://computing.vt.edu/infrastructure_services/vtaix/learning.html#4" rel="noreferrer">Message of the day</a>, /etc/motd</p>
<p>i.e. edit the /etc/motd text file</p>
| <p>Put some content in the file /etc/issue</p>
<p>Some more details in <a href="http://www.linuxfromscratch.org/blfs/view/svn/postlfs/logon.html" rel="nofollow noreferrer">http://www.linuxfromscratch.org/blfs/view/svn/postlfs/logon.html</a></p>
<hr>
<p>crap /etc/motd was the file i was trying to remember. Upvoting h... | 30,529 |
<p>Is there a PHP version of JavaScript's confirm() function?<br>
If not, what are my other options or how do I make something similar to the confirm()?</p>
| <p>Because PHP is a server-side language (all the PHP code is executed on the server, and the output of the code is sent to the client), you'd have to make an HTML form with OK/Cancel buttons that would submit to your PHP page. Something like this:</p>
<p>confirm.php:</p>
<pre><code><p>Are you sure you want to ... | <p>Using the same answer from the previous post adding some error treatment and safety:</p>
<pre><code><form action="page2.php" method="post">
Your choice: <input type="radio" name="choice" value="yes"> Yes <input type="radio" name="choice" value="no" /> No
<button type="submit">Send<... | 37,465 |
<p>More and more mobile devices are consuming content on my eCommerce sites. IPhones, Blackberries, PSPs, Windows Mobile, etc and I need some ideas how to handle repurposing my data using CSS templates for these devices. Any ideas would be great. </p>
| <p>I recommend you look at what Delta Airlines does with CSS at <a href="http://mobile.delta.com" rel="nofollow noreferrer">http://mobile.delta.com</a>. They get help from a company called MShift who does a bunch of mobile banking (which, obviously, has to work on many different devices).</p>
<p>You can get some insp... | <p>I would say keep it as simple as possible. Internet on phones can be 3g/wifi or as slow as you can possibly imagine. I would keep the test large so it's easier to read, and links easy to click if you are targeting a touch device. I would also say no to images unless they are 1kb or less.</p>
| 9,381 |
<p>The surfaces of my printed parts using PLA plastic look rough and uneven.</p>
<p>Would changing filament to a better one make any difference?</p>
<p>If not, what kind of methods can I use to achieve a smoother finish for my for 3D-printed objects?</p>
| <p><a href="https://en.wikipedia.org/wiki/Polylactic_acid">PLA</a> parts can be finished with a coat of epoxy like <a href="http://www.smooth-on.com/Epoxy-Coatings-XTC/c1397_1429/index.html">XTC-3D from Smooth-On</a>. This will smooth out the part and give it a pretty nice shine.</p>
<p>I've also had a fair amount of ... | <p>It is called <strong>Acetone Finishing</strong></p>
<p>Basically the 3D printed part stays in acetone vapor and the outer shell turns to smooth surface. I have heard that it works better with ABS. </p>
<p>This article shows how <em>with videos</em>:</p>
<ul>
<li>(<a href="https://ultimaker.com/en/community/10412-... | 89 |
<p>I'm trying to convert a VARIANT from VT_DATE to an <strong>invariant</strong> VT_BSTR. The following code works on Windows XP:</p>
<pre><code>VARIANT va;
::VariantInit(&va);
// set the variant to VT_DATE
SYSTEMTIME st;
memset(&st, 0, sizeof(SYSTEMTIME));
st.wYear = 2008;
st.wMonth = 9;
st.wDay = 22;
st.wH... | <p>This isn't really an answer, but changing a date to a string <em>isn't</em> a Locale-invariant task - it highly depends on the locale. In this case, I'd convert the Variant Time to System Time, then use a sprintf-style function to convert it to a string</p>
| <p>Not certain in your context here, but it seems maybe you're on the wrong path. Why not use <a href="http://msdn.microsoft.com/en-us/library/ms891320.aspx" rel="nofollow noreferrer">VarBstrFromDate</a>? This aloows using a locale (or optionally ignoring one) and is probably far closer to what you want.</p>
| 14,129 |
<p>I know a question like this was already asked, but the situation is a little different, and all the answers on that problem didn't work for me.</p>
<p>I'm trying to compile some C code in VS2008 and it doesn't create an exe. Also, when I try to run it with f5, I get:</p>
<blockquote>
<p>This application has fail... | <p>It sounds like either a problem with your VS2008 installation, or something wrong with your DLL search path. MSVCR90.DLL is installed when you install VS2008, you shouldn't have to install any additional redistributable packages.</p>
<p>First I would check your PATH environment variable and make sure there is no go... | <p>If you give the finished exe to someone else they will need to install the latest visual c runtime to run it. This will only work for release build AFAIK. Visual studio should install the required runtime both release and debug into your path. The project probably has an additional dependency accidently set for an i... | 37,448 |
<p>I would like to know if I can open 2 different diagrams using MS Visio and each diagram have its own window. I've tried in several ways, but I always end up with 1 Visio window ...</p>
<p>I'm using a triple monitor setup and I'd like to put one diagram to each side of my main monitor.</p>
<p>[]'s</p>
<p>André Cas... | <p>This allows you to open two or more instances of Visio so that you can view different Visio docs at the same time without going through the process to stretch the Visio window across two screens. I found this to be a simpler method and a bit easier to manipulate. If it doesn't work on your first try recheck the regi... | <p>Seems like my installation of Visio is the problem. I've tried on another computer here and it allow me to open 2 instances of the software.</p>
| 5,052 |
<p>I've just started developing in Silverlight 2 and have not run into any "missing parts" of .Net that I was using in the full version. Have you found anything to be missing from Silverlight 2's version of .Net that (1) you missed, (2) really needed, or (3) had to abandon Silverlight 2 because it was missing?</p>
| <p>Do your tables have primary keys? LINQ to SQL won't allow you to change the data if it doesn't have a key to use. I've run into that a lot with legacy systems. A lot of the time the table is using a defacto key, but it's not specifically set up in the database. In those cases, you can just mark the field as primary ... | <p>If you right-click on the table in the designer and choose properties, the Delete, Insert and Update are grayed out. I am not sure if you can supply alternate Delete, Insert and Update methods...</p>
<p>But if your question is about inserting, updating and deleting values in your tables, once you drag a table onto... | 44,953 |
<p>Under Windows Server 2003, Enterprise Edition, SP2 (/3GB switch not enabled)</p>
<p>As I understand it, and I may be wrong, the maximum addressable memory for a process is 4GB. </p>
<p>Is that 2GB of private bytes and 2GB of virtual bytes? </p>
<p>Do you get "out of memory" errors when the private byte limit or v... | <p>It is correct that the maximum address space of a process is 4GB, in a sense. Half of the address space is, for each process, taken up by the operating system. This can be changed with the 3GB switch but it might cause system instability. So, we are left with 2GB of addressable memory for the process to use on its o... | <p>Mark Russinovich started a series of posts on this..
<a href="http://blogs.technet.com/markrussinovich/archive/2008/07/21/3092070.aspx" rel="nofollow noreferrer">Pushing the Limits of Windows: Physical Memory</a></p>
<p>While 4GB is the licensed limit for 32-bit client SKUs, the effective limit is actually lower an... | 24,670 |
<p>I would like to execute <code>ls</code> in a Perl program as part of a CGI script. For this I used <code>exec(ls)</code>, but this does not return from the <code>exec</code> call.</p>
<p>Is there a better way to get a listing of a directory in Perl?</p>
| <p>Exec doesn't return at all. If you wanted that, use system.</p>
<p>If you just want to read a directory, open/read/close-dir may be more appropriate.</p>
<pre><code>opendir my($dh), $dirname or die "Couldn't open dir '$dirname': $!";
my @files = readdir $dh;
closedir $dh;
#print files...
</code></pre>
| <p>I would recommend you have a look at <a href="http://perldoc.perl.org/IPC/Open3.html" rel="nofollow noreferrer">IPC::Open3</a>. It allows for far more control over the spawned process than system or the backticks do.</p>
| 25,132 |
<p>I have a line color property in my custom grid control. I want it to default to <code>Drawing.SystemColors.InactiveBorder</code>. I tried:</p>
<pre><code>[DefaultValue(typeof(System.Drawing.SystemColors), "InactiveBorder")]
public Color LineColor { get; set; }
</code></pre>
<p>But it doesn't seem to work. How do I... | <p>You need to change first argument from <code>SystemColors</code> to <code>Color</code>.<br>
It seems that there is no type converter for the <code>SystemColors</code> type, only for the <code>Color</code> type.</p>
<pre><code>[DefaultValue(typeof(Color),"InactiveBorder")]
</code></pre>
| <p>According to the link Matt posted, the DefaultValue attribute doesn't set the default value of the property, it just lets the form designer know that the property <em>has</em> a default value. If you change a property from the default value it is shown as bold in the properties window.</p>
<p>You can't set a defaul... | 6,529 |
<p>There is a UNIQUE database constraint on an index which doesn't allow more than one record having identical columns.</p>
<p>There is a piece of code, managed by Hibernate (v2.1.8), doing two DAO <BR>
<code>getHibernateTemplate().save( theObject )</code><BR>
calls which results two records entered into the table me... | <p>You could try flushing the hibernate session in between the two saves. This may force Hibernate to perform the first update before the second insert.</p>
<p>Also, when you say that hibernate is inserting NULL with the insert, do you mean every column is NULL, or just the ID column?</p>
| <p>I have no experience in Hibernate, so I don't know if you are free to change the DB at your will or if Hibernate requires a specific DB structure you cannot change.</p>
<p>If you can make changes then you can use this workaround in MSSQL tu emulate the ANSI behaviour :</p>
<p>drop the unique index/constraint</p>
... | 16,060 |
<p>I have the following regex expression to match html links:</p>
<pre><code><a\s*href=['|"](http:\/\/(.*?)\S['|"]>
</code></pre>
<p>it kind of works. Except not really. Because it grabs everything after the < a href...
and just keeps going. I want to exclude the quote characters from that last \S match. Is ... | <p>I don't think your regex is doing what you want.</p>
<pre><code><a\s*href=['|"](http:\/\/(.*?)\S['|"]>
</code></pre>
<p>This captures anything non-greedily from http:// up to the first non-space character before a quote, single quote, or pipe. For that matter, I'm not sure how it parses, as it doesn't seem ... | <p>Why are you trying to match HTML links with a regex?</p>
<p>Depending on what you're trying to do the appropriate thing to do would vary.</p>
<p>You could try using an HTML Parser. There are several available, there's even one in the Python Library: <a href="https://docs.python.org/library/htmlparser.html" rel="no... | 37,280 |
<p>I'm using lucene in my project.
Here is my question:
should I use lucene to replace the whole search module which has been implemented with sql using a large number of <code>like</code> statement and accurate search by id or sth,
or should I just use lucene in fuzzy search(i mean full text search)?</p>
| <p>Probably you should use lucene, unless the SQL search is very performant.</p>
<p>We are right now moving to Solr (based on Lucene) because our search queries are inherently slow, and cannot be sped up with our database.... If you have reasonably large tables, your search queries will start to get really slow unless... | <p>I don't think using <strong>like</strong> statement abusively is a good idea.
And I believe the performance of lucene will be better than database.</p>
| 14,519 |
<p>I'm just getting into unit testing, and have written some short tests to check if function called isPrime() works correctly.</p>
<p>I've got a test that checks that the function works, and have some test data in the form of some numbers and the expected return value.</p>
<p>How many should I test? How do I decide ... | <p>You'd want to check edge cases. How big a prime number is your method supposed to be able to handle? This will depend on what representation (type) you used. If you're only interested in small (<em>really</em> relative term when used in number theory) primes, you're probably using int or long. Test a handful of ... | <p>A few questions, the answers may inform your decision:</p>
<ul>
<li>How important is the correct functioning of this code?</li>
<li>Is the implementation of this code likely to be changed in the future? (if so, test more to support the future change)</li>
<li>Is the public contract of this code likely to change in ... | 39,444 |
<p>I'm working on a setup which <em>wants to include the Microsoft.Web.Services3 (WSE 3.0) DLL</em>. However, I typically do not like including Microsoft DLL's in our installs except by way of Microsoft's redistributables. There is both a developer and a redist install package available from Microsoft.</p>
<p>So, as a... | <p>Usually, redistributing any of Microsoft DLLs outside of the redistributable package is forbidden by their EULA, so you might first want to check the appropriate EULA for that DLL.</p>
<p>Generally, I would prefer the redist package since that makes sure that it's correctly "registered" into the system, i.e. if you... | <p>If you don't include it you should at the very least link to it directly on your site or have your installer open the web browser to it (or even download it automatically). Or better yet, include the redistributable in your software package.</p>
<p>However, if the DLL is not very large and you suspect that few use... | 3,842 |
<p>in context of SQL Server 2005, I have a table for which the primary key is a uniqueidentifier (GUID), with a default value generated by the newid() function. I want to write a stored procedure that inserts a new record into the table. How do I get the record's PK value? for an identity-declared field, this is easy -... | <p>I would generate a new Guid prior to inserting the record, and explicitly use this new Guid as the PK for the record. You then use that guid after the insert, knowing that it refers to the row you have just inserted, e.g.</p>
<pre><code>DECLARE @newGuid uniqueidentifier
SET @newGuid = newid()
INSERT INTO myTable(i... | <p>You can return it as row by using <code>SELECT</code> statement or use <code>OUTPUT</code> parameter if it's one row at a time.</p>
| 44,147 |
<p>I have one website on my server, and my IIS Worker Process is using 4GB RAM consistently. What should I be checking?</p>
<pre><code>c:\windows\system32\inetsrv\w3wp.exe
</code></pre>
| <p>I would check the CLR Tuning Section in the <a href="http://msdn.microsoft.com/en-us/library/ms998583.aspx#scalenetchapt17_topic9" rel="noreferrer">document</a> Gulzar mentioned.</p>
<p>As the other posters pointed out, any object that implements <code>IDispose</code> should have <code>Dispose()</code> called on it ... | <p>As other people noted common cause of this problem is resource leaking, also there is a known issue with win2k3 server and IIS6 <a href="http://support.microsoft.com/kb/916984" rel="nofollow noreferrer">KB916984</a></p>
| 30,481 |
<p>Further to my previous question about the <a href="https://stackoverflow.com/questions/165383/optimal-raid-setup-for-sql-server">Optimal RAID setup for SQL server</a>, could anyone suggest a quick and dirty way of benchmarking the database performance on the new and old servers to compare them? Obviously, the proper... | <p>Measure the performance of your application itself with the new and old servers. It's not necessarily easy:</p>
<ul>
<li>Set up a performance test environment with your application on (depending on your architecture this may consist of several machines, some of which may be able to be VMs, but some of which may not... | <p>you can always insert, read, and delete a couple of million rows - it's not a realistic mix of operations but it should strain the disks nicely...</p>
| 21,886 |
<p>I am using UIImagePicker to take photo and save the photo. But appears the photo it takes was truncated on top and bottom, which was top and bottom menu when UIImagePicker taking the photo. I am wondering how to take the whole screen of the photo.</p>
<p>Thanks.</p>
| <p>The UIImagePicker crops all images to 320x320 if you allow editing. If you want something sized differently, you'll have to look at the original image and the cropping rect, both in the editingInfo dictionary you get back from the picker. Once you have those, you can resize or re-crop as needed.</p>
| <p>Look in the "editingInfo" dictionary that you get back in the didFinishPickingImage: method, if there's a value for the @"Original" key then it's the real, uncropped image (stored as a UIImage object).</p>
<p>From there you can look at the other editingInfo values to see if the user cropped that image, which you ca... | 30,186 |
<p>I have asp.net form that contains fields. When I access this window, my javascript functions can access the fields via the DOM with the getElementById() method and when I postpack to the server I am receiving the updates made by the client.</p>
<p>However, when I launch the form as a child window using Telerik's ... | <p>To get the ID of your asp.net control do something like this:</p>
<pre><code><%= theControl.ClientID %>
</code></pre>
<p>getElementByName is not as commonly used as getElementById. The ID attribute is supposed to be unique for each element on the page whereas the name attribute can be duplicated.</p>
| <p>I use getElementsByName for checkboxes within the same group.</p>
<p>As for the control's ID, TonyB has the right idea, but make sure you refer to the ClientID property in the PreRender event handler, because if you do it too early in the page life cycle, it will not be available yet).</p>
| 24,272 |
<p>I need to get UTF-8 working in my Java webapp (servlets + JSP, no framework used) to support <code>äöå</code> etc. for regular Finnish text and Cyrillic alphabets like <code>ЦжФ</code> for special cases.</p>
<p>My setup is the following:</p>
<ul>
<li>Development environment: Windows XP</li>
<li>Production environm... | <p><em>Answering myself as the FAQ of this site encourages it. This works for me: </em></p>
<p>Mostly characters äåö are not a problematic as the default character set used by browsers and tomcat/java for webapps is latin1 ie. ISO-8859-1 which "understands" those characters.</p>
<p>To get UTF-8 working under Java+Tom... | <p>In case you have specified in connection pool (mysql-ds.xml), in your Java code you can open the connection as follows:</p>
<pre><code>DriverManager.registerDriver(new com.mysql.jdbc.Driver());
Connection conn = DriverManager.getConnection(
"jdbc:mysql://192.168.1.12:3308/mydb?characterEncoding=greek",
"Myu... | 16,816 |
<p>Some programs read the company name that you entered when Windows was installed and display it in the program. How is this done? Are they simply reading the name from the registry?</p>
| <p>If you want the registered company name as entered in the registry, you can get it from:</p>
<pre><code>HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\RegisteredOrganization
</code></pre>
<p>Using the Registry class you can do something along these lines:</p>
<pre><code>string org = (string)Micro... | <p>I don't like to have text-y registry calls in my business code, and I'm not a fan of utility classes, so I wrote an extension method that gets the company name from the registry.</p>
<pre><code>using Microsoft.Win32;
namespace Extensions
{
public static class MyExtensions
{
public static string Com... | 34,284 |
<p>I have a producer-consumer pattern working for one product. What is the best implementation when the producer produce many products? For example a DataBaseEvent, GuiEvent and ControlEvent that the consumer shall consume. The code below shows the pattern for one product (a DataBaseEvent). Should each event type be en... | <p>Multiple queues would be useful if you want to actively separate the work - i.e. have different threads/pools for different types of event. If you want to share the load, there is another option - use an interface (rather than a base-class). Base-class is fine, but I can't think of anything that would mandate a base... | <p>I think that it would be better enqueue all of the request to one queue if they have the same priority and will be handled in similar way. </p>
<p>If one of the requests has higher probability, then either you need some fancy priority queue or you can use different queues.</p>
<p>Also, if you process the messages ... | 37,713 |
<p>What is the slowest (therefore best) hash algorithm for passwords in ASP Classic?</p>
<p>EDIT: For those unaware, when hashing passwords, slower hashes are preferred to faster to help slow rainbow table style attacks. </p>
<p>EDIT2: And yes, of course speed isn't the only valid concern for hash selection. My quest... | <p>A lot of people seem to be beating on the question-asker because he's looking for a slow hash function. Actually, all other aspects being equal, a slower hash function is more secure than a fast one. This is because a slower hash function results in <strong>slower generation of rainbow tables</strong> and <strong>sl... | <p>psuedocode for the slowest method:</p>
<pre><code>function hashPassword(password)
sleep for 10 seconds
return password
end function
</code></pre>
<p>This certainly isn't the most secure (or at all) but it's slow...</p>
<p>(I'm just pointing out that making it slower is not the answer...)</p>
| 31,620 |
<p>Say we are creating Acme CMS. This CMS web application will allow you to create an unlimited number of categories with sub-categories (unlimited depth), and each category can have 0+ content pages associated with it.</p>
<p>So this project, at a high level will have: </p>
<p><em>Front End</em>
1. index page
2. ... | <p>"I am thinking of breaking each section (front end/ admin panel) down into individual pages, then writing simple user stories for each page (or theme)."</p>
<p>Pages don't have stories. Users have stories. Pages are a thing you build to implement the user story.</p>
<p>The Theme -- if there is one for something ... | <p>The "unlimited" part is broken... even GMail has an upper limit... </p>
<p>Edit: Although my answer got downvoted I think it is right. As soon as you talk with non-programmers the "unlimite" parts become very dangerous, and will likely stab you in the back. Also you can't really have a scalable data schema for unli... | 39,078 |
<p>For example, I hate typing things like:</p>
<pre><code>$x = mysql_escape_string(stripslashes($_GET['x']));
</code></pre>
<p>Is there a way to alias those two functions in init.php or something without writing a separate function that takes one argument and returns that argument with those functions applied to it?<... | <p>This should do the trick :</p>
<pre><code>// Macros
$mes = "mysql_escape_string";
$ss = "stripslashes";
// Using your macros
$x = $mes($ss($_GET['x']));
</code></pre>
<p>Though I don't recommend coding like this at all. </p>
<p>I'm just answering the question since you said you didn't want to create any new func... | <p>"easily", sure? "elegantly", nope.</p>
| 41,318 |
<p>I would like to know if it is possible to copy/move files to a destination based on the origin name.</p>
<p>Basically, I have a /mail folder, which has several subfolders such as cur and new etc. I then have an extracted backup in /mail/home/username that is a duplicate. mv -f will not work, as I do not have permis... | <p>For copying, you should consider using <code>cpio</code> in 'pass' mode (<code>-p</code>):</p>
<pre><code>cd /mail; find . -type f | cpio -pvdmB /home/username/mail
</code></pre>
<p>The <code>-v</code> is for verbose; <code>-d</code> creates directories as necessary; <code>-m</code> preserves the modification time... | <p>I'm not entirely clear on what it is that you want to do, but you could try the following:</p>
<pre><code>for file in /mail/*; do
mv -f $file /home/username/mail/$(basename $file)
done
</code></pre>
<p>This will move every file and subdirectory in /mail from there into /home/username/mail.</p>
| 47,418 |
<p>I'm working on a module for a CMS. This module is distributed as a class library DLL.</p>
<p>I have several utility libraries I'd like to use in this module. Is there anyway I can link these libraries statically so I won't have to distribute several DLL's (thereby distributing my utility libraries separately)?</p>
... | <p>You can merge your many DLLs with ILMERGE:</p>
<p><a href="http://research.microsoft.com/~mbarnett/ILMerge.aspx" rel="noreferrer">http://research.microsoft.com/~mbarnett/ILMerge.aspx</a></p>
<p>Haven't tried it myself. Hope it helps.</p>
<hr>
<p>Download here:<br />
<a href="http://www.microsoft.com/downloads/de... | <p>The short answer for this is no!
You can not link in a dll during compilation.
I don't know if there is some subtle way to do this, but you would probably have to distribute the dlls along with your cms.
The best way to do this is to make some kind of re-distributable.</p>
| 6,019 |
<p>I'm really interested in speech-to-text algorithms, but I'm not sure where to start studying up on them. A bunch of searching around led me to <a href="http://cslu.cse.ogi.edu/HLTsurvey/download.html" rel="noreferrer">this</a>, but it's from 1996 and I'm fairly certain that there have been improvements since then.</... | <p>This is a HUGE questions, I wouldn't know how to begin... So let me just try giving you the right "terms" so you can refine your quest:</p>
<p>First, understand that Speech Recognition is a diverse and complicated subject, and it has many different applications. People tend to map this domain to the first thing tha... | <p>What platform are you targeting ?. There is <a href="http://www.microsoft.com/speech/speech2007/default.mspx" rel="nofollow noreferrer">Microsoft Speech APIs</a> that you can use if its for windows. </p>
| 3,561 |
<p>I have searched the internet and found various 3D printers with different advantages and materials which they can print - some even multi color. </p>
<p>However, I cannot seem to find a printer that can print multiple material with different properties; for instance, simultaneously printing PLA and metal. Is there... | <p>Yes and no.</p>
<blockquote>
<p>for instance simultanious printing of plas plastic and lets say metal. Is such a printer available or in development ?</p>
</blockquote>
<p>Practically speaking, no. Metal printing requires significantly higher temperatures than plastic, and the two processes are so incompatible ... | <p>For the most part, you can achieve this with a dual extruding printer. However, dual extrusion is best for either multi-color printing or printing with support material. For example, printing the part with PLA and all support material with water soluble PVA.</p>
<p>In practice, printing two completely different mat... | 182 |
<p>Given a columns' index, how can you get an Excel column name?</p>
<p>The problem is trickier than it sounds because it's <strong>not just base-26</strong>. The columns don't wrap over like normal digits would. Even the <a href="http://support.microsoft.com/kb/833402" rel="nofollow noreferrer">Microsoft Support Examp... | <p>The answer I came up with is to get a little recursive. This code is in VB.Net:</p>
<pre class="lang-vb prettyprint-override"><code>Function ColumnName(ByVal index As Integer) As String
Static chars() As Char = {"A"c, "B"c, "C"c, "D"c, "E"c, "F"c, ... | <p>I enjoy writing recursive functions, but I don't think it's necessary here. This is my solution in VB. It works up to column ZZ. If someone can tell me if it works for AAA to ZZZ that would be nice to know.</p>
<pre><code>Public Function TranslateColumnIndexToName(index As Integer) As String
'
Dim remainder As Inte... | 38,018 |
<p>I would like to implement a sliding notification bar as the one in Firefox or IE for my java application. But I don't want to reinvent the wheel and I'm sure someone out there has already done it and is willing to share.
Do you know any open-source implementation of this in java/swing?</p>
| <p>There's an example in <a href="https://rads.stackoverflow.com/amzn/click/com/0596009070" rel="nofollow noreferrer" rel="nofollow noreferrer">Swing Hacks</a> called "Slide Notes Out from the Taskbar" that seems pretty close to what you want (there's a <a href="http://books.google.com/books?id=oNbFfcyAtv4C&pg=PA24... | <p>A standard way to do it is to use <a href="http://docs.oracle.com/javase/7/docs/api/java/awt/TrayIcon.html" rel="nofollow noreferrer">Swing TrayIcon API</a>. That would probably be the most convenient way too :)</p>
| 36,982 |
<p>Our web application renders fast in some IE browsers, slow in others... It seems to be an HTML rendering problem... The first 10% of the page displays immediately, the last 90% takes up to 10 seconds, and this is static content. I've run with firefox/yslow, renders very quickly. Seems to be isolated to some user... | <p>Use Fiddler to look at the times to load images, css, js files, etc. In other words, is caching a problem? Javascript can definitely cause issues in different browser versions. There's lots of optimizations you find in some versions that aren't in others. Also, make sure your html is well-formed xhtml if possibl... | <p>Steve Souders gives an excellent presentation on 14 (simple) steps to improve the performance of your web pages:</p>
<p><a href="http://developer.yahoo.net/blogs/theater/archives/2007/08/steve_souders_high_performance.html" rel="nofollow noreferrer">http://developer.yahoo.net/blogs/theater/archives/2007/08/steve_so... | 26,089 |
<p>I have a problem with classic ASP. The encoding is wrong when I send data with <code>XMLHttp.send</code>. The response is a PDF file, but the “ÆØÅ” gets wrong, the “Ø” is read as “øy” for example. It’s like it’s a converting mistake from UTF-8 to ISO-8859-1, but it should be ISO-8859-1 now. I have <code><%@COD... | <p>Try:</p>
<pre><code>Session.CodePage = 28591
</code></pre>
<p>There is some good information <a href="http://devlibrary.businessobjects.com/BusinessObjectsXIR2/en/en/RAS_SDK/rassdk_com_doc/doc/rassdk_com_doc/BestPractices11.html" rel="nofollow noreferrer">here</a>, and I got the CodePage number <a href="http://sup... | <p>AFAIK this is a known problem with WinHttpReq / XMLHTTPRequest, hope someone proves me wrong.</p>
| 42,905 |
<p>Can someone explain the main benefits of different types of references in C#?</p>
<ul>
<li>Weak references</li>
<li>Soft references</li>
<li>Phantom references</li>
<li>Strong references.</li>
</ul>
<p>We have an application that is consuming a lot of memory and we are trying to determine if this is an area to foc... | <p>Soft and phantom references come from Java, I believe. A long weak reference (pass true to C#'s WeakReference constructor) might be considered similar to Java's PhantomReference. If there is an analog to SoftReference in C#, I don't know what it is.</p>
<p>Weak references do not extend the lifespan of an object, ... | <p>Brilliant real example with WeakReference is explained in <a href="http://developer.android.com/training/displaying-bitmaps/process-bitmap.html" rel="nofollow noreferrer">Android development tutorial</a>.</p>
<p>There is an image (Bitmap) and image container on the view (ImageView). If image will be loaded not from ... | 40,034 |
<p>We currently have developed an application using WCF. Our clients make connections to different WCF servicehosts located on the server, and the servicehosts return the data from the DB that the clients need. Standard model. However, this current design has all of our WCF data in app.config files both on the client s... | <p>Please look at using the <a href="http://search.cpan.org/dist/WWW-Mechanize/" rel="noreferrer">WWW::Mechanize</a> module for this. It will fetch your web pages for you, and then give you easy-to-work with lists of URLs.</p>
<pre><code>my $mech = WWW::Mechanize->new();
$mech->get( $some_url );
my @links = $me... | <p>We can use regular expression to extract the link with its link text. This is also the one way.</p>
<pre><code>local $/ = '';
my $a = <DATA>;
while( $a =~ m/<a[^>]*?href=\"([^>]*?)\"[^>]*?>\s*([\w\W]*?)\s*<\/a>/igs )
{
print "Link:$1 \t Text: $2\n";
}
__DATA__
<a href="http:... | 31,726 |
<p>I have a class called myClass which defines post() and get() methods. </p>
<p>From <em>index.html</em>, I have a form with an action that calls myClass.post() which grabs some data from the data base, sets a couple variables and sends the user to <em>new.html</em>. </p>
<p>now, <em>new.html</em> has a form which c... | <p>What you're talking about is establishing a "session". That is, a way to remember the user and the state of their transaction.</p>
<p>There are several ways of tackling this, all of which rely on techniques for remembering that you're in a session in the first place.</p>
<p>HTTP provides you no help. You have to... | <p>I don't know specifically about the google app engine, but normally, here's what happens:</p>
<p>The server would have some kind of thread pool. Every time an http request is sent to the server, a thread is selected from the pool or created.</p>
<p>In that thread an instance of some kind of controller object will ... | 46,739 |
<p>I have done a bit of testing on this myself (During the server side processing of a DWR Framework Ajax request handler to be exact) and it seems you CAN successfully manipulate cookies, but this goes against much that I have read on Ajax best practices and how browsers interpret the response from an XmlHttpRequest. ... | <p>XMLHttpRequest always uses the Web Browser's connection framework. This is a requirement for AJAX programs to work correctly as the user would get logged out if the XHR object lacked access to the browser's cookie pool. </p>
<p>It's theoretically possible for a web browser to simply share session cookies without us... | <p>Manipulating cookies on the client side is rather the opposite of "best practice". And it shouldn't be necessary, either. HttpOnly cookies weren't introduced for nothing.</p>
| 11,507 |
<p>I have a directory full of files and I need to pull the headers and footers off of them. They are all variable length so using head or tail isn't going to work. Each file does have a line I can search for, but I don't want to include the line in the results.</p>
<p>It's usually </p>
<pre><code>*** Start (more text... | <p>Try the <a href="http://perldoc.perl.org/perlop.html#Range-Operators" rel="nofollow noreferrer">flip flop!</a> ".." operator.</p>
<pre><code># flip-flop.pl
use strict;
use warnings;
my $start = qr/^\*\*\* Start/;
my $finish = qr/^\*\*\* Finish/;
while ( <> ) {
if ( /$start/ .. /$finish/ ) {
nex... | <p>Maybe? Start to Finish with not-delete.</p>
<pre><code>$ sed -i '/^\*\*\* Start/,/^\*\*\* Finish/d!' *
</code></pre>
<p>or...less sure of it...but, if it works, should remove the Start and Finish lines as well:</p>
<pre><code>$ sed -i -e '/./,/^\*\*\* Start/d' -e '/^\*\*\* Finish/,/./d' *
</code></pre>
<p><code>... | 37,897 |
<p>I'm using the DnsQueryConfig Win32 function to get the DNS servers used by Windows. This works fine for IPv4 addresses, but what if the DNS servers have IPv6 addresses?</p>
| <p>I could not find an API in MSDN, but I did find this line command:</p>
<blockquote>
<p><a href="http://msdn.microsoft.com/en-us/library/aa916844.aspx" rel="nofollow noreferrer">IPv6 dp6dns</a></p>
</blockquote>
| <p>Which version of Windows do you mean?</p>
<p>At least in Windows XP, there's no support for querying DNS servers over IPv6 transport, so the question is moot.</p>
<p>I don't know whether that's fixed in Vista.</p>
| 24,007 |
<p>I have a very large database table in PostgresQL and a column like "copied". Every new row starts uncopied and will later be replicated to another thing by a background programm. There is an partial index on that table "btree(ID) WHERE replicated=0". The background programm does a select for at most 2000 entries (LI... | <p>How about adding a new table to store this replicated value (and a primary key to link each record to the main table). Then you simply add a record for every replicated item, and delete records to remove the replicated flag. (Or maybe the other way around - a record for every non-replicated record, depending on whic... | <p>I think it's better to change your postgres to version 8.X. probably the cause is the low version of Postgres. Also try this query below. I hope this can help. </p>
<pre><code>UPDATE table1 SET name = table2.value
FROM table2
WHERE table1.id = table2.id;
</code></pre>
| 13,741 |
<p>I'm having problems refreshing .Net 2.0 with IIS 6.</p>
<p>I have been able to successfully execute "aspnet_regiis.exe -i", but when I try to register the aspnet_isapi.dll:</p>
<pre><code>regsvr32 “C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll"
</code></pre>
<p>I get the error</p>
<bl... | <p>In the end, I think the problem was caused by a step that is missed by the script when you refresh ASP.Net 2.0 with IIS 6.</p>
<p>I managed to resolve this using the following steps:</p>
<ul>
<li><p>Refresh the install using <code>C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis -s /w3svc/1/root</code><... | <p>When you get the error, it means either:</p>
<p>1 The DLL does not need to be registered</p>
<p>or</p>
<p>2 The DLL is corrupt</p>
| 12,419 |
<p>I was wondering if anyone here had some experience writing this type of script and if they could give me some pointers.</p>
<p>I would like to modify this <a href="http://wordaligned.org/articles/a-subversion-pre-commit-hook" rel="nofollow noreferrer">script</a> to validate that the check-in file does not have a Ca... | <p>I think you can avoid a commit hook script in this case by using the <code>svn:eol-style</code> property as described in the SVNBook:</p>
<ul>
<li><p><a href="http://svnbook.red-bean.com/en/1.7/svn.advanced.props.file-portability.html#svn.advanced.props.special.eol-style" rel="nofollow noreferrer">End-of-Line Chara... | <p>What exactly are you trying to do?</p>
<p>Of course, there are numerous places to learn about svn pre-commit hooks (e.g. <a href="http://wordaligned.org/articles/a-subversion-pre-commit-hook" rel="nofollow noreferrer"> here </a>, <a href="http://www.windley.com/archives/2008/08/using_a_precommit_hook_to_check_puppe... | 7,103 |
<p><b><a href="http://www.javafx.com/" rel="noreferrer">JavaFX 1.0</a></b> was released on Thursday, Dec. 4. </p>
<p>As a developer, what do you think of JavaFX? In your workplace, do you have any plans to move forward with JavaFX-based apps or websites? Do you have near-term plans to learn JavaFX?</p>
| <p>JavaFX is the only open RIA platform, so I believe it will catch up with competition sooner or later.</p>
<p>It looks pretty good for 1.0 version. Demos are well documented and offer everything I need. </p>
<p>There are some problems of course. Java applet seems improved a little, but it's still way behind. Loadin... | <p>As far as I can tell JavaFX is falling flat on it's face. I've looked at the demos and example source code and I'm not impressed. JavaFX has an uphill battle to compete with Adobe and Silverlight which have already been in the wild for some time. Note that I'm a long time Java developer. </p>
| 45,985 |
<p>I have been adding dependency injection to my code because it makes by code much easier to Unit test through mocking.</p>
<p>However I am requiring objects higher up my call chain to have knowledge of objects further down the call chain.</p>
<p>Does this break the Law of Demeter? If so does it matter?</p>
<p>for ... | <p>Dependency Injection CAN break the Law of Demeter. If you force consumers to do the injection of the dependencies. This can be avoided through static factory methods, and DI frameworks.</p>
<p>You can have both by designing your objects in such a way that they require the dependencies be passed in, and at the sam... | <p>Depends :-)</p>
<p>I think the top answer is not correct , even with a framework a lot of code uses Dependency injection and injects high level objects. You then get spaghetti code with lots of dependencies. </p>
<p>Dependency injection is best used for all the stuff that would pollute your object model eg an ... | 19,355 |
<p>I'm using NHibernate on a project and I need to do data auditing. I found <a href="http://www.codeproject.com/KB/cs/NHibernate_IInterceptor.aspx" rel="nofollow noreferrer">this article</a> on codeproject which discusses the IInterceptor interface.</p>
<p>What is your preferred way of auditing data? Do you use dat... | <p>For NHibernate 2.0, you should also look at <a href="http://knol.google.com/k/fabio-maulo/nhibernate-chapter-11/1nr4enxv3dpeq/14#view" rel="noreferrer">Event Listeners</a>. These are the evolution of the IInterceptor interface and we use them successfully for auditing.</p>
| <p>I prefer the CodeProject approach you mentioned.</p>
<p>One problem with database triggers is that it leaves you no choice but to use Integrated Security coupled with ActiveDirectory as access to your SQL Server. The reason for that is that your connection should inherit the identity of the user who triggered the c... | 3,671 |
<p>Programming PHP in Eclipse PDT is predominately a joy: code completion, templates, method jumping, etc.</p>
<p>However, one thing that drives me crazy is that I can't get my lines in PHP files to word wrap so on long lines I'm typing out indefinitely to the right.</p>
<p>I click on Windows|Preferences and type in ... | <p>This has really been one of the most desired features in Eclipse. It's not just missing in PHP files-- it's missing in the IDE. Fortunately, from Google Summer of Code, we get this plug-in <a href="http://ahtik.com/blog/projects/eclipse-word-wrap/" rel="noreferrer">Eclipse Word-Wrap</a></p>
<p>To install it, add th... | <p>It's a known enhancement request. <a href="https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779" rel="noreferrer">Bug 35779</a></p>
| 12,316 |
<p>What firefox plugins could you not live without, as relates to webdev?</p>
<p>My list would be:</p>
<ul>
<li><a href="https://addons.mozilla.org/en-US/firefox/addon/3227" rel="nofollow noreferrer">DBGBar</a></li>
<li><a href="https://addons.mozilla.org/nl/firefox/addon/6622" rel="nofollow noreferrer">Dom Inspector... | <p><a href="http://getfirebug.com/" rel="noreferrer">Firebug</a> is the main one I use.</p>
| <ul>
<li>Web Developer</li>
<li>Firebug</li>
<li>Delicious</li>
</ul>
<p>Might also add Page Validator</p>
| 45,310 |
<p>I am fairly new to WPF. I want to develop a datagrid control which supports databinding.</p>
<p>There is a lot of information available about databinding to existing controls, but I cannot find any information how to develop a control from scratch which supports databinding. </p>
<p>I do not expect a simple answer... | <p>Are you planning to build a DatGrid control?. There is one here <a href="http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14963" rel="nofollow noreferrer">http://www.codeplex.com/wpf/Release/ProjectReleases.aspx?ReleaseId=14963</a></p>
<p>Binding is one of the important features of WPF, Dependancy... | <p>Thanks for the answer.</p>
<p>Yes, when I said 'grid' I meant a 'datagrid'. I edited the question to make this more clear.</p>
<p>The article on MSDN main describes how to use databinding, and does not say too much what you have to do if you want to develop a WPF-control which supports databinding.</p>
| 23,968 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.