input stringlengths 51 42.3k | output stringlengths 18 55k |
|---|---|
Vimdiff current line compare <p>In Beyond Compare, the line you currently have selected is compared on top of each other at the bottom of the window. Is there any way to accomplish this in vimdiff?</p>
| <p>Short answer No. </p>
<p>Vim does not have a built in way to do that. You would have to write a plugin that would split two more windows on the bottom, re-size them to 1 line. I tried doing it manually but it didn't keep one of the windows in sync while scrolling.</p>
<p>My work around is to use <code>CTRL-W J</co... |
How do you change the owner of a database in sql? <p>In management studio you can see the owner under properties but it won't let you change it. My guess is there's some stored procedure to change it and you can't do it through the gui.</p>
| <p>Surpisingly, it's called <a href="http://msdn.microsoft.com/library/ms178630.aspx"><code>sp_changedbowner</code></a>.</p>
<p>You can actually change it in <code>SQL Server Management Studio</code> under <code>Database / Properties / Files</code></p>
|
What Class for Serializable Multidimensional Arrays? <p><strong><em>EDIT: See Below</em></strong></p>
<p>I have a web service which uses a class of functions in order to return data used in various business processes (via InfoPath). </p>
<p>One of the functions takes a given SQLCommand object and executes it into a ... | <p>If your code knows the schema of the returned data before the call, then you should return data in the same shape. Have a struct or class with properties of the appropriate type for each column of the returned data. For each row, create an instance of such a struct, and fill in the properties from the returned colum... |
Winforms &TimeSpan - Which control works best? <p>I am building a form with winforms - and should add a view and editable time span value.
Which controls works best for this ?</p>
<p>A normal edit control shows the value correctly -> but it's not really nice for changing values </p>
<p>the normal date time picker doe... | <p>I built one that had a TextBox coupled with a ComboBox to choose the units. The user control had range settings (value +-) and (time units). Based on the units picked, the text box was ranged checked - e.g., 1-7 days might be valid but if units were minutes, 1-60 minutes might be better.</p>
<p>I've done combinat... |
Mac OS X equivalent for TerminateProcess(GetCurrentProcess,0); <p>I am looking for a simple and uncatchable way to terminate the Mac port of my C++ application. In Windows I was using</p>
<pre><code>TerminateProcess(GetCurrentProcess, 0);
</code></pre>
<p>What's the equivalent command I can use with Mac OS X / XCode ... | <p>Actually you want <code>_exit</code> if you want to have the same semantics as <code>TerminateProcess</code>. <code>exit</code> semantics are more closely aligned with <code>ExitProcess</code>.</p>
|
Inconsistent browser caching of session variables - any solutions? <p>Hi all<br />
Why are my session variables being dropped here?</p>
<p>I submit a form using the submit button and create session variables of the values to allow them to be carried to other pages. All's fine. If I now move back and forward between th... | <p>Your session variables are not lost. Rather, what's happening is that, when going back, none of the browsers will reload the form from your server (with the defaults filled in from the session variables.) Some browsers, however, will be nice about it and remember themselves what values the form fields last had whe... |
How can I tail a remote file? <p>I am trying to find a good way to tail a file on a remote host. This is on an internal network of Linux machines. The requirements are:</p>
<ol>
<li><p>Must be well behaved (no extra process laying around, or continuing output)</p></li>
<li><p>Cannot require someone's pet Perl module... | <p>Have you tried</p>
<pre><code>ssh -t remotemachine <some command>
</code></pre>
<p>-t option from the ssh man page:</p>
<pre><code> -t Force pseudo-tty allocation. This can be used to execute
arbitrary screen-based programs on a remote machine, which
can be very useful, e.g. when imp... |
Using an ASP.NET server control in a SQL Server 2005 reporting .rdl file <p>How would I embed an ASP.NET server control on a SQL Server 2005 Reporting file (.rdl)? </p>
<p>I am using the design view to accomplish my task.</p>
| <p>Last time I checked you can't. You're limited to code that generates images, like bar codes.</p>
|
Silverlight Development - Service URL while developing locally <p>What is the correct pattern or method for developing a Silverlight application (which is the Silverlight project and Web Application in a single solution)? I mean, how do you add the Service Reference if the localhost port number will be constantly chang... | <p>Like this one:
<a href="http://forums.silverlight.net/forums/t/19021.aspx" rel="nofollow">http://forums.silverlight.net/forums/t/19021.aspx</a></p>
<p>Do not rely on the URL set in the ServiceReference.ClientConfig. Set your URL in the code. Change your WebSerivice Calling code to the following:</p>
<pre><code> ... |
What allows a Windows authentication username to work (flow) between 2 servers? <p>Typical ISP setup. One server is the web server, another is the DB SQL server. There is a local administrator account, let's say XYZ, created on both machines. So when I log in remotely, I am either WebServer\XYZ or DBServer\XYZ, depe... | <p>You <code>XYZ</code> accounts seem to have same passwords on both machines, and they are not a part of a domain.</p>
<p><code>WebServer</code> sends just <code>XYZ</code> as a username and answers all password challenges successfuly, as the passwords do match.</p>
<p><code>DbServer</code>, of course, thinks of you... |
Linq to Sql - Select from 1:Many <p>I'm new to using Linq and just started a side project to learn some of the basics. I'm currently using Linq to Sql and all my DB Table relationships worked very well. Currently I have a Client table and a Project table. Each Client can have 1 or more Projects. Therefore, as you'd exp... | <p>To get the client which has the specific project ID:</p>
<pre><code>var client = (from u in db.Clients
where u.id == Convert.ToInt32(Session["ClientID"]) &&
u.Projects.Any(x=>x.id == projectID)
select u).SingleOrDefault();
</code></pre>
<p>To get the proj... |
Can I protect my ASP.NET application against decompilers? <ol>
<li>I know also that ASP.NET when published can be precompiled</li>
<li>I know that .NET applications are compiled to MSIL that are easily reverted to any .NET language through tools like Red Gate's .NET Reflector. </li>
<li>I want to develop and deliver an... | <p>In my experience people who are obfuscating their code donât produce code that is worth the trouble.</p>
|
How do I calculate the average direction of two vectors <p>I am writing and opengl based iphone app and would like to allow a user to translate around a view based on the direction that they move two fingers on the screen. For one finger I know I could just calculate the vector from the start position to the current po... | <p>Vector math works just like you think:</p>
<pre><code>v3 = (v1 + v2)/2
// so:
v3.x = (v1.x + v2.x) / 2;
// same for Y and Z
</code></pre>
|
C#: Casting types dynamically <p>I currently have this type of code:</p>
<pre><code>private void FillObject(Object MainObject, Foo Arg1, Bar Arg2)
{
if (MainObject is SomeClassType1)
{
SomeClassType1 HelpObject = (SomeClassType1)MainObject;
HelpObject.Property1 = Arg1;
HelpObject.Proper... | <p>It looks like both of the types you care about implement the same two properties. In that case, what you want to do is define an interface for those properties:</p>
<pre><code>public interface IMyInterface
{
public Foo Property1 {get; set;}
public Bar Property2 {get;set;}
}
</code></pre>
<p>Then, make sure ... |
Good resources for learning visual studio DSL tools? <p>Can anyone recommend any good resources (online or books) for learning how to use visual studio's domain specific language tools? I know the msdn site has some pretty good walk-throughs/tutorials but I am looking for something more detailed.</p>
| <p>I found the DSL tools lab found <a href="http://code.msdn.microsoft.com/DSLToolsLab">here</a> to be quite useful. You might also find the book "Domain-Specific Development with Visual Studio DSL Tools" (<a href="http://rads.stackoverflow.com/amzn/click/0321398203">here</a>) useful as well.</p>
<p>Finally, it has b... |
How can I install a certificate into the local machine store programmatically using c#? <p>I have a certificate generated via MakeCert. I want to use this certificate for WCF message security using PeerTrust. How can I programmatically install the certificate into the "trusted people" local machine certificate store ... | <p>I believe that this is correct:</p>
<pre><code>X509Store store = new X509Store(StoreName.TrustedPeople, StoreLocation.LocalMachine);
store.Open(OpenFlags.ReadWrite);
store.Add(cert); //where cert is an X509Certificate object
store.Close();
</code></pre>
|
Dynamic/Conditional SQL Join? <p>I have data in a MSSQL table (TableB) where [dbo].tableB.myColumn changes format after a certain date... </p>
<p>I'm doing a simple Join to that table.. </p>
<pre><code>Select [dbo].tableB.theColumnINeed from [dbo].tableA
left outer join [dbo].tableB on [dbo].tableA.myColumn = [dbo].... | <pre><code>SELECT [dbo].tableB.theColumnINeed
FROM [dbo].tableA
LEFT OUTER JOIN [dbo].tableB
ON [dbo].tableA.myColumn =
CASE
WHEN [dbo].tableA.myDateColumn <= '1/1/2009' THEN FormatColumnOneWay([dbo].tableB.myColumn)
ELSE FormatColumnAnotherWay([dbo].tableB.myColumn)
END
</code></pre>
|
BufferedImage Rotation <p>What is the best way of rotating a bufferedimage about its center where the gradient is 1 degree?</p>
<p>I know there is AffineTransform, but that causes shearing and weird stretching or black spots that should be blank.</p>
<p><em>edit</em> The sizes of images I am dealing with are icon siz... | <p>The quality of rotation for such a small angle will vary greatly with the size of the image. How big is your image?</p>
<p>[After the OP edited the question to indicate the size of the image]</p>
<p>IMO the image is too small for any meaningful rotation other than in multiples of 90 degrees (assuming its a square)... |
c# Threads and display update <p>I have a Windows Form with a label and a picture box. To retreive an image from a web service I use a thread.</p>
<p>The user click on a button and first the label must be displayed and then new thread is started to retrieve the image. This is the code:</p>
<pre><code>private void men... | <p>The question is unclear, but by using Invoke, you are defeating the purpose of having the image request on a separate thread. (You might notice that your interface becomes unresponsive while the request is happening)</p>
<p>Instead, it is better to create a new thread object, start it, and then use the Invoke to s... |
Why are .NET app.config load rules different for win2k3? <p>...and are there any other caveat for other platforms?</p>
<p>I create an app.config for a win forms project, for example Application.exe.</p>
<p>By default I expect that at runtime my application is going to look for a file called Application.exe.config.</p... | <p>I don't have the details at hand, but I believe a service pack or point version of the .NET Framework allowed <code>ExeName.config</code> to be an option, and that is now still supported for backward compatibility, but more recent service packs have returned to defaulting to <code>ExeName.exe.config</code> for all s... |
Assign on-click VBA function to a dynamically created button on Excel Userform <p>I'm creating buttons dynamically on an Excel userform with the following code:</p>
<pre><code>With Me.CurrentFrame.Controls.Add("Forms.CommandButton.1")
.Caption = "XYZ"
.name = "AButton"
.Font.Bold = True
.ForeColor = &a... | <p>You need to dynamically create code / event handlers for each button.</p>
<p>It take a bit of doing - see here: <a href="http://www.cpearson.com/excel/vbe.aspx" rel="nofollow">http://navpadexcel.blogspot.com/2006/11/httpwwwcpearsoncomexcelvbehtm.html</a></p>
<p>A better way might be to create a bunch of buttons on... |
Flex databinding a function <p>Does anyone know how to programmatically bind a property to a function that isn't a getter? IE: I have a function that returns a translated string based on the identifier you pass it. How do I do this in AS3 rather than MXML? (reason being - I have a dynamic layout that I render based on... | <p>You can call a setter function using <code>BindingUtils.bindSetter()</code>. You can use this to call a setter function that calls your translation function and sets the return value to a specified place. Unfortunately you can't dynamically specify the host of the setter like you can with <code>BindingUtils.bindProp... |
Delegates: Predicate Action Func <p>Can someone provide a good explanation (hopefully with examples) of these 3 most important delegates:</p>
<ul>
<li>Predicate</li>
<li>Action</li>
<li>Func</li>
</ul>
<p>What other delegates should a C# developer be aware of?</p>
<p>How often do you use them in production code?</p>... | <ul>
<li><p><code>Predicate</code>: essentially <code>Func<T, bool></code>; asks the question "does the specified argument satisfy the condition represented by the delegate?" Used in things like List.FindAll.</p></li>
<li><p><code>Action</code>: Perform an action given the arguments. Very general purpose. Not use... |
Expose webservice information to SCOM / WMI <p>What would be the best way to expose information from an ASP.NET webservice to SCOM or WMI? I'm interested in basically exposing performance information so the service can be monitored: ie. get a metric of calls processed per hour, total calls per day, etc.</p>
<p><stron... | <p>You'll need to write a WMI provider to expose info to WMI - there's <a href="http://www.codeproject.com/KB/system/WMIProviderExtensions.aspx" rel="nofollow">an example on CodeProject</a>. An alternative, possibly simpler, would be to expose some custom performance counters as outlined <a href="http://www.ondotnet.co... |
Sorting a list based on string case <p>How can I sort a List by order of case e.g.</p>
<ul>
<li>smtp:user@domain.com</li>
<li>smtp:user@otherdomain.com</li>
<li>SMTP:user@anotherdomain.com</li>
</ul>
<p>I would like to sort so that the upper case record is first in the list e.g SMTP:user@anotherdomain.com.</p>
| <p>You can use StringComparer.Ordinal to get a case sensitive sorting:</p>
<pre><code> List<string> l = new List<string>();
l.Add("smtp:a");
l.Add("smtp:c");
l.Add("SMTP:b");
l.Sort(StringComparer.Ordinal);
</code></pre>
|
Is PHP allowed to modify .htaccess file in current folder? <p>I have a PHP web app located on <strong>shared hosting</strong>.
My goal is to modify .htaccess file from PHP code when the PHP page is running.
I need that .htaccess to insert a couple of mod_rewrite lines into it.</p>
<p>The problem is that on Windows+Apa... | <p>This seems like an overly-complex solution to just having a general "load category" page that takes the category name from the URL and loads the corresponding ID.</p>
<p>For example, if the URL is:</p>
<pre><code>http://yoursite.com/category/programming
</code></pre>
<p>I would remap that to something like:</p>
... |
NHibernate - What kind of association(s) is this? <p>I'm having some trouble getting NH to persist my object graph.</p>
<p>I have (something like) this:</p>
<pre><code>/*Tables*/
TABLE Parent
ParentID PK
LastEventID NULL
TABLE Event
EventID PK
ParentID FK NOT NULL
</code></pre>
<p><hr /></p>
<pre><code>//... | <p>Without seeing your mapping schema, I'll have to guess.</p>
<p>Are you cascading your updates? From the <a href="http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html/manipulatingdata.html#manipulatingdata-graphs" rel="nofollow" title="NHibernate Reference">reference</a>:</p>
<blockquote>
<p>To sav... |
C++ linker problem with wrapper <p>I have a library opengl.lib which contains wrapper functions to all opengl functions. The functions are declared in their own namespace so that the wrapper functions can be named with the same name as the opengl functions. So inside a wrapper function, opengl function is called with :... | <p>Are your wrappers thin enough that they are being inlined?</p>
|
Ajax Script Manager and Master Pages <p>I'm building a new website and want to use Ajax controls.</p>
<p>Do I need to put a ScriptManager control on both the MasterPage and on each content page? or Just on the MasterPage?(or just on the content page?)</p>
| <p>Content pages or MasterPages can only have one ScriptManager control on them. If you have a ScriptManager control on your MasterPage, you can drop a ScriptManagerProxy control onto your content pages to use any given specific ASP.NET AJAX functionality like this, for example:</p>
<pre><code><asp:Content ID="Con... |
Tools to reduce risk regarding password security and HDD slack space <p>Down at the bottom of <a href="http://www.schneier.com/essay-148.html" rel="nofollow">this essay</a> is a comment about a spooky way to beat passwords. Scan the entire HDD of a user including dead space, swap space etc, and just try everything that... | <p>I don't understand your first question (do you want to modify the file system? Why? Isn't this dead space exactly where you want to look?)</p>
<p>Anyway, <a href="http://phihag.de/2009/so/hddpass.c" rel="nofollow">here's an example of such a tool</a>:</p>
<pre><code>#include <stdio.h>
#include <alloca.h&g... |
Web programming: Get rid of Javascript or convince me to dive into this mess <p>I'm looking for alternatives to client side Javascript in web programming, because for me this language just plain sucks. I mean I am indeed impressed of the capabilities jquery or other javascript-frameworks accomplish, but for myself prog... | <p>Javascript is an awesome beast when tamed. Learn it and love it. :)</p>
<p>I'm also not quite sure what your experiences are with jQuery, but I am a big fan of it because it lets you do what you want to do very, very, easily. Just hang in there.</p>
|
Asp.Net Absolute Path of a URL <p>To make it simpler for a webapp to share files with another app on a different server, I'm using a base href tag in my master page. As many people have discovered, this breaks webform paths. I have a working Form Adaptor class but am not sure how to get the absolute path of the url. ... | <p>I have used this in the past:</p>
<pre><code>// Gets the base url in the following format:
// "http(s)://domain(:port)/AppPath"
HttpContext.Current.Request.Url.Scheme
+ "://"
+ HttpContext.Current.Request.Url.Authority
+ HttpContext.Current.Request.ApplicationPath;
</code></pre>
|
How to reload user profile from script file in PowerShell <p>I want to reload my user profile from a script file. I thought that dot sourcing it from within the script file would do the trick, but it doesn't work:</p>
<pre><code># file.ps1
. $PROFILE</code></pre>
<p>However, it does work if I dot source it from Power... | <p>If you want to globally refresh your profile from a script, you will have to run that script "dot-sourced". </p>
<p>When you run your script, all the profile script runs in a "script" scope and will not modify your "global" scope. </p>
<p>In order for a script to modify your global scope, it needs to be "dot-sou... |
Detecting overwriting of ruby test methods <p>If you write a test class like</p>
<pre><code>class MyTest < Test::Unit::TestCase
def setup
end
def test_1
flunk
end
def test_1
assert true
end
end
</code></pre>
<p>the first test_1 is ignored. Although it looks like a stupid mistake, it can h... | <p>You can take advantage of Ruby's <code>method_added</code> that gets called anytime a method is added to a class. You should be able to can something into a module that you include, but here is a simple example of doing it inside your test class.</p>
<pre><code>class MyTest < Test::Unit::TestCase
@@my_tests ... |
Google image search <p>In C#, how can I extract the URL's of any images found when performing a search with Google? I'm writing a little app to get the artwork for my ripped cd's. I played around with the Amazon service but found the results I received were erratic. I can't be bothered to learn the whole Amazon API jus... | <p>Try using the HTML Agility Pack. It works wonders on scraping content.</p>
<p>It lives <a href="http://www.codeplex.com/htmlagilitypack" rel="nofollow">here</a> on Codeplex.</p>
<p>I used it to scrape a <a href="http://www.chrisballance.com/so" rel="nofollow">user ranking list</a> from so.com, and loved it.</p>
... |
Repeated Keyword Value in JSON <p>On <a href="http://json.org" rel="nofollow">JSON.org</a> the essential data structures that JSON represents are given as </p>
<ol>
<li>A collection of name/value pairs, and </li>
<li>An ordered list of values.</li>
</ol>
<p>I have not been able to find anywhere whether a second membe... | <p>JSON is simply a subset of the object literal notation of JavaScript and as such, is constrained by the same rules - the latest value for repeated keys will override any previously assigned value for that key, within the specific object. Think in terms of assigning a value to an object property; A later assignment ... |
Best practice when using multiple libraries with overlapping classes <p>Consider the task: </p>
<ol>
<li>Read a polygon from a KML file using library A </li>
<li>Intersect it with another polygon using library B </li>
<li>Calculate its area using library C</li>
</ol>
<p>Each library has it's own Polygon class, and... | <p>I would either choose one polygon class and only use that class or build my own Polygon class to store all of them in.</p>
<p>At any rate, make sure your namespaces are aptly named so that you can differentiate between the two.</p>
<p>Why not merge the duplicated functionality?</p>
|
What is the fastest way to copy my array? <p>I'm doing some Wave file handling and have them read from disk into an array of bytes. I want to quickly copy portions from this byte array into another buffer for intermediate processing. Currently I use something like this:</p>
<pre><code>float[] fin;
byte[] buf;
//fill ... | <p>There is also:</p>
<pre><code>Array.Copy
Array.CopyTo
</code></pre>
<p>but whether these will be faster will require profiling.</p>
<p><em>But be warned</em> about focusing on micro-optimisations to the extent you miss the big picture, on modern PCs the effect of multi-level memory caching is likely to be greater... |
Regular expression to get text inside parenthesis <p>I'm looking at a string and trying to get everything inside the pair of brackets.
The contents may change and the max and min may not exist in certain cirumstances.</p>
<pre><code>get(max(fieldname1),min(fieldname2),fieldname3)where(something=something) sort(fieldna... | <p>You better use a parser such as:</p>
<pre><code>$str = 'get(max(fieldname1),min(fieldname2),fieldname3)where(something=something) sort(fieldname2 asc)';
$array = array();
$buffer = '';
$depth = 0;
for ($i=0; $i<strlen($str); $i++) {
$buffer .= $str[$i];
switch ($str[$i]) {
case '(':
$... |
Problem running Java .war on Tomcat <p>I am following the tutorial here: </p>
<p><a href="http://nutch.sourceforge.net/docs/en/tutorial.html" rel="nofollow">http://nutch.sourceforge.net/docs/en/tutorial.html</a></p>
<p>Crawling works fine, as does the test search from the command line. </p>
<p>When I try to fire u... | <p>In Java, applications sometimes rely on third party libraries. In this case, it appears that your Tomcat installation does not include one such library. Judging by the error you received, it appears that you are missing the <a href="http://commons.apache.org/logging/" rel="nofollow">Apache Commons Logging</a> librar... |
jQuery Flexigrid Resize columns in IE7 broken <p>In firefox, column resizing works fine. But in ie7, it's broken. </p>
<p><a href="http://markmail.org/message/dyv44u5fjhgylu2r?q=ie7+resize+column+list:com.googlegroups.flexigrid" rel="nofollow">Here's a thread</a> about flexigrid broken from jquery 1.3, I've tried the ... | <p>IE7 requires the following at the top of the page:</p>
<pre><code><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http:// www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
</code></pre>
|
Can you create more than one element of a list at a time with a list comprehension in haskell? <p>So, for example, say I had a list of numbers and I wanted to create a list that contained each number multiplied by 2 and 3. Is there any way to do something like the following, but get back a single list of numbers instea... | <p>I find that extending the list comprehension makes this easier to read:</p>
<pre><code>[ m | n <- [1..5], m <- [2*n,3*n] ]
</code></pre>
<p>It might be helpful to examine exactly what this does, and how it relates to other solutions. Let's define it as a function:</p>
<pre><code>mult lst = [ m | n <- lst... |
Permissions for web site users <p>I'm working on a web site where each user can have multiple roles/permissions such as basic logging in, ordering products, administrating other users, and so on. On top of this, there are stores, and each store can have multiple users administrating it. Each store also has it's own set... | <p>This is probably obvious to you by now, but <a href="http://en.wikipedia.org/wiki/Role-based_access_control" rel="nofollow">role based access control</a> is <em>hard</em>. My suggestion is, don't try to write your own unless you want that one part to take up all the time you were hoping to spend on the 'cool stuff'.... |
How can I create a Windows application that can run with a GUI *or* as a Windows service in C#? <p>I'd like to create an application using C# that...: </p>
<ul>
<li><p>Can be run as a Windows application, with a GUI (it'll indicate progress, status, etc.)</p>
<p>OR</p></li>
<li><p>Can be run as a Windows service, wit... | <p>I'm doing something similar to what you're asking for. I have programmed it so that if you send the command line parameter "/form" to the executable, it will pop up a windows form instead of running as a service.</p>
<p>As far as running the background job itself, in both cases you will need to do some sort of thr... |
Querying full DNS record <p>I do alot of programming in *nix using C gcc. I know how to do a basic gethostbyname(). BUt what if I wanted to pull down the entire DNS record. More to the point, is there a function that I'm missing that allows you to specify the specific record that you want to pull? Or will I need to... | <p>No, there is no such function in standard C or POSIX (and even the gethostbyname function, contrary to what you may think, is not a function for querying DNS - it can use any other way to get the address, like /etc/hosts or mDNS, whatever).</p>
<p>You might want to look at some DNS-specific libraries, like <a href=... |
CSS layout problem <p>At the top of <a href="http://chaletsdesbouleaux.com/" rel="nofollow">this webpage</a>, there are two elements in the main content area (white background): an image and a logo box.</p>
<p>The logo box is floated right and the image has a right-margin which is sufficiently large to accomodate the ... | <p>The css <code>min-width</code> property does what you want. Doesn't work in IE 6, though. For that some JavaScript can help out if it's really necessary.</p>
<p>Set the white DIV's <code>min-width</code> to the size of the image + the border.</p>
|
Submitting Data via GET with "Snoopy" in PHP <p>I'm trying to send data to a url via <code>GET</code> in PHP. I've decided to go with the <a href="http://sourceforge.net/projects/snoopy/" rel="nofollow">Snoopy Class</a> after receiving an answer to another question here. The thing is, I cannot seem to find very good do... | <pre class="lang-php prettyprint-override"><code>$vars = array( "fname" => "Jonathan", "lname" => "Sampson" );
$snoopy = new Snoopy();
$snoopy->httpmethod = "GET"; // is GET by default
$snoopy->submit( "http://www.example.com", $vars );
print $snoopy->results;
</code></pre>
|
Tips for profiling misbehaving Emacs Lisp? <p>I customize Emacs a lot. Recently, I added something to my .emacs configuration that sporadically pegs my CPU at 100%, but I really don't know what it is. </p>
<p>If I press C-g a bunch of times, eventually I'll get a message <em>below</em> the minibuffer asking me if I wa... | <p>The suggestion of setting <code>debug-on-quit</code> to <code>t</code> so that you can find out what Emacs is up to is a good one. You can think of this as being a form of sampling profiling with a single sample: often a single sample is all you need.</p>
<hr>
<p><strong>Update:</strong> Starting with version 24.3... |
Upgrading Reporting Services RLD 2005 --> 2008 <p>I ran the solution conversion for a bunch of reports I maintain, but a handful (about half a dozen) failed to convert. I managed to convert some by hand, but some are different enough that changing the RDL by hand is difficult. Is there a better way to fix these repor... | <p>Did you try to open those file into SQL Server Business Intelligence Development Studio and save it again ?</p>
|
What is the complexity of finding median and doing counts in MySQL? <p>I would like to know what the complexity of the following two operations are. The first case is a count where I order by a column that I have an index on and ask for the count of all values below or above a certain number like this:</p>
<pre><code>... | <p>The <code>ORDER BY</code> clauses are unnecessary - or confusing, or both.</p>
<p><code>SELECT COUNT(*)</code> will return a single row (normally). Because you have a criterion on the search, the optimizer may have to do an index scan of col1 (if there is an index with col1 as the leading column of the index), or ... |
Python-like list unpacking in C#? <p>In python, I can do something like this:</p>
<pre><code>List=[3, 4]
def Add(x, y):
return x + y
Add(*List) #7
</code></pre>
<p>Is there any way to do this or something similar in C#? Basically I want to be able to pass a List of arguments to an arbitrary function, and have t... | <p>Well, the closest would be reflection, but that is on the slow side... but look at <a href="http://msdn.microsoft.com/en-us/library/a89hcwhh.aspx">MethodInfo.Invoke</a>...</p>
|
SQL script to aggregate column values <p>i'd appreciate some help putting together a sql script to copy data from one table to another. essentially what i need to do for each row in the source table is aggregate the column values and store them into a single column in the target table.</p>
<pre><code>TableA: ID, Colu... | <p>Here is a row-by-row processing example. This will provide you the results in a way where you can process each row at a time. Or you can use TableC at the end and do whatever processing you need to do.</p>
<p>However, it would be a lot faster if you added an extra column to TableB (Called TableA_ID) and just INSE... |
Get the diff of two MSWord doc files and output to html <blockquote>
<p><strong>Possible Duplicate:</strong><br>
<a href="http://stackoverflow.com/questions/90075/how-to-compare-two-word-documents">How to compare two word documents?</a> </p>
</blockquote>
<p>How can you get the diff of two word .doc documents p... | <p>Use this option in Word 2003: </p>
<blockquote>
<p><strong>T</strong>ools | Compare and Merge <strong>D</strong>ocuments</p>
</blockquote>
<p>Or this in Word 2007: </p>
<blockquote>
<p><strong>R</strong>eview | Co<b>m</b>pare</p>
</blockquote>
<p>It prompts you for a file with which to compare the file you... |
Loading C# form into ActiveX control <p>Is it possible loading C# form (or C# application) into ActiveX control? I know how to load ActiveX control to C# form.... </p>
| <p>You can call a .Net form in VB6 (with Interop Forms Toolkit 2.0), and you can use VB6 to create an ActiveX so my guess is that it is possible.</p>
<p>I have also heard of ppl used forms created from .net-dlls and den using setparent-api and got it to act as a child to vb6-form.</p>
<p>All in all, yes it seems poss... |
How to give entry in the where clause when we use it in webpages? <p>According to the user's input I want to select the record from the database. This is my code:</p>
<p><code><pre>
<%
String jempid=request.getParameter("empid");
out.println(jempid);
int intempid=1223;
Connection conn=null;
String url="jdbc:mysql:/... | <p>It's a bad idea to construct SQL using string concatenation - you're just opening yourself up to a SQL injection attack -- ESPECIALLY considering that you're getting the value of "empid" directly from the request. Yikes!</p>
<p>A better approach is use a parametrized query such as below:</p>
<pre><code>PreparedSt... |
AWK - My regexp won't respect case <p>I'm running Ubuntu 8.04 and my code looks like this...</p>
<pre><code> for (i=1;i<=n;i++)
{
if (arr[i] ~ /^[A-Z]{2,4}$/) printf(arr[i])
}
</code></pre>
<p>I quickly discovered that the {n} expression won't work in gawk without the --posix switch. Once enabled the expressio... | <p>The expression itself works for me:</p>
<pre><code>dfs:~# gawk --posix '/^[A-Z]{2,4}$/ {print "Yes"}'
AAAA
Yes
AA
Yes
TT
Yes
tt
YY
Yes
yy
</code></pre>
<p>Your problems may be caused by two things. Either you accidentally set the <code>IGNORECASE</code> awk variable or otherwise turned of <a href="http://www.gnu.o... |
Which linux distribution fits a new learner of linux programming? <p>As I come up with linux ,I found the commands are different in OpenSuse and Ubuntu.</p>
<p>Which of them is suitable to somebody who was new in linux and want to master the command</p>
<p>needed when programming and using linux?</p>
| <p>I got the impression that OpenSuSE did some things a little unconventionally (kdesu, gksu), but it's a fine (KDE) distro. I've found (K)Ubuntu is a little better for beginners since it has access to huge compiled package repositories, plus <a href="http://ubuntuforums.org/" rel="nofollow">the community</a> is unbea... |
How do I use different Fields in the same column in a DataGridView <p>I have a, probably unique situation in which I need to use a single column for two different alternating values.</p>
<p>My data has seperate columns for date and time. Not my choice, I have to live with it. Rows are displayed in "pairs" Row 1 and... | <p>If you have control over the data feed coming into your system, say a SQL Stored Procedure, what about something like this?</p>
<pre><code>SELECT
ROWID AS 'ID'
, MYDATE + MYTIME AS 'MYDATETIME'
FROM
MYTABLE
</code></pre>
<p>If you don't have control over the data source, I'd recommend using the on Row_Da... |
Possible memory leak? <p>Okay, so I have two classes, call them A and B--in that order in the code. Class B instantiates class A as an array, and class B also has an error message char* variable, which class A must set in the event of an error. I created a third class with a pure virtual function to set the errorMessag... | <p>It seems scary that you:</p>
<ul>
<li>Mix dynamic memory with static string constants ("No errors.") in the same pointer.</li>
<li>Use an explicit <code>while</code>-loop to compute the string's length; have you not heard of <code>strlen()</code>?</li>
<li>Use such low-level C-like string processing, for no good re... |
Where to start as the new programmer working on a project <p>What process you guys follow when you join a new team/product or new job and start working on project there? There could be different answers :</p>
<ul>
<li>Start reading documentations.</li>
<li>Start debugging code.</li>
<li>Start fixing bugs.</li>
<li>Sta... | <p>First I would try to use the software myself for some time to get accustomed to what it is doing and how it is doing it. Then I would proceed by looking at the general architecture of the software (using the UML docs if there are any), then try to learn more about the some detail questions I might get during that pr... |
What is better, many small assemblies, or one big assembly? <p>All is in the title :)</p>
<p>Currently, we have a VS2005 solution with 20+ projets. Like</p>
<pre><code>MySolution
MySolution.Modules.Foo
MySolution.Modules.Bar
[insert many here]
MySolution.Modules.Baz
</code></pre>
<p>Can there be a harm to "merge" My... | <p>I have been in a couple of companies where having far too many projects has been a pain in various ways. I haven't yet been anywhere which had too <em>few</em> projects, although that's certainly possible.</p>
<p>Think about a project as a unit of reuse, amongst other things. Is any product going to need Foo but no... |
how do i use another identity to execute my code in asp.net provided i have a username and password <p>I'm building a small web based management app.
Within it I need to connect to different servers using different accounts via wmi.</p>
<p>What I want is to tell my app: you are now run by user1, do this and this.
And ... | <p>You would have to write a seperate piece of .Net code (some umanaged calls too) to perform impersonation of your user then call your code whilst impersonating that user. You can then restore the user account afterwards:</p>
<p>Apologies for the VB sample, but this would be easy to port to C#.</p>
<p><hr /></p>
<... |
How to detect a string of data from xml in Xquery <p>I have an untyped XML column in Sql Server Database which holds values such as </p>
<pre><code> 1
<root><a>123</a></root>
<root>23d</root>
23
</code></pre>
<p>I was trying with the following query </p>
<pre><code>declare @x x... | <p>The .exist() method returns 1 if the XQuery expression evaluates to non-null node list, otherwise it returns 0. So it'll return 1 every time in your example.</p>
<p>If I understand you correctly, you want it to return 1 when the value is just an integer, and 0 when it's XML?</p>
<p>In that case you need to do the ... |
Why is memory still accessible after std::map::clear() is called? <p>I am observing strange behaviour of std::map::clear(). This method is supposed to call element's destructor when called, however memory is still accessible after call to clear().</p>
<p>For example:</p>
<pre><code>struct A
{
~A() { x = 0; }
int ... | <p>If you store pointers on a map (or a list, or anything like that) <strong>YOU</strong> are the responsible for deleting the pointers, since the map doesn't know if they have been created with new, or not. The clear function only invokes destructors if you don't use pointers.</p>
<p>Oh, and one more thing: invoking ... |
Repeater, Datalist in ASP vs PHP <p>Can anyone give me some suggestion please. In ASP we can use datalist and repeater control to repeate the rows but how can we do similar in PHP.</p>
<p>I am designing a private message page for the similair as inbox page.</p>
| <p>Use a loop construct. For example:</p>
<pre><code><?php foreach ($rows as $row): ?>
<tr>
<td><?php echo htmlspecialchars($row['id']); ?></td>
<td><?php echo htmlspecialchars($row['name']); ?></td>
<td><?php echo htmlspecialchars($row['email']); ... |
Are there any tools to do Migrations (a la Ruby) on Microsoft SQL Server (MSSQL)? <p>Are there any tools, or 'best practices' for creating Migrations on MSSQL? I have a Dev & Production database, and the Dev one often has new SPROCs created, and occasionally the structure is added to. I'd like to be able to write a... | <p>There are a few:</p>
<ul>
<li><a href="http://wiki.rubyonrails.org/rails/pages/HowtoConnectToMicrosoftSQLServer" rel="nofollow">Rails Migrations running on SQL Server</a></li>
<li><a href="http://www.rikware.com/RikMigrations.html" rel="nofollow">RikMigrations</a></li>
<li><a href="http://code.google.com/p/tarantin... |
Change default SVN diffing tool <p>Following a blog, I created a batch file, wm.bat:</p>
<pre><code>"d:\svnroot\external\winmerge\WinMerge.exe" /B /WAIT "d:\svnroot\external\winmerge\WinMergeU.exe" /e /ub /dl %3 /dr %5 %6 %7
</code></pre>
<p>And I tried calling</p>
<pre><code>svn diff | wm
</code></pre>
<p>but that... | <p>Ok, looking at the <a href="http://flimflan.com/blog/UsingWinMergeWithSubversion.aspx">original blog post</a>, this is what you want:</p>
<pre><code>svn diff --diff-cmd wm [optional-filename]
</code></pre>
<p>If you want to see what is actually happening here (i.e. what sort of parameters the <code>svn diff</code>... |
Vim search for a pattern and if occurs delete to end of line <p>I am trying to search a text file for a certain pattern. If this pattern occurs then it means that the rest of the line is not needed and therefore can be deleted.</p>
<p>I have tried using the following commands, but so far have been unsuccessful.</p>
... | <p>would <code>:%s/{pattern}.*//</code> work?</p>
|
SSL error RemoteCertificateNameMismatch <p>I am using WCF for the client to access service. I am trying to access the endpoint with TLS (https). I have certificates with both private and public keys. </p>
<p>If I have the end point of the service to have the host name same as the certificate name ("Issued To"), then i... | <p>In that case, you need to define the trust policy for the server on client side,</p>
<p>Call SetCertPolicy once before you make any call to the services.</p>
<pre><code>using System.Net;
using System.Security.Cryptography.X509Certificates;
public static void SetCertPolicy()
{
ServicePointManager.Se... |
Flex FileReference.download - is it possible to open associated application <p>When using FileReference.download() to retrieve a file from a server, I'd like to give the user the option to open the associated application directly rather than having to save it to disk first.</p>
<p>Is this possible in Flex 3? And, if s... | <p>Nope, you can't do that unfortunately. My guess is that this is due to security restrictions.</p>
|
Choking experienced while using the TCP/IP Adapter for BizTalk Server 2006 <p>I am using the TCP/IP Adapter for BizTalk Server 2006 which was obtained from codeplex: <a href="http://www.codeplex.com/BTSTCPIP" rel="nofollow">http://www.codeplex.com/BTSTCPIP</a> <br>
Once the application was deployed in production, we st... | <p>We experienced similar behaviour but it was a deeper systemic problem. Is the issue affecting other appplications? Is your DBA seeing excessive blocking in the database? Are your SQL Jobs running and/or failing? Are your backups processing at a regular interval? </p>
<p>I documented the problem we had <a href="... |
How do I choose web hosting? <p>I have a couple of personal web-based projects in the pipeline, and am unable to chose how to host them.</p>
<p>I have questions in the area of domain names and actual file hosting (which I believe are separate topics, though many companies provide both).</p>
<h2>Domain Names</h2>
<p>... | <p>Domain names are best kept separate from the hosting. Decent domain registrars let you freely define <em>name severs</em>, which in then give the IP address for the domain. Typically (but not necessarily) these name servers are provided by the hosting company. So, the steps are:</p>
<ol>
<li>Choose the hosting prov... |
Float 2 divs in a parent div and arrange such divs one below another <p>I am creating a web page with 3 columns. The middle column is where all the content goes. The content I want to enter has to be in the format of left aligned image, followed by some text next to the image. And this flows throughout the column with ... | <p>It is really hard to follow because you are describing very much every other word is 'div'. Anyhow you described that you have three columns but If I understood correctly it is just the middle one you are asking about.</p>
<p>You want this format:</p>
<ul>
<li>picture to the left</li>
<li>Right of the picture you ... |
mod_rewrite - old parameter name to new name <p>Hi all I need a bit of getting a redirect working in mod_rewrite.</p>
<p>I need to redirect the following</p>
<pre><code>http://mysite.com/dictionary/find?word=test
</code></pre>
<p>to</p>
<pre><code>http://mysite.com/dictionary/find?w=test
</code></pre>
<p>I'm sure ... | <p>This should be sufficient for you...</p>
<p>RewriteRule (?|&)word=(\w+) $1w=$2</p>
<p>this will replace it even if combined with other parameters.Your attempt to only process the querystring is interesting, I have never used that and cannot answer to if it's possible.</p>
<p>As a sidenote, turn on:</p>
<p>Re... |
How to keep track of thread progress in Python without freezing the PyQt GUI? <h2><strong>Questions:</strong></h2>
<ol>
<li>What is the best practice for
keeping track of a tread's
progress without locking the GUI
("Not Responding")?</li>
<li>Generally, what are the best practices for
threading as it applies to GUI... | <p>If you want to use signals to indicate progress to the main thread then you should really be using PyQt's QThread class instead of the Thread class from Python's threading module.</p>
<p>A simple example which uses QThread, signals and slots can be found on the PyQt Wiki:</p>
<p><a href="https://wiki.python.org/mo... |
Passing Unmanaged pointers in C++/CLI <p>I'm creating a C++/CLI wrapper DLL that depends on numerous C++ static libraries. Some of the function calls expect unmanaged pointers to be passed in. How do i pass them properly?</p>
<p>Also, other functions expect a "this pointer" to be passed in as a void*. What's the right... | <p>If you are passing a pointer to a managed class then it is easy to convert the ^ reference into a pointer but you must pin the managed object so that the GC doesn't move it about in memory (thus invalidating the pointer)</p>
<p>This is simple with <a href="http://msdn.microsoft.com/en-us/library/1dz8byfh(VS.80).asp... |
External JS and browser <p>I have an external JS file that I include in my ASPX page. Whenever I make changes to the JS, I need to close the browser and reopen it to see the changes. I have tried Ctrl F5 to refresh the cached JS copy but that doesn't work in IE.</p>
<p>Is there some way to not restart the browser to s... | <p>As others suggest, I would switch to Firefox for developing and keep IE only for testing. </p>
<p>If you want to keep developing on IE try the <a href="http://www.microsoft.com/en-us/download/details.aspx?id=18359" rel="nofollow">Internet Explorer Developer Toolbar</a>. It offers some of the functionality of Firebu... |
Where is the best place to store global information in a WPF application? <p>I'm a former PHP developer now doing WPF/C# applications, and am having trouble understanding the best way to access global variables and how UserControls access the main Window, etc.</p>
<p>In the constructor of my Window1 class I load UserC... | <p>Try using a <a href="http://www.yoda.arachsys.com/csharp/singleton.html" rel="nofollow">singleton</a> object. The idea is to exploit the mechanics of static objects to achieve "global" variables but which are contained in a object for sanity management.</p>
|
Strange ListView selection behavior on Android <p>Got an activity that extends <code>ListActivity</code>.
The list is backed up by a custom adapter that extends <code>BaseAdapter</code>.</p>
<pre><code>getListView().setFocusable(true);
getListView().setChoiceMode(ListView.CHOICE_MODE_SINGLE);
</code></pre>
<p>I do a ... | <p>Relying on the <code>selectedItemPosition</code> on a <code>ListView</code> can be a dangerous approach. In my experience if the List loses focus (by clicking something else) the <code>selectedItemPosition</code> gets set to <code>INVALID_POSITION</code>.</p>
<p>Basically if your item doesn't have that orange 'high... |
How to hide a WCF service from the public? <p>What measures can you take to 'hide' a WCF service from the public?</p>
<p>i.e. even if they know the URL, you don't expose the methods etc.</p>
| <p>I don't think you can if they have any idea what the specs for your contract are. If they don't, then they're just randomly guessing (as long as you don't expose metadata). Your best bet is to have an authentication function in your contract which must be called first and is necessary for subsequent calls to be allo... |
What's the best way to communicate between view controllers? <p>Being new to objective-c, cocoa, and iPhone dev in general, I have a strong desire to get the most out of the language and the frameworks.</p>
<p>One of the resources I'm using is Stanford's CS193P class notes that they have left on the web. It includes ... | <p>These are good questions, and its great to see that you're doing this research and seem concerned with learning how to "do it right" instead of just hacking it together.</p>
<p><strong><em>First</em></strong>, I agree with the previous answers which focus on the importance of putting data in model objects when appr... |
What causes Visual Basic Run-time error -2147319765 (8002802b) in Excel when an ActiveX control has been instanced? <p>I have created an ActiveX control using C++. I use Visual Basic code to instance the control in an Excel worksheet. I can only run the VB script once, subsequent runs cause the following runtime erro... | <p>You have created an "unqualified" reference to an Excel application that you cannot release by utilizing a Global variable intended for VBA that should not be used in VB 6.0.</p>
<p>This is an unfortunate side-effect of using VB 6.0, but it is the only problem I know of using VB6, and it is easily fixed.</p>
<p>Th... |
How to calculate distance from a GPX file? <p>I have a <a href="http://en.wikipedia.org/wiki/GPX_%28data_transfer%29">GPX file</a> with a GPS track. Now I want to calculate the distance I covered with this track.</p>
<p>What's the best way to calculate this?</p>
| <p>The traditional way of calculating the distance between two points (each pair of waypoints in your GPX file) is with the Haversine formula.</p>
<p>I have a SQL Server function that implements the algorithm. This should be easy to translate into other languages:</p>
<pre class="lang-sql prettyprint-override"><code>... |
Convert static files into MySQL entries <p>I am converting about 4000 text files that contain HTML into MySQL database entries. Seems like an easy way to do this would be to add a couple lines to the HTML to make them appear as XML files, then XSLT the XML into MySQL INSERT statements. (Building a CSV would also work, ... | <p>I'm not familiar with xsl, so I would tackle this problem using <a href="http://php.net/dom" rel="nofollow">php's DOM</a>.
IIRC it could parse html without being proper xml.</p>
<p>Tutortial at <a href="http://www.phpro.org/examples/Parse-HTML-With-PHP-And-DOM.html" rel="nofollow">www.phpro.org</a></p>
|
Why does my DBI program complain about 'Undefined subroutine &DBD::Pg::db::_login'? <p>I am trying to use PostgreSQL database for storing Apache's session information, but I can't get it to work. It is failing with the following error:</p>
<pre><code> Undefined subroutine &DBD::Pg::db::_login
</code></pre>
<p>It ... | <p>Browsing back through the history, there has never been a Perl method named <code>_login</code> defined in the package <code>DBD::Pg::db</code> (which is defined in Pg.pm), and the invocation is explicitly <code>DBD::Pg::db::_login()</code>.</p>
<p>This is a guess, but I think that <code>_login</code> is a C functi... |
IIS7 Authentication on Server 2008 <p>I recently upgraded my Server 2000 running IIS6 to Server 2008 running IIS7. Servers are stand alone, no A/D. I have a website designed with Frontpage 2003 running Server Extensions 2003 which I also migrated to my new Server 2008. Site on old server required username and password... | <p>In the site's Authentication settings, disable anonymous and enable integrated windows authentication.</p>
|
Oracle Application Server; What role in an organization typically supports the middle tier? <p><strong>In medium to large organizations what team or group typically support middle tier components like Oracle Application Servers?</strong> </p>
<p>(Unix Team, DBA Team, Or Application Development/Support Team)</p>
<p>In... | <p>For large organizations, you generally eventually get to a point where there are dedicated teams to manage the middle tier web servers and application servers. </p>
<p>The problem for smaller organizations generally comes that when you first deploy the app servers, there may not be enough admin work to justify a s... |
Dashboard Cross-domain AJAX with jquery <p>Hey everyone, I'm working on a widget for Apple's Dashboard and I've run into a problem while trying to get data from my server using jquery's ajax function. Here's my javascript code:</p>
<pre><code>$.getJSON("http://example.com/getData.php?act=data",function(json) {
$(... | <p>In Dashcode click <strong>Widget Attributes</strong> then <strong>Allow Network Access</strong> make sure that option is checked. I've built something that simply refused to work, and this was the solution.</p>
|
Throttling login attempts <p>(This is in principal a language-agnostic question, though in my case I am using ASP.NET 3.5)</p>
<p>I am using the standard ASP.NET <a href="http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.login.aspx">login control</a> and would like to implement the following failed log... | <p>The last thing you want to do is storing all unsuccessful login attempts in a database, that'll work well enough but also makes it extremely trivial for DDOS attacks to bring your database server down.</p>
<p>You are probably using some type of server-side cache on your webserver, memcached or similar. Those are p... |
How can I deploy my WCF Service without IIS? <p>I'm doing some quick Java-.NET interop and have decided on POX with WCF. However, I don't want to -- nor have access to -- deploy to IIS. </p>
<p>Would just wrapping it up as a .NET Service be the way to go? (I've built my fair share of Windows services in my years.)<... | <p>You can deploy it as Windows service and expose an http endpoint. Check the following url.</p>
<p><a href="http://msdn.microsoft.com/en-us/library/ms751414.aspx">http://msdn.microsoft.com/en-us/library/ms751414.aspx</a> </p>
|
Are Java Applets unable to communicate with javascript within Firefox on Mac OS? <p>I have a java applet running in a browser that is calling some javascript functions and expecting a result from theses functions. This is working with the following configurations :</p>
<ul>
<li>Internet Explorer</li>
<li>FireFox / Win... | <p>I haven't used the applet api in a while but if i recall correctly in order to allow an Applet to cann JS code you should enable the attribute mayscript in your applet tag or a param mayscript in the object tag notation.</p>
<p>For communication in the other way JS to Applet you should also use the scriptable attri... |
PowerShell - Most Compact way of "Delete all files from this folder except one" <p>What is the most compact way of deleting all files from a folder <em>except</em> one file in a PowerShell script. I doesn't matter at all which file is kept, just as long as one is kept.</p>
<p>I'm using the PowerShell 2 CTP.</p>
<p><s... | <p>In PS V2 we added -SKIP to Select so you could do:</p>
<p>dir | where {$_.mode -notmatch "d"} |select -skip 1 |del</p>
|
Recording sound as WAV on iphone <p>I am making an iPhone recording app that needs to submit the sound file as a .wav to an external server.</p>
<p>Starting from the SpeakHere example, I am able to record sound as a file, but only as .caf</p>
<p>Does anyone know how to record it as a wav instead? Or how to convert fr... | <p>Yup, the key is kAudioFileWAVEType</p>
<pre><code>AudioFileCreateWithURL (
audioFileURL,
kAudioFileWAVEType,
&audioFormat,
kAudioFileFlags_EraseFile,
&audioFileID
);
</code></pre>
<p>Changing to WAVE from CAF in the SpeakHere example causes the recording to be as wav. I a... |
Running commands over ssh with Java <p>Scenerio: I'd like to run commands on remote machines from a Java program over ssh (I am using OpenSSH on my development machine). I'd also like to make the ssh connection by passing the password rather than setting up keys as I would with 'expect'.<br />
Problem: When trying t... | <p>The prompt might only be shown when <code>ssh</code> is connected to a TTY, which it isn't in the case of Java.</p>
<p>There's probably a way to supply the password on the command-line in your <code>ssh</code> application. That will be the way to get past the prompt.</p>
<p>Alternately, consider connecting direct... |
Most robust Equals implementation for custom classes for value equality in C# <p>Say I have a Point2 class, and I want to implement the following Equals:</p>
<pre><code>public override bool Equals ( object obj )
public bool Equals ( Point2 obj )
</code></pre>
<p>This is from the Effective C# 3 book:</p>
<pre><code>... | <p>Supporting equality with an inheritance hierarchy is tricky. You need to work out exactly what you mean. Do you really need inheritance here? If not - if Point2 derives directly from System.Object, and you can make it sealed, life becomes a bit easier. In that case I would use:</p>
<pre><code>public override bool E... |
Manually create unbound datagrid <p>Can anyone tell me if it is possible to create and add data to an unbound WPF Toolkit datagrid.</p>
<p>If it is in fact possible to do, can someone please provide an example of the following:</p>
<p>Programmatically:
create a datagrid
create a datagridtextcolumn
add the datagridtex... | <p>I've never used a grid without binding it to something. </p>
<p><strong><em>BUT</em></strong> looking at the underlying reason, that can be solved while still using databinding. </p>
<p>For example:
If you use a ViewModel class for you object that the grid is being bound to, then you can make an aspect of that cl... |
Managing the merge of DBA's production changes/tweaks with dev's pending DB changescripts <p>We maintain a set of change scripts that must be run on the DB when our web application is released. We waste a lot of time and experience some difficultly keeping these updated however, our DBA likes to (rightly) tweak stored... | <p>DBAs should not ever tweak procs on prod only. They should also use source control and put the changes onthe other environments so that others making changes are aware of them. </p>
|
HttpHandler is not processed when its associate HttpModule is processed <p>In our asp.net 2.0 application we have the an HttpModule and HttpHandler. They are registered in web.config to handle requests for certain file types.
The request is initiated asynchronously from client side using MS AJAX.
I noticed something s... | <p>Do you have that file type set up in IIS to be processed by .net?</p>
|
Can I use jtracert to sequence diagram a unit test running in eclipse? <p>How would I go about using jtracert to sequence diagram a junit test being run within eclipse?</p>
| <p>In the "Run" dialog, select your JUnit configuration and go the "Arguments" tab.
Add jTracert parameters to "VM arguments" section (something like -javaagent:/home/dmitrybedrin/work/jtracert/deploy/jTracert.jar)</p>
<p>Click on "Run" button.</p>
<p>You will see the following in the "Console" tab:</p>
<p>jTracert ... |
What could be wrong: ping works fine but tnsping works intermittently <p>We have oracle 10g running on windows server 2003. A machine which runs an application using that database has as of a few weeks ago suddenly started having connectivity problems. Today we ran the automatic updates for windows server and the pro... | <p>To help eliminate DNS issues from the equation, specify the host's IP address in the TNSNAMES.ora file for your connection instead of a hostname. Are you using DHCP?</p>
<p>Have you eliminated hardware as the problem - have you tried a different NIC?</p>
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.